Esempio n. 1
0
def setup(process,
          input_files,
          collection,
          json_file="",
          cosmics_zero_tesla=False,
          cosmics_deco_mode=True):
    """Mille-specific setup.

    Arguments:
    - `process`: cms.Process object
    - `input_files`: input file list -> cms.untracked.vstring()
    - `collection`: track collection to be used
    - `cosmics_zero_tesla`: triggers the corresponding track selection
    - `cosmics_deco_mode`: triggers the corresponding track selection
    """

    # no database output in the mille step:
    # --------------------------------------------------------------------------
    process.AlignmentProducer.saveToDB = False
    process.AlignmentProducer.saveApeToDB = False
    process.AlignmentProducer.saveDeformationsToDB = False

    # Track selection and refitting
    # --------------------------------------------------------------------------
    process.load("RecoVertex.BeamSpotProducer.BeamSpot_cfi")

    import Alignment.CommonAlignment.tools.trackselectionRefitting as trackRefitter
    process.TrackRefittingSequence = trackRefitter.getSequence(
        process,
        collection,
        cosmicsDecoMode=cosmics_deco_mode,
        cosmicsZeroTesla=cosmics_zero_tesla)

    # Overwrite Track-Selector filter options from unified sequence to 'False'
    process.AlignmentTrackSelector.filter = False
    if collection != "ALCARECOTkAlCosmicsCTF0T":
        # there is no HighPurity selector for cosmics
        process.HighPurityTrackSelector.filter = False

    # Configure the input data
    # --------------------------------------------------------------------------
    process.source = cms.Source("PoolSource", fileNames=input_files)

    # Set Luminosity-Blockrange from json-file if given
    if (json_file != "") and (json_file != "placeholder_json"):
        import FWCore.PythonUtilities.LumiList as LumiList
        lumi_list = LumiList.LumiList(
            filename=json_file).getVLuminosityBlockRange()
        process.source.lumisToProcess = lumi_list

    # The executed path
    # --------------------------------------------------------------------------
    process.p = cms.Path(process.offlineBeamSpot *
                         process.TrackRefittingSequence)
Esempio n. 2
0
def setup(process, input_files, collection,
          json_file = "", cosmics_zero_tesla = False, cosmics_deco_mode = True):
    """Mille-specific setup.

    Arguments:
    - `process`: cms.Process object
    - `input_files`: input file list -> cms.untracked.vstring()
    - `collection`: track collection to be used
    - `cosmics_zero_tesla`: triggers the corresponding track selection
    - `cosmics_deco_mode`: triggers the corresponding track selection
    """

    # no database output in the mille step:
    # --------------------------------------------------------------------------
    process.AlignmentProducer.saveToDB = False
    process.AlignmentProducer.saveApeToDB = False
    process.AlignmentProducer.saveDeformationsToDB = False


    # Track selection and refitting
    # --------------------------------------------------------------------------
    process.load("RecoVertex.BeamSpotProducer.BeamSpot_cfi")

    import Alignment.CommonAlignment.tools.trackselectionRefitting as trackRefitter
    process.TrackRefittingSequence = trackRefitter.getSequence(
        process,
        collection,
        cosmicsDecoMode = cosmics_deco_mode,
        cosmicsZeroTesla = cosmics_zero_tesla)

    # Overwrite Track-Selector filter options from unified sequence to 'False'
    process.AlignmentTrackSelector.filter = False
    if collection not in ("ALCARECOTkAlCosmicsCTF0T",
                          "ALCARECOTkAlCosmicsInCollisions"):
        # there is no HighPurity selector for cosmics
        process.HighPurityTrackSelector.filter = False


    # Configure the input data
    # --------------------------------------------------------------------------
    process.source = cms.Source("PoolSource", fileNames  = input_files)

    # Set Luminosity-Blockrange from json-file if given
    if (json_file != "") and (json_file != "placeholder_json"):
        import FWCore.PythonUtilities.LumiList as LumiList
        lumi_list = LumiList.LumiList(filename = json_file).getVLuminosityBlockRange()
        process.source.lumisToProcess = lumi_list


    # The executed path
    # --------------------------------------------------------------------------
    process.p = cms.Path(process.offlineBeamSpot*process.TrackRefittingSequence)
