Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2022-12-22 00:37:14

0001 ## /*****************************************************************************
0002 ##  * Project: CMS detector at the CERN
0003 ##  *
0004 ##  * Package: PhysicsTools/TagAndProbe
0005 ##  *
0006 ##  *
0007 ##  * Authors:
0008 ##  *
0009 ##  *   Kalanand Mishra, Fermilab - kalanand@fnal.gov
0010 ##  *
0011 ##  * Description:
0012 ##  *   - Produces tag & probe TTree for further analysis and computing efficiency
0013 ##  *
0014 ##  * History:
0015 ##  *   
0016 ##  * 
0017 ##  *****************************************************************************/
0018 
0019 
0020 import FWCore.ParameterSet.Config as cms
0021 
0022 ##                      _              _       
0023 ##   ___ ___  _ __  ___| |_ __ _ _ __ | |_ ___ 
0024 ##  / __/ _ \| '_ \/ __| __/ _` | '_ \| __/ __|
0025 ## | (_| (_) | | | \__ \ || (_| | | | | |_\__ \
0026 ##  \___\___/|_| |_|___/\__\__,_|_| |_|\__|___/
0027 ##                                              
0028 ################################################
0029 MC_flag = True
0030 GLOBAL_TAG = 'GR_R_42_V12::All'
0031 if MC_flag:
0032     GLOBAL_TAG = 'START42_V12::All'
0033     
0034 HLTPath = "HLT_Ele52_CaloIdVT_TrkIdT_v3"
0035 HLTProcessName = "HLT"
0036 if MC_flag:
0037     HLTPath = "HLT_Ele32_SW_TighterEleId_L1R_v2"
0038     HLTProcessName = "HLT"
0039 
0040 OUTPUT_FILE_NAME = "testNewWrite.root"
0041 
0042 
0043 ELECTRON_ET_CUT_MIN = 17.0
0044 ELECTRON_COLL = "gsfElectrons"
0045 ELECTRON_CUTS = "ecalDrivenSeed==1 && (abs(superCluster.eta)<2.5) && !(1.4442<abs(superCluster.eta)<1.566) && (ecalEnergy*sin(superClusterPosition.theta)>" + str(ELECTRON_ET_CUT_MIN) + ")"
0046 ####
0047 
0048 PHOTON_COLL = "photons"
0049 PHOTON_CUTS = "hadronicOverEm<0.15 && (abs(superCluster.eta)<2.5) && !(1.4442<abs(superCluster.eta)<1.566) && ((isEB && sigmaIetaIeta<0.01) || (isEE && sigmaIetaIeta<0.03)) && (superCluster.energy*sin(superCluster.position.theta)>" + str(ELECTRON_ET_CUT_MIN) + ")"
0050 ####
0051 
0052 SUPERCLUSTER_COLL_EB = "hybridSuperClusters"
0053 SUPERCLUSTER_COLL_EE = "multi5x5SuperClustersWithPreshower"
0054 if MC_flag:
0055     SUPERCLUSTER_COLL_EB = "correctedHybridSuperClusters"
0056     SUPERCLUSTER_COLL_EE = "correctedMulti5x5SuperClustersWithPreshower"
0057 SUPERCLUSTER_CUTS = "abs(eta)<2.5 && !(1.4442< abs(eta) <1.566) && et>" + str(ELECTRON_ET_CUT_MIN)
0058 
0059 
0060 JET_COLL = "ak5PFJets"
0061 JET_CUTS = "abs(eta)<2.6 && chargedHadronEnergyFraction>0 && electronEnergyFraction<0.1 && nConstituents>1 && neutralHadronEnergyFraction<0.99 && neutralEmEnergyFraction<0.99" 
0062 ########################
0063 
0064 ##    ___            _           _      
0065 ##   |_ _|_ __   ___| |_   _  __| | ___ 
0066 ##    | || '_ \ / __| | | | |/ _` |/ _ \
0067 ##    | || | | | (__| | |_| | (_| |  __/
0068 ##   |___|_| |_|\___|_|\__,_|\__,_|\___|
0069 ##
0070 process = cms.Process("TagProbe")
0071 process.load('Configuration.StandardSequences.FrontierConditions_GlobalTag_cff')
0072 process.load("Configuration.StandardSequences.GeometryDB_cff")
0073 process.GlobalTag.globaltag = GLOBAL_TAG
0074 process.load('FWCore.MessageService.MessageLogger_cfi')
0075 process.load("SimGeneral.HepPDTESSource.pythiapdt_cfi")
0076 #process.options   = cms.untracked.PSet( wantSummary = cms.untracked.bool(True) )
0077 process.MessageLogger.cerr.FwkReport.reportEvery = 1000
0078 
0079 
0080 
0081 ############# Needed for pileup re-weighting ##########
0082 process.pileupReweightingProducer = cms.EDProducer("PileupWeightProducer",
0083                                                    FirstTime = cms.untracked.bool(True),
0084                                                    PileupMCFile = cms.untracked.string("PUMC_dist_flat10.root"),
0085                                                    PileupDataFile = cms.untracked.string("PUData_finebin_dist.root")
0086 )
0087 #########
0088 ##   ____             _ ____                           
0089 ##  |  _ \ ___   ___ | / ___|  ___  _   _ _ __ ___ ___ 
0090 ##  | |_) / _ \ / _ \| \___ \ / _ \| | | | '__/ __/ _ \
0091 ##  |  __/ (_) | (_) | |___) | (_) | |_| | | | (_|  __/
0092 ##  |_|   \___/ \___/|_|____/ \___/ \__,_|_|  \___\___|
0093 ##  
0094 process.source = cms.Source("PoolSource", 
0095     fileNames = cms.untracked.vstring(
0096 
0097 ##        '/store/data/Run2011A/SingleElectron/RECO/PromptReco-v4/000/167/283/BC0BDDDF-829D-E011-89EE-0030487CF41E.root',
0098 ##        '/store/data/Run2011A/SingleElectron/RECO/PromptReco-v4/000/167/282/F0A7CE51-AE9D-E011-9C9E-003048D374F2.root',
0099 ##        '/store/data/Run2011A/SingleElectron/RECO/PromptReco-v4/000/167/282/B2D25F4E-A79D-E011-94AD-003048F024DC.root',
0100 ##        '/store/data/Run2011A/SingleElectron/RECO/PromptReco-v4/000/167/282/A89EC329-979D-E011-92F3-001D09F24DDF.root',
0101 ##        '/store/data/Run2011A/SingleElectron/RECO/PromptReco-v4/000/167/282/5831779B-989D-E011-995A-0019B9F730D2.root',
0102 ##        '/store/data/Run2011A/SingleElectron/RECO/PromptReco-v4/000/167/282/5021FAFB-AE9D-E011-B07F-003048D37538.root',
0103 ##        '/store/data/Run2011A/SingleElectron/RECO/PromptReco-v4/000/167/282/34B74172-A99D-E011-8CD1-003048D2BDD8.root',
0104 
0105        '/store/mc/Summer11/ZJetToEE_Pt-30to50_TuneZ2_7TeV_pythia6/AODSIM/PU_S3_START42_V11-v2/0000/F6082563-6C7F-E011-9730-00215E222790.root',
0106        '/store/mc/Summer11/ZJetToEE_Pt-30to50_TuneZ2_7TeV_pythia6/AODSIM/PU_S3_START42_V11-v2/0000/F4B4B87C-927F-E011-9805-00215E21D786.root',
0107        '/store/mc/Summer11/ZJetToEE_Pt-30to50_TuneZ2_7TeV_pythia6/AODSIM/PU_S3_START42_V11-v2/0000/E673A7C3-927F-E011-B8C0-00215E2205AC.root',
0108        '/store/mc/Summer11/ZJetToEE_Pt-30to50_TuneZ2_7TeV_pythia6/AODSIM/PU_S3_START42_V11-v2/0000/D0725463-6C7F-E011-9285-00215E222790.root',
0109        '/store/mc/Summer11/ZJetToEE_Pt-30to50_TuneZ2_7TeV_pythia6/AODSIM/PU_S3_START42_V11-v2/0000/BC3E4618-BC80-E011-8AB8-E41F13181A50.root',
0110        '/store/mc/Summer11/ZJetToEE_Pt-30to50_TuneZ2_7TeV_pythia6/AODSIM/PU_S3_START42_V11-v2/0000/A60D2563-6C7F-E011-84A1-00215E222790.root',
0111 
0112 
0113        
0114     )
0115 )
0116 process.maxEvents = cms.untracked.PSet( input = cms.untracked.int32(10) )    
0117 process.source.inputCommands = cms.untracked.vstring("keep *","drop *_MEtoEDMConverter_*_*")
0118 
0119 ##   ____                         ____ _           _            
0120 ##  / ___| _   _ _ __   ___ _ __ / ___| |_   _ ___| |_ ___ _ __ 
0121 ##  \___ \| | | | '_ \ / _ \ '__| |   | | | | / __| __/ _ \ '__|
0122 ##   ___) | |_| | |_) |  __/ |  | |___| | |_| \__ \ ||  __/ |   
0123 ##  |____/ \__,_| .__/ \___|_|   \____|_|\__,_|___/\__\___|_|   
0124 ##  
0125 
0126 #  SuperClusters  ################
0127 process.superClusters = cms.EDProducer("SuperClusterMerger",
0128    src = cms.VInputTag(cms.InputTag( SUPERCLUSTER_COLL_EB ,"", "RECO"),
0129                        cms.InputTag( SUPERCLUSTER_COLL_EE ,"", "RECO") )  
0130 )
0131 
0132 process.superClusterCands = cms.EDProducer("ConcreteEcalCandidateProducer",
0133    src = cms.InputTag("superClusters"),
0134    particleType = cms.int32(11),
0135 )
0136 
0137 #   Get the above SC's Candidates and place a cut on their Et and eta
0138 process.goodSuperClusters = cms.EDFilter("CandViewSelector",
0139       src = cms.InputTag("superClusterCands"),
0140       cut = cms.string( SUPERCLUSTER_CUTS ),
0141       filter = cms.bool(True)
0142 )                                         
0143                                          
0144 
0145 #### remove real jets (with high hadronic energy fraction) from SC collection
0146 ##### this improves the purity of the probe sample without affecting efficiency
0147 
0148 process.JetsToRemoveFromSuperCluster = cms.EDFilter("CaloJetSelector",   
0149     src = cms.InputTag("ak5CaloJets"),
0150     cut = cms.string('pt>5 && energyFractionHadronic > 0.15')
0151 )
0152 process.goodSuperClustersClean = cms.EDProducer("CandViewCleaner",
0153     srcObject = cms.InputTag("goodSuperClusters"),
0154     module_label = cms.string(''),
0155     srcObjectsToRemove = cms.VInputTag(cms.InputTag("JetsToRemoveFromSuperCluster")),
0156     deltaRMin = cms.double(0.1)
0157 )
0158 
0159 #  Photons!!! ################ 
0160 process.goodPhotons = cms.EDFilter(
0161     "PhotonSelector",
0162     src = cms.InputTag( PHOTON_COLL ),
0163     cut = cms.string(PHOTON_CUTS)
0164     )
0165 
0166 
0167 process.sc_sequence = cms.Sequence(
0168     process.superClusters +
0169     process.superClusterCands +
0170     process.goodSuperClusters +
0171     process.JetsToRemoveFromSuperCluster +
0172     process.goodSuperClustersClean +
0173     process.goodPhotons
0174     )
0175 
0176 
0177 ##    ____      __ _____ _           _                   
0178 ##   / ___|___ / _| ____| | ___  ___| |_ _ __ ___  _ __  
0179 ##  | |  _/ __| |_|  _| | |/ _ \/ __| __| '__/ _ \| '_ \ 
0180 ##  | |_| \__ \  _| |___| |  __/ (__| |_| | | (_) | | | |
0181 ##   \____|___/_| |_____|_|\___|\___|\__|_|  \___/|_| |_|
0182 ##  
0183 #  GsfElectron ################ 
0184 process.goodElectrons = cms.EDFilter("GsfElectronRefSelector",
0185     src = cms.InputTag( ELECTRON_COLL ),
0186     cut = cms.string( ELECTRON_CUTS )    
0187 )
0188 
0189 process.GsfMatchedSuperClusterCands = cms.EDProducer("ElectronMatchedCandidateProducer",
0190    src     = cms.InputTag("goodSuperClustersClean"),
0191    ReferenceElectronCollection = cms.untracked.InputTag("goodElectrons"),
0192    deltaR =  cms.untracked.double(0.3)
0193 )
0194 
0195 process.GsfMatchedPhotonCands = process.GsfMatchedSuperClusterCands.clone()
0196 process.GsfMatchedPhotonCands.src = cms.InputTag("goodPhotons")
0197 
0198             
0199 
0200 ##    _____ _           _                     ___    _ 
0201 ##   | ____| | ___  ___| |_ _ __ ___  _ __   |_ _|__| |
0202 ##   |  _| | |/ _ \/ __| __| '__/ _ \| '_ \   | |/ _` |
0203 ##   | |___| |  __/ (__| |_| | | (_) | | | |  | | (_| |
0204 ##   |_____|_|\___|\___|\__|_|  \___/|_| |_| |___\__,_|
0205 ##   
0206 # Electron ID  ######
0207 process.PassingWP95 = process.goodElectrons.clone()
0208 process.PassingWP95.cut = cms.string(
0209     process.goodElectrons.cut.value() +
0210     " && (gsfTrack.hitPattern().numberOfLostHits(\'MISSING_INNER_HITS\') <= 1)"
0211     " && ((isEB"
0212     " && ( dr03TkSumPt/p4.Pt < 0.15 && dr03EcalRecHitSumEt/p4.Pt < 2.0 && dr03HcalTowerSumEt/p4.Pt < 0.12 )" 
0213     " && (sigmaIetaIeta<0.01)"
0214     " && ( -0.8<deltaPhiSuperClusterTrackAtVtx<0.8 )"
0215     " && ( -0.007<deltaEtaSuperClusterTrackAtVtx<0.007 )"
0216     " && (hadronicOverEm<0.15)"
0217     ")"
0218     " || (isEE"
0219     " && (dr03TkSumPt/p4.Pt < 0.08 && dr03EcalRecHitSumEt/p4.Pt < 0.06  && dr03HcalTowerSumEt/p4.Pt < 0.05 )"  
0220     " && (sigmaIetaIeta<0.03)"
0221     " && ( -0.7<deltaPhiSuperClusterTrackAtVtx<0.7 )"
0222     " && ( -0.01<deltaEtaSuperClusterTrackAtVtx<0.01 )"
0223     " && (hadronicOverEm<0.07) "
0224     "))"
0225     )
0226 process.PassingWP90 = process.goodElectrons.clone()
0227 process.PassingWP90.cut = cms.string(
0228     process.goodElectrons.cut.value() +
0229     " && (gsfTrack.hitPattern().numberOfLostHits(\'MISSING_INNER_HITS\') == 0 && !(-0.02<convDist<0.02 && -0.02<convDcot<0.02))"
0230     " && ((isEB"
0231     " && ( dr03TkSumPt/p4.Pt <0.12 && dr03EcalRecHitSumEt/p4.Pt < 0.09 && dr03HcalTowerSumEt/p4.Pt  < 0.1 )"
0232     " && (sigmaIetaIeta<0.01)"
0233     " && ( -0.8<deltaPhiSuperClusterTrackAtVtx<0.8 )"
0234     " && ( -0.007<deltaEtaSuperClusterTrackAtVtx<0.007 )"
0235     " && (hadronicOverEm<0.12)"
0236     ")"
0237     " || (isEE"
0238     " && ( dr03TkSumPt/p4.Pt <0.05 && dr03EcalRecHitSumEt/p4.Pt < 0.06 && dr03HcalTowerSumEt/p4.Pt  < 0.03 )"
0239     " && (sigmaIetaIeta<0.03)"
0240     " && ( -0.7<deltaPhiSuperClusterTrackAtVtx<0.7 )"
0241     " && ( -0.009<deltaEtaSuperClusterTrackAtVtx<0.009 )"
0242     " && (hadronicOverEm<0.05) "
0243     "))"
0244     ) 
0245 process.PassingWP85 = process.goodElectrons.clone()
0246 process.PassingWP85.cut = cms.string(
0247     process.goodElectrons.cut.value() +
0248     " && (gsfTrack.hitPattern().numberOfLostHits(\'MISSING_INNER_HITS\') == 0 && !(-0.02<convDist<0.02 && -0.02<convDcot<0.02))"
0249     " && ((isEB"
0250     " && ( dr03TkSumPt/p4.Pt <0.09 && dr03EcalRecHitSumEt/p4.Pt < 0.08 && dr03HcalTowerSumEt/p4.Pt  < 0.1 )"
0251     " && (sigmaIetaIeta<0.01)"
0252     " && ( -0.6<deltaPhiSuperClusterTrackAtVtx<0.6 )"
0253     " && ( -0.006<deltaEtaSuperClusterTrackAtVtx<0.006 )"
0254     " && (hadronicOverEm<0.04)"
0255     ")"
0256     " || (isEE"
0257     " && ( dr03TkSumPt/p4.Pt <0.05 && dr03EcalRecHitSumEt/p4.Pt < 0.05 && dr03HcalTowerSumEt/p4.Pt  < 0.025 )"
0258     " && (sigmaIetaIeta<0.03)"
0259     " && ( -0.04<deltaPhiSuperClusterTrackAtVtx<0.04 )"
0260     " && ( -0.007<deltaEtaSuperClusterTrackAtVtx<0.007 )"
0261     " && (hadronicOverEm<0.025) "
0262     "))"
0263     ) 
0264 process.PassingWP80 = process.goodElectrons.clone()
0265 process.PassingWP80.cut = cms.string(
0266     process.goodElectrons.cut.value() +
0267     " && (gsfTrack.hitPattern().numberOfLostHits(\'MISSING_INNER_HITS\') == 0 && !(-0.02<convDist<0.02 && -0.02<convDcot<0.02))"
0268     " && ((isEB"
0269     " && ( dr03TkSumPt/p4.Pt <0.09 && dr03EcalRecHitSumEt/p4.Pt < 0.07 && dr03HcalTowerSumEt/p4.Pt  < 0.1 )"
0270     " && (sigmaIetaIeta<0.01)"
0271     " && ( -0.06<deltaPhiSuperClusterTrackAtVtx<0.06 )"
0272     " && ( -0.004<deltaEtaSuperClusterTrackAtVtx<0.004 )"
0273     " && (hadronicOverEm<0.04)"
0274     ")"
0275     " || (isEE"
0276     " && ( dr03TkSumPt/p4.Pt <0.04 && dr03EcalRecHitSumEt/p4.Pt < 0.05 && dr03HcalTowerSumEt/p4.Pt  < 0.025 )"
0277     " && (sigmaIetaIeta<0.03)"
0278     " && ( -0.03<deltaPhiSuperClusterTrackAtVtx<0.03 )"
0279     " && ( -0.007<deltaEtaSuperClusterTrackAtVtx<0.007 )"
0280     " && (hadronicOverEm<0.025) "
0281     "))"
0282     ) 
0283 process.PassingWP70 = process.goodElectrons.clone()
0284 process.PassingWP70.cut = cms.string(
0285     process.goodElectrons.cut.value() +
0286     " && (gsfTrack.hitPattern().numberOfLostHits(\'MISSING_INNER_HITS\') == 0 && !(-0.02<convDist<0.02 && -0.02<convDcot<0.02))"
0287     " && ((isEB"
0288     " && ( dr03TkSumPt/p4.Pt <0.05 && dr03EcalRecHitSumEt/p4.Pt < 0.06 && dr03HcalTowerSumEt/p4.Pt  < 0.03 )"
0289     " && (sigmaIetaIeta<0.01)"
0290     " && ( -0.03<deltaPhiSuperClusterTrackAtVtx<0.03 )"
0291     " && ( -0.004<deltaEtaSuperClusterTrackAtVtx<0.004 )"
0292     " && (hadronicOverEm<0.025)"
0293     ")"
0294     " || (isEE"
0295     " && ( dr03TkSumPt/p4.Pt <0.025 && dr03EcalRecHitSumEt/p4.Pt < 0.025 && dr03HcalTowerSumEt/p4.Pt  < 0.02 )"
0296     " && (sigmaIetaIeta<0.03)"
0297     " && ( -0.02<deltaPhiSuperClusterTrackAtVtx<0.02 )"
0298     " && ( -0.005<deltaEtaSuperClusterTrackAtVtx<0.005 )"
0299     " && (hadronicOverEm<0.025) "
0300     "))"
0301     ) 
0302 process.PassingWP60 = process.goodElectrons.clone()
0303 process.PassingWP60.cut = cms.string(
0304     process.goodElectrons.cut.value() +
0305     " && (gsfTrack.hitPattern().numberOfLostHits(\'MISSING_INNER_HITS\') == 0 && !(-0.02<convDist<0.02 && -0.02<convDcot<0.02))"
0306     " && ((isEB"
0307     " && ( dr03TkSumPt/p4.Pt <0.04 && dr03EcalRecHitSumEt/p4.Pt < 0.04 && dr03HcalTowerSumEt/p4.Pt  < 0.03 )"
0308     " && (sigmaIetaIeta<0.01)"
0309     " && ( -0.025<deltaPhiSuperClusterTrackAtVtx<0.025 )"
0310     " && ( -0.004<deltaEtaSuperClusterTrackAtVtx<0.004 )"
0311     " && (hadronicOverEm<0.025)"
0312     ")"
0313     " || (isEE"
0314     " && ( dr03TkSumPt/p4.Pt <0.025 && dr03EcalRecHitSumEt/p4.Pt < 0.02 && dr03HcalTowerSumEt/p4.Pt  < 0.02 )"
0315     " && (sigmaIetaIeta<0.03)"
0316     " && ( -0.02<deltaPhiSuperClusterTrackAtVtx<0.02 )"
0317     " && ( -0.005<deltaEtaSuperClusterTrackAtVtx<0.005 )"
0318     " && (hadronicOverEm<0.025) "
0319     "))"
0320     ) 
0321 
0322 ##     ____ _  ____ 
0323 ##    / ___(_)/ ___|
0324 ##   | |   | | |    
0325 ##   | |___| | |___ 
0326 ##    \____|_|\____|
0327 ##   
0328 process.load("RecoEgamma.ElectronIdentification.cutsInCategoriesElectronIdentificationV06_DataTuning_cfi")
0329 process.load("RecoEgamma.ElectronIdentification.electronIdLikelihoodExt_cfi")
0330 
0331 process.eIDSequence = cms.Sequence(
0332     process.eidVeryLoose+ 
0333     process.eidLoose+                
0334     process.eidMedium+
0335     process.eidTight+
0336     process.eidSuperTight+
0337     process.eidHyperTight1+
0338     process.eidHyperTight2+
0339     process.eidHyperTight3+
0340     process.eidHyperTight4+
0341     process.eidLikelihoodExt 
0342     )
0343 
0344 
0345 # select a subset of the GsfElectron collection based on the quality stored in a ValueMap
0346 process.PassingCicVeryLoose = cms.EDProducer("BtagGsfElectronSelector",
0347    input     = cms.InputTag( ELECTRON_COLL ),
0348    selection = cms.InputTag('eidVeryLoose'),
0349    cut       = cms.double(14.5) ### 15== passing all iso,id,tip cuts
0350 )
0351 process.PassingCicLoose = process.PassingCicVeryLoose.clone()
0352 process.PassingCicLoose.selection = cms.InputTag('eidLoose')
0353 process.PassingCicMedium = process.PassingCicVeryLoose.clone()
0354 process.PassingCicMedium.selection = cms.InputTag('eidMedium')
0355 process.PassingCicTight = process.PassingCicVeryLoose.clone()
0356 process.PassingCicTight.selection = cms.InputTag('eidTight')
0357 process.PassingCicSuperTight = process.PassingCicVeryLoose.clone()
0358 process.PassingCicSuperTight.selection = cms.InputTag('eidSuperTight')
0359 process.PassingCicHyperTight1 = process.PassingCicVeryLoose.clone()
0360 process.PassingCicHyperTight1.selection = cms.InputTag('eidHyperTight1')
0361 process.PassingCicHyperTight2 = process.PassingCicVeryLoose.clone()
0362 process.PassingCicHyperTight2.selection = cms.InputTag('eidHyperTight2')
0363 process.PassingCicHyperTight3 = process.PassingCicVeryLoose.clone()
0364 process.PassingCicHyperTight3.selection = cms.InputTag('eidHyperTight3')
0365 process.PassingCicHyperTight4 = process.PassingCicVeryLoose.clone()
0366 process.PassingCicHyperTight4.selection = cms.InputTag('eidHyperTight4')
0367 
0368 
0369                          
0370 ##    _____     _                         __  __       _       _     _             
0371 ##   |_   _| __(_) __ _  __ _  ___ _ __  |  \/  | __ _| |_ ___| |__ (_)_ __   __ _ 
0372 ##     | || '__| |/ _` |/ _` |/ _ \ '__| | |\/| |/ _` | __/ __| '_ \| | '_ \ / _` |
0373 ##     | || |  | | (_| | (_| |  __/ |    | |  | | (_| | || (__| | | | | | | | (_| |
0374 ##     |_||_|  |_|\__, |\__, |\___|_|    |_|  |_|\__,_|\__\___|_| |_|_|_| |_|\__, |
0375 ##                |___/ |___/                                                |___/ 
0376 ##   
0377 # Trigger  ##################
0378 process.PassingHLT = cms.EDProducer("trgMatchedGsfElectronProducer",    
0379     InputProducer = cms.InputTag( ELECTRON_COLL ),                          
0380     hltTags = cms.VInputTag(cms.InputTag(HLTPath,"", HLTProcessName)),
0381     triggerEventTag = cms.untracked.InputTag("hltTriggerSummaryAOD","",HLTProcessName),
0382     triggerResultsTag = cms.untracked.InputTag("TriggerResults","",HLTProcessName)   
0383 )
0384 
0385 ##    _____      _                        _  __     __             
0386 ##   | ____|_  _| |_ ___ _ __ _ __   __ _| | \ \   / /_ _ _ __ ___ 
0387 ##   |  _| \ \/ / __/ _ \ '__| '_ \ / _` | |  \ \ / / _` | '__/ __|
0388 ##   | |___ >  <| ||  __/ |  | | | | (_| | |   \ V / (_| | |  \__ \
0389 ##   |_____/_/\_\\__\___|_|  |_| |_|\__,_|_|    \_/ \__,_|_|  |___/
0390 ##   
0391 ## Here we show how to use a module to compute an external variable
0392 
0393 process.superClusterDRToNearestJet = cms.EDProducer("DeltaRNearestJetComputer",
0394     probes = cms.InputTag("goodSuperClusters"),
0395        # ^^--- NOTA BENE: if probes are defined by ref, as in this case, 
0396        #       this must be the full collection, not the subset by refs.
0397     objects = cms.InputTag(JET_COLL),
0398     objectSelection = cms.string(JET_CUTS + " && pt > 20.0"),
0399 )
0400 process.JetMultiplicityInSCEvents = cms.EDProducer("CandMultiplicityCounter",
0401     probes = cms.InputTag("goodSuperClusters"),
0402     objects = cms.InputTag(JET_COLL),
0403     objectSelection = cms.string(JET_CUTS + " && pt > 20.0"),
0404 )
0405 process.SCConvRejVars = cms.EDProducer("ElectronConversionRejectionVars",
0406     probes = cms.InputTag("goodSuperClusters")
0407 )
0408 process.GsfConvRejVars = process.SCConvRejVars.clone()
0409 process.GsfConvRejVars.probes = cms.InputTag( ELECTRON_COLL )
0410 process.PhotonDRToNearestJet = process.superClusterDRToNearestJet.clone()
0411 process.PhotonDRToNearestJet.probes =cms.InputTag("goodPhotons")
0412 process.JetMultiplicityInPhotonEvents = process.JetMultiplicityInSCEvents.clone()
0413 process.JetMultiplicityInPhotonEvents.probes = cms.InputTag("goodPhotons")
0414 process.PhotonConvRejVars = process.SCConvRejVars.clone()
0415 process.PhotonConvRejVars.probes = cms.InputTag("goodPhotons")
0416 
0417 process.GsfDRToNearestJet = process.superClusterDRToNearestJet.clone()
0418 process.GsfDRToNearestJet.probes = cms.InputTag( ELECTRON_COLL )
0419 process.JetMultiplicityInGsfEvents = process.JetMultiplicityInSCEvents.clone()
0420 process.JetMultiplicityInGsfEvents.probes = cms.InputTag( ELECTRON_COLL )
0421 
0422 process.ext_ToNearestJet_sequence = cms.Sequence(
0423     #process.ak5PFResidual + 
0424     process.superClusterDRToNearestJet +
0425     process.JetMultiplicityInSCEvents +
0426     process.SCConvRejVars +
0427     process.PhotonDRToNearestJet +
0428     process.JetMultiplicityInPhotonEvents +    
0429     process.PhotonConvRejVars + 
0430     process.GsfDRToNearestJet +
0431     process.JetMultiplicityInGsfEvents +
0432     process.GsfConvRejVars
0433     )
0434 
0435 
0436 ##    _____             ____        __ _       _ _   _             
0437 ##   |_   _|_ _  __ _  |  _ \  ___ / _(_)_ __ (_) |_(_) ___  _ __  
0438 ##     | |/ _` |/ _` | | | | |/ _ \ |_| | '_ \| | __| |/ _ \| '_ \ 
0439 ##     | | (_| | (_| | | |_| |  __/  _| | | | | | |_| | (_) | | | |
0440 ##     |_|\__,_|\__, | |____/ \___|_| |_|_| |_|_|\__|_|\___/|_| |_|
0441 ##              |___/
0442 ## 
0443 process.Tag = process.PassingHLT.clone()
0444 process.Tag.InputProducer = cms.InputTag( "PassingWP80" )
0445 process.TagMatchedSuperClusterCandsClean = cms.EDProducer("ElectronMatchedCandidateProducer",
0446    src     = cms.InputTag("goodSuperClustersClean"),
0447    ReferenceElectronCollection = cms.untracked.InputTag("Tag"),
0448    deltaR =  cms.untracked.double(0.3)
0449 )
0450 process.TagMatchedPhotonCands = process.TagMatchedSuperClusterCandsClean.clone()
0451 process.TagMatchedPhotonCands.src     = cms.InputTag("goodPhotons")
0452 process.WP95MatchedSuperClusterCandsClean = process.TagMatchedSuperClusterCandsClean.clone()
0453 process.WP95MatchedSuperClusterCandsClean.ReferenceElectronCollection = cms.untracked.InputTag("PassingWP95")
0454 process.WP90MatchedSuperClusterCandsClean = process.TagMatchedSuperClusterCandsClean.clone()
0455 process.WP90MatchedSuperClusterCandsClean.ReferenceElectronCollection = cms.untracked.InputTag("PassingWP90")
0456 process.WP85MatchedSuperClusterCandsClean = process.TagMatchedSuperClusterCandsClean.clone()
0457 process.WP85MatchedSuperClusterCandsClean.ReferenceElectronCollection = cms.untracked.InputTag("PassingWP85")
0458 process.WP80MatchedSuperClusterCandsClean = process.TagMatchedSuperClusterCandsClean.clone()
0459 process.WP80MatchedSuperClusterCandsClean.ReferenceElectronCollection = cms.untracked.InputTag("PassingWP80")
0460 process.WP70MatchedSuperClusterCandsClean = process.TagMatchedSuperClusterCandsClean.clone()
0461 process.WP70MatchedSuperClusterCandsClean.ReferenceElectronCollection = cms.untracked.InputTag("PassingWP70")
0462 process.WP60MatchedSuperClusterCandsClean = process.TagMatchedSuperClusterCandsClean.clone()
0463 process.WP60MatchedSuperClusterCandsClean.ReferenceElectronCollection = cms.untracked.InputTag("PassingWP60")
0464 process.CicVeryLooseMatchedSuperClusterCandsClean = process.TagMatchedSuperClusterCandsClean.clone()
0465 process.CicVeryLooseMatchedSuperClusterCandsClean.ReferenceElectronCollection = cms.untracked.InputTag("PassingCicVeryLoose")
0466 process.CicLooseMatchedSuperClusterCandsClean = process.TagMatchedSuperClusterCandsClean.clone()
0467 process.CicLooseMatchedSuperClusterCandsClean.ReferenceElectronCollection = cms.untracked.InputTag("PassingCicLoose")
0468 process.CicMediumMatchedSuperClusterCandsClean = process.TagMatchedSuperClusterCandsClean.clone()
0469 process.CicMediumMatchedSuperClusterCandsClean.ReferenceElectronCollection = cms.untracked.InputTag("PassingCicMedium")
0470 process.CicTightMatchedSuperClusterCandsClean = process.TagMatchedSuperClusterCandsClean.clone()
0471 process.CicTightMatchedSuperClusterCandsClean.ReferenceElectronCollection = cms.untracked.InputTag("PassingCicTight")
0472 process.CicSuperTightMatchedSuperClusterCandsClean = process.TagMatchedSuperClusterCandsClean.clone()
0473 process.CicSuperTightMatchedSuperClusterCandsClean.ReferenceElectronCollection = cms.untracked.InputTag("PassingCicSuperTight")
0474 process.CicHyperTight1MatchedSuperClusterCandsClean = process.TagMatchedSuperClusterCandsClean.clone()
0475 process.CicHyperTight1MatchedSuperClusterCandsClean.ReferenceElectronCollection = cms.untracked.InputTag("PassingCicHyperTight1")
0476 process.CicHyperTight2MatchedSuperClusterCandsClean = process.TagMatchedSuperClusterCandsClean.clone()
0477 process.CicHyperTight2MatchedSuperClusterCandsClean.ReferenceElectronCollection = cms.untracked.InputTag("PassingCicHyperTight2")
0478 process.CicHyperTight3MatchedSuperClusterCandsClean = process.TagMatchedSuperClusterCandsClean.clone()
0479 process.CicHyperTight3MatchedSuperClusterCandsClean.ReferenceElectronCollection = cms.untracked.InputTag("PassingCicHyperTight3")
0480 process.CicHyperTight4MatchedSuperClusterCandsClean = process.TagMatchedSuperClusterCandsClean.clone()
0481 process.CicHyperTight4MatchedSuperClusterCandsClean.ReferenceElectronCollection = cms.untracked.InputTag("PassingCicHyperTight4")
0482 
0483 
0484 process.WP95MatchedPhotonCands = process.GsfMatchedPhotonCands.clone()
0485 process.WP95MatchedPhotonCands.ReferenceElectronCollection = cms.untracked.InputTag("PassingWP95")
0486 process.WP90MatchedPhotonCands = process.GsfMatchedPhotonCands.clone()
0487 process.WP90MatchedPhotonCands.ReferenceElectronCollection = cms.untracked.InputTag("PassingWP90")
0488 process.WP85MatchedPhotonCands = process.GsfMatchedPhotonCands.clone()
0489 process.WP85MatchedPhotonCands.ReferenceElectronCollection = cms.untracked.InputTag("PassingWP85")
0490 process.WP80MatchedPhotonCands = process.GsfMatchedPhotonCands.clone()
0491 process.WP80MatchedPhotonCands.ReferenceElectronCollection = cms.untracked.InputTag("PassingWP80")
0492 process.WP70MatchedPhotonCands = process.GsfMatchedPhotonCands.clone()
0493 process.WP70MatchedPhotonCands.ReferenceElectronCollection = cms.untracked.InputTag("PassingWP70")
0494 process.WP60MatchedPhotonCands = process.GsfMatchedPhotonCands.clone()
0495 process.WP60MatchedPhotonCands.ReferenceElectronCollection = cms.untracked.InputTag("PassingWP60")
0496 process.CicVeryLooseMatchedPhotonCands = process.GsfMatchedPhotonCands.clone()
0497 process.CicVeryLooseMatchedPhotonCands.ReferenceElectronCollection = cms.untracked.InputTag("PassingCicVeryLoose")
0498 process.CicLooseMatchedPhotonCands = process.GsfMatchedPhotonCands.clone()
0499 process.CicLooseMatchedPhotonCands.ReferenceElectronCollection = cms.untracked.InputTag("PassingCicLoose")
0500 process.CicMediumMatchedPhotonCands = process.GsfMatchedPhotonCands.clone()
0501 process.CicMediumMatchedPhotonCands.ReferenceElectronCollection = cms.untracked.InputTag("PassingCicMedium")
0502 process.CicTightMatchedPhotonCands = process.GsfMatchedPhotonCands.clone()
0503 process.CicTightMatchedPhotonCands.ReferenceElectronCollection = cms.untracked.InputTag("PassingCicTight")
0504 process.CicSuperTightMatchedPhotonCands = process.GsfMatchedPhotonCands.clone()
0505 process.CicSuperTightMatchedPhotonCands.ReferenceElectronCollection = cms.untracked.InputTag("PassingCicSuperTight")
0506 process.CicHyperTight1MatchedPhotonCands = process.GsfMatchedPhotonCands.clone()
0507 process.CicHyperTight1MatchedPhotonCands.ReferenceElectronCollection = cms.untracked.InputTag("PassingCicHyperTight1")
0508 process.CicHyperTight2MatchedPhotonCands = process.GsfMatchedPhotonCands.clone()
0509 process.CicHyperTight2MatchedPhotonCands.ReferenceElectronCollection = cms.untracked.InputTag("PassingCicHyperTight2")
0510 process.CicHyperTight3MatchedPhotonCands = process.GsfMatchedPhotonCands.clone()
0511 process.CicHyperTight3MatchedPhotonCands.ReferenceElectronCollection = cms.untracked.InputTag("PassingCicHyperTight3")
0512 process.CicHyperTight4MatchedPhotonCands = process.GsfMatchedPhotonCands.clone()
0513 process.CicHyperTight4MatchedPhotonCands.ReferenceElectronCollection = cms.untracked.InputTag("PassingCicHyperTight4")
0514 
0515 process.ele_sequence = cms.Sequence(
0516     process.goodElectrons +
0517     process.GsfMatchedSuperClusterCands +
0518     process.GsfMatchedPhotonCands +
0519     process.PassingWP95 +
0520     process.PassingWP90 +
0521     process.PassingWP85 +
0522     process.PassingWP80 +
0523     process.PassingWP70 +
0524     process.PassingWP60 +
0525     process.PassingCicVeryLoose +
0526     process.PassingCicLoose +
0527     process.PassingCicMedium +
0528     process.PassingCicTight +
0529     process.PassingCicSuperTight +
0530     process.PassingCicHyperTight1 +
0531     process.PassingCicHyperTight2 +
0532     process.PassingCicHyperTight3 +
0533     process.PassingCicHyperTight4 +       
0534     process.PassingHLT +
0535     process.Tag +
0536     process.TagMatchedSuperClusterCandsClean +
0537     process.TagMatchedPhotonCands +
0538     process.WP95MatchedSuperClusterCandsClean +
0539     process.WP90MatchedSuperClusterCandsClean +
0540     process.WP85MatchedSuperClusterCandsClean +
0541     process.WP80MatchedSuperClusterCandsClean +
0542     process.WP70MatchedSuperClusterCandsClean +
0543     process.WP60MatchedSuperClusterCandsClean +    
0544     process.CicVeryLooseMatchedSuperClusterCandsClean +
0545     process.CicLooseMatchedSuperClusterCandsClean +
0546     process.CicMediumMatchedSuperClusterCandsClean +
0547     process.CicTightMatchedSuperClusterCandsClean +
0548     process.CicSuperTightMatchedSuperClusterCandsClean +
0549     process.CicHyperTight1MatchedSuperClusterCandsClean +
0550     process.CicHyperTight2MatchedSuperClusterCandsClean +
0551     process.CicHyperTight3MatchedSuperClusterCandsClean +
0552     process.CicHyperTight4MatchedSuperClusterCandsClean +
0553     process.WP95MatchedPhotonCands +
0554     process.WP90MatchedPhotonCands +
0555     process.WP85MatchedPhotonCands +
0556     process.WP80MatchedPhotonCands +
0557     process.WP70MatchedPhotonCands +
0558     process.WP60MatchedPhotonCands +    
0559     process.CicVeryLooseMatchedPhotonCands +
0560     process.CicLooseMatchedPhotonCands +
0561     process.CicMediumMatchedPhotonCands +
0562     process.CicTightMatchedPhotonCands +
0563     process.CicSuperTightMatchedPhotonCands +
0564     process.CicHyperTight1MatchedPhotonCands +
0565     process.CicHyperTight2MatchedPhotonCands +
0566     process.CicHyperTight3MatchedPhotonCands +
0567     process.CicHyperTight4MatchedPhotonCands         
0568     )
0569 
0570 
0571 ##    _____ ___   ____    ____       _          
0572 ##   |_   _( _ ) |  _ \  |  _ \ __ _(_)_ __ ___ 
0573 ##     | | / _ \/\ |_) | | |_) / _` | | '__/ __|
0574 ##     | || (_>  <  __/  |  __/ (_| | | |  \__ \
0575 ##     |_| \___/\/_|     |_|   \__,_|_|_|  |___/
0576 ##                                              
0577 ##   
0578 #  Tag & probe selection ######
0579 process.tagSC = cms.EDProducer("CandViewShallowCloneCombiner",
0580     decay = cms.string("Tag goodSuperClustersClean"), # charge coniugate states are implied
0581     checkCharge = cms.bool(False),                           
0582     cut   = cms.string("40 < mass < 1000"),
0583 )
0584 
0585 process.tagPhoton = process.tagSC.clone()
0586 process.tagPhoton.decay = cms.string("Tag goodPhotons")
0587 process.GsfGsf = process.tagSC.clone()
0588 process.GsfGsf.decay = cms.string("goodElectrons goodElectrons")
0589 process.tagGsf = process.tagSC.clone()
0590 process.tagGsf.decay = cms.string("Tag goodElectrons")
0591 process.tagWP95 = process.tagSC.clone()
0592 process.tagWP95.decay = cms.string("Tag PassingWP95")
0593 process.tagWP90 = process.tagSC.clone()
0594 process.tagWP90.decay = cms.string("Tag PassingWP90")
0595 process.tagWP85 = process.tagSC.clone()
0596 process.tagWP85.decay = cms.string("Tag PassingWP85")
0597 process.tagWP80 = process.tagSC.clone()
0598 process.tagWP80.decay = cms.string("Tag PassingWP80")
0599 process.tagWP70 = process.tagSC.clone()
0600 process.tagWP70.decay = cms.string("Tag PassingWP70")
0601 process.tagWP60 = process.tagSC.clone()
0602 process.tagWP60.decay = cms.string("Tag PassingWP60")
0603 process.tagCicVeryLoose = process.tagSC.clone()
0604 process.tagCicVeryLoose.decay = cms.string("Tag PassingCicVeryLoose")
0605 process.tagCicLoose = process.tagSC.clone()
0606 process.tagCicLoose.decay = cms.string("Tag PassingCicLoose")
0607 process.tagCicMedium = process.tagSC.clone()
0608 process.tagCicMedium.decay = cms.string("Tag PassingCicMedium")
0609 process.tagCicTight = process.tagSC.clone()
0610 process.tagCicTight.decay = cms.string("Tag PassingCicTight")
0611 process.tagCicSuperTight = process.tagSC.clone()
0612 process.tagCicSuperTight.decay = cms.string("Tag PassingCicSuperTight")
0613 process.tagCicHyperTight1 = process.tagSC.clone()
0614 process.tagCicHyperTight1.decay = cms.string("Tag PassingCicHyperTight1")
0615 process.tagCicHyperTight2 = process.tagSC.clone()
0616 process.tagCicHyperTight2.decay = cms.string("Tag PassingCicHyperTight2")
0617 process.tagCicHyperTight3 = process.tagSC.clone()
0618 process.tagCicHyperTight3.decay = cms.string("Tag PassingCicHyperTight3")
0619 process.tagCicHyperTight4 = process.tagSC.clone()
0620 process.tagCicHyperTight4.decay = cms.string("Tag PassingCicHyperTight4")
0621 process.elecMet = process.tagSC.clone()
0622 process.elecMet.decay = cms.string("pfMet PassingWP90")
0623 process.elecMet.cut = cms.string("mt > 0")
0624 
0625 process.CSVarsTagGsf = cms.EDProducer("ColinsSoperVariablesComputer",
0626     parentBoson = cms.InputTag("tagGsf")
0627 )
0628 process.CSVarsGsfGsf = process.CSVarsTagGsf.clone()
0629 process.CSVarsGsfGsf.parentBoson = cms.InputTag("GsfGsf")
0630 
0631 
0632 
0633 process.allTagsAndProbes = cms.Sequence(
0634     process.tagSC +
0635     process.tagPhoton +
0636     process.tagGsf +
0637     process.GsfGsf +
0638     process.tagWP95 +
0639     process.tagWP90 +
0640     process.tagWP85 +
0641     process.tagWP80 +
0642     process.tagWP70 +
0643     process.tagWP60 +
0644     process.tagCicVeryLoose +
0645     process.tagCicLoose +
0646     process.tagCicMedium +
0647     process.tagCicTight +
0648     process.tagCicSuperTight +
0649     process.tagCicHyperTight1 +
0650     process.tagCicHyperTight2 +
0651     process.tagCicHyperTight3 +
0652     process.tagCicHyperTight4 +
0653     process.elecMet + 
0654     process.CSVarsTagGsf +
0655     process.CSVarsGsfGsf
0656 )
0657 
0658 ##    __  __  ____   __  __       _       _               
0659 ##   |  \/  |/ ___| |  \/  | __ _| |_ ___| |__   ___  ___ 
0660 ##   | |\/| | |     | |\/| |/ _` | __/ __| '_ \ / _ \/ __|
0661 ##   | |  | | |___  | |  | | (_| | || (__| | | |  __/\__ \
0662 ##   |_|  |_|\____| |_|  |_|\__,_|\__\___|_| |_|\___||___/
0663 ##                                                        
0664 process.McMatchTag = cms.EDProducer("MCTruthDeltaRMatcherNew",
0665     matchPDGId = cms.vint32(11),
0666     src = cms.InputTag("Tag"),
0667     distMin = cms.double(0.3),
0668     matched = cms.InputTag("genParticles"),
0669     checkCharge = cms.bool(True)
0670 )
0671 process.McMatchSC = cms.EDProducer("MCTruthDeltaRMatcherNew",
0672     matchPDGId = cms.vint32(11),
0673     src = cms.InputTag("goodSuperClustersClean"),
0674     distMin = cms.double(0.3),
0675     matched = cms.InputTag("genParticles")
0676 )
0677 process.McMatchPhoton = process.McMatchSC.clone()
0678 process.McMatchPhoton.src = cms.InputTag("goodPhotons")
0679 process.McMatchGsf = process.McMatchTag.clone()
0680 process.McMatchGsf.src = cms.InputTag("goodElectrons")
0681 process.McMatchWP95 = process.McMatchTag.clone()
0682 process.McMatchWP95.src = cms.InputTag("PassingWP95")
0683 process.McMatchWP90 = process.McMatchTag.clone()
0684 process.McMatchWP90.src = cms.InputTag("PassingWP90")
0685 process.McMatchWP85 = process.McMatchTag.clone()
0686 process.McMatchWP85.src = cms.InputTag("PassingWP85")
0687 process.McMatchWP80 = process.McMatchTag.clone()
0688 process.McMatchWP80.src = cms.InputTag("PassingWP80")
0689 process.McMatchWP70 = process.McMatchTag.clone()
0690 process.McMatchWP70.src = cms.InputTag("PassingWP70")
0691 process.McMatchWP60 = process.McMatchTag.clone()
0692 process.McMatchWP60.src = cms.InputTag("PassingWP60")
0693 process.McMatchCicVeryLoose = process.McMatchTag.clone()
0694 process.McMatchCicVeryLoose.src = cms.InputTag("PassingCicVeryLoose")
0695 process.McMatchCicLoose = process.McMatchTag.clone()
0696 process.McMatchCicLoose.src = cms.InputTag("PassingCicLoose")
0697 process.McMatchCicMedium = process.McMatchTag.clone()
0698 process.McMatchCicMedium.src = cms.InputTag("PassingCicMedium")
0699 process.McMatchCicTight = process.McMatchTag.clone()
0700 process.McMatchCicTight.src = cms.InputTag("PassingCicTight")
0701 process.McMatchCicSuperTight = process.McMatchTag.clone()
0702 process.McMatchCicSuperTight.src = cms.InputTag("PassingCicSuperTight")
0703 process.McMatchCicHyperTight1 = process.McMatchTag.clone()
0704 process.McMatchCicHyperTight1.src = cms.InputTag("PassingCicHyperTight1")
0705 process.McMatchCicHyperTight2 = process.McMatchTag.clone()
0706 process.McMatchCicHyperTight2.src = cms.InputTag("PassingCicHyperTight2")
0707 process.McMatchCicHyperTight3 = process.McMatchTag.clone()
0708 process.McMatchCicHyperTight3.src = cms.InputTag("PassingCicHyperTight3")
0709 process.McMatchCicHyperTight4 = process.McMatchTag.clone()
0710 process.McMatchCicHyperTight4.src = cms.InputTag("PassingCicHyperTight4")
0711     
0712 process.mc_sequence = cms.Sequence(
0713    process.McMatchTag +
0714    process.McMatchSC +
0715    process.McMatchPhoton +
0716    process.McMatchGsf + 
0717    process.McMatchWP95 +
0718    process.McMatchWP90 +
0719    process.McMatchWP85 +
0720    process.McMatchWP80 +
0721    process.McMatchWP70 +   
0722    process.McMatchWP60 +
0723    process.McMatchCicVeryLoose +
0724    process.McMatchCicLoose +
0725    process.McMatchCicMedium +
0726    process.McMatchCicTight +
0727    process.McMatchCicSuperTight +
0728    process.McMatchCicHyperTight1 +
0729    process.McMatchCicHyperTight2 +
0730    process.McMatchCicHyperTight3 +
0731    process.McMatchCicHyperTight4    
0732 )
0733 
0734 ############################################################################
0735 ##    _____           _       _ ____            _            _   _  ____  ##
0736 ##   |_   _|_ _  __ _( )_ __ ( )  _ \ _ __ ___ | |__   ___  | \ | |/ ___| ##
0737 ##     | |/ _` |/ _` |/| '_ \|/| |_) | '__/ _ \| '_ \ / _ \ |  \| | |  _  ##
0738 ##     | | (_| | (_| | | | | | |  __/| | | (_) | |_) |  __/ | |\  | |_| | ##
0739 ##     |_|\__,_|\__, | |_| |_| |_|   |_|  \___/|_.__/ \___| |_| \_|\____| ##
0740 ##              |___/                                                     ##
0741 ##                                                                        ##
0742 ############################################################################
0743 ##    ____                      _     _           
0744 ##   |  _ \ ___ _   _ ___  __ _| |__ | | ___  ___ 
0745 ##   | |_) / _ \ | | / __|/ _` | '_ \| |/ _ \/ __|
0746 ##   |  _ <  __/ |_| \__ \ (_| | |_) | |  __/\__ \
0747 ##   |_| \_\___|\__,_|___/\__,_|_.__/|_|\___||___/
0748 ##
0749 ## I define some common variables for re-use later.
0750 ## This will save us repeating the same code for each efficiency category
0751 ZVariablesToStore = cms.PSet(
0752     eta = cms.string("eta"),
0753     pt  = cms.string("pt"),
0754     phi  = cms.string("phi"),
0755     et  = cms.string("et"),
0756     e  = cms.string("energy"),
0757     p  = cms.string("p"),
0758     px  = cms.string("px"),
0759     py  = cms.string("py"),
0760     pz  = cms.string("pz"),
0761     theta  = cms.string("theta"),    
0762     vx     = cms.string("vx"),
0763     vy     = cms.string("vy"),
0764     vz     = cms.string("vz"),
0765     rapidity  = cms.string("rapidity"),
0766     mass  = cms.string("mass"),
0767     mt  = cms.string("mt"),    
0768 )   
0769 
0770 ProbeVariablesToStore = cms.PSet(
0771     probe_gsfEle_eta = cms.string("eta"),
0772     probe_gsfEle_pt  = cms.string("pt"),
0773     probe_gsfEle_phi  = cms.string("phi"),
0774     probe_gsfEle_et  = cms.string("et"),
0775     probe_gsfEle_e  = cms.string("energy"),
0776     probe_gsfEle_p  = cms.string("p"),
0777     probe_gsfEle_px  = cms.string("px"),
0778     probe_gsfEle_py  = cms.string("py"),
0779     probe_gsfEle_pz  = cms.string("pz"),
0780     probe_gsfEle_theta  = cms.string("theta"),    
0781     probe_gsfEle_charge = cms.string("charge"),
0782     probe_gsfEle_rapidity  = cms.string("rapidity"),
0783     probe_gsfEle_missingHits = cms.string("gsfTrack.hitPattern().numberOfLostHits(\'MISSING_INNER_HITS\')"),
0784     probe_gsfEle_convDist = cms.string("convDist"),
0785     probe_gsfEle_convDcot = cms.string("convDcot"),
0786     probe_gsfEle_convRadius = cms.string("convRadius"),        
0787     probe_gsfEle_hasValidHitInFirstPixelBarrel = cms.string("gsfTrack.hitPattern().hasValidHitInFirstPixelBarrel()"),
0788     ## super cluster quantities
0789     probe_sc_energy = cms.string("superCluster.energy"),
0790     probe_sc_et    = cms.string("superCluster.energy*sin(superClusterPosition.theta)"),    
0791     probe_sc_x      = cms.string("superCluster.x"),
0792     probe_sc_y      = cms.string("superCluster.y"),
0793     probe_sc_z      = cms.string("superCluster.z"),
0794     probe_sc_eta    = cms.string("superCluster.eta"),
0795     probe_sc_theta  = cms.string("superClusterPosition.theta"),   
0796     probe_sc_phi    = cms.string("superCluster.phi"),
0797     probe_sc_size   = cms.string("superCluster.size"), # number of hits
0798     ## track quantities
0799     probe_track_p      = cms.string("gsfTrack.p"),
0800     probe_track_pt     = cms.string("gsfTrack.pt"),    
0801     probe_track_px     = cms.string("gsfTrack.px"),
0802     probe_track_py     = cms.string("gsfTrack.py"),
0803     probe_track_pz     = cms.string("gsfTrack.pz"),
0804     probe_track_eta    = cms.string("gsfTrack.eta"),
0805     probe_track_theta  = cms.string("gsfTrack.theta"),   
0806     probe_track_phi    = cms.string("gsfTrack.phi"),
0807     probe_track_vx     = cms.string("gsfTrack.vx"),
0808     probe_track_vy     = cms.string("gsfTrack.vy"),
0809     probe_track_vz     = cms.string("gsfTrack.vz"),    
0810     probe_track_dxy    = cms.string("gsfTrack.dxy"),
0811     probe_track_d0     = cms.string("gsfTrack.d0"),
0812     probe_track_dsz    = cms.string("gsfTrack.dsz"),
0813     probe_track_charge = cms.string("gsfTrack.charge"),
0814     probe_track_qoverp = cms.string("gsfTrack.qoverp"),
0815     probe_track_normalizedChi2 = cms.string("gsfTrack.normalizedChi2"),
0816     ## isolation 
0817     probe_gsfEle_trackiso = cms.string("dr03TkSumPt"),
0818     probe_gsfEle_ecaliso  = cms.string("dr03EcalRecHitSumEt"),
0819     probe_gsfEle_hcaliso  = cms.string("dr03HcalTowerSumEt"),
0820     ## classification, location, etc.    
0821     probe_gsfEle_classification = cms.string("classification"),
0822     probe_gsfEle_numberOfBrems  = cms.string("numberOfBrems"),     
0823     probe_gsfEle_bremFraction   = cms.string("fbrem"),
0824     probe_gsfEle_mva            = cms.string("mva"),        
0825     probe_gsfEle_deltaEta       = cms.string("deltaEtaSuperClusterTrackAtVtx"),
0826     probe_gsfEle_deltaPhi       = cms.string("deltaPhiSuperClusterTrackAtVtx"),
0827     probe_gsfEle_deltaPhiOut    = cms.string("deltaPhiSeedClusterTrackAtCalo"),
0828     probe_gsfEle_deltaEtaOut    = cms.string("deltaEtaSeedClusterTrackAtCalo"),
0829     probe_gsfEle_isEB           = cms.string("isEB"),
0830     probe_gsfEle_isEE           = cms.string("isEE"),
0831     probe_gsfEle_isGap          = cms.string("isGap"),
0832     ## Hcal energy over Ecal Energy
0833     probe_gsfEle_HoverE         = cms.string("hcalOverEcal"),    
0834     probe_gsfEle_EoverP         = cms.string("eSuperClusterOverP"),
0835     probe_gsfEle_eSeedClusterOverP = cms.string("eSeedClusterOverP"),    
0836     ## Cluster shape information
0837     probe_gsfEle_sigmaEtaEta  = cms.string("sigmaEtaEta"),
0838     probe_gsfEle_sigmaIetaIeta = cms.string("sigmaIetaIeta"),
0839     probe_gsfEle_e1x5               = cms.string("e1x5"),
0840     probe_gsfEle_e2x5Max            = cms.string("e2x5Max"),
0841     probe_gsfEle_e5x5               = cms.string("e5x5"),
0842     ## is ECAL driven ? is Track driven ?
0843     probe_gsfEle_ecalDrivenSeed     = cms.string("ecalDrivenSeed"),
0844     probe_gsfEle_trackerDrivenSeed  = cms.string("trackerDrivenSeed")
0845 )
0846 
0847 
0848 TagVariablesToStore = cms.PSet(
0849     gsfEle_eta = cms.string("eta"),
0850     gsfEle_pt  = cms.string("pt"),
0851     gsfEle_phi  = cms.string("phi"),
0852     gsfEle_et  = cms.string("et"),
0853     gsfEle_e  = cms.string("energy"),
0854     gsfEle_p  = cms.string("p"),
0855     gsfEle_px  = cms.string("px"),
0856     gsfEle_py  = cms.string("py"),
0857     gsfEle_pz  = cms.string("pz"),
0858     gsfEle_theta  = cms.string("theta"),    
0859     gsfEle_charge = cms.string("charge"),
0860     gsfEle_rapidity  = cms.string("rapidity"),
0861     gsfEle_missingHits = cms.string("gsfTrack.hitPattern().numberOfLostHits(\'MISSING_INNER_HITS\')"),
0862     gsfEle_convDist = cms.string("convDist"),
0863     gsfEle_convDcot = cms.string("convDcot"),
0864     gsfEle_convRadius = cms.string("convRadius"),     
0865     gsfEle_hasValidHitInFirstPixelBarrel = cms.string("gsfTrack.hitPattern().hasValidHitInFirstPixelBarrel()"),
0866     ## super cluster quantities
0867     sc_energy = cms.string("superCluster.energy"),
0868     sc_et     = cms.string("superCluster.energy*sin(superClusterPosition.theta)"),    
0869     sc_x      = cms.string("superCluster.x"),
0870     sc_y      = cms.string("superCluster.y"),
0871     sc_z      = cms.string("superCluster.z"),
0872     sc_eta    = cms.string("superCluster.eta"),
0873     sc_theta  = cms.string("superClusterPosition.theta"),      
0874     sc_phi    = cms.string("superCluster.phi"),
0875     sc_size   = cms.string("superCluster.size"), # number of hits
0876     ## track quantities
0877     track_p      = cms.string("gsfTrack.p"),
0878     track_pt     = cms.string("gsfTrack.pt"),    
0879     track_px     = cms.string("gsfTrack.px"),
0880     track_py     = cms.string("gsfTrack.py"),
0881     track_pz     = cms.string("gsfTrack.pz"),
0882     track_eta    = cms.string("gsfTrack.eta"),
0883     track_theta  = cms.string("gsfTrack.theta"),   
0884     track_phi    = cms.string("gsfTrack.phi"),
0885     track_vx     = cms.string("gsfTrack.vx"),
0886     track_vy     = cms.string("gsfTrack.vy"),
0887     track_vz     = cms.string("gsfTrack.vz"),    
0888     track_dxy    = cms.string("gsfTrack.dxy"),
0889     track_d0     = cms.string("gsfTrack.d0"),
0890     track_dsz    = cms.string("gsfTrack.dsz"),
0891     track_charge = cms.string("gsfTrack.charge"),
0892     track_qoverp = cms.string("gsfTrack.qoverp"),
0893     track_normalizedChi2 = cms.string("gsfTrack.normalizedChi2"),    
0894     ## isolation 
0895     gsfEle_trackiso = cms.string("dr03TkSumPt"),
0896     gsfEle_ecaliso  = cms.string("dr03EcalRecHitSumEt"),
0897     gsfEle_hcaliso  = cms.string("dr03HcalTowerSumEt"),
0898     ## classification, location, etc.    
0899     gsfEle_classification = cms.string("classification"),
0900     gsfEle_numberOfBrems  = cms.string("numberOfBrems"),     
0901     gsfEle_bremFraction   = cms.string("fbrem"),
0902     gsfEle_mva            = cms.string("mva"),        
0903     gsfEle_deltaEta       = cms.string("deltaEtaSuperClusterTrackAtVtx"),
0904     gsfEle_deltaPhi       = cms.string("deltaPhiSuperClusterTrackAtVtx"),
0905     gsfEle_deltaPhiOut    = cms.string("deltaPhiSeedClusterTrackAtCalo"),
0906     gsfEle_deltaEtaOut    = cms.string("deltaEtaSeedClusterTrackAtCalo"),
0907     gsfEle_isEB           = cms.string("isEB"),
0908     gsfEle_isEE           = cms.string("isEE"),
0909     gsfEle_isGap          = cms.string("isGap"),
0910     ## Hcal energy over Ecal Energy
0911     gsfEle_HoverE         = cms.string("hcalOverEcal"),    
0912     gsfEle_EoverP         = cms.string("eSuperClusterOverP"),
0913     gsfEle_eSeedClusterOverP = cms.string("eSeedClusterOverP"),  
0914     ## Cluster shape information
0915     gsfEle_sigmaEtaEta  = cms.string("sigmaEtaEta"),
0916     gsfEle_sigmaIetaIeta = cms.string("sigmaIetaIeta"),
0917     gsfEle_e1x5               = cms.string("e1x5"),
0918     gsfEle_e2x5Max            = cms.string("e2x5Max"),
0919     gsfEle_e5x5               = cms.string("e5x5"),
0920     ## is ECAL driven ? is Track driven ?
0921     gsfEle_ecalDrivenSeed     = cms.string("ecalDrivenSeed"),
0922     gsfEle_trackerDrivenSeed  = cms.string("trackerDrivenSeed")
0923 )
0924 
0925 CommonStuffForGsfElectronProbe = cms.PSet(
0926     variables = cms.PSet(ProbeVariablesToStore),
0927     addRunLumiInfo   =  cms.bool (True),
0928     addEventVariablesInfo   =  cms.bool (True),
0929     pairVariables =  cms.PSet(ZVariablesToStore),
0930     pairFlags     =  cms.PSet(
0931           mass60to120 = cms.string("60 < mass < 120")
0932     ),
0933     tagVariables   =  cms.PSet(TagVariablesToStore),
0934     tagFlags     =  cms.PSet(
0935           passingGsf = cms.InputTag("goodElectrons"),
0936           isWP95 = cms.InputTag("PassingWP95"),
0937           isWP90 = cms.InputTag("PassingWP90"),
0938           isWP85 = cms.InputTag("PassingWP85"),          
0939           isWP80 = cms.InputTag("PassingWP80"),
0940           isWP70 = cms.InputTag("PassingWP70"),
0941           isWP60 = cms.InputTag("PassingWP60"),
0942           isCicVeryLoose = cms.InputTag("PassingCicVeryLoose"),
0943           isCicLoose = cms.InputTag("PassingCicLoose"),
0944           isCicMedium = cms.InputTag("PassingCicMedium"),
0945           isCicTight = cms.InputTag("PassingCicTight"),
0946           isCicSuperTight = cms.InputTag("PassingCicSuperTight"),          
0947           isCicHyperTight1 = cms.InputTag("PassingCicHyperTight1"),
0948           isCicHyperTight2 = cms.InputTag("PassingCicHyperTight2"),
0949           isCicHyperTight3 = cms.InputTag("PassingCicHyperTight3"),
0950           isCicHyperTight4 = cms.InputTag("PassingCicHyperTight4"),          
0951           passingHLT = cms.InputTag("PassingHLT")     
0952     ),    
0953 )
0954 
0955 CommonStuffForSuperClusterProbe = CommonStuffForGsfElectronProbe.clone()
0956 CommonStuffForSuperClusterProbe.variables = cms.PSet(
0957     probe_eta = cms.string("eta"),
0958     probe_pt  = cms.string("pt"),
0959     probe_phi  = cms.string("phi"),
0960     probe_et  = cms.string("et"),
0961     probe_e  = cms.string("energy"),
0962     probe_p  = cms.string("p"),
0963     probe_px  = cms.string("px"),
0964     probe_py  = cms.string("py"),
0965     probe_pz  = cms.string("pz"),
0966     probe_theta  = cms.string("theta"),
0967     )
0968 
0969 
0970 if MC_flag:
0971     mcTruthCommonStuff = cms.PSet(
0972         isMC = cms.bool(MC_flag),
0973         tagMatches = cms.InputTag("McMatchTag"),
0974         motherPdgId = cms.vint32(22,23),
0975         makeMCUnbiasTree = cms.bool(MC_flag),
0976         checkMotherInUnbiasEff = cms.bool(MC_flag),
0977         mcVariables = cms.PSet(
0978         probe_eta = cms.string("eta"),
0979         probe_pt  = cms.string("pt"),
0980         probe_phi  = cms.string("phi"),
0981         probe_et  = cms.string("et"),
0982         probe_e  = cms.string("energy"),
0983         probe_p  = cms.string("p"),
0984         probe_px  = cms.string("px"),
0985         probe_py  = cms.string("py"),
0986         probe_pz  = cms.string("pz"),
0987         probe_theta  = cms.string("theta"),    
0988         probe_vx     = cms.string("vx"),
0989         probe_vy     = cms.string("vy"),
0990         probe_vz     = cms.string("vz"),   
0991         probe_charge = cms.string("charge"),
0992         probe_rapidity  = cms.string("rapidity"),    
0993         probe_mass  = cms.string("mass"),
0994         probe_mt  = cms.string("mt"),    
0995         ),
0996         mcFlags     =  cms.PSet(
0997         probe_flag = cms.string("pt>0")
0998         ),      
0999         )
1000 else:
1001      mcTruthCommonStuff = cms.PSet(
1002          isMC = cms.bool(False)
1003          )
1004 
1005 
1006 ##    ____   ____       __     ____      __ 
1007 ##   / ___| / ___|      \ \   / ___|___ / _|
1008 ##   \___ \| |      _____\ \ | |  _/ __| |_ 
1009 ##    ___) | |___  |_____/ / | |_| \__ \  _|
1010 ##   |____/ \____|      /_/   \____|___/_|  
1011 ##
1012 ## super cluster --> gsf electron
1013 process.SuperClusterToGsfElectron = cms.EDAnalyzer("TagProbeFitTreeProducer",
1014     ## pick the defaults
1015     CommonStuffForSuperClusterProbe, mcTruthCommonStuff,
1016     # choice of tag and probe pairs, and arbitration                 
1017     tagProbePairs = cms.InputTag("tagSC"),
1018     arbitration   = cms.string("Random2"),                      
1019     flags = cms.PSet(
1020         probe_passingGsf = cms.InputTag("GsfMatchedSuperClusterCands"),        
1021         probe_isWP95 = cms.InputTag("WP95MatchedSuperClusterCandsClean"),
1022         probe_isWP90 = cms.InputTag("WP90MatchedSuperClusterCandsClean"),
1023         probe_isWP85 = cms.InputTag("WP85MatchedSuperClusterCandsClean"),        
1024         probe_isWP80 = cms.InputTag("WP80MatchedSuperClusterCandsClean"),
1025         probe_isWP70 = cms.InputTag("WP70MatchedSuperClusterCandsClean"),
1026         probe_isWP60 = cms.InputTag("WP60MatchedSuperClusterCandsClean"),
1027         probe_isCicVeryLoose = cms.InputTag("CicVeryLooseMatchedSuperClusterCandsClean"), 
1028         probe_isCicLoose = cms.InputTag("CicLooseMatchedSuperClusterCandsClean"), 
1029         probe_isCicMedium = cms.InputTag("CicMediumMatchedSuperClusterCandsClean"), 
1030         probe_isCicTight = cms.InputTag("CicTightMatchedSuperClusterCandsClean"), 
1031         probe_isCicSuperTight = cms.InputTag("CicSuperTightMatchedSuperClusterCandsClean"), 
1032         probe_isCicHyperTight1 = cms.InputTag("CicHyperTight1MatchedSuperClusterCandsClean"), 
1033         probe_isCicHyperTight2 = cms.InputTag("CicHyperTight2MatchedSuperClusterCandsClean"), 
1034         probe_isCicHyperTight3 = cms.InputTag("CicHyperTight3MatchedSuperClusterCandsClean"), 
1035         probe_isCicHyperTight4 = cms.InputTag("CicHyperTight4MatchedSuperClusterCandsClean"),        
1036         probe_passingHLT = cms.InputTag("TagMatchedSuperClusterCandsClean")
1037     ),
1038     probeMatches  = cms.InputTag("McMatchSC"),
1039     allProbes     = cms.InputTag("goodSuperClustersClean")
1040 )
1041 process.SuperClusterToGsfElectron.variables.probe_dRjet = cms.InputTag("superClusterDRToNearestJet")
1042 process.SuperClusterToGsfElectron.variables.probe_nJets = cms.InputTag("JetMultiplicityInSCEvents")
1043 process.SuperClusterToGsfElectron.variables.probe_dist = cms.InputTag("SCConvRejVars","dist")
1044 process.SuperClusterToGsfElectron.variables.probe_dcot = cms.InputTag("SCConvRejVars","dcot")
1045 process.SuperClusterToGsfElectron.variables.probe_convradius = cms.InputTag("SCConvRejVars","convradius")
1046 process.SuperClusterToGsfElectron.variables.probe_passConvRej = cms.InputTag("SCConvRejVars","passConvRej")
1047 process.SuperClusterToGsfElectron.tagVariables.dRjet = cms.InputTag("GsfDRToNearestJet")
1048 process.SuperClusterToGsfElectron.tagVariables.nJets = cms.InputTag("JetMultiplicityInGsfEvents")
1049 process.SuperClusterToGsfElectron.tagVariables.eidCicVeryLoose = cms.InputTag("eidVeryLoose")
1050 process.SuperClusterToGsfElectron.tagVariables.eidCicLoose = cms.InputTag("eidLoose")
1051 process.SuperClusterToGsfElectron.tagVariables.eidCicMedium = cms.InputTag("eidMedium")
1052 process.SuperClusterToGsfElectron.tagVariables.eidCicTight = cms.InputTag("eidTight")
1053 process.SuperClusterToGsfElectron.tagVariables.eidCicSuperTight = cms.InputTag("eidSuperTight")
1054 process.SuperClusterToGsfElectron.tagVariables.eidCicHyperTight1 = cms.InputTag("eidHyperTight1")
1055 process.SuperClusterToGsfElectron.tagVariables.eidCicHyperTight2 = cms.InputTag("eidHyperTight2")
1056 process.SuperClusterToGsfElectron.tagVariables.eidCicHyperTight3 = cms.InputTag("eidHyperTight3")
1057 process.SuperClusterToGsfElectron.tagVariables.eidCicHyperTight4 = cms.InputTag("eidHyperTight4")
1058 process.SuperClusterToGsfElectron.tagVariables.eidLikelihood = cms.InputTag("eidLikelihoodExt")
1059 process.SuperClusterToGsfElectron.tagVariables.dist = cms.InputTag("GsfConvRejVars","dist")
1060 process.SuperClusterToGsfElectron.tagVariables.dcot = cms.InputTag("GsfConvRejVars","dcot")
1061 process.SuperClusterToGsfElectron.tagVariables.convradius = cms.InputTag("GsfConvRejVars","convradius")
1062 process.SuperClusterToGsfElectron.tagVariables.passConvRej = cms.InputTag("GsfConvRejVars","passConvRej")
1063 
1064 
1065 
1066 ## good photon --> gsf electron
1067 process.PhotonToGsfElectron = process.SuperClusterToGsfElectron.clone()
1068 process.PhotonToGsfElectron.tagProbePairs = cms.InputTag("tagPhoton")
1069 process.PhotonToGsfElectron.flags = cms.PSet(
1070     probe_passingGsf = cms.InputTag("GsfMatchedPhotonCands"),
1071     probe_passingHLT = cms.InputTag("TagMatchedPhotonCands"),
1072     probe_isWP95 = cms.InputTag("WP95MatchedPhotonCands"),
1073     probe_isWP90 = cms.InputTag("WP90MatchedPhotonCands"),
1074     probe_isWP85 = cms.InputTag("WP85MatchedPhotonCands"),        
1075     probe_isWP80 = cms.InputTag("WP80MatchedPhotonCands"),
1076     probe_isWP70 = cms.InputTag("WP70MatchedPhotonCands"),
1077     probe_isWP60 = cms.InputTag("WP60MatchedPhotonCands"),
1078     probe_isCicVeryLoose = cms.InputTag("CicVeryLooseMatchedPhotonCands"), 
1079     probe_isCicLoose = cms.InputTag("CicLooseMatchedPhotonCands"), 
1080     probe_isCicMedium = cms.InputTag("CicMediumMatchedPhotonCands"), 
1081     probe_isCicTight = cms.InputTag("CicTightMatchedPhotonCands"), 
1082     probe_isCicSuperTight = cms.InputTag("CicSuperTightMatchedPhotonCands"), 
1083     probe_isCicHyperTight1 = cms.InputTag("CicHyperTight1MatchedPhotonCands"), 
1084     probe_isCicHyperTight2 = cms.InputTag("CicHyperTight2MatchedPhotonCands"), 
1085     probe_isCicHyperTight3 = cms.InputTag("CicHyperTight3MatchedPhotonCands"), 
1086     probe_isCicHyperTight4 = cms.InputTag("CicHyperTight4MatchedPhotonCands")        
1087     )
1088 process.PhotonToGsfElectron.probeMatches  = cms.InputTag("McMatchPhoton")
1089 process.PhotonToGsfElectron.allProbes     = cms.InputTag("goodPhotons")
1090 process.PhotonToGsfElectron.variables.probe_dRjet = cms.InputTag("PhotonDRToNearestJet")
1091 process.PhotonToGsfElectron.variables.probe_nJets = cms.InputTag("JetMultiplicityInPhotonEvents")
1092 process.PhotonToGsfElectron.variables.probe_trackiso = cms.string("trkSumPtHollowConeDR03")
1093 process.PhotonToGsfElectron.variables.probe_ecaliso = cms.string("ecalRecHitSumEtConeDR03")
1094 process.PhotonToGsfElectron.variables.probe_hcaliso = cms.string("hcalTowerSumEtConeDR03")
1095 process.PhotonToGsfElectron.variables.probe_HoverE  = cms.string("hadronicOverEm")
1096 process.PhotonToGsfElectron.variables.probe_sigmaIetaIeta = cms.string("sigmaIetaIeta")
1097 process.PhotonToGsfElectron.variables.probe_dist = cms.InputTag("PhotonConvRejVars","dist")
1098 process.PhotonToGsfElectron.variables.probe_dcot = cms.InputTag("PhotonConvRejVars","dcot")
1099 process.PhotonToGsfElectron.variables.probe_convradius = cms.InputTag("PhotonConvRejVars","convradius")
1100 process.PhotonToGsfElectron.variables.probe_passConvRej = cms.InputTag("PhotonConvRejVars","passConvRej")
1101 process.PhotonToGsfElectron.tagVariables.dRjet = cms.InputTag("GsfDRToNearestJet")
1102 process.PhotonToGsfElectron.tagVariables.nJets = cms.InputTag("JetMultiplicityInGsfEvents")
1103 process.PhotonToGsfElectron.tagVariables.eidCicVeryLoose = cms.InputTag("eidVeryLoose")
1104 process.PhotonToGsfElectron.tagVariables.eidCicLoose = cms.InputTag("eidLoose")
1105 process.PhotonToGsfElectron.tagVariables.eidCicMedium = cms.InputTag("eidMedium")
1106 process.PhotonToGsfElectron.tagVariables.eidCicTight = cms.InputTag("eidTight")
1107 process.PhotonToGsfElectron.tagVariables.eidCicSuperTight = cms.InputTag("eidSuperTight")
1108 process.PhotonToGsfElectron.tagVariables.eidCicHyperTight1 = cms.InputTag("eidHyperTight1")
1109 process.PhotonToGsfElectron.tagVariables.eidCicHyperTight2 = cms.InputTag("eidHyperTight2")
1110 process.PhotonToGsfElectron.tagVariables.eidCicHyperTight3 = cms.InputTag("eidHyperTight3")
1111 process.PhotonToGsfElectron.tagVariables.eidCicHyperTight4 = cms.InputTag("eidHyperTight4")
1112 process.PhotonToGsfElectron.tagVariables.eidLikelihood = cms.InputTag("eidLikelihoodExt")
1113 process.PhotonToGsfElectron.tagVariables.dist = cms.InputTag("GsfConvRejVars","dist")
1114 process.PhotonToGsfElectron.tagVariables.dcot = cms.InputTag("GsfConvRejVars","dcot")
1115 process.PhotonToGsfElectron.tagVariables.convradius = cms.InputTag("GsfConvRejVars","convradius")
1116 process.PhotonToGsfElectron.tagVariables.passConvRej = cms.InputTag("GsfConvRejVars","passConvRej")
1117 
1118 ##   ____      __       __    ___                 ___    _ 
1119 ##  / ___|___ / _|      \ \  |_ _|___  ___       |_ _|__| |
1120 ## | |  _/ __| |_   _____\ \  | |/ __|/ _ \       | |/ _` |
1121 ## | |_| \__ \  _| |_____/ /  | |\__ \ (_) |  _   | | (_| |
1122 ##  \____|___/_|        /_/  |___|___/\___/  ( ) |___\__,_|
1123 ##                                           |/            
1124 ##  gsf electron --> isolation, electron id  etc.
1125 process.GsfElectronToId = cms.EDAnalyzer("TagProbeFitTreeProducer",
1126     mcTruthCommonStuff, CommonStuffForGsfElectronProbe,                        
1127     tagProbePairs = cms.InputTag("tagGsf"),
1128     arbitration   = cms.string("Random2"),
1129     flags = cms.PSet(
1130         probe_isWP95 = cms.InputTag("PassingWP95"),
1131         probe_isWP90 = cms.InputTag("PassingWP90"),
1132         probe_isWP85 = cms.InputTag("PassingWP85"),        
1133         probe_isWP80 = cms.InputTag("PassingWP80"),
1134         probe_isWP70 = cms.InputTag("PassingWP70"),
1135         probe_isWP60 = cms.InputTag("PassingWP60"),
1136         probe_isCicVeryLoose = cms.InputTag("PassingCicVeryLoose"),
1137         probe_isCicLoose = cms.InputTag("PassingCicLoose"),
1138         probe_isCicMedium = cms.InputTag("PassingCicMedium"),
1139         probe_isCicTight = cms.InputTag("PassingCicTight"),
1140         probe_isCicSuperTight = cms.InputTag("PassingCicSuperTight"),          
1141         probe_isCicHyperTight1 = cms.InputTag("PassingCicHyperTight1"),
1142         probe_isCicHyperTight2 = cms.InputTag("PassingCicHyperTight2"),
1143         probe_isCicHyperTight3 = cms.InputTag("PassingCicHyperTight3"),
1144         probe_isCicHyperTight4 = cms.InputTag("PassingCicHyperTight4"),   
1145         probe_passingHLT = cms.InputTag("PassingHLT")        
1146     ),
1147     probeMatches  = cms.InputTag("McMatchGsf"),
1148     allProbes     = cms.InputTag("goodElectrons")
1149 )
1150 process.GsfElectronToId.variables.probe_dRjet = cms.InputTag("GsfDRToNearestJet")
1151 process.GsfElectronToId.variables.probe_nJets = cms.InputTag("JetMultiplicityInGsfEvents")
1152 process.GsfElectronToId.variables.probe_eidCicVeryLoose = cms.InputTag("eidVeryLoose")
1153 process.GsfElectronToId.variables.probe_eidCicLoose = cms.InputTag("eidLoose")
1154 process.GsfElectronToId.variables.probe_eidCicMedium = cms.InputTag("eidMedium")
1155 process.GsfElectronToId.variables.probe_eidCicTight = cms.InputTag("eidTight")
1156 process.GsfElectronToId.variables.probe_eidCicSuperTight = cms.InputTag("eidSuperTight")
1157 process.GsfElectronToId.variables.probe_eidCicHyperTight1 = cms.InputTag("eidHyperTight1")
1158 process.GsfElectronToId.variables.probe_eidCicHyperTight2 = cms.InputTag("eidHyperTight2")
1159 process.GsfElectronToId.variables.probe_eidCicHyperTight3 = cms.InputTag("eidHyperTight3")
1160 process.GsfElectronToId.variables.probe_eidCicHyperTight4 = cms.InputTag("eidHyperTight4")
1161 process.GsfElectronToId.variables.probe_eidLikelihood = cms.InputTag("eidLikelihoodExt")
1162 process.GsfElectronToId.variables.probe_dist = cms.InputTag("GsfConvRejVars","dist")
1163 process.GsfElectronToId.variables.probe_dcot = cms.InputTag("GsfConvRejVars","dcot")
1164 process.GsfElectronToId.variables.probe_convradius = cms.InputTag("GsfConvRejVars","convradius")
1165 process.GsfElectronToId.variables.probe_passConvRej = cms.InputTag("GsfConvRejVars","passConvRej")
1166 process.GsfElectronToId.tagVariables.dRjet = cms.InputTag("GsfDRToNearestJet")
1167 process.GsfElectronToId.tagVariables.nJets = cms.InputTag("JetMultiplicityInGsfEvents")
1168 process.GsfElectronToId.tagVariables.eidCicVeryLoose = cms.InputTag("eidVeryLoose")
1169 process.GsfElectronToId.tagVariables.eidCicLoose = cms.InputTag("eidLoose")
1170 process.GsfElectronToId.tagVariables.eidCicMedium = cms.InputTag("eidMedium")
1171 process.GsfElectronToId.tagVariables.eidCicTight = cms.InputTag("eidTight")
1172 process.GsfElectronToId.tagVariables.eidCicSuperTight = cms.InputTag("eidSuperTight")
1173 process.GsfElectronToId.tagVariables.eidCicHyperTight1 = cms.InputTag("eidHyperTight1")
1174 process.GsfElectronToId.tagVariables.eidCicHyperTight2 = cms.InputTag("eidHyperTight2")
1175 process.GsfElectronToId.tagVariables.eidCicHyperTight3 = cms.InputTag("eidHyperTight3")
1176 process.GsfElectronToId.tagVariables.eidCicHyperTight4 = cms.InputTag("eidHyperTight4")
1177 process.GsfElectronToId.tagVariables.eidLikelihood = cms.InputTag("eidLikelihoodExt")
1178 process.GsfElectronToId.tagVariables.dist = cms.InputTag("GsfConvRejVars","dist")
1179 process.GsfElectronToId.tagVariables.dcot = cms.InputTag("GsfConvRejVars","dcot")
1180 process.GsfElectronToId.tagVariables.convradius = cms.InputTag("GsfConvRejVars","convradius")
1181 process.GsfElectronToId.tagVariables.passConvRej = cms.InputTag("GsfConvRejVars","passConvRej")
1182 process.GsfElectronToId.pairVariables.costheta = cms.InputTag("CSVarsTagGsf","costheta")
1183 process.GsfElectronToId.pairVariables.sin2theta = cms.InputTag("CSVarsTagGsf","sin2theta")
1184 process.GsfElectronToId.pairVariables.tanphi = cms.InputTag("CSVarsTagGsf","tanphi")
1185 
1186 
1187 process.GsfElectronPlusGsfElectron = process.GsfElectronToId.clone()
1188 process.GsfElectronPlusGsfElectron.tagProbePairs = cms.InputTag("GsfGsf")
1189 process.GsfElectronPlusGsfElectron.tagMatches = cms.InputTag("McMatchGsf")
1190 process.GsfElectronPlusGsfElectron.pairVariables.costheta = cms.InputTag("CSVarsGsfGsf","costheta")
1191 process.GsfElectronPlusGsfElectron.pairVariables.sin2theta = cms.InputTag("CSVarsGsfGsf","sin2theta")
1192 process.GsfElectronPlusGsfElectron.pairVariables.tanphi = cms.InputTag("CSVarsGsfGsf","tanphi")
1193 if MC_flag:
1194     process.GsfElectronPlusGsfElectron.PUWeightSrc = cms.InputTag("pileupReweightingProducer","pileupWeights")
1195 
1196 
1197 process.GsfElectronPlusMet = process.GsfElectronToId.clone()
1198 process.GsfElectronPlusMet.tagProbePairs = cms.InputTag("elecMet")
1199 process.GsfElectronPlusMet.tagVariables = cms.PSet()
1200 process.GsfElectronPlusMet.pairVariables =  cms.PSet(ZVariablesToStore)
1201 process.GsfElectronPlusMet.pairFlags =  cms.PSet( isMTabove40 = cms.string("mt > 40") )
1202 process.GsfElectronPlusMet.isMC = cms.bool(False)
1203 
1204 
1205 ##    ___    _       __    _   _ _   _____ 
1206 ##   |_ _|__| |      \ \  | | | | | |_   _|
1207 ##    | |/ _` |  _____\ \ | |_| | |   | |  
1208 ##    | | (_| | |_____/ / |  _  | |___| |  
1209 ##   |___\__,_|      /_/  |_| |_|_____|_|
1210 ##
1211 ##  offline selection --> HLT. First specify which quantities to store in the TP tree. 
1212 if MC_flag:
1213     HLTmcTruthCommonStuff = cms.PSet(
1214         isMC = cms.bool(MC_flag),
1215         tagMatches = cms.InputTag("McMatchTag"),
1216         motherPdgId = cms.vint32(22,23),
1217         makeMCUnbiasTree = cms.bool(MC_flag),
1218         checkMotherInUnbiasEff = cms.bool(MC_flag),
1219         mcVariables = cms.PSet(
1220           probe_eta = cms.string("eta"),
1221           probe_phi  = cms.string("phi"),
1222           probe_et  = cms.string("et"),
1223           probe_charge = cms.string("charge"),
1224         ),
1225         mcFlags     =  cms.PSet(
1226           probe_flag = cms.string("pt>0")
1227         ),      
1228         )
1229 else:
1230      HLTmcTruthCommonStuff = cms.PSet(
1231          isMC = cms.bool(False)
1232          )
1233 
1234 ##  WP95 --> HLT
1235 process.WP95ToHLT = cms.EDAnalyzer("TagProbeFitTreeProducer",
1236     HLTmcTruthCommonStuff,                                
1237     variables = cms.PSet(
1238       probe_gsfEle_eta = cms.string("eta"),
1239       probe_gsfEle_phi  = cms.string("phi"),
1240       probe_gsfEle_et  = cms.string("et"),
1241       probe_gsfEle_charge = cms.string("charge"),
1242       probe_sc_et    = cms.string("superCluster.energy*sin(superClusterPosition.theta)"),    
1243       probe_sc_eta    = cms.string("superCluster.eta"), 
1244       probe_sc_phi    = cms.string("superCluster.phi"),
1245       probe_gsfEle_isEB           = cms.string("isEB"),
1246       probe_gsfEle_isEE           = cms.string("isEE"),
1247       probe_gsfEle_isGap          = cms.string("isGap"),
1248     ),
1249     addRunLumiInfo   =  cms.bool (False),
1250     addEventVariablesInfo   =  cms.bool (False),                                                        
1251     tagProbePairs = cms.InputTag("tagWP95"),
1252     arbitration   = cms.string("Random2"),
1253     flags = cms.PSet( 
1254         probe_passingHLT = cms.InputTag("PassingHLT")        
1255     ),
1256     probeMatches  = cms.InputTag("McMatchWP95"),
1257     allProbes     = cms.InputTag("PassingWP95")
1258 )
1259 if MC_flag:
1260     process.WP95ToHLT.PUWeightSrc = cms.InputTag("pileupReweightingProducer","pileupWeights")
1261 
1262 
1263 ##  WP90 --> HLT
1264 process.WP90ToHLT = process.WP95ToHLT.clone()
1265 process.WP90ToHLT.tagProbePairs = cms.InputTag("tagWP90")
1266 process.WP90ToHLT.probeMatches  = cms.InputTag("McMatchWP90")
1267 process.WP90ToHLT.allProbes     = cms.InputTag("PassingWP90")
1268 
1269 ##  WP85 --> HLT
1270 process.WP85ToHLT = process.WP95ToHLT.clone()
1271 process.WP85ToHLT.tagProbePairs = cms.InputTag("tagWP85")
1272 process.WP85ToHLT.probeMatches  = cms.InputTag("McMatchWP85")
1273 process.WP85ToHLT.allProbes     = cms.InputTag("PassingWP85")
1274 
1275 ##  WP80 --> HLT
1276 process.WP80ToHLT = process.WP95ToHLT.clone()
1277 process.WP80ToHLT.tagProbePairs = cms.InputTag("tagWP80")
1278 process.WP80ToHLT.probeMatches  = cms.InputTag("McMatchWP80")
1279 process.WP80ToHLT.allProbes     = cms.InputTag("PassingWP80")
1280 
1281 ##  WP70 --> HLT
1282 process.WP70ToHLT = process.WP95ToHLT.clone()
1283 process.WP70ToHLT.tagProbePairs = cms.InputTag("tagWP70")
1284 process.WP70ToHLT.probeMatches  = cms.InputTag("McMatchWP70")
1285 process.WP70ToHLT.allProbes     = cms.InputTag("PassingWP70")
1286 
1287 ##  WP60 --> HLT
1288 process.WP60ToHLT = process.WP95ToHLT.clone()
1289 process.WP60ToHLT.tagProbePairs = cms.InputTag("tagWP60")
1290 process.WP60ToHLT.probeMatches  = cms.InputTag("McMatchWP60")
1291 process.WP60ToHLT.allProbes     = cms.InputTag("PassingWP60")
1292 
1293 ##  CicVeryLoose --> HLT
1294 process.CicVeryLooseToHLT = process.WP95ToHLT.clone()
1295 process.CicVeryLooseToHLT.tagProbePairs = cms.InputTag("tagCicVeryLoose")
1296 process.CicVeryLooseToHLT.probeMatches  = cms.InputTag("McMatchCicVeryLoose")
1297 process.CicVeryLooseToHLT.allProbes     = cms.InputTag("PassingCicVeryLoose")
1298 
1299 ##  CicLoose --> HLT
1300 process.CicLooseToHLT = process.WP95ToHLT.clone()
1301 process.CicLooseToHLT.tagProbePairs = cms.InputTag("tagCicLoose")
1302 process.CicLooseToHLT.probeMatches  = cms.InputTag("McMatchCicLoose")
1303 process.CicLooseToHLT.allProbes     = cms.InputTag("PassingCicLoose")
1304 
1305 ##  CicMedium --> HLT
1306 process.CicMediumToHLT = process.WP95ToHLT.clone()
1307 process.CicMediumToHLT.tagProbePairs = cms.InputTag("tagCicMedium")
1308 process.CicMediumToHLT.probeMatches  = cms.InputTag("McMatchCicMedium")
1309 process.CicMediumToHLT.allProbes     = cms.InputTag("PassingCicMedium")
1310 
1311 ##  CicTight --> HLT
1312 process.CicTightToHLT = process.WP95ToHLT.clone()
1313 process.CicTightToHLT.tagProbePairs = cms.InputTag("tagCicTight")
1314 process.CicTightToHLT.probeMatches  = cms.InputTag("McMatchCicTight")
1315 process.CicTightToHLT.allProbes     = cms.InputTag("PassingCicTight")
1316 
1317 ##  CicSuperTight --> HLT
1318 process.CicSuperTightToHLT = process.WP95ToHLT.clone()
1319 process.CicSuperTightToHLT.tagProbePairs = cms.InputTag("tagCicSuperTight")
1320 process.CicSuperTightToHLT.probeMatches  = cms.InputTag("McMatchCicSuperTight")
1321 process.CicSuperTightToHLT.allProbes     = cms.InputTag("PassingCicSuperTight")
1322 
1323 ##  CicHyperTight1 --> HLT
1324 process.CicHyperTight1ToHLT = process.WP95ToHLT.clone()
1325 process.CicHyperTight1ToHLT.tagProbePairs = cms.InputTag("tagCicHyperTight1")
1326 process.CicHyperTight1ToHLT.probeMatches  = cms.InputTag("McMatchCicHyperTight1")
1327 process.CicHyperTight1ToHLT.allProbes     = cms.InputTag("PassingCicHyperTight1")
1328 
1329 ##  CicHyperTight2 --> HLT
1330 process.CicHyperTight2ToHLT = process.WP95ToHLT.clone()
1331 process.CicHyperTight2ToHLT.tagProbePairs = cms.InputTag("tagCicHyperTight2")
1332 process.CicHyperTight2ToHLT.probeMatches  = cms.InputTag("McMatchCicHyperTight2")
1333 process.CicHyperTight2ToHLT.allProbes     = cms.InputTag("PassingCicHyperTight2")
1334 
1335 ##  CicHyperTight3 --> HLT
1336 process.CicHyperTight3ToHLT = process.WP95ToHLT.clone()
1337 process.CicHyperTight3ToHLT.tagProbePairs = cms.InputTag("tagCicHyperTight3")
1338 process.CicHyperTight3ToHLT.probeMatches  = cms.InputTag("McMatchCicHyperTight3")
1339 process.CicHyperTight3ToHLT.allProbes     = cms.InputTag("PassingCicHyperTight3")
1340 
1341 ##  CicHyperTight4 --> HLT
1342 process.CicHyperTight4ToHLT = process.WP95ToHLT.clone()
1343 process.CicHyperTight4ToHLT.tagProbePairs = cms.InputTag("tagCicHyperTight4")
1344 process.CicHyperTight4ToHLT.probeMatches  = cms.InputTag("McMatchCicHyperTight4")
1345 process.CicHyperTight4ToHLT.allProbes     = cms.InputTag("PassingCicHyperTight4")
1346 
1347 
1348 process.tree_sequence = cms.Sequence(
1349     process.SuperClusterToGsfElectron +
1350     process.PhotonToGsfElectron +
1351     process.GsfElectronToId +
1352     process.GsfElectronPlusGsfElectron +
1353     process.GsfElectronPlusMet + 
1354     process.WP95ToHLT +
1355     process.WP90ToHLT +
1356     process.WP85ToHLT + 
1357     process.WP80ToHLT +
1358     process.WP70ToHLT + 
1359     process.WP60ToHLT +
1360     process.CicVeryLooseToHLT +
1361     process.CicLooseToHLT +
1362     process.CicMediumToHLT +
1363     process.CicTightToHLT +
1364     process.CicSuperTightToHLT +
1365     process.CicHyperTight1ToHLT +
1366     process.CicHyperTight2ToHLT +
1367     process.CicHyperTight3ToHLT +
1368     process.CicHyperTight4ToHLT        
1369 )    
1370 
1371 ##    ____       _   _     
1372 ##   |  _ \ __ _| |_| |__  
1373 ##   | |_) / _` | __| '_ \ 
1374 ##   |  __/ (_| | |_| | | |
1375 ##   |_|   \__,_|\__|_| |_|
1376 ##
1377 
1378 if MC_flag:
1379     process.tagAndProbe = cms.Path(
1380         process.sc_sequence + process.eIDSequence + process.ele_sequence + 
1381         process.ext_ToNearestJet_sequence + 
1382         process.allTagsAndProbes + process.pileupReweightingProducer + 
1383         process.mc_sequence + 
1384         process.tree_sequence
1385         )
1386 else:
1387     process.tagAndProbe = cms.Path(
1388         process.sc_sequence + process.eIDSequence + process.ele_sequence + 
1389         process.ext_ToNearestJet_sequence + 
1390         process.allTagsAndProbes +
1391         process.tree_sequence
1392         )
1393     
1394 process.TFileService = cms.Service(
1395     "TFileService", fileName = cms.string( OUTPUT_FILE_NAME )
1396     )