Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 import FWCore.ParameterSet.Config as cms
0002 
0003 ##                      _              _       
0004 ##   ___ ___  _ __  ___| |_ __ _ _ __ | |_ ___ 
0005 ##  / __/ _ \| '_ \/ __| __/ _` | '_ \| __/ __|
0006 ## | (_| (_) | | | \__ \ || (_| | | | | |_\__ \
0007 ##  \___\___/|_| |_|___/\__\__,_|_| |_|\__|___/
0008 ##                                              
0009 ########################
0010 MC_flag = False
0011 #GLOBAL_TAG = "GR_R_38X_V13::All"
0012 GLOBAL_TAG = 'GR_R_39X_V4::All'
0013 OUTPUT_FILE_NAME = "Photon_tagProbeTree.root"
0014 HLTPath1 = "HLT_Photon50_Cleaned_L1R_v1"
0015 HLTPath2 = "HLT_Photon30_Cleaned_L1R_v1"
0016 HLTPath3 = "HLT_Photon20_Cleaned_L1R"
0017 #InputTagProcess = "REDIGI36X"
0018 InputTagProcess = "HLT"
0019 RECOProcess = "RECO"
0020 JET_COLL = "ak5PFJets"
0021 JET_CUTS = "abs(eta)<2.6 && chargedHadronEnergyFraction>0 && electronEnergyFraction<0.1 && nConstituents>1 && neutralHadronEnergyFraction<0.99 && neutralEmEnergyFraction<0.99 && pt>15.0" 
0022 ELECTRON_ET_CUT_MIN = 20.0
0023 ELECTRON_COLL = "gsfElectrons"
0024 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) + ")"
0025 
0026 ##    ___            _           _      
0027 ##   |_ _|_ __   ___| |_   _  __| | ___ 
0028 ##    | || '_ \ / __| | | | |/ _` |/ _ \
0029 ##    | || | | | (__| | |_| | (_| |  __/
0030 ##   |___|_| |_|\___|_|\__,_|\__,_|\___|
0031 
0032 process = cms.Process("TagProbe")
0033 #stuff needed for prescales
0034 process.load('Configuration.StandardSequences.FrontierConditions_GlobalTag_cff')
0035 process.GlobalTag.globaltag = GLOBAL_TAG
0036 process.load('FWCore.MessageService.MessageLogger_cfi')
0037 process.load("SimGeneral.HepPDTESSource.pythiapdt_cfi")
0038 ##process.options = cms.untracked.PSet(wantSummary = cms.untracked.bool(True),
0039 ##                                     SkipEvent = cms.untracked.vstring('ProductNotFound')
0040 ##                                     )
0041 process.MessageLogger.cerr.FwkReport.reportEvery = 1000
0042 
0043 ##   ____             _ ____                           
0044 ##  |  _ \ ___   ___ | / ___|  ___  _   _ _ __ ___ ___ 
0045 ##  | |_) / _ \ / _ \| \___ \ / _ \| | | | '__/ __/ _ \
0046 ##  |  __/ (_) | (_) | |___) | (_) | |_| | | | (_|  __/
0047 ##  |_|   \___/ \___/|_|____/ \___/ \__,_|_|  \___\___|
0048 ##  
0049 
0050 readFiles = cms.untracked.vstring()
0051 
0052 process.source = cms.Source("PoolSource", 
0053                             fileNames = readFiles
0054                             )
0055 readFiles.extend([
0056     #FILES
0057     ])
0058 
0059 process.maxEvents = cms.untracked.PSet( input = cms.untracked.int32(-1) )    
0060 process.source.inputCommands = cms.untracked.vstring("keep *","drop *_MEtoEDMConverter_*_*")
0061 
0062 
0063 
0064 ##  ____  _           _                                _               
0065 ## |  _ \| |__   ___ | |_ ___  _ __    _ __  _ __ ___ | |__   ___  ___ 
0066 ## | |_) | '_ \ / _ \| __/ _ \| '_ \  | '_ \| '__/ _ \| '_ \ / _ \/ __|
0067 ## |  __/| | | | (_) | || (_) | | | | | |_) | | | (_) | |_) |  __/\__ \
0068 ## |_|   |_| |_|\___/ \__\___/|_| |_| | .__/|_|  \___/|_.__/ \___||___/
0069 ##                                    |_|                              
0070 
0071 #basic probe photon selection
0072 #keep EB and EE efficiencies separate
0073 #loose track match requirement cuts down on non-Z-electron background
0074 process.probePhotons = cms.EDProducer("TrackMatchedPhotonProducer",
0075     srcObject = cms.InputTag("photons", "", RECOProcess),
0076     srcObjectsToMatch = cms.VInputTag(cms.InputTag("generalTracks")),
0077     srcObjectSelection = cms.string("et>20.0 && abs(eta)<2.5"),
0078     srcObjectsToMatchSelection = cms.string('pt > 20.0 && quality("highPurity")'),  
0079     deltaRMax = cms.double(0.3)
0080     )
0081 
0082 ##     ___           _       _   _             
0083 ##    |_ _|___  ___ | | __ _| |_(_) ___  _ __  
0084 ##     | |/ __|/ _ \| |/ _` | __| |/ _ \| '_ \ 
0085 ##     | |\__ \ (_) | | (_| | |_| | (_) | | | |
0086 ##    |___|___/\___/|_|\__,_|\__|_|\___/|_| |_|
0087 
0088                                          
0089 #  Isolation ################
0090 #ECAL and HCAL only
0091 process.photonIsolation = cms.EDFilter("PhotonRefSelector",
0092     src = cms.InputTag("probePhotons"),
0093     cut = cms.string(
0094     "(ecalRecHitSumEtConeDR04 < (0.006*pt + 4.2))"
0095     " && (hcalTowerSumEtConeDR04 < (0.0025*pt + 2.2 ))"
0096     )
0097 )
0098 
0099 ##  ____  _           _                ___    _ 
0100 ## |  _ \| |__   ___ | |_ ___  _ __   |_ _|__| |
0101 ## | |_) | '_ \ / _ \| __/ _ \| '_ \   | |/ _` |
0102 ## |  __/| | | | (_) | || (_) | | | |  | | (_| |
0103 ## |_|   |_| |_|\___/ \__\___/|_| |_| |___\__,_|
0104 ##        
0105 #track isolation
0106 process.photonIDsusydiphoton = process.photonIsolation.clone()
0107 process.photonIDsusydiphoton.cut = cms.string(
0108     "(hadronicOverEm < 0.05) && (trkSumPtHollowConeDR04 < (0.001*pt + 2.0)"
0109     " && (sigmaIetaIeta < 0.013))"
0110     )
0111 
0112 process.photonIDiso = process.photonIsolation.clone()
0113 process.photonIDiso.cut = cms.string(
0114     "hadronicOverEm < 0.05 && ecalRecHitSumEtConeDR04 < 2.4"
0115     "&& hcalTowerSumEtConeDR04 < 1.0 && trkSumPtHollowConeDR04 < 0.9"
0116     " &&sigmaIetaIeta > 0.001"
0117     )
0118 
0119 process.photonIDreliso = process.photonIsolation.clone()
0120 process.photonIDreliso.cut = cms.string(
0121     "hadronicOverEm < 0.05 && ecalRecHitSumEtConeDR04 < 4.2+0.001*pt"
0122     " && hcalTowerSumEtConeDR04 < 2.2+0.003*pt"
0123     " && trkSumPtHollowConeDR04 < 2+0.001*pt && sigmaIetaIeta > 0.001"
0124     )
0125 
0126 process.photonIDreliso2 = process.photonIsolation.clone()
0127 process.photonIDreliso2.cut = cms.string(
0128     "hadronicOverEm < 0.05 && ecalRecHitSumEtConeDR04 < 4.2+0.001*pt"
0129     " && hcalTowerSumEtConeDR04 < 2.2+0.003*pt && sigmaIetaIeta > 0.001"
0130     )
0131 
0132 
0133 ##    _____     _                         __  __       _       _     _             
0134 ##   |_   _| __(_) __ _  __ _  ___ _ __  |  \/  | __ _| |_ ___| |__ (_)_ __   __ _ 
0135 ##     | || '__| |/ _` |/ _` |/ _ \ '__| | |\/| |/ _` | __/ __| '_ \| | '_ \ / _` |
0136 ##     | || |  | | (_| | (_| |  __/ |    | |  | | (_| | || (__| | | | | | | | (_| |
0137 ##     |_||_|  |_|\__, |\__, |\___|_|    |_|  |_|\__,_|\__\___|_| |_|_|_| |_|\__, |
0138 ##                |___/ |___/                                                |___/ 
0139 ##   
0140 process.probePhotonsPassingHLT = cms.EDProducer(
0141     "trgMatchedPhotonProducer",                     
0142     InputProducer = cms.InputTag("probePhotons"),
0143     hltTags = cms.VInputTag(
0144     cms.InputTag(HLTPath1,"",InputTagProcess),
0145     cms.InputTag(HLTPath2,"",InputTagProcess),
0146     cms.InputTag(HLTPath3,"",InputTagProcess),
0147     ),
0148     triggerEventTag = cms.untracked.InputTag("hltTriggerSummaryAOD","",InputTagProcess),
0149     triggerResultsTag = cms.untracked.InputTag("TriggerResults", "", InputTagProcess)
0150     )
0151 
0152 
0153 ##    _____      _                        _  __     __             
0154 ##   | ____|_  _| |_ ___ _ __ _ __   __ _| | \ \   / /_ _ _ __ ___ 
0155 ##   |  _| \ \/ / __/ _ \ '__| '_ \ / _` | |  \ \ / / _` | '__/ __|
0156 ##   | |___ >  <| ||  __/ |  | | | | (_| | |   \ V / (_| | |  \__ \
0157 ##   |_____/_/\_\\__\___|_|  |_| |_|\__,_|_|    \_/ \__,_|_|  |___/
0158 ##   
0159 
0160 ## Here we show how to use a module to compute an external variable
0161 #producer of dR < 0.5 photon-cleaned jets
0162 process.cleanJets = cms.EDProducer("JetViewCleaner",
0163     srcObject = cms.InputTag(JET_COLL, "", "RECO"),
0164     srcObjectSelection = cms.string(JET_CUTS),
0165     srcObjectsToRemove = cms.VInputTag( cms.InputTag("photons", "", RECOProcess)),
0166     deltaRMin = cms.double(0.5)  
0167     )
0168 
0169 
0170 #produce dR(photon, nearest IDed uncorrected jet passing cuts on corrected eta and pT)
0171 process.photonDRToNearestJet = cms.EDProducer("DeltaRNearestJetComputer",
0172     probes = cms.InputTag("probePhotons"),
0173        # ^^--- NOTA BENE: if probes are defined by ref, as in this case, 
0174        #       this must be the full collection, not the subset by refs.
0175     objects = cms.InputTag("cleanJets"),
0176     objectSelection = cms.string(JET_CUTS)
0177 )
0178 
0179 
0180 #count jets passing cuts
0181 process.JetMultiplicity = cms.EDProducer("CandMultiplicityCounter",
0182     probes = cms.InputTag("probePhotons"),
0183     objects = cms.InputTag("cleanJets"),
0184     objectSelection = cms.string(JET_CUTS),
0185     )
0186 
0187 
0188 process.ext_ToNearestJet_sequence = cms.Sequence(
0189     process.cleanJets + 
0190     process.photonDRToNearestJet +
0191     process.JetMultiplicity
0192     )
0193 
0194 
0195 ##    _____             ____        __ _       _ _   _             
0196 ##   |_   _|_ _  __ _  |  _ \  ___ / _(_)_ __ (_) |_(_) ___  _ __  
0197 ##     | |/ _` |/ _` | | | | |/ _ \ |_| | '_ \| | __| |/ _ \| '_ \ 
0198 ##     | | (_| | (_| | | |_| |  __/  _| | | | | | |_| | (_) | | | |
0199 ##     |_|\__,_|\__, | |____/ \___|_| |_|_| |_|_|\__|_|\___/|_| |_|
0200 ##              |___/                                              
0201 
0202 ## tag should be a well reconstructed electron. We use VBTF WP80.
0203 process.ElectronPassingWP80 = cms.EDFilter("GsfElectronRefSelector",
0204     src = cms.InputTag( ELECTRON_COLL ),
0205     cut = cms.string( ELECTRON_CUTS  +
0206     " && (gsfTrack.hitPattern().numberOfLostHits(\'MISSING_INNER_HITS\') == 0 && !(-0.02<convDist<0.02 && -0.02<convDcot<0.02))"
0207     " && ((isEB"
0208     " && ( dr03TkSumPt/p4.Pt <0.09 && dr03EcalRecHitSumEt/p4.Pt < 0.07 && dr03HcalTowerSumEt/p4.Pt  < 0.1 )"
0209     " && (sigmaIetaIeta<0.01)"
0210     " && ( -0.06<deltaPhiSuperClusterTrackAtVtx<0.06 )"
0211     " && ( -0.004<deltaEtaSuperClusterTrackAtVtx<0.004 )"
0212     " && (hadronicOverEm<0.04)"
0213     ")"
0214     " || (isEE"
0215     " && ( dr03TkSumPt/p4.Pt <0.04 && dr03EcalRecHitSumEt/p4.Pt < 0.05 && dr03HcalTowerSumEt/p4.Pt  < 0.025 )"
0216     " && (sigmaIetaIeta<0.03)"
0217     " && ( -0.03<deltaPhiSuperClusterTrackAtVtx<0.03 )"
0218     " && ( -0.007<deltaEtaSuperClusterTrackAtVtx<0.007 )"
0219     " && (hadronicOverEm<0.025) "
0220     "))"
0221     ) 
0222 )
0223 
0224 process.Tag = process.ElectronPassingWP80.clone()
0225 process.photon_sequence = cms.Sequence(
0226     process.probePhotons +
0227     process.photonIsolation +
0228     process.photonIDsusydiphoton +
0229     process.photonIDiso +
0230     process.photonIDreliso +
0231     process.photonIDreliso2 +
0232     process.probePhotonsPassingHLT + 
0233     process.ElectronPassingWP80 +
0234     process.Tag
0235     )
0236 
0237 
0238 ##    _____ ___   ____    ____       _          
0239 ##   |_   _( _ ) |  _ \  |  _ \ __ _(_)_ __ ___ 
0240 ##     | | / _ \/\ |_) | | |_) / _` | | '__/ __|
0241 ##     | || (_>  <  __/  |  __/ (_| | | |  \__ \
0242 ##     |_| \___/\/_|     |_|   \__,_|_|_|  |___/
0243 ##                                              
0244 ##   
0245 #  Tag & probe selection ######
0246 process.tagPhoton = cms.EDProducer("CandViewShallowCloneCombiner",
0247                                    decay = cms.string("Tag probePhotons"),
0248                                    checkCharge = cms.bool(False),
0249                                    cut = cms.string("60 < mass < 120")
0250                                    )
0251 process.tagphotonIDsusydiphoton = process.tagPhoton.clone()
0252 process.tagphotonIDsusydiphoton.decay = cms.string("Tag photonIDsusydiphoton")
0253 process.tagphotonIDiso = process.tagPhoton.clone()
0254 process.tagphotonIDiso.decay = cms.string("Tag photonIDiso")
0255 process.tagphotonIDreliso = process.tagPhoton.clone()
0256 process.tagphotonIDreliso.decay = cms.string("Tag photonIDreliso")
0257 process.tagphotonIDreliso2 = process.tagPhoton.clone()
0258 process.tagphotonIDreliso2.decay = cms.string("Tag photonIDreliso2")
0259 
0260 process.allTagsAndProbes = cms.Sequence(
0261     process.tagPhoton +
0262     process.tagphotonIDsusydiphoton +
0263     process.tagphotonIDiso +
0264     process.tagphotonIDreliso +
0265     process.tagphotonIDreliso2 
0266 )
0267 
0268 
0269 ##    __  __  ____   __  __       _       _               
0270 ##   |  \/  |/ ___| |  \/  | __ _| |_ ___| |__   ___  ___ 
0271 ##   | |\/| | |     | |\/| |/ _` | __/ __| '_ \ / _ \/ __|
0272 ##   | |  | | |___  | |  | | (_| | || (__| | | |  __/\__ \
0273 ##   |_|  |_|\____| |_|  |_|\__,_|\__\___|_| |_|\___||___/
0274 ##                                                        
0275 
0276 process.McMatchTag = cms.EDFilter("MCTruthDeltaRMatcherNew",
0277     matchPDGId = cms.vint32(11),
0278     src = cms.InputTag("Tag"),
0279     distMin = cms.double(0.3),
0280     matched = cms.InputTag("genParticles"),
0281     checkCharge = cms.bool(True)
0282 )
0283 process.McMatchPhoton = process.McMatchTag.clone()
0284 process.McMatchPhoton.src = cms.InputTag("probePhotons")
0285 process.McMatchId_susy_diphoton = process.McMatchTag.clone()
0286 process.McMatchId_susy_diphoton.src = cms.InputTag("photonIDsusydiphoton")
0287 process.McMatchId_iso = process.McMatchTag.clone()
0288 process.McMatchId_iso.src = cms.InputTag("photonIDiso")
0289 process.McMatchId_rel_iso = process.McMatchTag.clone()
0290 process.McMatchId_rel_iso.src = cms.InputTag("photonIDreliso")
0291 process.McMatchId_rel_iso_2 = process.McMatchTag.clone()
0292 process.McMatchId_rel_iso_2.src = cms.InputTag("photonIDreliso2")
0293 process.McMatchHLT = process.McMatchTag.clone()
0294 process.McMatchHLT.src = cms.InputTag("probePhotonsPassingHLT")
0295 
0296 process.mc_sequence = cms.Sequence(
0297    process.McMatchTag +
0298    process.McMatchPhoton +
0299    process.McMatchId_susy_diphoton  +
0300    process.McMatchId_iso +
0301    process.McMatchId_rel_iso +
0302    process.McMatchId_rel_iso_2 +
0303    process.McMatchHLT
0304 )
0305 
0306 ############################################################################
0307 ##    _____           _       _ ____            _            _   _  ____  ##
0308 ##   |_   _|_ _  __ _( )_ __ ( )  _ \ _ __ ___ | |__   ___  | \ | |/ ___| ##
0309 ##     | |/ _` |/ _` |/| '_ \|/| |_) | '__/ _ \| '_ \ / _ \ |  \| | |  _  ##
0310 ##     | | (_| | (_| | | | | | |  __/| | | (_) | |_) |  __/ | |\  | |_| | ##
0311 ##     |_|\__,_|\__, | |_| |_| |_|   |_|  \___/|_.__/ \___| |_| \_|\____| ##
0312 ##              |___/                                                     ##
0313 ##                                                                        ##
0314 ############################################################################
0315 ##    ____                      _     _           
0316 ##   |  _ \ ___ _   _ ___  __ _| |__ | | ___  ___ 
0317 ##   | |_) / _ \ | | / __|/ _` | '_ \| |/ _ \/ __|
0318 ##   |  _ <  __/ |_| \__ \ (_| | |_) | |  __/\__ \
0319 ##   |_| \_\___|\__,_|___/\__,_|_.__/|_|\___||___/
0320 
0321 
0322 ## I define some common variables for re-use later.
0323 ## This will save us repeating the same code for each efficiency category
0324 
0325 ZVariablesToStore = cms.PSet(
0326     eta = cms.string("eta"),
0327     pt  = cms.string("pt"),
0328     phi  = cms.string("phi"),
0329     et  = cms.string("et"),
0330     e  = cms.string("energy"),
0331     p  = cms.string("p"),
0332     px  = cms.string("px"),
0333     py  = cms.string("py"),
0334     pz  = cms.string("pz"),
0335     theta  = cms.string("theta"),    
0336     vx     = cms.string("vx"),
0337     vy     = cms.string("vy"),
0338     vz     = cms.string("vz"),
0339     rapidity  = cms.string("rapidity"),
0340     mass  = cms.string("mass"),
0341     mt  = cms.string("mt"),    
0342 )   
0343 
0344 
0345 TagPhotonVariablesToStore = cms.PSet(
0346     eta = cms.string("eta"),
0347     pt  = cms.string("pt"),
0348     phi  = cms.string("phi"),
0349     px  = cms.string("px"),
0350     py  = cms.string("py"),
0351     pz  = cms.string("pz"),
0352     ## super cluster quantities
0353     sc_energy = cms.string("superCluster.energy"),
0354     sc_et     = cms.string("superCluster.energy*sin(superCluster.position.theta)"),    
0355     sc_eta    = cms.string("superCluster.eta"),
0356     sc_phi    = cms.string("superCluster.phi"),
0357 )
0358 
0359 
0360 ProbePhotonVariablesToStore = cms.PSet(
0361         probe_eta = cms.string("eta"),
0362         probe_phi  = cms.string("phi"),
0363         probe_et  = cms.string("et"),
0364         probe_px  = cms.string("px"),
0365         probe_py  = cms.string("py"),
0366         probe_pz  = cms.string("pz"),
0367         ## isolation 
0368         probe_trkSumPtHollowConeDR03 = cms.string("trkSumPtHollowConeDR03"),
0369         probe_ecalRecHitSumEtConeDR03  = cms.string("ecalRecHitSumEtConeDR03"),
0370         probe_hcalTowerSumEtConeDR03  = cms.string("hcalTowerSumEtConeDR03"),
0371         probe_trkSumPtHollowConeDR04 = cms.string("trkSumPtHollowConeDR04"),
0372         probe_ecalRecHitSumEtConeDR04  = cms.string("ecalRecHitSumEtConeDR04"),
0373         probe_hcalTowerSumEtConeDR04  = cms.string("hcalTowerSumEtConeDR04"),
0374         ## booleans
0375         probe_isPhoton  = cms.string("isPhoton"),     
0376 
0377         ## Hcal energy over Ecal Energy
0378         probe_hadronicOverEm = cms.string("hadronicOverEm"),
0379         ## Cluster shape information
0380         probe_sigmaIetaIeta = cms.string("sigmaIetaIeta"),
0381         ## Pixel seed
0382         probe_hasPixelSeed = cms.string("hasPixelSeed")
0383 )
0384 
0385 
0386 CommonStuffForPhotonProbe = cms.PSet(
0387    variables = cms.PSet(ProbePhotonVariablesToStore),
0388    #fillTagTree      =  cms.bool (True),
0389    addRunLumiInfo   =  cms.bool (True),
0390    addEventVariablesInfo   =  cms.bool (True),
0391    pairVariables =  cms.PSet(ZVariablesToStore),
0392    pairFlags     =  cms.PSet(
0393           mass60to120 = cms.string("60 < mass < 120")
0394     ),
0395     tagVariables   =  cms.PSet(TagPhotonVariablesToStore),
0396     tagFlags     =  cms.PSet(
0397           flag = cms.string("pt>0")
0398     ),    
0399 )
0400 
0401 
0402 
0403 if MC_flag:
0404     mcTruthCommonStuff = cms.PSet(
0405         isMC = cms.bool(MC_flag),
0406         tagMatches = cms.InputTag("McMatchTag"),
0407         motherPdgId = cms.vint32(22,23),
0408         makeMCUnbiasTree = cms.bool(MC_flag),
0409         checkMotherInUnbiasEff = cms.bool(MC_flag),
0410         mcVariables = cms.PSet(
0411         probe_eta = cms.string("eta"),
0412         probe_pt  = cms.string("pt"),
0413         probe_phi  = cms.string("phi"),
0414         probe_et  = cms.string("et"),
0415         probe_e  = cms.string("energy"),
0416         probe_p  = cms.string("p"),
0417         probe_px  = cms.string("px"),
0418         probe_py  = cms.string("py"),
0419         probe_pz  = cms.string("pz"),
0420         probe_theta  = cms.string("theta"),    
0421         probe_vx     = cms.string("vx"),
0422         probe_vy     = cms.string("vy"),
0423         probe_vz     = cms.string("vz"),   
0424         probe_charge = cms.string("charge"),
0425         probe_rapidity  = cms.string("rapidity"),    
0426         probe_mass  = cms.string("mass"),
0427         probe_mt  = cms.string("mt"),    
0428         ),
0429         mcFlags     =  cms.PSet(
0430         probe_flag = cms.string("pt>0")
0431         ),      
0432         )
0433 else:
0434      mcTruthCommonStuff = cms.PSet(
0435          isMC = cms.bool(False)
0436          )
0437 
0438 
0439 ##    ___                 ___    _ 
0440 ##  |_ _|___  ___       |_ _|__| |
0441 ##   | |/ __|/ _ \       | |/ _` |
0442 ##   | |\__ \ (_) |  _   | | (_| |
0443 ##   |___|___/\___/  ( ) |___\__,_|
0444 ##                   |/            
0445 ##  Photon --> isolation, id  etc.
0446 
0447 process.PhotonToIsoId = cms.EDAnalyzer("TagProbeFitTreeProducer",
0448     ## pick the defaults
0449     mcTruthCommonStuff,
0450     CommonStuffForPhotonProbe,
0451     # choice of tag and probe pairs, and arbitration                 
0452     tagProbePairs = cms.InputTag("tagPhoton"),
0453     arbitration   = cms.string("None"),                      
0454     flags = cms.PSet(
0455         probe_passingIso = cms.InputTag("photonIsolation"),
0456         probe_passingHLT = cms.InputTag("probePhotonsPassingHLT"),
0457         probe_passingId_susy_diphoton = cms.InputTag("photonIDsusydiphoton"),
0458         probe_passingId_iso = cms.InputTag("photonIDiso"),
0459         probe_passingId_rel_iso = cms.InputTag("photonIDreliso"),
0460         probe_passingId_rel_iso_2 = cms.InputTag("photonIDreliso2"),
0461     ),
0462     probeMatches  = cms.InputTag("McMatchPhoton"),
0463     allProbes     = cms.InputTag("probePhotons")
0464 )
0465 process.PhotonToIsoId.variables.probe_dRjet = cms.InputTag("photonDRToNearestJet")
0466 process.PhotonToIsoId.variables.probe_nJets = cms.InputTag("JetMultiplicity")
0467 
0468 
0469 
0470 ##    ___    _       __    _   _ _   _____ 
0471 ##   |_ _|__| |      \ \  | | | | | |_   _|
0472 ##    | |/ _` |  _____\ \ | |_| | |   | |  
0473 ##    | | (_| | |_____/ / |  _  | |___| |  
0474 ##   |___\__,_|      /_/  |_| |_|_____|_|  
0475 
0476 ##  offline selection --> HLT. First specify which quantities to store in the TP tree. 
0477 if MC_flag:
0478     HLTmcTruthCommonStuff = cms.PSet(
0479         isMC = cms.bool(MC_flag),
0480         tagMatches = cms.InputTag("McMatchTag"),
0481         motherPdgId = cms.vint32(22,23),
0482         makeMCUnbiasTree = cms.bool(MC_flag),
0483         checkMotherInUnbiasEff = cms.bool(MC_flag),
0484         mcVariables = cms.PSet(
0485           probe_eta = cms.string("eta"),
0486           probe_phi  = cms.string("phi"),
0487           probe_et  = cms.string("et"),
0488           probe_charge = cms.string("charge"),
0489         ),
0490         mcFlags     =  cms.PSet(
0491           probe_flag = cms.string("pt>0")
0492         ),      
0493         )
0494 else:
0495      HLTmcTruthCommonStuff = cms.PSet(
0496          isMC = cms.bool(False)
0497          )
0498 
0499 
0500 process.photonIDsusydiphotonToHLT = cms.EDAnalyzer("TagProbeFitTreeProducer",
0501     HLTmcTruthCommonStuff,                                
0502     variables = cms.PSet(
0503       probe_eta = cms.string("eta"),
0504       probe_phi  = cms.string("phi"),
0505       probe_et  = cms.string("et"),
0506     ),
0507     addRunLumiInfo   =  cms.bool (False),
0508     addEventVariablesInfo   =  cms.bool (False),                                                        
0509     tagProbePairs = cms.InputTag("tagphotonIDsusydiphoton"),
0510     arbitration   = cms.string("None"),
0511     flags = cms.PSet( 
0512         probe_passingHLT = cms.InputTag("probePhotonsPassingHLT")        
0513     ),
0514     probeMatches  = cms.InputTag("McMatchId_susy_diphoton"),
0515     allProbes     = cms.InputTag("photonIDsusydiphoton")
0516 )
0517 
0518 process.photonIDisoToHLT = process.photonIDsusydiphotonToHLT.clone()
0519 process.photonIDisoToHLT.tagProbePairs = cms.InputTag("tagphotonIDiso")
0520 process.photonIDisoToHLT.probeMatches  = cms.InputTag("McMatchId_iso")
0521 process.photonIDisoToHLT.allProbes     = cms.InputTag("photonIDiso")
0522 
0523 process.photonIDrelisoToHLT = process.photonIDsusydiphotonToHLT.clone()
0524 process.photonIDrelisoToHLT.tagProbePairs = cms.InputTag("tagphotonIDreliso")
0525 process.photonIDrelisoToHLT.probeMatches  = cms.InputTag("McMatchId_rel_iso")
0526 process.photonIDrelisoToHLT.allProbes     = cms.InputTag("photonIDreliso")
0527 
0528 process.photonIDreliso2ToHLT = process.photonIDsusydiphotonToHLT.clone()
0529 process.photonIDreliso2ToHLT.tagProbePairs = cms.InputTag("tagphotonIDreliso2")
0530 process.photonIDreliso2ToHLT.probeMatches  = cms.InputTag("McMatchId_rel_iso_2")
0531 process.photonIDreliso2ToHLT.allProbes     = cms.InputTag("photonIDreliso2")
0532 
0533 
0534 
0535 process.tree_sequence = cms.Sequence(
0536     process.PhotonToIsoId +
0537     process.photonIDsusydiphotonToHLT +
0538     process.photonIDisoToHLT +
0539     process.photonIDrelisoToHLT +
0540     process.photonIDreliso2ToHLT
0541 )    
0542 
0543 ##    ____       _   _     
0544 ##   |  _ \ __ _| |_| |__  
0545 ##   | |_) / _` | __| '_ \ 
0546 ##   |  __/ (_| | |_| | | |
0547 ##   |_|   \__,_|\__|_| |_|
0548 ##
0549 
0550 if MC_flag:
0551     process.tagAndProbe = cms.Path(
0552         process.photon_sequence +
0553         process.ext_ToNearestJet_sequence + 
0554         process.allTagsAndProbes +
0555         process.mc_sequence + 
0556         process.tree_sequence
0557         )
0558 else:
0559     process.tagAndProbe = cms.Path(
0560         process.photon_sequence +
0561         process.ext_ToNearestJet_sequence + 
0562         process.allTagsAndProbes +
0563         process.tree_sequence
0564         )
0565 
0566 process.TFileService = cms.Service("TFileService",
0567                                    fileName = cms.string(OUTPUT_FILE_NAME)
0568                                    )