Esempio n. 3
0
# process.AlignmentTrackSelector.dzMin     = cms.double(-999999.0)
# process.AlignmentTrackSelector.dzMax     = cms.double(+999999.0)

if(theRefitter == RefitType.COMMON):

     print(">>>>>>>>>> testPVValidation_cfg.py: msg%-i: using the common track selection and refit sequence!")
     ####################################################################
     # Load and Configure Common Track Selection and refitting sequence
     ####################################################################
     import Alignment.CommonAlignment.tools.trackselectionRefitting as trackselRefit
     process.seqTrackselRefit = trackselRefit.getSequence(process, 'TRACKTYPETEMPLATE',
                                                          isPVValidation=True,
                                                          TTRHBuilder='TTRHBUILDERTEMPLATE',
                                                          usePixelQualityFlag=True,
                                                          openMassWindow=False,
                                                          cosmicsDecoMode=True,
                                                          cosmicsZeroTesla=False,
                                                          momentumConstraint=None,
                                                          cosmicTrackSplitting=False,
                                                          use_d0cut=False,
                                                          )
     if((process.TrackerTrackHitFilter.usePixelQualityFlag.value()==True) and (process.FirstTrackRefitter.TTRHBuilder.value()=="WithTrackAngle")):
          print(" \n\n","*"*70,"\n *\t\t\t\t WARNING!!!!!\t\t\t\n *\n * Found an inconsistent configuration!\n * TTRHBuilder = WithTrackAngle requires usePixelQualityFlag = False.\n * Going to reset it! \n *\n","*"*70)
          process.TrackerTrackHitFilter.usePixelQualityFlag = False

elif (theRefitter == RefitType.STANDARD):

     print(">>>>>>>>>> testPVValidation_cfg.py: msg%-i: using the standard single refit sequence!")
     ####################################################################
     # Load and Configure Measurement Tracker Event
     # (needed in case NavigationSchool is set != '')
Esempio n. 4
0
    trackSelector = AlignmentTrackSelector.CosmicsSkimSelector
else: # Extend list here with custom track selectors
    print("Unknown trackSelection %s, exiting"%(trackSelection))
    exit(1)

process.MuSkim = trackSelector

##
## If preselected track list is used
##
if options.useTrackList:
    process.MuSkim.src = 'TrackList'
    process.TriggerSelectionSequence *= process.TrackList

import Alignment.CommonAlignment.tools.trackselectionRefitting as trackselRefit
process.seqTrackselRefit = trackselRefit.getSequence(process, trackSelector.src.getModuleLabel())


##
## Path
##
process.path = cms.Path(
    process.offlineBeamSpot*
    process.seqTrackselRefit*
    process.MuSkim
)

