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
'''
Defines the selection sequence ZmmgSkimSeq for the Zmmg skim for the 
RAW-RECO event content. It also defines several other modules and sequences
used: 
    ZmmgHLTFilter
    ZmmgTrailingMuons
    ZmmgLeadingMuons
    ZmmgDimuons
    ZmmgDimuonFilter
    ZmmgDimuonSequence
    ZmmgMergedSuperClusters
    ZmmgPhotonCandidates
    ZmmgPhotons
    ZmmgPhotonSequence
    ZmmgCandidates
    ZmmgFilter
    ZmmgSequence

Jan Veverka, Caltech, 5 May 2012
'''

import copy
import FWCore.ParameterSet.Config as cms


###____________________________________________________________________________
###
###  HLT Filter
###____________________________________________________________________________

import copy
from HLTrigger.HLTfilters.hltHighLevel_cfi import *
ZmmgHLTFilter = copy.deepcopy(hltHighLevel)
ZmmgHLTFilter.throw = cms.bool(False)
ZmmgHLTFilter.HLTPaths = ['HLT_Mu*','HLT_IsoMu*','HLT_DoubleMu*']


###____________________________________________________________________________
###
###  Build the Dimuon Sequence
###____________________________________________________________________________

### Get muons of needed quality for Z -> mumugamma 
ZmmgTrailingMuons = cms.EDFilter('MuonSelector',
    src = cms.InputTag('muons'),
    cut = cms.string('''pt > 10 && 
                        abs(eta) < 2.4 && 
                        isGlobalMuon = 1 && 
                        isTrackerMuon = 1 && 
                        abs(innerTrack().dxy)<2.0'''),
    filter = cms.bool(True)                                
    )

### Require a harder pt cut on the leading leg
ZmmgLeadingMuons = cms.EDFilter('MuonSelector',
    src = cms.InputTag('ZmmgTrailingMuons'),
    cut = cms.string('pt > 20'),
    filter = cms.bool(True)                                
    )

### Build dimuon candidates
ZmmgDimuons = cms.EDProducer('CandViewShallowCloneCombiner',
    decay = cms.string('ZmmgLeadingMuons@+ ZmmgTrailingMuons@-'),
    checkCharge = cms.bool(True),
    cut = cms.string('mass > 30'),
    )

### Require at least one dimuon candidate
ZmmgDimuonFilter = cms.EDFilter('CandViewCountFilter',
    src = cms.InputTag('ZmmgDimuons'),
    minNumber = cms.uint32(1)
    )

### Put together the dimuon sequence
ZmmgDimuonSequence = cms.Sequence(
    ZmmgTrailingMuons *
    ZmmgLeadingMuons *
    ZmmgDimuons *
    ZmmgDimuonFilter
    )
    
    
###____________________________________________________________________________
###
###  Build the Supercluster/Photon Sequence
###____________________________________________________________________________

### Merge the barrel and endcap superclusters
ZmmgMergedSuperClusters =  cms.EDProducer('EgammaSuperClusterMerger',
    src = cms.VInputTag(
        cms.InputTag('correctedHybridSuperClusters'),
        cms.InputTag('correctedMulti5x5SuperClustersWithPreshower')
        )
    )

### Build candidates from all the merged superclusters
ZmmgPhotonCandidates = cms.EDProducer('ConcreteEcalCandidateProducer',
    src = cms.InputTag('ZmmgMergedSuperClusters'),
    particleType = cms.string('gamma')
    )

### Select photon candidates with Et > 5 GeV
ZmmgPhotons = cms.EDFilter('CandViewSelector',
    src = cms.InputTag('ZmmgPhotonCandidates'),
    cut = cms.string('et > 5'),
    filter = cms.bool(True)
    )

### Put together the photon sequence
ZmmgPhotonSequence = cms.Sequence(
    ZmmgMergedSuperClusters *
    ZmmgPhotonCandidates *
    ZmmgPhotons
    )
    
    
###____________________________________________________________________________
###
###  Build the mu-mu-gamma filter sequence
###____________________________________________________________________________

### Combine dimuons and photons to mumugamma candidates requiring
###     1. trailing muon pt + photon et > 20 GeV
###     2. distance between photon and near muon deltaR < 1.5
###     3. sum of invariant masses of the mmg and mm systems < 200 GeV 
###     4. invariant mass of the mmg system > 40 GeV
### dimuon        = daughter(0)
### leading muon  = daughter(0).daughter(0)
### trailing muon = daughter(0).daughter(1)
### photon        = daughter(1)
ZmmgCandidates = cms.EDProducer('CandViewShallowCloneCombiner',
    decay = cms.string('ZmmgDimuons ZmmgPhotons'),
    checkCharge = cms.bool(False),
    cut = cms.string('''
        daughter(0).daughter(1).pt + daughter(1).pt > 20 &
        min(deltaR(daughter(0).daughter(0).eta,
                   daughter(0).daughter(0).phi,
                   daughter(1).eta,
                   daughter(1).phi),
            deltaR(daughter(0).daughter(1).eta,
                   daughter(0).daughter(1).phi,
                   daughter(1).eta,
                   daughter(1).phi)) < 1.5 &
        mass + daughter(0).mass < 200 &
        mass > 40
        '''),
    )
    
### Require at least one mu-mu-gamma candidate passing the cuts
ZmmgFilter = cms.EDFilter('CandViewCountFilter',
    src = cms.InputTag('ZmmgCandidates'),
    minNumber = cms.uint32(1)
    )
    
ZmmgSequence = cms.Sequence(
    ZmmgCandidates *
    ZmmgFilter
    )


###____________________________________________________________________________
###
###  Build the full selection sequence for the ZMuMuGammaSkim
###____________________________________________________________________________

ZmmgSkimSeq = cms.Sequence(
    ZmmgHLTFilter *
    ZmmgDimuonSequence *
    ZmmgPhotonSequence *
    ZmmgSequence
    )