Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 13:33:23

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.Geometry_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 ## process.load("JetMETCorrections.Configuration.DefaultJEC_cff")
0393 ## ak5PFResidual.useCondDB = False
0394 
0395 process.superClusterDRToNearestJet = cms.EDProducer("DeltaRNearestJetComputer",
0396     probes = cms.InputTag("goodSuperClusters"),
0397        # ^^--- NOTA BENE: if probes are defined by ref, as in this case, 
0398        #       this must be the full collection, not the subset by refs.
0399     objects = cms.InputTag(JET_COLL),
0400     objectSelection = cms.string(JET_CUTS + " && pt > 20.0"),
0401 )
0402 process.JetMultiplicityInSCEvents = cms.EDProducer("CandMultiplicityCounter",
0403     probes = cms.InputTag("goodSuperClusters"),
0404     objects = cms.InputTag(JET_COLL),
0405     objectSelection = cms.string(JET_CUTS + " && pt > 20.0"),
0406 )
0407 process.SCConvRejVars = cms.EDProducer("ElectronConversionRejectionVars",
0408     probes = cms.InputTag("goodSuperClusters")
0409 )
0410 process.GsfConvRejVars = process.SCConvRejVars.clone()
0411 process.GsfConvRejVars.probes = cms.InputTag( ELECTRON_COLL )
0412 process.PhotonDRToNearestJet = process.superClusterDRToNearestJet.clone()
0413 process.PhotonDRToNearestJet.probes =cms.InputTag("goodPhotons")
0414 process.JetMultiplicityInPhotonEvents = process.JetMultiplicityInSCEvents.clone()
0415 process.JetMultiplicityInPhotonEvents.probes = cms.InputTag("goodPhotons")
0416 process.PhotonConvRejVars = process.SCConvRejVars.clone()
0417 process.PhotonConvRejVars.probes = cms.InputTag("goodPhotons")
0418 
0419 process.GsfDRToNearestJet = process.superClusterDRToNearestJet.clone()
0420 process.GsfDRToNearestJet.probes = cms.InputTag( ELECTRON_COLL )
0421 process.JetMultiplicityInGsfEvents = process.JetMultiplicityInSCEvents.clone()
0422 process.JetMultiplicityInGsfEvents.probes = cms.InputTag( ELECTRON_COLL )
0423 
0424 process.ext_ToNearestJet_sequence = cms.Sequence(
0425     #process.ak5PFResidual + 
0426     process.superClusterDRToNearestJet +
0427     process.JetMultiplicityInSCEvents +
0428     process.SCConvRejVars +
0429     process.PhotonDRToNearestJet +
0430     process.JetMultiplicityInPhotonEvents +    
0431     process.PhotonConvRejVars + 
0432     process.GsfDRToNearestJet +
0433     process.JetMultiplicityInGsfEvents +
0434     process.GsfConvRejVars
0435     )
0436 
0437 
0438 ##    _____             ____        __ _       _ _   _             
0439 ##   |_   _|_ _  __ _  |  _ \  ___ / _(_)_ __ (_) |_(_) ___  _ __  
0440 ##     | |/ _` |/ _` | | | | |/ _ \ |_| | '_ \| | __| |/ _ \| '_ \ 
0441 ##     | | (_| | (_| | | |_| |  __/  _| | | | | | |_| | (_) | | | |
0442 ##     |_|\__,_|\__, | |____/ \___|_| |_|_| |_|_|\__|_|\___/|_| |_|
0443 ##              |___/
0444 ## 
0445 process.Tag = process.PassingHLT.clone()
0446 process.Tag.InputProducer = cms.InputTag( "PassingWP80" )
0447 process.TagMatchedSuperClusterCandsClean = cms.EDProducer("ElectronMatchedCandidateProducer",
0448    src     = cms.InputTag("goodSuperClustersClean"),
0449    ReferenceElectronCollection = cms.untracked.InputTag("Tag"),
0450    deltaR =  cms.untracked.double(0.3)
0451 )
0452 process.TagMatchedPhotonCands = process.TagMatchedSuperClusterCandsClean.clone()
0453 process.TagMatchedPhotonCands.src     = cms.InputTag("goodPhotons")
0454 process.WP95MatchedSuperClusterCandsClean = process.TagMatchedSuperClusterCandsClean.clone()
0455 process.WP95MatchedSuperClusterCandsClean.ReferenceElectronCollection = cms.untracked.InputTag("PassingWP95")
0456 process.WP90MatchedSuperClusterCandsClean = process.TagMatchedSuperClusterCandsClean.clone()
0457 process.WP90MatchedSuperClusterCandsClean.ReferenceElectronCollection = cms.untracked.InputTag("PassingWP90")
0458 process.WP85MatchedSuperClusterCandsClean = process.TagMatchedSuperClusterCandsClean.clone()
0459 process.WP85MatchedSuperClusterCandsClean.ReferenceElectronCollection = cms.untracked.InputTag("PassingWP85")
0460 process.WP80MatchedSuperClusterCandsClean = process.TagMatchedSuperClusterCandsClean.clone()
0461 process.WP80MatchedSuperClusterCandsClean.ReferenceElectronCollection = cms.untracked.InputTag("PassingWP80")
0462 process.WP70MatchedSuperClusterCandsClean = process.TagMatchedSuperClusterCandsClean.clone()
0463 process.WP70MatchedSuperClusterCandsClean.ReferenceElectronCollection = cms.untracked.InputTag("PassingWP70")
0464 process.WP60MatchedSuperClusterCandsClean = process.TagMatchedSuperClusterCandsClean.clone()
0465 process.WP60MatchedSuperClusterCandsClean.ReferenceElectronCollection = cms.untracked.InputTag("PassingWP60")
0466 process.CicVeryLooseMatchedSuperClusterCandsClean = process.TagMatchedSuperClusterCandsClean.clone()
0467 process.CicVeryLooseMatchedSuperClusterCandsClean.ReferenceElectronCollection = cms.untracked.InputTag("PassingCicVeryLoose")
0468 process.CicLooseMatchedSuperClusterCandsClean = process.TagMatchedSuperClusterCandsClean.clone()
0469 process.CicLooseMatchedSuperClusterCandsClean.ReferenceElectronCollection = cms.untracked.InputTag("PassingCicLoose")
0470 process.CicMediumMatchedSuperClusterCandsClean = process.TagMatchedSuperClusterCandsClean.clone()
0471 process.CicMediumMatchedSuperClusterCandsClean.ReferenceElectronCollection = cms.untracked.InputTag("PassingCicMedium")
0472 process.CicTightMatchedSuperClusterCandsClean = process.TagMatchedSuperClusterCandsClean.clone()
0473 process.CicTightMatchedSuperClusterCandsClean.ReferenceElectronCollection = cms.untracked.InputTag("PassingCicTight")
0474 process.CicSuperTightMatchedSuperClusterCandsClean = process.TagMatchedSuperClusterCandsClean.clone()
0475 process.CicSuperTightMatchedSuperClusterCandsClean.ReferenceElectronCollection = cms.untracked.InputTag("PassingCicSuperTight")
0476 process.CicHyperTight1MatchedSuperClusterCandsClean = process.TagMatchedSuperClusterCandsClean.clone()
0477 process.CicHyperTight1MatchedSuperClusterCandsClean.ReferenceElectronCollection = cms.untracked.InputTag("PassingCicHyperTight1")
0478 process.CicHyperTight2MatchedSuperClusterCandsClean = process.TagMatchedSuperClusterCandsClean.clone()
0479 process.CicHyperTight2MatchedSuperClusterCandsClean.ReferenceElectronCollection = cms.untracked.InputTag("PassingCicHyperTight2")
0480 process.CicHyperTight3MatchedSuperClusterCandsClean = process.TagMatchedSuperClusterCandsClean.clone()
0481 process.CicHyperTight3MatchedSuperClusterCandsClean.ReferenceElectronCollection = cms.untracked.InputTag("PassingCicHyperTight3")
0482 process.CicHyperTight4MatchedSuperClusterCandsClean = process.TagMatchedSuperClusterCandsClean.clone()
0483 process.CicHyperTight4MatchedSuperClusterCandsClean.ReferenceElectronCollection = cms.untracked.InputTag("PassingCicHyperTight4")
0484 
0485 
0486 process.WP95MatchedPhotonCands = process.GsfMatchedPhotonCands.clone()
0487 process.WP95MatchedPhotonCands.ReferenceElectronCollection = cms.untracked.InputTag("PassingWP95")
0488 process.WP90MatchedPhotonCands = process.GsfMatchedPhotonCands.clone()
0489 process.WP90MatchedPhotonCands.ReferenceElectronCollection = cms.untracked.InputTag("PassingWP90")
0490 process.WP85MatchedPhotonCands = process.GsfMatchedPhotonCands.clone()
0491 process.WP85MatchedPhotonCands.ReferenceElectronCollection = cms.untracked.InputTag("PassingWP85")
0492 process.WP80MatchedPhotonCands = process.GsfMatchedPhotonCands.clone()
0493 process.WP80MatchedPhotonCands.ReferenceElectronCollection = cms.untracked.InputTag("PassingWP80")
0494 process.WP70MatchedPhotonCands = process.GsfMatchedPhotonCands.clone()
0495 process.WP70MatchedPhotonCands.ReferenceElectronCollection = cms.untracked.InputTag("PassingWP70")
0496 process.WP60MatchedPhotonCands = process.GsfMatchedPhotonCands.clone()
0497 process.WP60MatchedPhotonCands.ReferenceElectronCollection = cms.untracked.InputTag("PassingWP60")
0498 process.CicVeryLooseMatchedPhotonCands = process.GsfMatchedPhotonCands.clone()
0499 process.CicVeryLooseMatchedPhotonCands.ReferenceElectronCollection = cms.untracked.InputTag("PassingCicVeryLoose")
0500 process.CicLooseMatchedPhotonCands = process.GsfMatchedPhotonCands.clone()
0501 process.CicLooseMatchedPhotonCands.ReferenceElectronCollection = cms.untracked.InputTag("PassingCicLoose")
0502 process.CicMediumMatchedPhotonCands = process.GsfMatchedPhotonCands.clone()
0503 process.CicMediumMatchedPhotonCands.ReferenceElectronCollection = cms.untracked.InputTag("PassingCicMedium")
0504 process.CicTightMatchedPhotonCands = process.GsfMatchedPhotonCands.clone()
0505 process.CicTightMatchedPhotonCands.ReferenceElectronCollection = cms.untracked.InputTag("PassingCicTight")
0506 process.CicSuperTightMatchedPhotonCands = process.GsfMatchedPhotonCands.clone()
0507 process.CicSuperTightMatchedPhotonCands.ReferenceElectronCollection = cms.untracked.InputTag("PassingCicSuperTight")
0508 process.CicHyperTight1MatchedPhotonCands = process.GsfMatchedPhotonCands.clone()
0509 process.CicHyperTight1MatchedPhotonCands.ReferenceElectronCollection = cms.untracked.InputTag("PassingCicHyperTight1")
0510 process.CicHyperTight2MatchedPhotonCands = process.GsfMatchedPhotonCands.clone()
0511 process.CicHyperTight2MatchedPhotonCands.ReferenceElectronCollection = cms.untracked.InputTag("PassingCicHyperTight2")
0512 process.CicHyperTight3MatchedPhotonCands = process.GsfMatchedPhotonCands.clone()
0513 process.CicHyperTight3MatchedPhotonCands.ReferenceElectronCollection = cms.untracked.InputTag("PassingCicHyperTight3")
0514 process.CicHyperTight4MatchedPhotonCands = process.GsfMatchedPhotonCands.clone()
0515 process.CicHyperTight4MatchedPhotonCands.ReferenceElectronCollection = cms.untracked.InputTag("PassingCicHyperTight4")
0516 
0517 process.ele_sequence = cms.Sequence(
0518     process.goodElectrons +
0519     process.GsfMatchedSuperClusterCands +
0520     process.GsfMatchedPhotonCands +
0521     process.PassingWP95 +
0522     process.PassingWP90 +
0523     process.PassingWP85 +
0524     process.PassingWP80 +
0525     process.PassingWP70 +
0526     process.PassingWP60 +
0527     process.PassingCicVeryLoose +
0528     process.PassingCicLoose +
0529     process.PassingCicMedium +
0530     process.PassingCicTight +
0531     process.PassingCicSuperTight +
0532     process.PassingCicHyperTight1 +
0533     process.PassingCicHyperTight2 +
0534     process.PassingCicHyperTight3 +
0535     process.PassingCicHyperTight4 +       
0536     process.PassingHLT +
0537     process.Tag +
0538     process.TagMatchedSuperClusterCandsClean +
0539     process.TagMatchedPhotonCands +
0540     process.WP95MatchedSuperClusterCandsClean +
0541     process.WP90MatchedSuperClusterCandsClean +
0542     process.WP85MatchedSuperClusterCandsClean +
0543     process.WP80MatchedSuperClusterCandsClean +
0544     process.WP70MatchedSuperClusterCandsClean +
0545     process.WP60MatchedSuperClusterCandsClean +    
0546     process.CicVeryLooseMatchedSuperClusterCandsClean +
0547     process.CicLooseMatchedSuperClusterCandsClean +
0548     process.CicMediumMatchedSuperClusterCandsClean +
0549     process.CicTightMatchedSuperClusterCandsClean +
0550     process.CicSuperTightMatchedSuperClusterCandsClean +
0551     process.CicHyperTight1MatchedSuperClusterCandsClean +
0552     process.CicHyperTight2MatchedSuperClusterCandsClean +
0553     process.CicHyperTight3MatchedSuperClusterCandsClean +
0554     process.CicHyperTight4MatchedSuperClusterCandsClean +
0555     process.WP95MatchedPhotonCands +
0556     process.WP90MatchedPhotonCands +
0557     process.WP85MatchedPhotonCands +
0558     process.WP80MatchedPhotonCands +
0559     process.WP70MatchedPhotonCands +
0560     process.WP60MatchedPhotonCands +    
0561     process.CicVeryLooseMatchedPhotonCands +
0562     process.CicLooseMatchedPhotonCands +
0563     process.CicMediumMatchedPhotonCands +
0564     process.CicTightMatchedPhotonCands +
0565     process.CicSuperTightMatchedPhotonCands +
0566     process.CicHyperTight1MatchedPhotonCands +
0567     process.CicHyperTight2MatchedPhotonCands +
0568     process.CicHyperTight3MatchedPhotonCands +
0569     process.CicHyperTight4MatchedPhotonCands         
0570     )
0571 
0572 
0573 ##    _____ ___   ____    ____       _          
0574 ##   |_   _( _ ) |  _ \  |  _ \ __ _(_)_ __ ___ 
0575 ##     | | / _ \/\ |_) | | |_) / _` | | '__/ __|
0576 ##     | || (_>  <  __/  |  __/ (_| | | |  \__ \
0577 ##     |_| \___/\/_|     |_|   \__,_|_|_|  |___/
0578 ##                                              
0579 ##   
0580 #  Tag & probe selection ######
0581 process.tagSC = cms.EDProducer("CandViewShallowCloneCombiner",
0582     decay = cms.string("Tag goodSuperClustersClean"), # charge coniugate states are implied
0583     checkCharge = cms.bool(False),                           
0584     cut   = cms.string("40 < mass < 1000"),
0585 )
0586 
0587 process.tagPhoton = process.tagSC.clone()
0588 process.tagPhoton.decay = cms.string("Tag goodPhotons")
0589 process.GsfGsf = process.tagSC.clone()
0590 process.GsfGsf.decay = cms.string("goodElectrons goodElectrons")
0591 process.tagGsf = process.tagSC.clone()
0592 process.tagGsf.decay = cms.string("Tag goodElectrons")
0593 process.tagWP95 = process.tagSC.clone()
0594 process.tagWP95.decay = cms.string("Tag PassingWP95")
0595 process.tagWP90 = process.tagSC.clone()
0596 process.tagWP90.decay = cms.string("Tag PassingWP90")
0597 process.tagWP85 = process.tagSC.clone()
0598 process.tagWP85.decay = cms.string("Tag PassingWP85")
0599 process.tagWP80 = process.tagSC.clone()
0600 process.tagWP80.decay = cms.string("Tag PassingWP80")
0601 process.tagWP70 = process.tagSC.clone()
0602 process.tagWP70.decay = cms.string("Tag PassingWP70")
0603 process.tagWP60 = process.tagSC.clone()
0604 process.tagWP60.decay = cms.string("Tag PassingWP60")
0605 process.tagCicVeryLoose = process.tagSC.clone()
0606 process.tagCicVeryLoose.decay = cms.string("Tag PassingCicVeryLoose")
0607 process.tagCicLoose = process.tagSC.clone()
0608 process.tagCicLoose.decay = cms.string("Tag PassingCicLoose")
0609 process.tagCicMedium = process.tagSC.clone()
0610 process.tagCicMedium.decay = cms.string("Tag PassingCicMedium")
0611 process.tagCicTight = process.tagSC.clone()
0612 process.tagCicTight.decay = cms.string("Tag PassingCicTight")
0613 process.tagCicSuperTight = process.tagSC.clone()
0614 process.tagCicSuperTight.decay = cms.string("Tag PassingCicSuperTight")
0615 process.tagCicHyperTight1 = process.tagSC.clone()
0616 process.tagCicHyperTight1.decay = cms.string("Tag PassingCicHyperTight1")
0617 process.tagCicHyperTight2 = process.tagSC.clone()
0618 process.tagCicHyperTight2.decay = cms.string("Tag PassingCicHyperTight2")
0619 process.tagCicHyperTight3 = process.tagSC.clone()
0620 process.tagCicHyperTight3.decay = cms.string("Tag PassingCicHyperTight3")
0621 process.tagCicHyperTight4 = process.tagSC.clone()
0622 process.tagCicHyperTight4.decay = cms.string("Tag PassingCicHyperTight4")
0623 process.elecMet = process.tagSC.clone()
0624 process.elecMet.decay = cms.string("pfMet PassingWP90")
0625 process.elecMet.cut = cms.string("mt > 0")
0626 
0627 process.CSVarsTagGsf = cms.EDProducer("ColinsSoperVariablesComputer",
0628     parentBoson = cms.InputTag("tagGsf")
0629 )
0630 process.CSVarsGsfGsf = process.CSVarsTagGsf.clone()
0631 process.CSVarsGsfGsf.parentBoson = cms.InputTag("GsfGsf")
0632 
0633 
0634 
0635 process.allTagsAndProbes = cms.Sequence(
0636     process.tagSC +
0637     process.tagPhoton +
0638     process.tagGsf +
0639     process.GsfGsf +
0640     process.tagWP95 +
0641     process.tagWP90 +
0642     process.tagWP85 +
0643     process.tagWP80 +
0644     process.tagWP70 +
0645     process.tagWP60 +
0646     process.tagCicVeryLoose +
0647     process.tagCicLoose +
0648     process.tagCicMedium +
0649     process.tagCicTight +
0650     process.tagCicSuperTight +
0651     process.tagCicHyperTight1 +
0652     process.tagCicHyperTight2 +
0653     process.tagCicHyperTight3 +
0654     process.tagCicHyperTight4 +
0655     process.elecMet + 
0656     process.CSVarsTagGsf +
0657     process.CSVarsGsfGsf
0658 )
0659 
0660 ##    __  __  ____   __  __       _       _               
0661 ##   |  \/  |/ ___| |  \/  | __ _| |_ ___| |__   ___  ___ 
0662 ##   | |\/| | |     | |\/| |/ _` | __/ __| '_ \ / _ \/ __|
0663 ##   | |  | | |___  | |  | | (_| | || (__| | | |  __/\__ \
0664 ##   |_|  |_|\____| |_|  |_|\__,_|\__\___|_| |_|\___||___/
0665 ##                                                        
0666 process.McMatchTag = cms.EDProducer("MCTruthDeltaRMatcherNew",
0667     matchPDGId = cms.vint32(11),
0668     src = cms.InputTag("Tag"),
0669     distMin = cms.double(0.3),
0670     matched = cms.InputTag("genParticles"),
0671     checkCharge = cms.bool(True)
0672 )
0673 process.McMatchSC = cms.EDProducer("MCTruthDeltaRMatcherNew",
0674     matchPDGId = cms.vint32(11),
0675     src = cms.InputTag("goodSuperClustersClean"),
0676     distMin = cms.double(0.3),
0677     matched = cms.InputTag("genParticles")
0678 )
0679 process.McMatchPhoton = process.McMatchSC.clone()
0680 process.McMatchPhoton.src = cms.InputTag("goodPhotons")
0681 process.McMatchGsf = process.McMatchTag.clone()
0682 process.McMatchGsf.src = cms.InputTag("goodElectrons")
0683 process.McMatchWP95 = process.McMatchTag.clone()
0684 process.McMatchWP95.src = cms.InputTag("PassingWP95")
0685 process.McMatchWP90 = process.McMatchTag.clone()
0686 process.McMatchWP90.src = cms.InputTag("PassingWP90")
0687 process.McMatchWP85 = process.McMatchTag.clone()
0688 process.McMatchWP85.src = cms.InputTag("PassingWP85")
0689 process.McMatchWP80 = process.McMatchTag.clone()
0690 process.McMatchWP80.src = cms.InputTag("PassingWP80")
0691 process.McMatchWP70 = process.McMatchTag.clone()
0692 process.McMatchWP70.src = cms.InputTag("PassingWP70")
0693 process.McMatchWP60 = process.McMatchTag.clone()
0694 process.McMatchWP60.src = cms.InputTag("PassingWP60")
0695 process.McMatchCicVeryLoose = process.McMatchTag.clone()
0696 process.McMatchCicVeryLoose.src = cms.InputTag("PassingCicVeryLoose")
0697 process.McMatchCicLoose = process.McMatchTag.clone()
0698 process.McMatchCicLoose.src = cms.InputTag("PassingCicLoose")
0699 process.McMatchCicMedium = process.McMatchTag.clone()
0700 process.McMatchCicMedium.src = cms.InputTag("PassingCicMedium")
0701 process.McMatchCicTight = process.McMatchTag.clone()
0702 process.McMatchCicTight.src = cms.InputTag("PassingCicTight")
0703 process.McMatchCicSuperTight = process.McMatchTag.clone()
0704 process.McMatchCicSuperTight.src = cms.InputTag("PassingCicSuperTight")
0705 process.McMatchCicHyperTight1 = process.McMatchTag.clone()
0706 process.McMatchCicHyperTight1.src = cms.InputTag("PassingCicHyperTight1")
0707 process.McMatchCicHyperTight2 = process.McMatchTag.clone()
0708 process.McMatchCicHyperTight2.src = cms.InputTag("PassingCicHyperTight2")
0709 process.McMatchCicHyperTight3 = process.McMatchTag.clone()
0710 process.McMatchCicHyperTight3.src = cms.InputTag("PassingCicHyperTight3")
0711 process.McMatchCicHyperTight4 = process.McMatchTag.clone()
0712 process.McMatchCicHyperTight4.src = cms.InputTag("PassingCicHyperTight4")
0713     
0714 process.mc_sequence = cms.Sequence(
0715    process.McMatchTag +
0716    process.McMatchSC +
0717    process.McMatchPhoton +
0718    process.McMatchGsf + 
0719    process.McMatchWP95 +
0720    process.McMatchWP90 +
0721    process.McMatchWP85 +
0722    process.McMatchWP80 +
0723    process.McMatchWP70 +   
0724    process.McMatchWP60 +
0725    process.McMatchCicVeryLoose +
0726    process.McMatchCicLoose +
0727    process.McMatchCicMedium +
0728    process.McMatchCicTight +
0729    process.McMatchCicSuperTight +
0730    process.McMatchCicHyperTight1 +
0731    process.McMatchCicHyperTight2 +
0732    process.McMatchCicHyperTight3 +
0733    process.McMatchCicHyperTight4    
0734 )
0735 
0736 ############################################################################
0737 ##    _____           _       _ ____            _            _   _  ____  ##
0738 ##   |_   _|_ _  __ _( )_ __ ( )  _ \ _ __ ___ | |__   ___  | \ | |/ ___| ##
0739 ##     | |/ _` |/ _` |/| '_ \|/| |_) | '__/ _ \| '_ \ / _ \ |  \| | |  _  ##
0740 ##     | | (_| | (_| | | | | | |  __/| | | (_) | |_) |  __/ | |\  | |_| | ##
0741 ##     |_|\__,_|\__, | |_| |_| |_|   |_|  \___/|_.__/ \___| |_| \_|\____| ##
0742 ##              |___/                                                     ##
0743 ##                                                                        ##
0744 ############################################################################
0745 ##    ____                      _     _           
0746 ##   |  _ \ ___ _   _ ___  __ _| |__ | | ___  ___ 
0747 ##   | |_) / _ \ | | / __|/ _` | '_ \| |/ _ \/ __|
0748 ##   |  _ <  __/ |_| \__ \ (_| | |_) | |  __/\__ \
0749 ##   |_| \_\___|\__,_|___/\__,_|_.__/|_|\___||___/
0750 ##
0751 ## I define some common variables for re-use later.
0752 ## This will save us repeating the same code for each efficiency category
0753 ZVariablesToStore = cms.PSet(
0754     eta = cms.string("eta"),
0755     pt  = cms.string("pt"),
0756     phi  = cms.string("phi"),
0757     et  = cms.string("et"),
0758     e  = cms.string("energy"),
0759     p  = cms.string("p"),
0760     px  = cms.string("px"),
0761     py  = cms.string("py"),
0762     pz  = cms.string("pz"),
0763     theta  = cms.string("theta"),    
0764     vx     = cms.string("vx"),
0765     vy     = cms.string("vy"),
0766     vz     = cms.string("vz"),
0767     rapidity  = cms.string("rapidity"),
0768     mass  = cms.string("mass"),
0769     mt  = cms.string("mt"),    
0770 )   
0771 
0772 ProbeVariablesToStore = cms.PSet(
0773     probe_gsfEle_eta = cms.string("eta"),
0774     probe_gsfEle_pt  = cms.string("pt"),
0775     probe_gsfEle_phi  = cms.string("phi"),
0776     probe_gsfEle_et  = cms.string("et"),
0777     probe_gsfEle_e  = cms.string("energy"),
0778     probe_gsfEle_p  = cms.string("p"),
0779     probe_gsfEle_px  = cms.string("px"),
0780     probe_gsfEle_py  = cms.string("py"),
0781     probe_gsfEle_pz  = cms.string("pz"),
0782     probe_gsfEle_theta  = cms.string("theta"),    
0783     probe_gsfEle_charge = cms.string("charge"),
0784     probe_gsfEle_rapidity  = cms.string("rapidity"),
0785     probe_gsfEle_missingHits = cms.string("gsfTrack.hitPattern().numberOfLostHits(\'MISSING_INNER_HITS\')"),
0786     probe_gsfEle_convDist = cms.string("convDist"),
0787     probe_gsfEle_convDcot = cms.string("convDcot"),
0788     probe_gsfEle_convRadius = cms.string("convRadius"),        
0789     probe_gsfEle_hasValidHitInFirstPixelBarrel = cms.string("gsfTrack.hitPattern().hasValidHitInFirstPixelBarrel()"),
0790     ## super cluster quantities
0791     probe_sc_energy = cms.string("superCluster.energy"),
0792     probe_sc_et    = cms.string("superCluster.energy*sin(superClusterPosition.theta)"),    
0793     probe_sc_x      = cms.string("superCluster.x"),
0794     probe_sc_y      = cms.string("superCluster.y"),
0795     probe_sc_z      = cms.string("superCluster.z"),
0796     probe_sc_eta    = cms.string("superCluster.eta"),
0797     probe_sc_theta  = cms.string("superClusterPosition.theta"),   
0798     probe_sc_phi    = cms.string("superCluster.phi"),
0799     probe_sc_size   = cms.string("superCluster.size"), # number of hits
0800     ## track quantities
0801     probe_track_p      = cms.string("gsfTrack.p"),
0802     probe_track_pt     = cms.string("gsfTrack.pt"),    
0803     probe_track_px     = cms.string("gsfTrack.px"),
0804     probe_track_py     = cms.string("gsfTrack.py"),
0805     probe_track_pz     = cms.string("gsfTrack.pz"),
0806     probe_track_eta    = cms.string("gsfTrack.eta"),
0807     probe_track_theta  = cms.string("gsfTrack.theta"),   
0808     probe_track_phi    = cms.string("gsfTrack.phi"),
0809     probe_track_vx     = cms.string("gsfTrack.vx"),
0810     probe_track_vy     = cms.string("gsfTrack.vy"),
0811     probe_track_vz     = cms.string("gsfTrack.vz"),    
0812     probe_track_dxy    = cms.string("gsfTrack.dxy"),
0813     probe_track_d0     = cms.string("gsfTrack.d0"),
0814     probe_track_dsz    = cms.string("gsfTrack.dsz"),
0815     probe_track_charge = cms.string("gsfTrack.charge"),
0816     probe_track_qoverp = cms.string("gsfTrack.qoverp"),
0817     probe_track_normalizedChi2 = cms.string("gsfTrack.normalizedChi2"),
0818     ## isolation 
0819     probe_gsfEle_trackiso = cms.string("dr03TkSumPt"),
0820     probe_gsfEle_ecaliso  = cms.string("dr03EcalRecHitSumEt"),
0821     probe_gsfEle_hcaliso  = cms.string("dr03HcalTowerSumEt"),
0822     ## classification, location, etc.    
0823     probe_gsfEle_classification = cms.string("classification"),
0824     probe_gsfEle_numberOfBrems  = cms.string("numberOfBrems"),     
0825     probe_gsfEle_bremFraction   = cms.string("fbrem"),
0826     probe_gsfEle_mva            = cms.string("mva"),        
0827     probe_gsfEle_deltaEta       = cms.string("deltaEtaSuperClusterTrackAtVtx"),
0828     probe_gsfEle_deltaPhi       = cms.string("deltaPhiSuperClusterTrackAtVtx"),
0829     probe_gsfEle_deltaPhiOut    = cms.string("deltaPhiSeedClusterTrackAtCalo"),
0830     probe_gsfEle_deltaEtaOut    = cms.string("deltaEtaSeedClusterTrackAtCalo"),
0831     probe_gsfEle_isEB           = cms.string("isEB"),
0832     probe_gsfEle_isEE           = cms.string("isEE"),
0833     probe_gsfEle_isGap          = cms.string("isGap"),
0834     ## Hcal energy over Ecal Energy
0835     probe_gsfEle_HoverE         = cms.string("hcalOverEcal"),    
0836     probe_gsfEle_EoverP         = cms.string("eSuperClusterOverP"),
0837     probe_gsfEle_eSeedClusterOverP = cms.string("eSeedClusterOverP"),    
0838     ## Cluster shape information
0839     probe_gsfEle_sigmaEtaEta  = cms.string("sigmaEtaEta"),
0840     probe_gsfEle_sigmaIetaIeta = cms.string("sigmaIetaIeta"),
0841     probe_gsfEle_e1x5               = cms.string("e1x5"),
0842     probe_gsfEle_e2x5Max            = cms.string("e2x5Max"),
0843     probe_gsfEle_e5x5               = cms.string("e5x5"),
0844     ## is ECAL driven ? is Track driven ?
0845     probe_gsfEle_ecalDrivenSeed     = cms.string("ecalDrivenSeed"),
0846     probe_gsfEle_trackerDrivenSeed  = cms.string("trackerDrivenSeed")
0847 )
0848 
0849 
0850 TagVariablesToStore = cms.PSet(
0851     gsfEle_eta = cms.string("eta"),
0852     gsfEle_pt  = cms.string("pt"),
0853     gsfEle_phi  = cms.string("phi"),
0854     gsfEle_et  = cms.string("et"),
0855     gsfEle_e  = cms.string("energy"),
0856     gsfEle_p  = cms.string("p"),
0857     gsfEle_px  = cms.string("px"),
0858     gsfEle_py  = cms.string("py"),
0859     gsfEle_pz  = cms.string("pz"),
0860     gsfEle_theta  = cms.string("theta"),    
0861     gsfEle_charge = cms.string("charge"),
0862     gsfEle_rapidity  = cms.string("rapidity"),
0863     gsfEle_missingHits = cms.string("gsfTrack.hitPattern().numberOfLostHits(\'MISSING_INNER_HITS\')"),
0864     gsfEle_convDist = cms.string("convDist"),
0865     gsfEle_convDcot = cms.string("convDcot"),
0866     gsfEle_convRadius = cms.string("convRadius"),     
0867     gsfEle_hasValidHitInFirstPixelBarrel = cms.string("gsfTrack.hitPattern().hasValidHitInFirstPixelBarrel()"),
0868     ## super cluster quantities
0869     sc_energy = cms.string("superCluster.energy"),
0870     sc_et     = cms.string("superCluster.energy*sin(superClusterPosition.theta)"),    
0871     sc_x      = cms.string("superCluster.x"),
0872     sc_y      = cms.string("superCluster.y"),
0873     sc_z      = cms.string("superCluster.z"),
0874     sc_eta    = cms.string("superCluster.eta"),
0875     sc_theta  = cms.string("superClusterPosition.theta"),      
0876     sc_phi    = cms.string("superCluster.phi"),
0877     sc_size   = cms.string("superCluster.size"), # number of hits
0878     ## track quantities
0879     track_p      = cms.string("gsfTrack.p"),
0880     track_pt     = cms.string("gsfTrack.pt"),    
0881     track_px     = cms.string("gsfTrack.px"),
0882     track_py     = cms.string("gsfTrack.py"),
0883     track_pz     = cms.string("gsfTrack.pz"),
0884     track_eta    = cms.string("gsfTrack.eta"),
0885     track_theta  = cms.string("gsfTrack.theta"),   
0886     track_phi    = cms.string("gsfTrack.phi"),
0887     track_vx     = cms.string("gsfTrack.vx"),
0888     track_vy     = cms.string("gsfTrack.vy"),
0889     track_vz     = cms.string("gsfTrack.vz"),    
0890     track_dxy    = cms.string("gsfTrack.dxy"),
0891     track_d0     = cms.string("gsfTrack.d0"),
0892     track_dsz    = cms.string("gsfTrack.dsz"),
0893     track_charge = cms.string("gsfTrack.charge"),
0894     track_qoverp = cms.string("gsfTrack.qoverp"),
0895     track_normalizedChi2 = cms.string("gsfTrack.normalizedChi2"),    
0896     ## isolation 
0897     gsfEle_trackiso = cms.string("dr03TkSumPt"),
0898     gsfEle_ecaliso  = cms.string("dr03EcalRecHitSumEt"),
0899     gsfEle_hcaliso  = cms.string("dr03HcalTowerSumEt"),
0900     ## classification, location, etc.    
0901     gsfEle_classification = cms.string("classification"),
0902     gsfEle_numberOfBrems  = cms.string("numberOfBrems"),     
0903     gsfEle_bremFraction   = cms.string("fbrem"),
0904     gsfEle_mva            = cms.string("mva"),        
0905     gsfEle_deltaEta       = cms.string("deltaEtaSuperClusterTrackAtVtx"),
0906     gsfEle_deltaPhi       = cms.string("deltaPhiSuperClusterTrackAtVtx"),
0907     gsfEle_deltaPhiOut    = cms.string("deltaPhiSeedClusterTrackAtCalo"),
0908     gsfEle_deltaEtaOut    = cms.string("deltaEtaSeedClusterTrackAtCalo"),
0909     gsfEle_isEB           = cms.string("isEB"),
0910     gsfEle_isEE           = cms.string("isEE"),
0911     gsfEle_isGap          = cms.string("isGap"),
0912     ## Hcal energy over Ecal Energy
0913     gsfEle_HoverE         = cms.string("hcalOverEcal"),    
0914     gsfEle_EoverP         = cms.string("eSuperClusterOverP"),
0915     gsfEle_eSeedClusterOverP = cms.string("eSeedClusterOverP"),  
0916     ## Cluster shape information
0917     gsfEle_sigmaEtaEta  = cms.string("sigmaEtaEta"),
0918     gsfEle_sigmaIetaIeta = cms.string("sigmaIetaIeta"),
0919     gsfEle_e1x5               = cms.string("e1x5"),
0920     gsfEle_e2x5Max            = cms.string("e2x5Max"),
0921     gsfEle_e5x5               = cms.string("e5x5"),
0922     ## is ECAL driven ? is Track driven ?
0923     gsfEle_ecalDrivenSeed     = cms.string("ecalDrivenSeed"),
0924     gsfEle_trackerDrivenSeed  = cms.string("trackerDrivenSeed")
0925 )
0926 
0927 CommonStuffForGsfElectronProbe = cms.PSet(
0928     variables = cms.PSet(ProbeVariablesToStore),
0929     addRunLumiInfo   =  cms.bool (True),
0930     addEventVariablesInfo   =  cms.bool (True),
0931     pairVariables =  cms.PSet(ZVariablesToStore),
0932     pairFlags     =  cms.PSet(
0933           mass60to120 = cms.string("60 < mass < 120")
0934     ),
0935     tagVariables   =  cms.PSet(TagVariablesToStore),
0936     tagFlags     =  cms.PSet(
0937           passingGsf = cms.InputTag("goodElectrons"),
0938           isWP95 = cms.InputTag("PassingWP95"),
0939           isWP90 = cms.InputTag("PassingWP90"),
0940           isWP85 = cms.InputTag("PassingWP85"),          
0941           isWP80 = cms.InputTag("PassingWP80"),
0942           isWP70 = cms.InputTag("PassingWP70"),
0943           isWP60 = cms.InputTag("PassingWP60"),
0944           isCicVeryLoose = cms.InputTag("PassingCicVeryLoose"),
0945           isCicLoose = cms.InputTag("PassingCicLoose"),
0946           isCicMedium = cms.InputTag("PassingCicMedium"),
0947           isCicTight = cms.InputTag("PassingCicTight"),
0948           isCicSuperTight = cms.InputTag("PassingCicSuperTight"),          
0949           isCicHyperTight1 = cms.InputTag("PassingCicHyperTight1"),
0950           isCicHyperTight2 = cms.InputTag("PassingCicHyperTight2"),
0951           isCicHyperTight3 = cms.InputTag("PassingCicHyperTight3"),
0952           isCicHyperTight4 = cms.InputTag("PassingCicHyperTight4"),          
0953           passingHLT = cms.InputTag("PassingHLT")     
0954     ),    
0955 )
0956 
0957 CommonStuffForSuperClusterProbe = CommonStuffForGsfElectronProbe.clone()
0958 CommonStuffForSuperClusterProbe.variables = cms.PSet(
0959     probe_eta = cms.string("eta"),
0960     probe_pt  = cms.string("pt"),
0961     probe_phi  = cms.string("phi"),
0962     probe_et  = cms.string("et"),
0963     probe_e  = cms.string("energy"),
0964     probe_p  = cms.string("p"),
0965     probe_px  = cms.string("px"),
0966     probe_py  = cms.string("py"),
0967     probe_pz  = cms.string("pz"),
0968     probe_theta  = cms.string("theta"),
0969     )
0970 
0971 
0972 if MC_flag:
0973     mcTruthCommonStuff = cms.PSet(
0974         isMC = cms.bool(MC_flag),
0975         tagMatches = cms.InputTag("McMatchTag"),
0976         motherPdgId = cms.vint32(22,23),
0977         makeMCUnbiasTree = cms.bool(MC_flag),
0978         checkMotherInUnbiasEff = cms.bool(MC_flag),
0979         mcVariables = cms.PSet(
0980         probe_eta = cms.string("eta"),
0981         probe_pt  = cms.string("pt"),
0982         probe_phi  = cms.string("phi"),
0983         probe_et  = cms.string("et"),
0984         probe_e  = cms.string("energy"),
0985         probe_p  = cms.string("p"),
0986         probe_px  = cms.string("px"),
0987         probe_py  = cms.string("py"),
0988         probe_pz  = cms.string("pz"),
0989         probe_theta  = cms.string("theta"),    
0990         probe_vx     = cms.string("vx"),
0991         probe_vy     = cms.string("vy"),
0992         probe_vz     = cms.string("vz"),   
0993         probe_charge = cms.string("charge"),
0994         probe_rapidity  = cms.string("rapidity"),    
0995         probe_mass  = cms.string("mass"),
0996         probe_mt  = cms.string("mt"),    
0997         ),
0998         mcFlags     =  cms.PSet(
0999         probe_flag = cms.string("pt>0")
1000         ),      
1001         )
1002 else:
1003      mcTruthCommonStuff = cms.PSet(
1004          isMC = cms.bool(False)
1005          )
1006 
1007 
1008 ##    ____   ____       __     ____      __ 
1009 ##   / ___| / ___|      \ \   / ___|___ / _|
1010 ##   \___ \| |      _____\ \ | |  _/ __| |_ 
1011 ##    ___) | |___  |_____/ / | |_| \__ \  _|
1012 ##   |____/ \____|      /_/   \____|___/_|  
1013 ##
1014 ## super cluster --> gsf electron
1015 process.SuperClusterToGsfElectron = cms.EDAnalyzer("TagProbeFitTreeProducer",
1016     ## pick the defaults
1017     CommonStuffForSuperClusterProbe, mcTruthCommonStuff,
1018     # choice of tag and probe pairs, and arbitration                 
1019     tagProbePairs = cms.InputTag("tagSC"),
1020     arbitration   = cms.string("Random2"),                      
1021     flags = cms.PSet(
1022         probe_passingGsf = cms.InputTag("GsfMatchedSuperClusterCands"),        
1023         probe_isWP95 = cms.InputTag("WP95MatchedSuperClusterCandsClean"),
1024         probe_isWP90 = cms.InputTag("WP90MatchedSuperClusterCandsClean"),
1025         probe_isWP85 = cms.InputTag("WP85MatchedSuperClusterCandsClean"),        
1026         probe_isWP80 = cms.InputTag("WP80MatchedSuperClusterCandsClean"),
1027         probe_isWP70 = cms.InputTag("WP70MatchedSuperClusterCandsClean"),
1028         probe_isWP60 = cms.InputTag("WP60MatchedSuperClusterCandsClean"),
1029         probe_isCicVeryLoose = cms.InputTag("CicVeryLooseMatchedSuperClusterCandsClean"), 
1030         probe_isCicLoose = cms.InputTag("CicLooseMatchedSuperClusterCandsClean"), 
1031         probe_isCicMedium = cms.InputTag("CicMediumMatchedSuperClusterCandsClean"), 
1032         probe_isCicTight = cms.InputTag("CicTightMatchedSuperClusterCandsClean"), 
1033         probe_isCicSuperTight = cms.InputTag("CicSuperTightMatchedSuperClusterCandsClean"), 
1034         probe_isCicHyperTight1 = cms.InputTag("CicHyperTight1MatchedSuperClusterCandsClean"), 
1035         probe_isCicHyperTight2 = cms.InputTag("CicHyperTight2MatchedSuperClusterCandsClean"), 
1036         probe_isCicHyperTight3 = cms.InputTag("CicHyperTight3MatchedSuperClusterCandsClean"), 
1037         probe_isCicHyperTight4 = cms.InputTag("CicHyperTight4MatchedSuperClusterCandsClean"),        
1038         probe_passingHLT = cms.InputTag("TagMatchedSuperClusterCandsClean")
1039     ),
1040     probeMatches  = cms.InputTag("McMatchSC"),
1041     allProbes     = cms.InputTag("goodSuperClustersClean")
1042 )
1043 process.SuperClusterToGsfElectron.variables.probe_dRjet = cms.InputTag("superClusterDRToNearestJet")
1044 process.SuperClusterToGsfElectron.variables.probe_nJets = cms.InputTag("JetMultiplicityInSCEvents")
1045 process.SuperClusterToGsfElectron.variables.probe_dist = cms.InputTag("SCConvRejVars","dist")
1046 process.SuperClusterToGsfElectron.variables.probe_dcot = cms.InputTag("SCConvRejVars","dcot")
1047 process.SuperClusterToGsfElectron.variables.probe_convradius = cms.InputTag("SCConvRejVars","convradius")
1048 process.SuperClusterToGsfElectron.variables.probe_passConvRej = cms.InputTag("SCConvRejVars","passConvRej")
1049 process.SuperClusterToGsfElectron.tagVariables.dRjet = cms.InputTag("GsfDRToNearestJet")
1050 process.SuperClusterToGsfElectron.tagVariables.nJets = cms.InputTag("JetMultiplicityInGsfEvents")
1051 process.SuperClusterToGsfElectron.tagVariables.eidCicVeryLoose = cms.InputTag("eidVeryLoose")
1052 process.SuperClusterToGsfElectron.tagVariables.eidCicLoose = cms.InputTag("eidLoose")
1053 process.SuperClusterToGsfElectron.tagVariables.eidCicMedium = cms.InputTag("eidMedium")
1054 process.SuperClusterToGsfElectron.tagVariables.eidCicTight = cms.InputTag("eidTight")
1055 process.SuperClusterToGsfElectron.tagVariables.eidCicSuperTight = cms.InputTag("eidSuperTight")
1056 process.SuperClusterToGsfElectron.tagVariables.eidCicHyperTight1 = cms.InputTag("eidHyperTight1")
1057 process.SuperClusterToGsfElectron.tagVariables.eidCicHyperTight2 = cms.InputTag("eidHyperTight2")
1058 process.SuperClusterToGsfElectron.tagVariables.eidCicHyperTight3 = cms.InputTag("eidHyperTight3")
1059 process.SuperClusterToGsfElectron.tagVariables.eidCicHyperTight4 = cms.InputTag("eidHyperTight4")
1060 process.SuperClusterToGsfElectron.tagVariables.eidLikelihood = cms.InputTag("eidLikelihoodExt")
1061 process.SuperClusterToGsfElectron.tagVariables.dist = cms.InputTag("GsfConvRejVars","dist")
1062 process.SuperClusterToGsfElectron.tagVariables.dcot = cms.InputTag("GsfConvRejVars","dcot")
1063 process.SuperClusterToGsfElectron.tagVariables.convradius = cms.InputTag("GsfConvRejVars","convradius")
1064 process.SuperClusterToGsfElectron.tagVariables.passConvRej = cms.InputTag("GsfConvRejVars","passConvRej")
1065 
1066 
1067 
1068 ## good photon --> gsf electron
1069 process.PhotonToGsfElectron = process.SuperClusterToGsfElectron.clone()
1070 process.PhotonToGsfElectron.tagProbePairs = cms.InputTag("tagPhoton")
1071 process.PhotonToGsfElectron.flags = cms.PSet(
1072     probe_passingGsf = cms.InputTag("GsfMatchedPhotonCands"),
1073     probe_passingHLT = cms.InputTag("TagMatchedPhotonCands"),
1074     probe_isWP95 = cms.InputTag("WP95MatchedPhotonCands"),
1075     probe_isWP90 = cms.InputTag("WP90MatchedPhotonCands"),
1076     probe_isWP85 = cms.InputTag("WP85MatchedPhotonCands"),        
1077     probe_isWP80 = cms.InputTag("WP80MatchedPhotonCands"),
1078     probe_isWP70 = cms.InputTag("WP70MatchedPhotonCands"),
1079     probe_isWP60 = cms.InputTag("WP60MatchedPhotonCands"),
1080     probe_isCicVeryLoose = cms.InputTag("CicVeryLooseMatchedPhotonCands"), 
1081     probe_isCicLoose = cms.InputTag("CicLooseMatchedPhotonCands"), 
1082     probe_isCicMedium = cms.InputTag("CicMediumMatchedPhotonCands"), 
1083     probe_isCicTight = cms.InputTag("CicTightMatchedPhotonCands"), 
1084     probe_isCicSuperTight = cms.InputTag("CicSuperTightMatchedPhotonCands"), 
1085     probe_isCicHyperTight1 = cms.InputTag("CicHyperTight1MatchedPhotonCands"), 
1086     probe_isCicHyperTight2 = cms.InputTag("CicHyperTight2MatchedPhotonCands"), 
1087     probe_isCicHyperTight3 = cms.InputTag("CicHyperTight3MatchedPhotonCands"), 
1088     probe_isCicHyperTight4 = cms.InputTag("CicHyperTight4MatchedPhotonCands")        
1089     )
1090 process.PhotonToGsfElectron.probeMatches  = cms.InputTag("McMatchPhoton")
1091 process.PhotonToGsfElectron.allProbes     = cms.InputTag("goodPhotons")
1092 process.PhotonToGsfElectron.variables.probe_dRjet = cms.InputTag("PhotonDRToNearestJet")
1093 process.PhotonToGsfElectron.variables.probe_nJets = cms.InputTag("JetMultiplicityInPhotonEvents")
1094 process.PhotonToGsfElectron.variables.probe_trackiso = cms.string("trkSumPtHollowConeDR03")
1095 process.PhotonToGsfElectron.variables.probe_ecaliso = cms.string("ecalRecHitSumEtConeDR03")
1096 process.PhotonToGsfElectron.variables.probe_hcaliso = cms.string("hcalTowerSumEtConeDR03")
1097 process.PhotonToGsfElectron.variables.probe_HoverE  = cms.string("hadronicOverEm")
1098 process.PhotonToGsfElectron.variables.probe_sigmaIetaIeta = cms.string("sigmaIetaIeta")
1099 process.PhotonToGsfElectron.variables.probe_dist = cms.InputTag("PhotonConvRejVars","dist")
1100 process.PhotonToGsfElectron.variables.probe_dcot = cms.InputTag("PhotonConvRejVars","dcot")
1101 process.PhotonToGsfElectron.variables.probe_convradius = cms.InputTag("PhotonConvRejVars","convradius")
1102 process.PhotonToGsfElectron.variables.probe_passConvRej = cms.InputTag("PhotonConvRejVars","passConvRej")
1103 process.PhotonToGsfElectron.tagVariables.dRjet = cms.InputTag("GsfDRToNearestJet")
1104 process.PhotonToGsfElectron.tagVariables.nJets = cms.InputTag("JetMultiplicityInGsfEvents")
1105 process.PhotonToGsfElectron.tagVariables.eidCicVeryLoose = cms.InputTag("eidVeryLoose")
1106 process.PhotonToGsfElectron.tagVariables.eidCicLoose = cms.InputTag("eidLoose")
1107 process.PhotonToGsfElectron.tagVariables.eidCicMedium = cms.InputTag("eidMedium")
1108 process.PhotonToGsfElectron.tagVariables.eidCicTight = cms.InputTag("eidTight")
1109 process.PhotonToGsfElectron.tagVariables.eidCicSuperTight = cms.InputTag("eidSuperTight")
1110 process.PhotonToGsfElectron.tagVariables.eidCicHyperTight1 = cms.InputTag("eidHyperTight1")
1111 process.PhotonToGsfElectron.tagVariables.eidCicHyperTight2 = cms.InputTag("eidHyperTight2")
1112 process.PhotonToGsfElectron.tagVariables.eidCicHyperTight3 = cms.InputTag("eidHyperTight3")
1113 process.PhotonToGsfElectron.tagVariables.eidCicHyperTight4 = cms.InputTag("eidHyperTight4")
1114 process.PhotonToGsfElectron.tagVariables.eidLikelihood = cms.InputTag("eidLikelihoodExt")
1115 process.PhotonToGsfElectron.tagVariables.dist = cms.InputTag("GsfConvRejVars","dist")
1116 process.PhotonToGsfElectron.tagVariables.dcot = cms.InputTag("GsfConvRejVars","dcot")
1117 process.PhotonToGsfElectron.tagVariables.convradius = cms.InputTag("GsfConvRejVars","convradius")
1118 process.PhotonToGsfElectron.tagVariables.passConvRej = cms.InputTag("GsfConvRejVars","passConvRej")
1119 
1120 ##   ____      __       __    ___                 ___    _ 
1121 ##  / ___|___ / _|      \ \  |_ _|___  ___       |_ _|__| |
1122 ## | |  _/ __| |_   _____\ \  | |/ __|/ _ \       | |/ _` |
1123 ## | |_| \__ \  _| |_____/ /  | |\__ \ (_) |  _   | | (_| |
1124 ##  \____|___/_|        /_/  |___|___/\___/  ( ) |___\__,_|
1125 ##                                           |/            
1126 ##  gsf electron --> isolation, electron id  etc.
1127 process.GsfElectronToId = cms.EDAnalyzer("TagProbeFitTreeProducer",
1128     mcTruthCommonStuff, CommonStuffForGsfElectronProbe,                        
1129     tagProbePairs = cms.InputTag("tagGsf"),
1130     arbitration   = cms.string("Random2"),
1131     flags = cms.PSet(
1132         probe_isWP95 = cms.InputTag("PassingWP95"),
1133         probe_isWP90 = cms.InputTag("PassingWP90"),
1134         probe_isWP85 = cms.InputTag("PassingWP85"),        
1135         probe_isWP80 = cms.InputTag("PassingWP80"),
1136         probe_isWP70 = cms.InputTag("PassingWP70"),
1137         probe_isWP60 = cms.InputTag("PassingWP60"),
1138         probe_isCicVeryLoose = cms.InputTag("PassingCicVeryLoose"),
1139         probe_isCicLoose = cms.InputTag("PassingCicLoose"),
1140         probe_isCicMedium = cms.InputTag("PassingCicMedium"),
1141         probe_isCicTight = cms.InputTag("PassingCicTight"),
1142         probe_isCicSuperTight = cms.InputTag("PassingCicSuperTight"),          
1143         probe_isCicHyperTight1 = cms.InputTag("PassingCicHyperTight1"),
1144         probe_isCicHyperTight2 = cms.InputTag("PassingCicHyperTight2"),
1145         probe_isCicHyperTight3 = cms.InputTag("PassingCicHyperTight3"),
1146         probe_isCicHyperTight4 = cms.InputTag("PassingCicHyperTight4"),   
1147         probe_passingHLT = cms.InputTag("PassingHLT")        
1148     ),
1149     probeMatches  = cms.InputTag("McMatchGsf"),
1150     allProbes     = cms.InputTag("goodElectrons")
1151 )
1152 process.GsfElectronToId.variables.probe_dRjet = cms.InputTag("GsfDRToNearestJet")
1153 process.GsfElectronToId.variables.probe_nJets = cms.InputTag("JetMultiplicityInGsfEvents")
1154 process.GsfElectronToId.variables.probe_eidCicVeryLoose = cms.InputTag("eidVeryLoose")
1155 process.GsfElectronToId.variables.probe_eidCicLoose = cms.InputTag("eidLoose")
1156 process.GsfElectronToId.variables.probe_eidCicMedium = cms.InputTag("eidMedium")
1157 process.GsfElectronToId.variables.probe_eidCicTight = cms.InputTag("eidTight")
1158 process.GsfElectronToId.variables.probe_eidCicSuperTight = cms.InputTag("eidSuperTight")
1159 process.GsfElectronToId.variables.probe_eidCicHyperTight1 = cms.InputTag("eidHyperTight1")
1160 process.GsfElectronToId.variables.probe_eidCicHyperTight2 = cms.InputTag("eidHyperTight2")
1161 process.GsfElectronToId.variables.probe_eidCicHyperTight3 = cms.InputTag("eidHyperTight3")
1162 process.GsfElectronToId.variables.probe_eidCicHyperTight4 = cms.InputTag("eidHyperTight4")
1163 process.GsfElectronToId.variables.probe_eidLikelihood = cms.InputTag("eidLikelihoodExt")
1164 process.GsfElectronToId.variables.probe_dist = cms.InputTag("GsfConvRejVars","dist")
1165 process.GsfElectronToId.variables.probe_dcot = cms.InputTag("GsfConvRejVars","dcot")
1166 process.GsfElectronToId.variables.probe_convradius = cms.InputTag("GsfConvRejVars","convradius")
1167 process.GsfElectronToId.variables.probe_passConvRej = cms.InputTag("GsfConvRejVars","passConvRej")
1168 process.GsfElectronToId.tagVariables.dRjet = cms.InputTag("GsfDRToNearestJet")
1169 process.GsfElectronToId.tagVariables.nJets = cms.InputTag("JetMultiplicityInGsfEvents")
1170 process.GsfElectronToId.tagVariables.eidCicVeryLoose = cms.InputTag("eidVeryLoose")
1171 process.GsfElectronToId.tagVariables.eidCicLoose = cms.InputTag("eidLoose")
1172 process.GsfElectronToId.tagVariables.eidCicMedium = cms.InputTag("eidMedium")
1173 process.GsfElectronToId.tagVariables.eidCicTight = cms.InputTag("eidTight")
1174 process.GsfElectronToId.tagVariables.eidCicSuperTight = cms.InputTag("eidSuperTight")
1175 process.GsfElectronToId.tagVariables.eidCicHyperTight1 = cms.InputTag("eidHyperTight1")
1176 process.GsfElectronToId.tagVariables.eidCicHyperTight2 = cms.InputTag("eidHyperTight2")
1177 process.GsfElectronToId.tagVariables.eidCicHyperTight3 = cms.InputTag("eidHyperTight3")
1178 process.GsfElectronToId.tagVariables.eidCicHyperTight4 = cms.InputTag("eidHyperTight4")
1179 process.GsfElectronToId.tagVariables.eidLikelihood = cms.InputTag("eidLikelihoodExt")
1180 process.GsfElectronToId.tagVariables.dist = cms.InputTag("GsfConvRejVars","dist")
1181 process.GsfElectronToId.tagVariables.dcot = cms.InputTag("GsfConvRejVars","dcot")
1182 process.GsfElectronToId.tagVariables.convradius = cms.InputTag("GsfConvRejVars","convradius")
1183 process.GsfElectronToId.tagVariables.passConvRej = cms.InputTag("GsfConvRejVars","passConvRej")
1184 process.GsfElectronToId.pairVariables.costheta = cms.InputTag("CSVarsTagGsf","costheta")
1185 process.GsfElectronToId.pairVariables.sin2theta = cms.InputTag("CSVarsTagGsf","sin2theta")
1186 process.GsfElectronToId.pairVariables.tanphi = cms.InputTag("CSVarsTagGsf","tanphi")
1187 
1188 
1189 process.GsfElectronPlusGsfElectron = process.GsfElectronToId.clone()
1190 process.GsfElectronPlusGsfElectron.tagProbePairs = cms.InputTag("GsfGsf")
1191 process.GsfElectronPlusGsfElectron.tagMatches = cms.InputTag("McMatchGsf")
1192 process.GsfElectronPlusGsfElectron.pairVariables.costheta = cms.InputTag("CSVarsGsfGsf","costheta")
1193 process.GsfElectronPlusGsfElectron.pairVariables.sin2theta = cms.InputTag("CSVarsGsfGsf","sin2theta")
1194 process.GsfElectronPlusGsfElectron.pairVariables.tanphi = cms.InputTag("CSVarsGsfGsf","tanphi")
1195 if MC_flag:
1196     process.GsfElectronPlusGsfElectron.PUWeightSrc = cms.InputTag("pileupReweightingProducer","pileupWeights")
1197 
1198 
1199 process.GsfElectronPlusMet = process.GsfElectronToId.clone()
1200 process.GsfElectronPlusMet.tagProbePairs = cms.InputTag("elecMet")
1201 process.GsfElectronPlusMet.tagVariables = cms.PSet()
1202 process.GsfElectronPlusMet.pairVariables =  cms.PSet(ZVariablesToStore)
1203 process.GsfElectronPlusMet.pairFlags =  cms.PSet( isMTabove40 = cms.string("mt > 40") )
1204 process.GsfElectronPlusMet.isMC = cms.bool(False)
1205 
1206 
1207 ##    ___    _       __    _   _ _   _____ 
1208 ##   |_ _|__| |      \ \  | | | | | |_   _|
1209 ##    | |/ _` |  _____\ \ | |_| | |   | |  
1210 ##    | | (_| | |_____/ / |  _  | |___| |  
1211 ##   |___\__,_|      /_/  |_| |_|_____|_|
1212 ##
1213 ##  offline selection --> HLT. First specify which quantities to store in the TP tree. 
1214 if MC_flag:
1215     HLTmcTruthCommonStuff = cms.PSet(
1216         isMC = cms.bool(MC_flag),
1217         tagMatches = cms.InputTag("McMatchTag"),
1218         motherPdgId = cms.vint32(22,23),
1219         makeMCUnbiasTree = cms.bool(MC_flag),
1220         checkMotherInUnbiasEff = cms.bool(MC_flag),
1221         mcVariables = cms.PSet(
1222           probe_eta = cms.string("eta"),
1223           probe_phi  = cms.string("phi"),
1224           probe_et  = cms.string("et"),
1225           probe_charge = cms.string("charge"),
1226         ),
1227         mcFlags     =  cms.PSet(
1228           probe_flag = cms.string("pt>0")
1229         ),      
1230         )
1231 else:
1232      HLTmcTruthCommonStuff = cms.PSet(
1233          isMC = cms.bool(False)
1234          )
1235 
1236 ##  WP95 --> HLT
1237 process.WP95ToHLT = cms.EDAnalyzer("TagProbeFitTreeProducer",
1238     HLTmcTruthCommonStuff,                                
1239     variables = cms.PSet(
1240       probe_gsfEle_eta = cms.string("eta"),
1241       probe_gsfEle_phi  = cms.string("phi"),
1242       probe_gsfEle_et  = cms.string("et"),
1243       probe_gsfEle_charge = cms.string("charge"),
1244       probe_sc_et    = cms.string("superCluster.energy*sin(superClusterPosition.theta)"),    
1245       probe_sc_eta    = cms.string("superCluster.eta"), 
1246       probe_sc_phi    = cms.string("superCluster.phi"),
1247       probe_gsfEle_isEB           = cms.string("isEB"),
1248       probe_gsfEle_isEE           = cms.string("isEE"),
1249       probe_gsfEle_isGap          = cms.string("isGap"),
1250     ),
1251     addRunLumiInfo   =  cms.bool (False),
1252     addEventVariablesInfo   =  cms.bool (False),                                                        
1253     tagProbePairs = cms.InputTag("tagWP95"),
1254     arbitration   = cms.string("Random2"),
1255     flags = cms.PSet( 
1256         probe_passingHLT = cms.InputTag("PassingHLT")        
1257     ),
1258     probeMatches  = cms.InputTag("McMatchWP95"),
1259     allProbes     = cms.InputTag("PassingWP95")
1260 )
1261 if MC_flag:
1262     process.WP95ToHLT.PUWeightSrc = cms.InputTag("pileupReweightingProducer","pileupWeights")
1263 
1264 
1265 ##  WP90 --> HLT
1266 process.WP90ToHLT = process.WP95ToHLT.clone()
1267 process.WP90ToHLT.tagProbePairs = cms.InputTag("tagWP90")
1268 process.WP90ToHLT.probeMatches  = cms.InputTag("McMatchWP90")
1269 process.WP90ToHLT.allProbes     = cms.InputTag("PassingWP90")
1270 
1271 ##  WP85 --> HLT
1272 process.WP85ToHLT = process.WP95ToHLT.clone()
1273 process.WP85ToHLT.tagProbePairs = cms.InputTag("tagWP85")
1274 process.WP85ToHLT.probeMatches  = cms.InputTag("McMatchWP85")
1275 process.WP85ToHLT.allProbes     = cms.InputTag("PassingWP85")
1276 
1277 ##  WP80 --> HLT
1278 process.WP80ToHLT = process.WP95ToHLT.clone()
1279 process.WP80ToHLT.tagProbePairs = cms.InputTag("tagWP80")
1280 process.WP80ToHLT.probeMatches  = cms.InputTag("McMatchWP80")
1281 process.WP80ToHLT.allProbes     = cms.InputTag("PassingWP80")
1282 
1283 ##  WP70 --> HLT
1284 process.WP70ToHLT = process.WP95ToHLT.clone()
1285 process.WP70ToHLT.tagProbePairs = cms.InputTag("tagWP70")
1286 process.WP70ToHLT.probeMatches  = cms.InputTag("McMatchWP70")
1287 process.WP70ToHLT.allProbes     = cms.InputTag("PassingWP70")
1288 
1289 ##  WP60 --> HLT
1290 process.WP60ToHLT = process.WP95ToHLT.clone()
1291 process.WP60ToHLT.tagProbePairs = cms.InputTag("tagWP60")
1292 process.WP60ToHLT.probeMatches  = cms.InputTag("McMatchWP60")
1293 process.WP60ToHLT.allProbes     = cms.InputTag("PassingWP60")
1294 
1295 ##  CicVeryLoose --> HLT
1296 process.CicVeryLooseToHLT = process.WP95ToHLT.clone()
1297 process.CicVeryLooseToHLT.tagProbePairs = cms.InputTag("tagCicVeryLoose")
1298 process.CicVeryLooseToHLT.probeMatches  = cms.InputTag("McMatchCicVeryLoose")
1299 process.CicVeryLooseToHLT.allProbes     = cms.InputTag("PassingCicVeryLoose")
1300 
1301 ##  CicLoose --> HLT
1302 process.CicLooseToHLT = process.WP95ToHLT.clone()
1303 process.CicLooseToHLT.tagProbePairs = cms.InputTag("tagCicLoose")
1304 process.CicLooseToHLT.probeMatches  = cms.InputTag("McMatchCicLoose")
1305 process.CicLooseToHLT.allProbes     = cms.InputTag("PassingCicLoose")
1306 
1307 ##  CicMedium --> HLT
1308 process.CicMediumToHLT = process.WP95ToHLT.clone()
1309 process.CicMediumToHLT.tagProbePairs = cms.InputTag("tagCicMedium")
1310 process.CicMediumToHLT.probeMatches  = cms.InputTag("McMatchCicMedium")
1311 process.CicMediumToHLT.allProbes     = cms.InputTag("PassingCicMedium")
1312 
1313 ##  CicTight --> HLT
1314 process.CicTightToHLT = process.WP95ToHLT.clone()
1315 process.CicTightToHLT.tagProbePairs = cms.InputTag("tagCicTight")
1316 process.CicTightToHLT.probeMatches  = cms.InputTag("McMatchCicTight")
1317 process.CicTightToHLT.allProbes     = cms.InputTag("PassingCicTight")
1318 
1319 ##  CicSuperTight --> HLT
1320 process.CicSuperTightToHLT = process.WP95ToHLT.clone()
1321 process.CicSuperTightToHLT.tagProbePairs = cms.InputTag("tagCicSuperTight")
1322 process.CicSuperTightToHLT.probeMatches  = cms.InputTag("McMatchCicSuperTight")
1323 process.CicSuperTightToHLT.allProbes     = cms.InputTag("PassingCicSuperTight")
1324 
1325 ##  CicHyperTight1 --> HLT
1326 process.CicHyperTight1ToHLT = process.WP95ToHLT.clone()
1327 process.CicHyperTight1ToHLT.tagProbePairs = cms.InputTag("tagCicHyperTight1")
1328 process.CicHyperTight1ToHLT.probeMatches  = cms.InputTag("McMatchCicHyperTight1")
1329 process.CicHyperTight1ToHLT.allProbes     = cms.InputTag("PassingCicHyperTight1")
1330 
1331 ##  CicHyperTight2 --> HLT
1332 process.CicHyperTight2ToHLT = process.WP95ToHLT.clone()
1333 process.CicHyperTight2ToHLT.tagProbePairs = cms.InputTag("tagCicHyperTight2")
1334 process.CicHyperTight2ToHLT.probeMatches  = cms.InputTag("McMatchCicHyperTight2")
1335 process.CicHyperTight2ToHLT.allProbes     = cms.InputTag("PassingCicHyperTight2")
1336 
1337 ##  CicHyperTight3 --> HLT
1338 process.CicHyperTight3ToHLT = process.WP95ToHLT.clone()
1339 process.CicHyperTight3ToHLT.tagProbePairs = cms.InputTag("tagCicHyperTight3")
1340 process.CicHyperTight3ToHLT.probeMatches  = cms.InputTag("McMatchCicHyperTight3")
1341 process.CicHyperTight3ToHLT.allProbes     = cms.InputTag("PassingCicHyperTight3")
1342 
1343 ##  CicHyperTight4 --> HLT
1344 process.CicHyperTight4ToHLT = process.WP95ToHLT.clone()
1345 process.CicHyperTight4ToHLT.tagProbePairs = cms.InputTag("tagCicHyperTight4")
1346 process.CicHyperTight4ToHLT.probeMatches  = cms.InputTag("McMatchCicHyperTight4")
1347 process.CicHyperTight4ToHLT.allProbes     = cms.InputTag("PassingCicHyperTight4")
1348 
1349 
1350 process.tree_sequence = cms.Sequence(
1351     process.SuperClusterToGsfElectron +
1352     process.PhotonToGsfElectron +
1353     process.GsfElectronToId +
1354     process.GsfElectronPlusGsfElectron +
1355     process.GsfElectronPlusMet + 
1356     process.WP95ToHLT +
1357     process.WP90ToHLT +
1358     process.WP85ToHLT + 
1359     process.WP80ToHLT +
1360     process.WP70ToHLT + 
1361     process.WP60ToHLT +
1362     process.CicVeryLooseToHLT +
1363     process.CicLooseToHLT +
1364     process.CicMediumToHLT +
1365     process.CicTightToHLT +
1366     process.CicSuperTightToHLT +
1367     process.CicHyperTight1ToHLT +
1368     process.CicHyperTight2ToHLT +
1369     process.CicHyperTight3ToHLT +
1370     process.CicHyperTight4ToHLT        
1371 )    
1372 
1373 ##    ____       _   _     
1374 ##   |  _ \ __ _| |_| |__  
1375 ##   | |_) / _` | __| '_ \ 
1376 ##   |  __/ (_| | |_| | | |
1377 ##   |_|   \__,_|\__|_| |_|
1378 ##
1379 
1380 if MC_flag:
1381     process.tagAndProbe = cms.Path(
1382         process.sc_sequence + process.eIDSequence + process.ele_sequence + 
1383         process.ext_ToNearestJet_sequence + 
1384         process.allTagsAndProbes + process.pileupReweightingProducer + 
1385         process.mc_sequence + 
1386         process.tree_sequence
1387         )
1388 else:
1389     process.tagAndProbe = cms.Path(
1390         process.sc_sequence + process.eIDSequence + process.ele_sequence + 
1391         process.ext_ToNearestJet_sequence + 
1392         process.allTagsAndProbes +
1393         process.tree_sequence
1394         )
1395     
1396 process.TFileService = cms.Service(
1397     "TFileService", fileName = cms.string( OUTPUT_FILE_NAME )
1398     )