##
## Define event selection from path
##
EventSelection = cms.PSet(
Esempio n. 5
0
def setup(process, input_files, collection,
          json_file = "",
          cosmics_zero_tesla = False,
          cosmics_deco_mode = True,
          TTRHBuilder = None):
    """Mille-specific setup.

    Arguments:
    - `process`: cms.Process object
    - `input_files`: input file list -> cms.untracked.vstring()
    - `collection`: track collection to be used
    - `cosmics_zero_tesla`: triggers the corresponding track selection
    - `cosmics_deco_mode`: triggers the corresponding track selection
    - `TTRHBuilder`: TransientTrackingRecHitBuilder used in the track selection
                     and refitting sequence;
                     defaults to the default of the above-mentioned sequence
    """

    # no database output in the mille step:
    # --------------------------------------------------------------------------
    process.AlignmentProducer.saveToDB = False
    process.AlignmentProducer.saveApeToDB = False
    process.AlignmentProducer.saveDeformationsToDB = False


    # align calibrations to general settings
    # --------------------------------------------------------------------------
    for calib in process.AlignmentProducer.calibrations:
        calib.saveToDB       = process.AlignmentProducer.saveToDB
        calib.treeFile       = process.AlignmentProducer.algoConfig.treeFile
        calib.mergeTreeFiles = process.AlignmentProducer.algoConfig.mergeTreeFiles


    # Track selection and refitting
    # --------------------------------------------------------------------------
    import Alignment.CommonAlignment.tools.trackselectionRefitting as trackRefitter
    kwargs = {"cosmicsDecoMode": cosmics_deco_mode,
              "cosmicsZeroTesla": cosmics_zero_tesla}
    if TTRHBuilder is not None: kwargs["TTRHBuilder"] = TTRHBuilder
    process.TrackRefittingSequence \
        = trackRefitter.getSequence(process, collection, **kwargs)


    # Ensure the correct APV mode for cosmics
    # --------------------------------------------------------------------------
    if collection in ("ALCARECOTkAlCosmicsCTF0T",
                      "ALCARECOTkAlCosmicsInCollisions"):
        process.load("Alignment.CommonAlignment.apvModeFilter_cfi")
        process.apvModeFilter.apvMode = "deco" if cosmics_deco_mode else "peak"
        import helper
        helper.add_filter(process, process.apvModeFilter)


    # Configure the input data
    # --------------------------------------------------------------------------
    process.source = cms.Source("PoolSource", fileNames  = input_files)

    # Set Luminosity-Blockrange from json-file if given
    if (json_file != "") and (json_file != "placeholder_json"):
        import FWCore.PythonUtilities.LumiList as LumiList
        lumi_list = LumiList.LumiList(filename = json_file).getVLuminosityBlockRange()
        process.source.lumisToProcess = lumi_list


    # The executed path
    # --------------------------------------------------------------------------
    process.p = cms.Path(process.TrackRefittingSequence*
                         process.AlignmentProducer)
    if hasattr(process, "mps_filters"): process.p.insert(0, process.mps_filters)
Esempio n. 6
0
####################################################################
# Load and Configure TrackRefitter
####################################################################
# process.load("RecoTracker.TrackProducer.TrackRefitters_cff")
# import RecoTracker.TrackProducer.TrackRefitters_cff
# process.FinalTrackRefitter = RecoTracker.TrackProducer.TrackRefitter_cfi.TrackRefitter.clone()
# process.FinalTrackRefitter.src = "TRACKTYPETEMPLATE"
# process.FinalTrackRefitter.TrajectoryInEvent = True
# process.FinalTrackRefitter.NavigationSchool = ''
# process.FinalTrackRefitter.TTRHBuilder = "WithAngleAndTemplate"

####################################################################
# Load and Configure common selection sequence
####################################################################
import Alignment.CommonAlignment.tools.trackselectionRefitting as trackselRefit
process.seqTrackselRefit = trackselRefit.getSequence(process,'TRACKTYPETEMPLATE')
process.HighPurityTrackSelector.trackQualities = cms.vstring()
process.HighPurityTrackSelector.pMin     = cms.double(0.)
process.AlignmentTrackSelector.pMin      = cms.double(0.)
process.AlignmentTrackSelector.ptMin     = cms.double(0.)
process.AlignmentTrackSelector.nHitMin2D = cms.uint32(0)
process.AlignmentTrackSelector.nHitMin   = cms.double(0.)
process.AlignmentTrackSelector.d0Min     = cms.double(-999999.0)
process.AlignmentTrackSelector.d0Max     = cms.double(+999999.0)                  
process.AlignmentTrackSelector.dzMin     = cms.double(-999999.0)
process.AlignmentTrackSelector.dzMax     = cms.double(+999999.0)  

####################################################################
# Output file
####################################################################
process.TFileService = cms.Service("TFileService",
Esempio n. 7
0
##
## Skim tracks
##
import Alignment.APEEstimation.AlignmentTrackSelector_cff
process.MuSkim = Alignment.APEEstimation.AlignmentTrackSelector_cff.MuSkimSelector

##
## If preselected track list is used
##
if options.useTrackList:
    process.MuSkim.src = 'TrackList'
    process.TriggerSelectionSequence *= process.TrackList

import Alignment.CommonAlignment.tools.trackselectionRefitting as trackselRefit
process.seqTrackselRefit = trackselRefit.getSequence(
    process, 'ALCARECOTkAlMuonIsolated')
#~ process.seqTrackselRefit = trackselRefit.getSequence(process, 'ALCARECOTkAlZMuMu')

##
## Path
##
process.path = cms.Path(process.offlineBeamSpot * process.seqTrackselRefit *
                        process.MuSkim)

##
## Define event selection from path
##
EventSelection = cms.PSet(SelectEvents=cms.untracked.PSet(
    SelectEvents=cms.vstring('path')))

##
Esempio n. 8
0
    trackSelector = AlignmentTrackSelector.CosmicsSkimSelector
else: # Extend list here with custom track selectors
    print("Unknown trackSelection %s, exiting"%(trackSelection))
    exit(1)

process.MuSkim = trackSelector

##
## If preselected track list is used
##
if options.useTrackList:
    process.MuSkim.src = 'TrackList'
    process.TriggerSelectionSequence *= process.TrackList

import Alignment.CommonAlignment.tools.trackselectionRefitting as trackselRefit
process.seqTrackselRefit = trackselRefit.getSequence(process, trackSelector.src.getModuleLabel())


##
## Path
##
process.path = cms.Path(
    process.offlineBeamSpot*
    process.seqTrackselRefit*
    process.MuSkim
)

##
## Define event selection from path
##
EventSelection = cms.PSet(
Esempio n. 9
0
      process.TwoBodyDecayConstraint.sigmaPositionCut = cms.double(0.5)
      process.TwoBodyDecayConstraint.rescaleError = cms.double(1.0)
      process.TwoBodyDecayConstraint.chi2Cut = cms.double(99999.)
      #process.TwoBodyDecayConstraint.EstimatorParameters.RobustificationConstant = cms.double(1.0)
      strTBDConstrainer="TwoBodyDecayConstraint,trackParameters"

if strTBDConstrainer is not None:
   print("strTBDConstrainer=",strTBDConstrainer)

process.TrackRefitterSequence = TrackRefitterSequencer.getSequence(
   process,
   strtrackcollname,
   TTRHBuilder = strTTRHBuilder,
   usePixelQualityFlag = None, # Keep default behavior ("WithAngleAndTemplate" -> True, "WithTrackAngle" -> False)
   openMassWindow = False,
   cosmicsDecoMode = False,
   cosmicsZeroTesla = False,
   #momentumConstraint = None, # Should be a momentum constraint object name or None
   momentumConstraint = strTBDConstrainer, # Should be a momentum constraint object name or None
   cosmicTrackSplitting = False,
   use_d0cut = True
   )

# Override TrackRefitterSequencer defaults
process.HighPurityTrackSelector.pMin   = 0.0
process.AlignmentTrackSelector.pMin    = 0.0
process.AlignmentTrackSelector.ptMin   = 15.0
process.AlignmentTrackSelector.etaMin  = -3.0
process.AlignmentTrackSelector.etaMax  = 3.0
process.AlignmentTrackSelector.nHitMin  = 15
process.AlignmentTrackSelector.minHitsPerSubDet.inPIXEL = cms.int32(1)
Esempio n. 10
0
##
import Alignment.APEEstimation.AlignmentTrackSelector_cff
process.MuSkim = Alignment.APEEstimation.AlignmentTrackSelector_cff.MuSkimSelector



##
## If preselected track list is used
##
if options.useTrackList:
    process.MuSkim.src = 'TrackList'
    process.TriggerSelectionSequence *= process.TrackList

import Alignment.CommonAlignment.tools.trackselectionRefitting as trackselRefit
#~ process.seqTrackselRefit = trackselRefit.getSequence(process, 'ALCARECOTkAlMuonIsolated')
process.seqTrackselRefit = trackselRefit.getSequence(process, 'ALCARECOTkAlZMuMu')

##
## Path
##
process.path = cms.Path(
    process.offlineBeamSpot*
    process.seqTrackselRefit*
    process.MuSkim
)



##
## Define event selection from path
##
## Mille-procedure
## -----------------------------------------------------------------------------
if setupAlgoMode == "mille":
    
    # no database output in the mille step
    process.AlignmentProducer.saveDeformationsToDB = False
    
    ## Track selection and refitting
    ## -----------------------------------------------------------------------------
    process.load("RecoVertex.BeamSpotProducer.BeamSpot_cfi")
    
    import Alignment.CommonAlignment.tools.trackselectionRefitting as trackRefitter
    process.TrackRefittingSequence = trackRefitter.getSequence(
        process, 
        setupCollection, 
        cosmicsDecoMode = setupCosmicsDecoMode,
        cosmicsZeroTesla = setupCosmicsZeroTesla)
    
    ## Overwrite Track-Selector filter from unified Sequence to false 
    process.AlignmentTrackSelector.filter = False
    if setupCollection != "ALCARECOTkAlCosmicsCTF0T":
        # there is no HighPurity selector for cosmics
        process.HighPurityTrackSelector.filter = False
    
    
    ## Configure the input data.
    ## -----------------------------------------------------------------------------
    process.source = cms.Source(
        "PoolSource",
        skipEvents = cms.untracked.uint32(0),
Esempio n. 12
0
     process.goodvertexSkim = cms.Sequence(process.primaryVertexFilter + process.noscraping + process.noslowpt)


if(theRefitter == RefitType.COMMON):

     print(">>>>>>>>>> testPVValidation_cfg.py: msg%-i: using the common track selection and refit sequence!")          
     ####################################################################
     # Load and Configure Common Track Selection and refitting sequence
     ####################################################################
     import Alignment.CommonAlignment.tools.trackselectionRefitting as trackselRefit
     process.seqTrackselRefit = trackselRefit.getSequence(process, 'generalTracks',
                                                          isPVValidation=True, 
                                                          TTRHBuilder='WithAngleAndTemplate',
                                                          usePixelQualityFlag=True,
                                                          openMassWindow=False,
                                                          cosmicsDecoMode=True,
                                                          cosmicsZeroTesla=False,
                                                          momentumConstraint=None,
                                                          cosmicTrackSplitting=False,
                                                          use_d0cut=False,
                                                          )
     
elif (theRefitter == RefitType.STANDARD):

     print(">>>>>>>>>> testPVValidation_cfg.py: msg%-i: using the standard single refit sequence!")          
     ####################################################################
     # Load and Configure Measurement Tracker Event
     # (needed in case NavigationSchool is set != '')
     ####################################################################
     # process.load("RecoTracker.MeasurementDet.MeasurementTrackerEventProducer_cfi") 
     # process.MeasurementTrackerEvent.pixelClusterProducer = 'generalTracks'
Esempio n. 13
0
## Skim tracks
##
import Alignment.APEEstimation.AlignmentTrackSelector_cff
process.MuSkim = Alignment.APEEstimation.AlignmentTrackSelector_cff.MuSkimSelector



##
## If preselected track list is used
##
if options.useTrackList:
    process.MuSkim.src = 'TrackList'
    process.TriggerSelectionSequence *= process.TrackList

import Alignment.CommonAlignment.tools.trackselectionRefitting as trackselRefit
process.seqTrackselRefit = trackselRefit.getSequence(process, 'ALCARECOTkAlMuonIsolated')
#~ process.seqTrackselRefit = trackselRefit.getSequence(process, 'ALCARECOTkAlZMuMu')

##
## Path
##
process.path = cms.Path(
    process.offlineBeamSpot*
    process.MuSkim
)



##
## Define event selection from path
##
Esempio n. 14
0
if (theRefitter == RefitType.COMMON):

    print(
        ">>>>>>>>>> testPVValidation_cfg.py: msg%-i: using the common track selection and refit sequence!"
    )
    ####################################################################
    # Load and Configure Common Track Selection and refitting sequence
    ####################################################################
    import Alignment.CommonAlignment.tools.trackselectionRefitting as trackselRefit
    process.seqTrackselRefit = trackselRefit.getSequence(
        process,
        'generalTracks',
        isPVValidation=True,
        TTRHBuilder='WithAngleAndTemplate',
        usePixelQualityFlag=True,
        openMassWindow=False,
        cosmicsDecoMode=True,
        cosmicsZeroTesla=False,
        momentumConstraint=None,
        cosmicTrackSplitting=False,
        use_d0cut=False,
    )

elif (theRefitter == RefitType.STANDARD):

    print(
        ">>>>>>>>>> testPVValidation_cfg.py: msg%-i: using the standard single refit sequence!"
    )
    ####################################################################
    # Load and Configure Measurement Tracker Event
    # (needed in case NavigationSchool is set != '')
Esempio n. 15
0
        process.TwoBodyDecayConstraint.sigmaPositionCut = cms.double(0.5)
        process.TwoBodyDecayConstraint.rescaleError = cms.double(1.0)
        process.TwoBodyDecayConstraint.chi2Cut = cms.double(99999.)
        #process.TwoBodyDecayConstraint.EstimatorParameters.RobustificationConstant = cms.double(1.0)
        strTBDConstrainer = "TwoBodyDecayConstraint,trackParameters"

if strTBDConstrainer is not None:
    print("strTBDConstrainer=", strTBDConstrainer)

process.TrackRefitterSequence = TrackRefitterSequencer.getSequence(
    process,
    strtrackcollname,
    TTRHBuilder=strTTRHBuilder,
    usePixelQualityFlag=
    None,  # Keep default behavior ("WithAngleAndTemplate" -> True, "WithTrackAngle" -> False)
    openMassWindow=False,
    cosmicsDecoMode=False,
    cosmicsZeroTesla=False,
    #momentumConstraint = None, # Should be a momentum constraint object name or None
    momentumConstraint=
    strTBDConstrainer,  # Should be a momentum constraint object name or None
    cosmicTrackSplitting=False,
    use_d0cut=True)

# Override TrackRefitterSequencer defaults
process.HighPurityTrackSelector.pMin = 0.0
process.AlignmentTrackSelector.pMin = 0.0
process.AlignmentTrackSelector.ptMin = 15.0
process.AlignmentTrackSelector.etaMin = -3.0
process.AlignmentTrackSelector.etaMax = 3.0
process.AlignmentTrackSelector.nHitMin = 15
process.AlignmentTrackSelector.minHitsPerSubDet.inPIXEL = cms.int32(1)
Esempio n. 16
0
####################################################################
# Load and Configure TrackRefitter
####################################################################
# process.load("RecoTracker.TrackProducer.TrackRefitters_cff")
# import RecoTracker.TrackProducer.TrackRefitters_cff
# process.FinalTrackRefitter = RecoTracker.TrackProducer.TrackRefitter_cfi.TrackRefitter.clone()
# process.FinalTrackRefitter.src = "TRACKTYPETEMPLATE"
# process.FinalTrackRefitter.TrajectoryInEvent = True
# process.FinalTrackRefitter.NavigationSchool = ''
# process.FinalTrackRefitter.TTRHBuilder = "WithAngleAndTemplate"

####################################################################
# Load and Configure common selection sequence
####################################################################
import Alignment.CommonAlignment.tools.trackselectionRefitting as trackselRefit
process.seqTrackselRefit = trackselRefit.getSequence(process,'TRACKTYPETEMPLATE')
process.HighPurityTrackSelector.trackQualities = cms.vstring()
process.HighPurityTrackSelector.pMin     = cms.double(0.)
process.AlignmentTrackSelector.pMin      = cms.double(0.)
process.AlignmentTrackSelector.ptMin     = cms.double(0.)
process.AlignmentTrackSelector.nHitMin2D = cms.uint32(0)
process.AlignmentTrackSelector.nHitMin   = cms.double(0.)
process.AlignmentTrackSelector.d0Min     = cms.double(-999999.0)
process.AlignmentTrackSelector.d0Max     = cms.double(+999999.0)                  
process.AlignmentTrackSelector.dzMin     = cms.double(-999999.0)
process.AlignmentTrackSelector.dzMax     = cms.double(+999999.0)  

####################################################################
# Output file
####################################################################
process.TFileService = cms.Service("TFileService",
Esempio n. 17
0
## Mille-procedure
## -----------------------------------------------------------------------------
if setupAlgoMode == "mille":

    # no database output in the mille step
    process.AlignmentProducer.saveDeformationsToDB = False

    ## Track selection and refitting
    ## -----------------------------------------------------------------------------
    process.load("RecoVertex.BeamSpotProducer.BeamSpot_cfi")

    import Alignment.CommonAlignment.tools.trackselectionRefitting as trackRefitter
    process.TrackRefittingSequence = trackRefitter.getSequence(
        process,
        setupCollection,
        cosmicsDecoMode=setupCosmicsDecoMode,
        cosmicsZeroTesla=setupCosmicsZeroTesla)

    ## Overwrite Track-Selector filter from unified Sequence to false
    process.AlignmentTrackSelector.filter = False
    if setupCollection != "ALCARECOTkAlCosmicsCTF0T":
        # there is no HighPurity selector for cosmics
        process.HighPurityTrackSelector.filter = False

    ## Configure the input data.
    ## -----------------------------------------------------------------------------
    process.source = cms.Source("PoolSource",
                                skipEvents=cms.untracked.uint32(0),
                                fileNames=readFiles)
Esempio n. 18
0
def setup(process, input_files, collection,
          json_file = "",
          cosmics_zero_tesla = False,
          cosmics_deco_mode = True,
          TTRHBuilder = None):
    """Mille-specific setup.

    Arguments:
    - `process`: cms.Process object
    - `input_files`: input file list -> cms.untracked.vstring()
    - `collection`: track collection to be used
    - `cosmics_zero_tesla`: triggers the corresponding track selection
    - `cosmics_deco_mode`: triggers the corresponding track selection
    - `TTRHBuilder`: TransientTrackingRecHitBuilder used in the track selection
                     and refitting sequence;
                     defaults to the default of the above-mentioned sequence
    """

    # no database output in the mille step:
    # --------------------------------------------------------------------------
    process.AlignmentProducer.saveToDB = False
    process.AlignmentProducer.saveApeToDB = False
    process.AlignmentProducer.saveDeformationsToDB = False


    # Track selection and refitting
    # --------------------------------------------------------------------------
    import Alignment.CommonAlignment.tools.trackselectionRefitting as trackRefitter
    kwargs = {"cosmicsDecoMode": cosmics_deco_mode,
              "cosmicsZeroTesla": cosmics_zero_tesla}
    if TTRHBuilder is not None: kwargs["TTRHBuilder"] = TTRHBuilder
    process.TrackRefittingSequence \
        = trackRefitter.getSequence(process, collection, **kwargs)


    # Ensure the correct APV mode for cosmics
    # --------------------------------------------------------------------------
    if collection in ("ALCARECOTkAlCosmicsCTF0T",
                      "ALCARECOTkAlCosmicsInCollisions"):
        process.load("Alignment.CommonAlignment.apvModeFilter_cfi")
        process.apvModeFilter.apvMode = "deco" if cosmics_deco_mode else "peak"
        import helper
        helper.add_filter(process, process.apvModeFilter)


    # Configure the input data
    # --------------------------------------------------------------------------
    process.source = cms.Source("PoolSource", fileNames  = input_files)

    # Set Luminosity-Blockrange from json-file if given
    if (json_file != "") and (json_file != "placeholder_json"):
        import FWCore.PythonUtilities.LumiList as LumiList
        lumi_list = LumiList.LumiList(filename = json_file).getVLuminosityBlockRange()
        process.source.lumisToProcess = lumi_list


    # The executed path
    # --------------------------------------------------------------------------
    process.p = cms.Path(process.TrackRefittingSequence*
                         process.AlignmentProducer)
    if hasattr(process, "mps_filters"): process.p.insert(0, process.mps_filters)
Esempio n. 19
0
##
## Skim tracks
##
import Alignment.APEEstimation.AlignmentTrackSelector_cff
process.MuSkim = Alignment.APEEstimation.AlignmentTrackSelector_cff.MuSkimSelector

##
## If preselected track list is used
##
if options.useTrackList:
    process.MuSkim.src = 'TrackList'
    process.TriggerSelectionSequence *= process.TrackList

import Alignment.CommonAlignment.tools.trackselectionRefitting as trackselRefit
#~ process.seqTrackselRefit = trackselRefit.getSequence(process, 'ALCARECOTkAlMuonIsolated')
process.seqTrackselRefit = trackselRefit.getSequence(process,
                                                     'ALCARECOTkAlZMuMu')

##
## Path
##
process.path = cms.Path(process.offlineBeamSpot * process.seqTrackselRefit *
                        process.MuSkim)

##
## Define event selection from path
##
EventSelection = cms.PSet(SelectEvents=cms.untracked.PSet(
    SelectEvents=cms.vstring('path')))

##
## configure output module