//-------------------------------------------------------------------------------------------------- void runH4lSkim(const char *fileset = "0000", const char *skim = "noskim", const char *dataset = "r11b-pho-pr-v1", const char *book = "local/filefi/025", const char *catalogDir = "/home/cmsprod/catalog", const char *outputName = "h4l", int nEvents = 1000) { //------------------------------------------------------------------------------------------------ // some parameters get passed through the environment //------------------------------------------------------------------------------------------------ char json[1024], overlap[1024], path[1024]; float overlapCut = -1; if (decodeEnv(json,overlap,overlapCut,path) != 0) return; TString jsonFile = TString("/home/cmsprod/cms/json/") + TString(json); Bool_t isData = (jsonFile.CompareTo("/home/cmsprod/cms/json/~") != 0); printf("\n Initialization worked: \n\n"); printf(" JSON : %s (file: %s)\n", json,jsonFile.Data()); printf(" OVERLAP: %s\n\n",overlap); printf(" PATH : %s\n", path); printf(" isData : %d\n\n",isData); //------------------------------------------------------------------------------------------------ // some global setups //------------------------------------------------------------------------------------------------ using namespace mithep; gDebugMask = Debug::kGeneral; gDebugLevel = 3; //------------------------------------------------------------------------------------------------ // set up information //------------------------------------------------------------------------------------------------ RunLumiSelectionMod *runLumiSel = new RunLumiSelectionMod; runLumiSel->SetAcceptMC(kTRUE); // Monte Carlo events are always accepted // only select on run- and lumisection numbers when valid json file present if ((jsonFile.CompareTo("/home/cmsprod/cms/json/~") != 0) && (jsonFile.CompareTo("/home/cmsprod/cms/json/-") != 0) ) { printf("\n Jason file added: %s \n\n",jsonFile.Data()); runLumiSel->AddJSONFile(jsonFile.Data()); } if ((jsonFile.CompareTo("/home/cmsprod/cms/json/-") == 0) ) { printf("\n WARNING -- Looking at data without JSON file: always accept.\n\n"); runLumiSel->SetAbortIfNotAccepted(kFALSE); // accept all events if there is no valid JSON file } printf("\n Run lumi worked. \n\n"); //------------------------------------------------------------------------------------------------ // the skimmer //------------------------------------------------------------------------------------------------ H4lSkim *skmMod = new H4lSkim(); //------------------------------------------------------------------------------------------------ // making analysis chain //------------------------------------------------------------------------------------------------ runLumiSel->Add(skmMod); //------------------------------------------------------------------------------------------------ // setup analysis //------------------------------------------------------------------------------------------------ Analysis *ana = new Analysis; ana->SetUseHLT (kTRUE); ana->SetKeepHierarchy(kTRUE); ana->SetSuperModule (runLumiSel); ana->SetPrintScale (100); if (nEvents >= 0) ana->SetProcessNEvents(nEvents); //------------------------------------------------------------------------------------------------ // organize input //------------------------------------------------------------------------------------------------ Catalog *c = new Catalog(catalogDir); TString skimDataset = TString(dataset)+TString("/") +TString(skim); Dataset *d = NULL; if (TString(skim).CompareTo("noskim") == 0) d = c->FindDataset(book,dataset,fileset); else d = c->FindDataset(book,skimDataset.Data(),fileset); ana->AddDataset(d); //------------------------------------------------------------------------------------------------ // organize hist/ntuple output //------------------------------------------------------------------------------------------------ ana->SetOutputName("test.root"); ana->SetCacheSize(64*1024*1024); //------------------------------------------------------------------------------------------------ // organize root output //------------------------------------------------------------------------------------------------ OutputMod *outMod = new OutputMod; outMod->Drop("*"); outMod->Keep("EventHeader"); outMod->Keep("PileupInfo"); outMod->Keep("HLTObjects"); outMod->Keep("HLTObjectsRelation"); outMod->Keep("HLTBits"); outMod->Keep("Muons"); outMod->Keep("Electrons"); outMod->Keep("PrimaryVertexes"); outMod->Keep("BeamSpot"); outMod->Keep("AKt5PFJets"); outMod->Keep("HLTBits"); outMod->Keep("PFMet"); outMod->Keep("Photons"); outMod->Keep("MergedConversions"); outMod->Keep("Rho"); outMod->Keep("PFCandidates"); outMod->Keep("Tracks"); outMod->Keep("GlobalMuonTracks"); outMod->Keep("StandaloneMuonTracksWVtxConstraint"); outMod->Keep("GsfTracks"); outMod->Keep("BarrelSuperClusters"); outMod->Keep("EndcapSuperClusters"); outMod->Keep("BarrelBasicClusters"); outMod->Keep("MergedConversions_StableDatas"); outMod->Keep("ElectronsStable"); outMod->Keep("GsfElectronsStable"); outMod->Keep("EndcapBasicClusters"); outMod->Keep("PFSuperClusters"); outMod->Keep("PFBasicClusters"); outMod->Keep("ConversionOutInElectronsStable"); outMod->Keep("ConversionOutInTracks"); outMod->Keep("StandaloneMuonTracks"); outMod->Keep("ConversionInOutElectronsStable"); outMod->Keep("ConversionInOutTracks"); if(!isData) { outMod->Keep("MCEventInfo"); outMod->Keep("MCParticles"); } TString rootFile = TString(outputName); rootFile += TString("_") + TString(dataset) + TString("_") + TString(skim); if (TString(fileset) != TString("")) rootFile += TString("_") + TString(fileset); outMod->SetFileName(rootFile); outMod->SetPathName("."); // Last step is the output module skmMod->Add(outMod); //------------------------------------------------------------------------------------------------ // Say what we are doing //------------------------------------------------------------------------------------------------ printf("\n==== PARAMETER SUMMARY FOR THIS JOB ====\n"); printf("\n JSON file: %s\n and overlap cut: %f (%s)\n",jsonFile.Data(),overlapCut,overlap); printf("\n Rely on Catalog: %s\n",catalogDir); printf(" -> Book: %s Dataset: %s Skim: %s Fileset: %s <-\n",book,dataset,skim,fileset); printf("\n Root output: %s\n\n",rootFile.Data()); printf("\n========================================\n"); //------------------------------------------------------------------------------------------------ // run the analysis after successful initialisation //------------------------------------------------------------------------------------------------ ana->Run(!gROOT->IsBatch()); return; }
//-------------------------------------------------------------------------------------------------- void runFlatMonoJet(const char *fileset = "0000", const char *skim = "noskim", const char *dataset = "s12-zjets-ptz70-100-v7c", const char *book = "t2mit/filefi/032", const char *catalogDir = "/home/cmsprod/catalog", const char *outputName = "MonoJet_August13", int nEvents = 100) { //------------------------------------------------------------------------------------------------ // some parameters get passed through the environment //------------------------------------------------------------------------------------------------ TString cataDir = getCatalogDir(catalogDir); TString mitData = mithep::Utils::GetEnv("MIT_DATA"); TString json = mithep::Utils::GetEnv("MIT_PROD_JSON"); TString jsonFile = getJsonFile("/home/cmsprod/cms/json"); Bool_t isData = (json.CompareTo("~") != 0); printf("\n Initialization worked. Data?: %d\n\n",isData); std::cout<<"*********** Is data?? **********"<<isData<<std::endl; //------------------------------------------------------------------------------------------------ // some global setups //------------------------------------------------------------------------------------------------ using namespace mithep; gDebugMask = (Debug::EDebugMask) (Debug::kGeneral | Debug::kTreeIO); gDebugLevel = 3; // Caching and how Int_t local = 1, cacher = 1; // local = 0 - as is, // 1 - /mnt/hadoop (MIT:SmartCache - preload one-by-one) // 2 - /mnt/hadoop (MIT:SmartCache - preload complete fileset) // 3 - ./ (xrdcp - preload one-by-one) // cacher = 0 - no file by file caching // 1 - file by file caching on //------------------------------------------------------------------------------------------------ // set up information //------------------------------------------------------------------------------------------------ RunLumiSelectionMod *runLumiSel = new RunLumiSelectionMod; runLumiSel->SetAcceptMC(!isData); runLumiSel->SetAbortIfNotAccepted(kFALSE); // accept all events if there is no valid JSON file // only select on run- and lumisection numbers when valid json file present if (json.CompareTo("~") != 0 && json.CompareTo("-") != 0) { printf(" runBoostedV() - adding jsonFile: %s\n",jsonFile.Data()); runLumiSel->AddJSONFile(jsonFile.Data()); } if (json.CompareTo("-") == 0) { printf("\n WARNING -- Looking at data without JSON file: always accept.\n\n"); runLumiSel->SetAbortIfNotAccepted(kFALSE); // accept all events if there is no valid JSON file } printf("\n Run lumi worked. \n\n"); // Generator info GeneratorMod *generatorMod = new GeneratorMod; generatorMod->SetPrintDebug(kFALSE); generatorMod->SetPtLeptonMin(0.0); generatorMod->SetEtaLeptonMax(2.7); generatorMod->SetPtPhotonMin(0.0); generatorMod->SetEtaPhotonMax(2.7); generatorMod->SetPtRadPhotonMin(0.0); generatorMod->SetEtaRadPhotonMax(2.7); generatorMod->SetIsData(isData); generatorMod->SetFillHist(!isData); generatorMod->SetApplyISRFilter(kFALSE); generatorMod->SetApplyVVFilter(kFALSE); generatorMod->SetApplyVGFilter(kFALSE); generatorMod->SetFilterBTEvents(kFALSE); //----------------------------------------------------------------------------------------------------------- // HLT information : trigger not applied (neither for data nor for MC, store info to apply selection offline //----------------------------------------------------------------------------------------------------------- HLTMod *hltModP = new HLTMod("HLTModP"); // monojet triggers const int nMjtTrigs = 12; TString monoJetTriggers[nMjtTrigs] = { "HLT_MonoCentralPFJet80_PFMETnoMu105_NHEF0p95_v4", "HLT_MonoCentralPFJet80_PFMETnoMu105_NHEF0p95_v3", "HLT_MonoCentralPFJet80_PFMETnoMu105_NHEF0p95_v1", "HLT_MonoCentralPFJet80_PFMETnoMu95_NHEF0p95_v5", "HLT_MonoCentralPFJet80_PFMETnoMu95_NHEF0p95_v4", "HLT_MonoCentralPFJet80_PFMETnoMu95_NHEF0p95_v3", "HLT_MonoCentralPFJet80_PFMETnoMu95_NHEF0p95_v2", "HLT_MET120_HBHENoiseCleaned_v6", "HLT_MET120_HBHENoiseCleaned_v5", "HLT_MET120_HBHENoiseCleaned_v4", "HLT_MET120_HBHENoiseCleaned_v3", "HLT_MET120_HBHENoiseCleaned_v2" }; for (int i=0; i<nMjtTrigs; i++) hltModP->AddTrigger(TString("!+"+monoJetTriggers[i]),0,999999); // VBF triggers const int nVbfTrigs = 7; TString vbfTriggers[nVbfTrigs] = { "HLT_DiPFJet40_PFMETnoMu65_MJJ800VBF_AllJets_v9", "HLT_DiPFJet40_PFMETnoMu65_MJJ800VBF_AllJets_v8", "HLT_DiPFJet40_PFMETnoMu65_MJJ800VBF_AllJets_v6", "HLT_DiPFJet40_PFMETnoMu65_MJJ800VBF_AllJets_v5", "HLT_DiPFJet40_PFMETnoMu65_MJJ800VBF_AllJets_v4", "HLT_DiPFJet40_PFMETnoMu65_MJJ800VBF_AllJets_v3", "HLT_DiPFJet40_PFMETnoMu65_MJJ800VBF_AllJets_v2" }; for (int i=0; i<nVbfTrigs; i++) hltModP->AddTrigger((TString("!+")+vbfTriggers[i]).Data(),0,999999); hltModP->SetBitsName("HLTBits"); hltModP->SetTrigObjsName("MyHltPhotObjs"); hltModP->SetAbortIfNotAccepted(isData); hltModP->SetPrintTable(kFALSE); //------------------------------------------------------------------------------------------------ // split pfcandidates to PFPU and PFnoPU //------------------------------------------------------------------------------------------------ SeparatePileUpMod* SepPUMod = new SeparatePileUpMod; // SepPUMod->SetUseAllVerteces(kFALSE); // SepPUMod->SetVertexName("OutVtxCiC"); SepPUMod->SetPFNoPileUpName("pfnopileupcands"); SepPUMod->SetPFPileUpName("pfpileupcands"); SepPUMod->SetCheckClosestZVertex(kFALSE); //------------------------------------------------------------------------------------------------ // select events with a good primary vertex //------------------------------------------------------------------------------------------------ GoodPVFilterMod *goodPVFilterMod = new GoodPVFilterMod; goodPVFilterMod->SetMinVertexNTracks(0); goodPVFilterMod->SetMinNDof (4.0); goodPVFilterMod->SetMaxAbsZ (24.0); goodPVFilterMod->SetMaxRho (2.0); goodPVFilterMod->SetIsMC(!isData); goodPVFilterMod->SetVertexesName("PrimaryVertexes"); //------------------------------------------------------------------------------------------------ // object id and cleaning sequence //------------------------------------------------------------------------------------------------ //----------------------------------- // Lepton Selection //----------------------------------- ElectronIDMod* eleIdMod = new ElectronIDMod; eleIdMod->SetPtMin(10.); eleIdMod->SetEtaMax(2.5); eleIdMod->SetApplyEcalFiducial(kTRUE); eleIdMod->SetIDType("CustomLoose"); eleIdMod->SetIsoType("PFIso_HggLeptonTag2012HCP"); eleIdMod->SetPFNoPileUpName("pfnopileupcands"); eleIdMod->SetApplyConversionFilterType1(kTRUE); eleIdMod->SetApplyConversionFilterType2(kFALSE); eleIdMod->SetChargeFilter(kFALSE); eleIdMod->SetApplyD0Cut(kTRUE); eleIdMod->SetApplyDZCut(kTRUE); eleIdMod->SetWhichVertex(0); eleIdMod->SetNExpectedHitsInnerCut(0); eleIdMod->SetGoodElectronsName("GoodElectronsBS"); eleIdMod->SetRhoType(RhoUtilities::CMS_RHO_RHOKT6PFJETS); MuonIDMod *muonIdWW = new MuonIDMod; muonIdWW->SetOutputName("HWWMuons"); muonIdWW->SetIntRadius(0.0); muonIdWW->SetClassType("GlobalTracker"); muonIdWW->SetIDType("WWMuIdV4"); muonIdWW->SetIsoType("IsoRingsV0_BDTG_Iso"); muonIdWW->SetApplyD0Cut(kTRUE); muonIdWW->SetApplyDZCut(kTRUE); muonIdWW->SetWhichVertex(0); muonIdWW->SetRhoType(RhoUtilities::CMS_RHO_RHOKT6PFJETS); muonIdWW->SetPtMin(10.); muonIdWW->SetEtaCut(2.4); MuonIDMod *muonIdPOG = new MuonIDMod; muonIdPOG->SetOutputName("POGMuons"); muonIdPOG->SetClassType("GlobalTracker"); muonIdPOG->SetIDType("NoId"); muonIdPOG->SetApplyD0Cut(true); muonIdPOG->SetD0Cut(0.2); muonIdPOG->SetApplyDZCut(true); muonIdPOG->SetDZCut(0.5); //muonIdPOG->SetIsoType("PFIsoBetaPUCorrected"); //muonIdPOG->SetPFNoPileUpName("pfnopileupcands"); //muonIdPOG->SetPFPileUpName("pfpileupcands"); muonIdPOG->SetIsoType("NoIso"); muonIdPOG->SetPtMin(10.); muonIdPOG->SetEtaCut(2.4); MuonIDMod* muonIdIso = new MuonIDMod; muonIdIso->SetOutputName("IsolatedPOGMuons"); muonIdIso->SetClassType("GlobalorTracker"); muonIdIso->SetIDType("NoId"); muonIdIso->SetApplyD0Cut(true); muonIdIso->SetD0Cut(0.2); muonIdIso->SetApplyDZCut(true); muonIdIso->SetDZCut(0.5); muonIdIso->SetIsoType("PFIsoBetaPUCorrected"); //h muonIdIso->SetPFNoPileUpName("pfnopileupcands"); muonIdIso->SetPFPileUpName("pfpileupcands"); muonIdIso->SetPtMin(10.); muonIdIso->SetEtaCut(2.4); MuonIDMod *muonId = muonIdPOG; //MuonIDMod *muonId = muonIdIso; ElectronCleaningMod *electronCleaning = new ElectronCleaningMod; electronCleaning->SetCleanMuonsName(muonId->GetOutputName()); electronCleaning->SetGoodElectronsName(eleIdMod->GetOutputName()); electronCleaning->SetCleanElectronsName("CleanElectrons"); MergeLeptonsMod *merger = new MergeLeptonsMod; merger->SetMuonsName(muonId->GetOutputName()); merger->SetElectronsName(electronCleaning->GetOutputName()); merger->SetMergedName("MergedLeptons"); //----------------------------------- // Photon Regression + ID //----------------------------------- PhotonMvaMod *photreg = new PhotonMvaMod; photreg->SetRegressionVersion(3); photreg->SetRegressionWeights(std::string( (gSystem->Getenv("MIT_DATA") + TString("/gbrv3ph_52x.root")).Data() )); photreg->SetOutputName("GoodPhotonsRegr"); photreg->SetApplyShowerRescaling(kTRUE); photreg->SetMinNumPhotons(0); photreg->SetIsData(isData); PhotonIDMod *photonIDMod = new PhotonIDMod; photonIDMod->SetPtMin(15.0); photonIDMod->SetOutputName("GoodPhotons"); photonIDMod->SetIDType("MITMVAId"); photonIDMod->SetBdtCutBarrel(0.02); photonIDMod->SetBdtCutEndcap(0.1); photonIDMod->SetIdMVAType("2013FinalIdMVA_8TeV"); photonIDMod->SetApplyElectronVeto(kTRUE); photonIDMod->SetApplyFiduciality(kTRUE); photonIDMod->SetIsData(isData); photonIDMod->SetPhotonsFromBranch(kFALSE); photonIDMod->SetInputName(photreg->GetOutputName()); PFTauIDMod *pftauIDMod = new PFTauIDMod; pftauIDMod->SetPFTausName("HPSTaus"); pftauIDMod->SetIsLooseId(kFALSE); pftauIDMod->SetIsHPSSel(kTRUE); // to get >= 5_3_14 samples running PhotonCleaningMod *photonCleaningMod = new PhotonCleaningMod; photonCleaningMod->SetCleanElectronsName(electronCleaning->GetOutputName()); photonCleaningMod->SetGoodPhotonsName(photonIDMod->GetOutputName()); photonCleaningMod->SetCleanPhotonsName("CleanPhotons"); PFTauCleaningMod *pftauCleaningMod = new PFTauCleaningMod; pftauCleaningMod->SetGoodPFTausName(pftauIDMod->GetGoodPFTausName()); pftauCleaningMod->SetCleanMuonsName(muonId->GetOutputName()); PublisherMod<PFJet,Jet> *pubJet = new PublisherMod<PFJet,Jet>("JetPub"); pubJet->SetInputName("AKt5PFJets"); pubJet->SetOutputName("PubAKt5PFJets"); JetCorrectionMod *jetCorr = new JetCorrectionMod; if(isData){ jetCorr->AddCorrectionFromFile(std::string((gSystem->Getenv("CMSSW_BASE") + TString("/src/MitPhysics/data/Summer13_V1_DATA_L1FastJet_AK5PF.txt")).Data())); jetCorr->AddCorrectionFromFile(std::string((gSystem->Getenv("CMSSW_BASE") + TString("/src/MitPhysics/data/Summer13_V1_DATA_L2Relative_AK5PF.txt")).Data())); jetCorr->AddCorrectionFromFile(std::string((gSystem->Getenv("CMSSW_BASE") + TString("/src/MitPhysics/data/Summer13_V1_DATA_L3Absolute_AK5PF.txt")).Data())); jetCorr->AddCorrectionFromFile(std::string((gSystem->Getenv("CMSSW_BASE") + TString("/src/MitPhysics/data/Summer13_V1_DATA_L2L3Residual_AK5PF.txt")).Data())); } else { jetCorr->AddCorrectionFromFile(std::string((gSystem->Getenv("CMSSW_BASE") + TString("/src/MitPhysics/data/Summer13_V1_MC_L1FastJet_AK5PF.txt")).Data())); jetCorr->AddCorrectionFromFile(std::string((gSystem->Getenv("CMSSW_BASE") + TString("/src/MitPhysics/data/Summer13_V1_MC_L2Relative_AK5PF.txt")).Data())); jetCorr->AddCorrectionFromFile(std::string((gSystem->Getenv("CMSSW_BASE") + TString("/src/MitPhysics/data/Summer13_V1_MC_L3Absolute_AK5PF.txt")).Data())); } jetCorr->SetInputName(pubJet->GetOutputName()); jetCorr->SetCorrectedName("CorrectedJets"); JetIDMod *jetID = new JetIDMod; jetID->SetInputName(jetCorr->GetOutputName()); jetID->SetPtCut(30.0); jetID->SetEtaMaxCut(4.7); jetID->SetJetEEMFractionMinCut(0.00); jetID->SetOutputName("GoodJets"); jetID->SetApplyBetaCut(kFALSE); jetID->SetApplyMVACut(kTRUE); JetCleaningMod *jetCleaning = new JetCleaningMod; jetCleaning->SetCleanElectronsName(electronCleaning->GetOutputName()); jetCleaning->SetCleanMuonsName(muonIdIso->GetOutputName()); // clean up isolated muons (instead of the loose ones) jetCleaning->SetCleanPhotonsName(photonCleaningMod->GetOutputName()); jetCleaning->SetApplyPhotonRemoval(kTRUE); jetCleaning->SetGoodJetsName(jetID->GetOutputName()); jetCleaning->SetCleanJetsName("CleanJets"); MetCorrectionMod *metCorrT0T1Shift = new MetCorrectionMod; metCorrT0T1Shift->SetInputName("PFMet"); metCorrT0T1Shift->SetJetsName(pubJet->GetOutputName()); metCorrT0T1Shift->SetCorrectedJetsName(jetCorr->GetOutputName()); metCorrT0T1Shift->SetCorrectedName("PFMetT0T1Shift"); metCorrT0T1Shift->ApplyType0(kTRUE); metCorrT0T1Shift->ApplyType1(kTRUE); metCorrT0T1Shift->ApplyShift(kTRUE); metCorrT0T1Shift->IsData(isData); metCorrT0T1Shift->SetPrint(kFALSE); MonoJetTreeWriter *jetplusmettree = new MonoJetTreeWriter("MonoJetTreeWriter"); jetplusmettree->SetTriggerObjectsName(hltModP->GetOutputName()); jetplusmettree->SetMetName(metCorrT0T1Shift->GetOutputName()); //corrected met jetplusmettree->SetMetFromBranch(kFALSE); jetplusmettree->SetPhotonsFromBranch(kFALSE); jetplusmettree->SetPhotonsName(photonCleaningMod->GetOutputName()); jetplusmettree->SetElectronsFromBranch(kFALSE); jetplusmettree->SetElectronsName(electronCleaning->GetOutputName()); jetplusmettree->SetMuonsFromBranch(kFALSE); jetplusmettree->SetMuonsName(muonId->GetOutputName()); jetplusmettree->SetTausFromBranch(kFALSE); jetplusmettree->SetTausName(pftauCleaningMod->GetOutputName()); jetplusmettree->SetJetsFromBranch(kFALSE); jetplusmettree->SetJetsName(jetCleaning->GetOutputName()); jetplusmettree->SetRawJetsName(pubJet->GetOutputName()); jetplusmettree->SetPVFromBranch(kFALSE); jetplusmettree->SetPVName(goodPVFilterMod->GetOutputName()); jetplusmettree->SetLeptonsName(merger->GetOutputName()); jetplusmettree->SetIsData(isData); jetplusmettree->SetProcessID(0); jetplusmettree->SetFillNtupleType(0); //------------------------------------------------------------------------------------------------ // making analysis chain //------------------------------------------------------------------------------------------------ // this is how it always starts runLumiSel->Add(generatorMod); generatorMod->Add(goodPVFilterMod); goodPVFilterMod->Add(hltModP); // photon regression hltModP->Add(photreg); // simple object id modules photreg ->Add(SepPUMod); SepPUMod ->Add(muonId); muonId ->Add(eleIdMod); eleIdMod ->Add(electronCleaning); electronCleaning ->Add(merger); merger ->Add(photonIDMod); photonIDMod ->Add(photonCleaningMod); photonCleaningMod->Add(pftauIDMod); pftauIDMod ->Add(pftauCleaningMod); pftauCleaningMod ->Add(pubJet); pubJet ->Add(jetCorr); jetCorr ->Add(metCorrT0T1Shift); metCorrT0T1Shift ->Add(jetID); jetID ->Add(muonIdIso); muonIdIso ->Add(jetCleaning); jetCleaning ->Add(jetplusmettree); //------------------------------------------------------------------------------------------------ // setup analysis //------------------------------------------------------------------------------------------------ Analysis *ana = new Analysis; ana->SetUseCacher(cacher); ana->SetUseHLT(kTRUE); ana->SetKeepHierarchy(kTRUE); ana->SetSuperModule(runLumiSel); ana->SetPrintScale(100); if (nEvents >= 0) ana->SetProcessNEvents(nEvents); //------------------------------------------------------------------------------------------------ // organize input //------------------------------------------------------------------------------------------------ TString skimdataset = TString(dataset)+TString("/") +TString(skim); TString bookstr = book; Catalog *c = new Catalog(cataDir.Data()); Dataset *d = NULL; if (TString(skim).CompareTo("noskim") == 0) d = c->FindDataset(bookstr,dataset,fileset,local); else d = c->FindDataset(bookstr,skimdataset.Data(),fileset,local); ana->AddDataset(d); //ana->AddFile("/mnt/hadoop/cms/store/user/paus/filefi/032/r12a-met-j22-v1/C4AC0AB8-BA82-E211-B238-003048678FF4.root"); //------------------------------------------------------------------------------------------------ // organize output //------------------------------------------------------------------------------------------------ TString rootFile = TString(outputName); rootFile += TString("_") + TString(dataset) + TString("_") + TString(skim); if (TString(fileset) != TString("")) rootFile += TString("_") + TString(fileset); rootFile += TString(".root"); ana->SetOutputName(rootFile.Data()); ana->SetCacheSize(0); //------------------------------------------------------------------------------------------------ // Say what we are doing //------------------------------------------------------------------------------------------------ printf("\n==== PARAMETER SUMMARY FOR THIS JOB ====\n"); printf("\n JSON file: %s\n",jsonFile.Data()); printf("\n Rely on Catalog: %s\n",cataDir.Data()); printf(" -> Book: %s Dataset: %s Skim: %s Fileset: %s <-\n",book,dataset,skim,fileset); printf("\n Root output: %s\n\n",rootFile.Data()); printf("\n========================================\n"); //------------------------------------------------------------------------------------------------ // run the analysis after successful initialisation //------------------------------------------------------------------------------------------------ ana->Run(kFALSE); return; }
//-------------------------------------------------------------------------------------------------- void runMonoJetSkim(const char *fileset = "0000", const char *skim = "noskim", const char *dataset = "MET+Run2015B-PromptReco-v1+AOD", const char *book = "t2mit/filefi/041", const char *catalogDir = "/home/cmsprod/catalog", const char *outputLabel = "monojet", int nEvents = 1000) { float maxJetEta = 2.5; float minMet = 100.; float minLeadJetPt = 100.; //------------------------------------------------------------------------------------------------ // json parameters get passed through the environment // for MC, the value must be "~" //------------------------------------------------------------------------------------------------ TString json(gSystem->Getenv("MIT_PROD_JSON")); if (json.Length() == 0) { printf(" JSON file was not properly defined. EXIT!\n"); return; } Bool_t isData = (json != "~"); TString MitData(gSystem->Getenv("MIT_DATA")); if (MitData.Length() == 0) { printf(" MIT_DATA was not defined. EXIT!\n"); return; } TString jsonDir(gSystem->Getenv("MIT_JSON_DIR")); if (jsonDir.Length() == 0) { printf(" MIT_JSON_DIR was not defined. EXIT!\n"); return; } printf("\n Initialization worked: \n\n"); printf(" JSON : %s\n", json.Data()); printf(" isData : %d\n\n",isData); //------------------------------------------------------------------------------------------------ // some global setups //------------------------------------------------------------------------------------------------ using namespace mithep; gDebugMask = Debug::kGeneral; gDebugLevel = 3; //------------------------------------------------------------------------------------------------ // set up information //------------------------------------------------------------------------------------------------ std::vector<mithep::BaseMod*> modules; if (isData) { RunLumiSelectionMod* runLumiSel = new RunLumiSelectionMod; // only select on run- and lumisection numbers when valid json file present if ((json.CompareTo("-") == 0)) { printf("\n WARNING -- Looking at data without JSON file: always accept.\n\n"); runLumiSel->SetAbortIfNotAccepted(kFALSE); // accept all events if there is no valid JSON file } else if (json.CompareTo("~") != 0) { printf("\n Json file added: %s \n\n", json.Data()); runLumiSel->AddJSONFile((jsonDir + "/" + json).Data()); } modules.push_back(runLumiSel); } //----------------------------------------------------------------------------------------------------------- // HLT information : trigger not applied (neither for data nor for MC, store info to apply selection offline //----------------------------------------------------------------------------------------------------------- HLTMod *hltMod = new HLTMod(); // monojet triggers std::vector<TString> triggerNames[MonoJetAnalysisMod::nMonoJetCategories]; triggerNames[MonoJetAnalysisMod::kSignal].push_back("HLT_PFMETNoMu120_NoiseCleaned_PFMHTNoMu120_IDTight_v*"); triggerNames[MonoJetAnalysisMod::kSignal].push_back("HLT_PFMETNoMu90_NoiseCleaned_PFMHTNoMu90_IDTight_v*"); triggerNames[MonoJetAnalysisMod::kSingleMuon].push_back("HLT_PFMETNoMu120_NoiseCleaned_PFMHTNoMu120_IDTight_v*"); triggerNames[MonoJetAnalysisMod::kSingleMuon].push_back("HLT_PFMETNoMu90_NoiseCleaned_PFMHTNoMu90_IDTight_v*"); triggerNames[MonoJetAnalysisMod::kSingleMuon].push_back("HLT_IsoMu27_v*"); triggerNames[MonoJetAnalysisMod::kDimuon].push_back("HLT_PFMETNoMu120_NoiseCleaned_PFMHTNoMu120_IDTight_v*"); triggerNames[MonoJetAnalysisMod::kDimuon].push_back("HLT_PFMETNoMu90_NoiseCleaned_PFMHTNoMu90_IDTight_v*"); triggerNames[MonoJetAnalysisMod::kDimuon].push_back("HLT_Mu17_TrkIsoVVL_Mu8_TrkIsoVVL_DZ_v*"); triggerNames[MonoJetAnalysisMod::kSingleElectron].push_back("HLT_Ele27_eta2p1_WPLoose_Gsf_v*"); triggerNames[MonoJetAnalysisMod::kDielectron].push_back("HLT_Ele17_Ele12_CaloIdL_TrackIdL_IsoVL_DZ_v*"); triggerNames[MonoJetAnalysisMod::kPhoton].push_back("HLT_Photon175_v*"); for (auto& names : triggerNames) { for (auto& name : names) hltMod->AddTrigger(name); } hltMod->SetBitsName("HLTBits"); hltMod->SetTrigObjsName("MonoJetTriggerObjects"); hltMod->SetAbortIfNotAccepted(isData); hltMod->SetAbortIfNoData(kFALSE); modules.push_back(hltMod); //------------------------------------------------------------------------------------------------ // select events with a good primary vertex //------------------------------------------------------------------------------------------------ GoodPVFilterMod *goodPvMod = new GoodPVFilterMod; goodPvMod->SetMinVertexNTracks(0); goodPvMod->SetMinNDof(4.0); goodPvMod->SetMaxAbsZ(24.0); goodPvMod->SetMaxRho(2.0); goodPvMod->SetVertexesName("PrimaryVertexes"); modules.push_back(goodPvMod); //------------------------------------------------------------------------------------------------ // split pfcandidates to PFPU and PFnoPU //------------------------------------------------------------------------------------------------ SeparatePileUpMod* SepPUMod = new SeparatePileUpMod; SepPUMod->SetPFNoPileUpName("pfnopileupcands"); SepPUMod->SetPFPileUpName("pfpileupcands"); SepPUMod->SetCheckClosestZVertex(kFALSE); modules.push_back(SepPUMod); //----------------------------------- // Lepton Selection //----------------------------------- MuonIdMod *vetoMuonIdMod = new MuonIdMod("VetoMuonId"); vetoMuonIdMod->SetMuonClassType(mithep::MuonTools::kPFGlobalorTracker); vetoMuonIdMod->SetIdType(mithep::MuonTools::kNoId); vetoMuonIdMod->SetPFNoPileupCandidatesName(SepPUMod->GetPFNoPileUpName()); vetoMuonIdMod->SetPFPileupCandidatesName(SepPUMod->GetPFPileUpName()); vetoMuonIdMod->SetIsoType(mithep::MuonTools::kPFIsoBetaPUCorrected); vetoMuonIdMod->SetApplyD0Cut(kTRUE); vetoMuonIdMod->SetApplyDZCut(kTRUE); vetoMuonIdMod->SetWhichVertex(0); vetoMuonIdMod->SetPtMin(10.); vetoMuonIdMod->SetEtaMax(2.4); vetoMuonIdMod->SetOutputName("VetoMuons"); modules.push_back(vetoMuonIdMod); MuonIdMod *muonIdMod = new MuonIdMod("GoodMuonId"); muonIdMod->SetInputName(vetoMuonIdMod->GetOutputName()); muonIdMod->SetMuonClassType(mithep::MuonTools::kPFGlobalorTracker); muonIdMod->SetIdType(mithep::MuonTools::kMuonPOG2012CutBasedIdTight); muonIdMod->SetPFNoPileupCandidatesName(SepPUMod->GetPFNoPileUpName()); muonIdMod->SetPFPileupCandidatesName(SepPUMod->GetPFPileUpName()); muonIdMod->SetIsoType(mithep::MuonTools::kPFIsoBetaPUCorrectedTight); muonIdMod->SetApplyD0Cut(kTRUE); muonIdMod->SetApplyDZCut(kTRUE); muonIdMod->SetWhichVertex(0); muonIdMod->SetPtMin(20.); muonIdMod->SetEtaMax(2.4); muonIdMod->SetIsFilterMode(kFALSE); muonIdMod->SetOutputName("GoodMuons"); modules.push_back(muonIdMod); ElectronIdMod* vetoEleIdMod = new ElectronIdMod("VetoElectronId"); vetoEleIdMod->SetPtMin(10.); vetoEleIdMod->SetEtaMax(2.4); vetoEleIdMod->SetApplyEcalFiducial(true); vetoEleIdMod->SetIdType(mithep::ElectronTools::kSummer15Veto); vetoEleIdMod->SetIsoType(mithep::ElectronTools::kSummer15VetoIso); vetoEleIdMod->SetConversionsName("Conversions"); vetoEleIdMod->SetApplyConversionFilterType1(kTRUE); vetoEleIdMod->SetApplyConversionFilterType2(kFALSE); vetoEleIdMod->SetApplyD0Cut(kTRUE); vetoEleIdMod->SetApplyDZCut(kTRUE); vetoEleIdMod->SetWhichVertex(0); vetoEleIdMod->SetOutputName("VetoElectrons"); modules.push_back(vetoEleIdMod); ElectronIdMod* eleIdMod = new ElectronIdMod("GoodElectronId"); eleIdMod->SetInputName(vetoEleIdMod->GetOutputName()); eleIdMod->SetPtMin(20.); eleIdMod->SetEtaMax(2.4); eleIdMod->SetApplyEcalFiducial(true); eleIdMod->SetIdType(mithep::ElectronTools::kSummer15Medium); eleIdMod->SetIsoType(mithep::ElectronTools::kSummer15MediumIso); eleIdMod->SetConversionsName("Conversions"); eleIdMod->SetApplyConversionFilterType1(kTRUE); eleIdMod->SetApplyConversionFilterType2(kFALSE); eleIdMod->SetApplyD0Cut(kTRUE); eleIdMod->SetApplyDZCut(kTRUE); eleIdMod->SetWhichVertex(0); eleIdMod->SetIsFilterMode(kFALSE); eleIdMod->SetOutputName("GoodElectrons"); modules.push_back(eleIdMod); //----------------------------------- // Photon Id //----------------------------------- PhotonIdMod *vetoPhotonIdMod = new PhotonIdMod("VetoPhotonId"); vetoPhotonIdMod->SetPtMin(15.); vetoPhotonIdMod->SetOutputName("VetoPhotons"); vetoPhotonIdMod->SetIdType(mithep::PhotonTools::kSummer15Loose); vetoPhotonIdMod->SetIsoType(mithep::PhotonTools::kSummer15LooseIso); vetoPhotonIdMod->SetApplyElectronVeto(kTRUE); modules.push_back(vetoPhotonIdMod); PhotonIdMod *photonIdMod = new PhotonIdMod("GoodPhotonId"); photonIdMod->SetInputName(vetoPhotonIdMod->GetOutputName()); photonIdMod->SetPtMin(minMet); photonIdMod->SetOutputName("GoodPhotons"); photonIdMod->SetIdType(mithep::PhotonTools::kSummer15Medium); photonIdMod->SetIsoType(mithep::PhotonTools::kSummer15MediumIso); photonIdMod->SetApplyElectronVeto(kTRUE); photonIdMod->SetIsFilterMode(kFALSE); modules.push_back(photonIdMod); PFTauIdMod *pfTauIdMod = new PFTauIdMod; pfTauIdMod->SetPtMin(18.); pfTauIdMod->SetEtaMax(2.3); pfTauIdMod->SetInputName("HPSTaus"); pfTauIdMod->AddDiscriminator(mithep::PFTau::kDiscriminationByDecayModeFindingNewDMs); pfTauIdMod->AddCutDiscriminator(mithep::PFTau::kDiscriminationByRawCombinedIsolationDBSumPtCorr3Hits, 5., kFALSE); pfTauIdMod->SetOutputName("LooseTaus"); modules.push_back(pfTauIdMod); PFTauCleaningMod* pfTauCleaningMod = new PFTauCleaningMod; pfTauCleaningMod->SetOutputName("LooseCleanTaus"); pfTauCleaningMod->SetGoodPFTausName(pfTauIdMod->GetOutputName()); pfTauCleaningMod->SetCleanElectronsName(vetoEleIdMod->GetOutputName()); pfTauCleaningMod->SetCleanMuonsName(vetoMuonIdMod->GetOutputName()); modules.push_back(pfTauCleaningMod); // in principle can cut here with nTau == 0 but for now passing JetCorrectionMod *jetCorr = new JetCorrectionMod; if (isData){ jetCorr->AddCorrectionFromFile((MitData+TString("/74X_dataRun2_Prompt_v1_L1FastJet_AK4PFchs.txt")).Data()); jetCorr->AddCorrectionFromFile((MitData+TString("/74X_dataRun2_Prompt_v1_L2Relative_AK4PFchs.txt")).Data()); jetCorr->AddCorrectionFromFile((MitData+TString("/74X_dataRun2_Prompt_v1_L3Absolute_AK4PFchs.txt")).Data()); jetCorr->AddCorrectionFromFile((MitData+TString("/74X_dataRun2_Prompt_v1_L2L3Residual_AK4PFchs.txt")).Data()); } else { jetCorr->AddCorrectionFromFile((MitData+TString("/MCRUN2_74_V9_L1FastJet_AK4PFchs.txt")).Data()); jetCorr->AddCorrectionFromFile((MitData+TString("/MCRUN2_74_V9_L2Relative_AK4PFchs.txt")).Data()); jetCorr->AddCorrectionFromFile((MitData+TString("/MCRUN2_74_V9_L3Absolute_AK4PFchs.txt")).Data()); } jetCorr->SetInputName("AKt4PFJetsCHS"); jetCorr->SetCorrectedName("CorrectedJets"); modules.push_back(jetCorr); JetIdMod *jetId = new JetIdMod; jetId->SetInputName(jetCorr->GetOutputName()); jetId->SetOutputName("GoodJets"); jetId->SetPtMin(30.0); jetId->SetEtaMax(2.5); jetId->SetApplyPFLooseId(kTRUE); jetId->SetMVATrainingSet(JetIDMVA::k53BDTCHSFullPlusRMS); jetId->SetMVACutWP(JetIDMVA::kLoose); jetId->SetMVACutsFile(MitData + "/jetIDCuts_121221.dat"); jetId->SetMVAWeightsFile(MitData + "/TMVAClassification_5x_BDT_chsFullPlusRMS.weights.xml"); modules.push_back(jetId); MetCorrectionMod *type1MetCorr = new MetCorrectionMod; type1MetCorr->SetInputName("PFMet"); type1MetCorr->SetOutputName("PFType1CorrectedMet"); type1MetCorr->SetJetsName("AKt4PFJets"); type1MetCorr->SetRhoAlgo(PileupEnergyDensity::kFixedGridFastjetAll); type1MetCorr->SetMaxEMFraction(0.9); type1MetCorr->SetSkipMuons(kTRUE); type1MetCorr->ApplyType0(kFALSE); type1MetCorr->ApplyType1(kTRUE); type1MetCorr->ApplyShift(kFALSE); if (isData) { type1MetCorr->AddJetCorrectionFromFile(MitData + "/74X_dataRun2_Prompt_v1_L1FastJet_AK4PF.txt"); type1MetCorr->AddJetCorrectionFromFile(MitData + "/74X_dataRun2_Prompt_v1_L2Relative_AK4PF.txt"); type1MetCorr->AddJetCorrectionFromFile(MitData + "/74X_dataRun2_Prompt_v1_L3Absolute_AK4PF.txt"); type1MetCorr->AddJetCorrectionFromFile(MitData + "/74X_dataRun2_Prompt_v1_L2L3Residual_AK4PF.txt"); } else { type1MetCorr->AddJetCorrectionFromFile(MitData + "/MCRUN2_74_V9_L1FastJet_AK4PF.txt"); type1MetCorr->AddJetCorrectionFromFile(MitData + "/MCRUN2_74_V9_L2Relative_AK4PF.txt"); type1MetCorr->AddJetCorrectionFromFile(MitData + "/MCRUN2_74_V9_L3Absolute_AK4PF.txt"); } type1MetCorr->IsData(isData); modules.push_back(type1MetCorr); //------------------------------------------------------------------------------------------------ // select events //------------------------------------------------------------------------------------------------ MonoJetAnalysisMod *monojetSel = new MonoJetAnalysisMod("MonoJetSelector"); monojetSel->SetMetName(type1MetCorr->GetOutputName()); monojetSel->SetJetsName(jetId->GetOutputName()); monojetSel->SetVetoElectronsName(vetoEleIdMod->GetOutputName()); monojetSel->SetElectronMaskName(eleIdMod->GetOutputName()); monojetSel->SetVetoMuonsName(vetoMuonIdMod->GetOutputName()); monojetSel->SetMuonMaskName(muonIdMod->GetOutputName()); monojetSel->SetVetoTausName(pfTauCleaningMod->GetOutputName()); monojetSel->SetVetoPhotonsName(vetoPhotonIdMod->GetOutputName()); monojetSel->SetPhotonMaskName(photonIdMod->GetOutputName()); monojetSel->SetCategoryFlagsName("MonoJetEventCategories"); // Using uniform setup for all categories for (unsigned iCat = 0; iCat != MonoJetAnalysisMod::nMonoJetCategories; ++iCat) { monojetSel->SetCategoryActive(iCat, kTRUE); for (auto& name : triggerNames[iCat]) monojetSel->AddTriggerName(iCat, name); monojetSel->SetMaxNumJets(iCat, 0xffffffff); monojetSel->SetMaxJetEta(iCat, maxJetEta); monojetSel->SetMinChargedHadronFrac(iCat, 0.2); monojetSel->SetMaxNeutralHadronFrac(iCat, 0.7); monojetSel->SetMaxNeutralEmFrac(iCat, 0.7); monojetSel->SetIgnoreTrigger(!isData); switch (iCat) { case MonoJetAnalysisMod::kDielectron: case MonoJetAnalysisMod::kDimuon: monojetSel->SetMinNumJets(iCat, 0); monojetSel->SetMinMetPt(iCat, 0.); monojetSel->SetVetoPhotons(iCat, false); break; default: monojetSel->SetMinNumJets(iCat, 1); monojetSel->SetMinLeadJetPt(iCat, minLeadJetPt); monojetSel->SetMinMetPt(iCat, minMet); break; } } modules.push_back(monojetSel); //------------------------------------------------------------------------------------------------ // skim output //------------------------------------------------------------------------------------------------ TString outputName = TString(outputLabel); outputName += TString("_") + TString(dataset) + TString("_") + TString(skim); if (TString(fileset) != TString("")) outputName += TString("_") + TString(fileset); OutputMod *skimOutput = new OutputMod; skimOutput->Keep("*"); skimOutput->Drop("L1TechBits*"); skimOutput->Drop("L1AlgoBits*"); skimOutput->Drop("MCVertexes"); skimOutput->Drop("PFEcal*SuperClusters"); skimOutput->Drop("*Tracks"); skimOutput->Drop("StandaloneMuonTracksWVtxConstraint"); skimOutput->Drop("PrimaryVertexesBeamSpot"); skimOutput->Drop("InclusiveSecondaryVertexes"); skimOutput->Drop("CosmicMuons"); skimOutput->Drop("MergedElectronsStable"); skimOutput->Drop("MergedConversions*"); skimOutput->Drop("AKT8GenJets"); skimOutput->Drop("AKt4PFJets"); skimOutput->Drop("DCASig"); skimOutput->AddNewBranch(type1MetCorr->GetOutputName()); skimOutput->AddNewBranch(monojetSel->GetCategoryFlagsName()); skimOutput->SetMaxFileSize(10 * 1024); // 10 GB - should never exceed skimOutput->SetFileName(outputName); skimOutput->SetPathName("."); skimOutput->SetCheckTamBr(false); skimOutput->SetKeepTamBr(false); skimOutput->SetCheckBrDep(true); skimOutput->SetUseBrDep(true); skimOutput->AddCondition(monojetSel); //------------------------------------------------------------------------------------------------ // making the analysis chain //------------------------------------------------------------------------------------------------ auto mItr(modules.begin()); while (true) { auto* mod = *(mItr++); if (mItr == modules.end()) break; mod->Add(*mItr); } //------------------------------------------------------------------------------------------------ // setup analysis //------------------------------------------------------------------------------------------------ Analysis *ana = new Analysis; ana->SetUseCacher(1); ana->SetUseHLT(kTRUE); ana->SetAllowNoHLTTree(kTRUE); // for private MC with no HLT info ana->SetKeepHierarchy(kFALSE); ana->SetPrintScale(100); ana->SetOutputName(outputName + "_hist.root"); if (nEvents >= 0) ana->SetProcessNEvents(nEvents); ana->AddSuperModule(modules.front()); ana->AddOutputMod(skimOutput); //------------------------------------------------------------------------------------------------ // organize input //------------------------------------------------------------------------------------------------ Catalog *c = new Catalog(catalogDir); TString skimDataset = TString(dataset)+TString("/") +TString(skim); Dataset *d = NULL; if (TString(skim).CompareTo("noskim") == 0) d = c->FindDataset(book,dataset,fileset, 1); // 1 to use smartcache else d = c->FindDataset(book,skimDataset.Data(),fileset, 1); ana->AddDataset(d); ana->SetCacheSize(0); //------------------------------------------------------------------------------------------------ // Say what we are doing //------------------------------------------------------------------------------------------------ printf("\n==== PARAMETER SUMMARY FOR THIS JOB ====\n"); printf("\n JSON file: %s\n", json.Data()); printf("\n Rely on Catalog: %s\n",catalogDir); printf(" -> Book: %s Dataset: %s Skim: %s Fileset: %s <-\n",book,dataset,skim,fileset); printf("\n========================================\n"); std::cout << std::endl; std::cout << "+++++ ANALYSIS FLOW +++++" << std::endl; ana->PrintModuleTree(); std::cout << std::endl; std::cout << "+++++++++++++++++++++++++" << std::endl; //------------------------------------------------------------------------------------------------ // run the analysis after successful initialisation //------------------------------------------------------------------------------------------------ ana->Run(false); delete ana; // all modules deleted recursively // rename the output file so that condor can see it gSystem->Rename("./" + outputName + "_000.root", "./" + outputName + ".root"); return; }
//-------------------------------------------------------------------------------------------------- void runHgg(const char *fileset = "0000", const char *skim = "noskim", const char *dataset = "f11--h123gg-gf-v14b-pu", //const char *dataset = "r11a-pho-j16-v1", const char *book = "local/filefi/025", const char *catalogDir = "/home/cmsprod/catalog", const char *outputName = "hgg", int nEvents = 2000) { //------------------------------------------------------------------------------------------------ // some parameters get passed through the environment //------------------------------------------------------------------------------------------------ char json[1024], overlap[1024]; float overlapCut = -1; if (gSystem->Getenv("MIT_PROD_JSON")) sprintf(json, "%s",gSystem->Getenv("MIT_PROD_JSON")); else { sprintf(json, "%s", "~"); //printf(" JSON file was not properly defined. EXIT!\n"); //return; } TString jsonFile = TString("/home/mingyang/cms/json/") + TString(json); //TString jsonFile = TString("/home/mingyang/cms/json/") + TString("Cert_136033-149442_7TeV_Dec22ReReco_Collisions10_JSON_v4.txt"); Bool_t isData = ( (jsonFile.CompareTo("/home/mingyang/cms/json/~") != 0) ); if (gSystem->Getenv("MIT_PROD_OVERLAP")) { sprintf(overlap,"%s",gSystem->Getenv("MIT_PROD_OVERLAP")); if (EOF == sscanf(overlap,"%f",&overlapCut)) { printf(" Overlap was not properly defined. EXIT!\n"); return; } } else { sprintf(overlap,"%s", "-1.0"); //printf(" OVERLAP file was not properly defined. EXIT!\n"); //return; } printf("\n Initialization worked. \n\n"); //------------------------------------------------------------------------------------------------ // some global setups //------------------------------------------------------------------------------------------------ using namespace mithep; gDebugMask = Debug::kGeneral; gDebugLevel = 3; //------------------------------------------------------------------------------------------------ // set up information //------------------------------------------------------------------------------------------------ RunLumiSelectionMod *runLumiSel = new RunLumiSelectionMod; runLumiSel->SetAcceptMC(kTRUE); // Monte Carlo events are always accepted MCProcessSelectionMod *mcselmod = new MCProcessSelectionMod; MVASystematicsMod *sysMod = new MVASystematicsMod; sysMod->SetMCR9Scale(1.0035, 1.0035); sysMod->SetIsData(isData); // only select on run- and lumisection numbers when valid json file present if ((jsonFile.CompareTo("/home/mingyang/cms/json/~") != 0) && (jsonFile.CompareTo("/home/mingyang/cms/json/-") != 0) ) { runLumiSel->AddJSONFile(jsonFile.Data()); } if ((jsonFile.CompareTo("/home/mingyang/cms/json/-") == 0) ) { printf("\n WARNING -- Looking at data without JSON file: always accept.\n\n"); runLumiSel->SetAbortIfNotAccepted(kFALSE); // accept all events if there is no valid JSON file } printf("\n Run lumi worked. \n\n"); //------------------------------------------------------------------------------------------------ // HLT information //------------------------------------------------------------------------------------------------ HLTMod *hltModM = new HLTMod("HLTModM"); hltModM->AddTrigger("HLT_Mu9"); hltModM->AddTrigger("HLT_Mu11"); hltModM->AddTrigger("HLT_Mu15_v1"); hltModM->SetTrigObjsName("MyHltMuonObjs"); hltModM->SetAbortIfNotAccepted(kFALSE); HLTMod *hltModE = new HLTMod("HLTModE"); // hltModE->AddTrigger("HLT_Photon10_L1R",132440,137028); // hltModE->AddTrigger("HLT_Photon15_Cleaned_L1R",138564,140401); // hltModE->AddTrigger("HLT_Ele15_SW_CaloEleId_L1R",141956,144114); // hltModE->AddTrigger("HLT_Ele17_SW_CaloEleId_L1R",144115,147145); // hltModE->AddTrigger("HLT_Ele17_SW_TightEleId_L1R",147146,148102); // hltModE->AddTrigger("HLT_Ele27_SW_TightCaloEleIdTrack_L1R_v1",147146,148102); // hltModE->AddTrigger("HLT_Ele22_SW_TighterCaloIdIsol_L1R_v1",148103,159999); // hltModE->AddTrigger("HLT_Ele22_SW_TighterCaloIdIsol_L1R_v2",148103,159999); // hltModE->AddTrigger("HLT_Ele17_CaloIdL_CaloIsoVL_Ele8_CaloIdL_CaloIsoVL_v1",160000,999999); // hltModE->AddTrigger("HLT_Ele17_CaloIdL_CaloIsoVL_Ele8_CaloIdL_CaloIsoVL_v2",160000,999999); // hltModE->AddTrigger("HLT_Ele17_CaloIdL_CaloIsoVL_Ele8_CaloIdL_CaloIsoVL_v3",160000,999999); // hltModE->AddTrigger("HLT_Ele15_LW_L1R",1,1); // hltModE->AddTrigger("HLT_Ele17_SW_CaloEleId_L1R",1,1); // hltModE->AddTrigger("HLT_Ele22_SW_TighterCaloIdIsol_L1R_v2",1,1); hltModE->AddTrigger("HLT_Ele17_CaloIdL_CaloIsoVL_Ele8_CaloIdL_CaloIsoVL_v1",150000,161176); hltModE->AddTrigger("HLT_Ele17_CaloIdL_CaloIsoVL_Ele8_CaloIdL_CaloIsoVL_v2",161179,163261); hltModE->AddTrigger("HLT_Ele17_CaloIdL_CaloIsoVL_Ele8_CaloIdL_CaloIsoVL_v3",163262,164237); hltModE->AddTrigger("HLT_Ele17_CaloIdL_CaloIsoVL_Ele8_CaloIdL_CaloIsoVL_v4",165085,165888); hltModE->AddTrigger("HLT_Ele17_CaloIdL_CaloIsoVL_Ele8_CaloIdL_CaloIsoVL_v5",165900,166967); hltModE->AddTrigger("HLT_Ele17_CaloIdL_CaloIsoVL_Ele8_CaloIdL_CaloIsoVL_v6",166968,170053); hltModE->AddTrigger("HLT_Ele17_CaloIdT_CaloIsoVL_TrkIdVL_TrkIsoVL_Ele8_CaloIdT_CaloIsoVL_TrkIdVL_TrkIsoVL_v6",170054,170759); hltModE->AddTrigger("HLT_Ele17_CaloIdT_CaloIsoVL_TrkIdVL_TrkIsoVL_Ele8_CaloIdT_CaloIsoVL_TrkIdVL_TrkIsoVL_v7",170760,173198); hltModE->AddTrigger("HLT_Ele17_CaloIdT_CaloIsoVL_TrkIdVL_TrkIsoVL_Ele8_CaloIdT_CaloIsoVL_TrkIdVL_TrkIsoVL_v8",173199,178380); hltModE->AddTrigger("HLT_Ele17_CaloIdT_CaloIsoVL_TrkIdVL_TrkIsoVL_Ele8_CaloIdT_CaloIsoVL_TrkIdVL_TrkIsoVL_v9",178381,179889); hltModE->AddTrigger("HLT_Ele17_CaloIdT_CaloIsoVL_TrkIdVL_TrkIsoVL_Ele8_CaloIdT_CaloIsoVL_TrkIdVL_TrkIsoVL_v10",179890,999999); hltModE->SetTrigObjsName("MyHltElecObjs"); hltModE->SetAbortIfNotAccepted(isData); HLTMod *hltModES = new HLTMod("HLTModES"); hltModES->AddTrigger("HLT_Ele27_CaloIdVT_CaloIsoT_TrkIdT_TrkIsoT_v*",160000,999999); hltModES->AddTrigger("HLT_Ele27_CaloIdVT_CaloIsoT_TrkIdT_TrkIsoT_v2",160000,999999); hltModES->AddTrigger("HLT_Ele27_CaloIdVT_CaloIsoT_TrkIdT_TrkIsoT_v3",160000,999999); hltModES->AddTrigger("HLT_Ele25_WP80_PFMT40_v*",160000,999999); hltModES->AddTrigger("HLT_Ele27_WP80_PFMT50_v*",160000,999999); hltModES->SetTrigObjsName("MyHltElecSObjs"); hltModES->SetAbortIfNotAccepted(isData); HLTMod *hltModP = new HLTMod("HLTModP"); hltModP->AddTrigger("HLT_Photon26_CaloIdL_IsoVL_Photon18_CaloIdL_IsoVL_v*",160000,161176); hltModP->AddTrigger("HLT_Photon26_CaloIdL_IsoVL_Photon18_CaloIdL_IsoVL_v*",161216,165633); hltModP->AddTrigger("HLT_Photon26_CaloIdL_IsoVL_Photon18_R9Id_v*",161216,165633); hltModP->AddTrigger("HLT_Photon26_R9Id_Photon18_CaloIdL_IsoVL_v*",161216,165633); hltModP->AddTrigger("HLT_Photon20_R9Id_Photon18_R9Id_v*",161216,165633); hltModP->AddTrigger("HLT_Photon26_CaloIdL_IsoVL_Photon18_CaloIdL_IsoVL_v*",165970,173198); hltModP->AddTrigger("HLT_Photon26_CaloIdL_IsoVL_Photon18_R9Id_v*",165970,173198); hltModP->AddTrigger("HLT_Photon26_R9Id_Photon18_CaloIdL_IsoVL_v*",165970,173198); hltModP->AddTrigger("HLT_Photon26_R9Id_Photon18_R9Id_v*",165970,173198); hltModP->AddTrigger("HLT_Photon36_CaloIdL_IsoVL_Photon22_CaloIdL_IsoVL_v*",165970,173198); hltModP->AddTrigger("HLT_Photon36_R9Id_Photon22_CaloIdL_IsoVL_v*",165970,173198); hltModP->AddTrigger("HLT_Photon36_R9Id_Photon22_R9Id_v*",165970,173198); hltModP->AddTrigger("HLT_Photon36_CaloId_IsoVL_Photon22_R9Id_v*",165970,166967); hltModP->AddTrigger("HLT_Photon36_CaloIdL_IsoVL_Photon22_R9Id_v*",167039,173198); hltModP->AddTrigger("HLT_Photon26_CaloIdXL_IsoXL_Photon18_CaloIdXL_IsoXL_v*",173236,178380); hltModP->AddTrigger("HLT_Photon26_CaloIdXL_IsoXL_Photon18_R9Id_v*",173236,178380); hltModP->AddTrigger("HLT_Photon26_R9Id_Photon18_CaloIdXL_IsoXL_v*",173236,178380); hltModP->AddTrigger("HLT_Photon26_R9Id_Photon18_R9Id_v*",173236,178380); hltModP->AddTrigger("HLT_Photon36_CaloIdL_IsoVL_Photon22_CaloIdL_IsoVL_v*",173236,178380); hltModP->AddTrigger("HLT_Photon36_CaloIdL_IsoVL_Photon22_R9Id_v*",173236,178380); hltModP->AddTrigger("HLT_Photon36_R9Id_Photon22_CaloIdL_IsoVL_v*",173236,178380); hltModP->AddTrigger("HLT_Photon36_R9Id_Photon22_R9Id_v*",173236,178380); hltModP->AddTrigger("HLT_Photon26_CaloIdXL_IsoXL_Photon18_CaloIdXL_IsoXL_Mass60_v*",178420,999999); hltModP->AddTrigger("HLT_Photon26_CaloIdXL_IsoXL_Photon18_R9IdT_Mass60_v*",178420,999999); hltModP->AddTrigger("HLT_Photon26_R9IdT_Photon18_CaloIdXL_IsoXL_Mass60_v*",178420,999999); hltModP->AddTrigger("HLT_Photon26_R9IdT_Photon18_R9IdT_Mass60_v*",178420,999999); hltModP->AddTrigger("HLT_Photon36_CaloIdL_IsoVL_Photon22_CaloIdL_IsoVL_v*",178420,999999); hltModP->AddTrigger("HLT_Photon36_CaloIdL_IsoVL_Photon22_R9Id_v*",178420,999999); hltModP->AddTrigger("HLT_Photon36_R9Id_Photon22_CaloIdL_IsoVL_v*",178420,999999); hltModP->AddTrigger("HLT_Photon36_R9Id_Photon22_R9Id_v*",178420,999999); hltModP->SetTrigObjsName("MyHltPhotObjs"); hltModP->SetAbortIfNotAccepted(isData); //------------------------------------------------------------------------------------------------ // select events with a good primary vertex //------------------------------------------------------------------------------------------------ GoodPVFilterMod *goodPVFilterMod = new GoodPVFilterMod; goodPVFilterMod->SetMinVertexNTracks(0); goodPVFilterMod->SetMinNDof (4.0); goodPVFilterMod->SetMaxAbsZ (24.0); goodPVFilterMod->SetMaxRho (2.0); goodPVFilterMod->SetAbortIfNotAccepted(kFALSE); goodPVFilterMod->SetIsMC(!isData); GoodPVFilterMod *goodPVFilterModE = new GoodPVFilterMod("GoodPVFilterModE"); goodPVFilterModE->SetOutputName("GoodVertexesE"); goodPVFilterModE->SetMinVertexNTracks(0); goodPVFilterModE->SetMinNDof (4.0); goodPVFilterModE->SetMaxAbsZ (24.0); goodPVFilterModE->SetMaxRho (2.0); goodPVFilterModE->SetIsMC(!isData); GoodPVFilterMod *goodPVFilterModES = new GoodPVFilterMod("GoodPVFilterModES"); goodPVFilterModES->SetOutputName("GoodVertexesES"); goodPVFilterModES->SetMinVertexNTracks(0); goodPVFilterModES->SetMinNDof (4.0); goodPVFilterModES->SetMaxAbsZ (24.0); goodPVFilterModES->SetMaxRho (2.0); //------------------------------------------------------------------------------------------------ // object id and cleaning sequence //------------------------------------------------------------------------------------------------ MuonIDMod *muonId = new MuonIDMod; muonId->SetClassType ("Global"); muonId->SetIDType ("ZMuId"); muonId->SetIsoType ("TrackCaloSliding"); muonId->SetApplyD0Cut(kTRUE); ElectronIDMod *elecId = new ElectronIDMod; elecId->SetVertexName(goodPVFilterModE->GetOutputName()); elecId->SetIDType ("VBTFWorkingPointLowPtId"); elecId->SetIsoType ("PFIso"); elecId->SetNExpectedHitsInnerCut (0); elecId->SetEtaMax(999.); elecId->SetChargeFilter(kFALSE); elecId->SetApplySpikeRemoval(kFALSE); elecId->SetApplyEcalFiducial(kTRUE); elecId->SetApplyEcalSeeded(kTRUE); elecId->SetPtMin(20.0); ElectronIDMod *elecIdS = new ElectronIDMod("ElectronIDModS"); elecIdS->SetVertexName(goodPVFilterModES->GetOutputName()); elecIdS->SetIDType ("VBTFWorkingPoint70Id"); elecIdS->SetIsoType ("VBTFWorkingPoint70Iso"); elecIdS->SetNExpectedHitsInnerCut (0); elecIdS->SetEtaMax(999.); elecIdS->SetChargeFilter(kFALSE); elecIdS->SetApplySpikeRemoval(kFALSE); elecIdS->SetApplyEcalFiducial(kTRUE); elecIdS->SetApplyEcalSeeded(kTRUE); elecIdS->SetPtMin(20.0); elecIdS->SetOutputName("GoodElectronsS"); PublisherMod<PFJet,Jet> *pubJet = new PublisherMod<PFJet,Jet>("JetPub"); pubJet->SetInputName("AKt5PFJets"); pubJet->SetOutputName("PubAKt5PFJets"); PublisherMod<PFJet,Jet> *pubJetOpen = new PublisherMod<PFJet,Jet>("JetPubOpen"); pubJetOpen->SetInputName("AKt5PFJets"); pubJetOpen->SetOutputName("PubAKt5PFJetsOpen"); JetCorrectionMod *jetCorr = new JetCorrectionMod; jetCorr->AddCorrectionFromFile(std::string((gSystem->Getenv("CMSSW_BASE") + TString("/src/MitPhysics/data/START42_V12_AK5PF_L1FastJet.txt")).Data())); jetCorr->AddCorrectionFromFile(std::string((gSystem->Getenv("CMSSW_BASE") + TString("/src/MitPhysics/data/START42_V12_AK5PF_L2Relative.txt")).Data())); jetCorr->AddCorrectionFromFile(std::string((gSystem->Getenv("CMSSW_BASE") + TString("/src/MitPhysics/data/START42_V12_AK5PF_L3Absolute.txt")).Data())); if(isData){ jetCorr->AddCorrectionFromFile(std::string((gSystem->Getenv("CMSSW_BASE") + TString("/src/MitPhysics/data/START42_V12_AK5PF_L2L3Residual.txt")).Data())); } jetCorr->SetInputName(pubJet->GetOutputName()); jetCorr->SetCorrectedName("CorrectedJets"); Bool_t excludedoubleprompt = kFALSE; if (TString(dataset).Contains("-pj")) { mcselmod->ExcludeProcess(18); mcselmod->ExcludeProcess(114); excludedoubleprompt = kTRUE; } if (TString(dataset).Contains("-qcd2em") || TString(dataset).Contains("-qcd-2em")) { excludedoubleprompt = kTRUE; } PhotonMvaMod *photreg = new PhotonMvaMod; photreg->SetOutputName("GoodPhotonsRegr"); photreg->SetIsData(isData); PhotonPairSelector *photcic = new PhotonPairSelector("PhotonPairSelectorCiC"); photcic->SetOutputName("GoodPhotonsCIC"); photcic->SetPhotonSelType("CiCSelection"); photcic->SetVertexSelType("CiCMVASelection"); photcic->DoMCSmear(kTRUE); photcic->DoDataEneCorr(kTRUE); photcic->SetPhotonsFromBranch(kFALSE); photcic->SetInputPhotonsName(photreg->GetOutputName()); photcic->SetMCSmearFactors(0.0089, 0.0089, 0.0109, 0.0156, 0.0203,0.0303,0.0326,0.0318,0.0331); photcic->AddEnCorrPerRun(160000,167913,0.9905,0.9905,0.9971,0.9976,1.0094,0.9994,1.0044,0.9968,1.0079); photcic->AddEnCorrPerRun(170249,172619,0.9909,0.9909,0.9975,0.9994,1.0112,0.9962,1.0012,0.9962,1.0072); photcic->AddEnCorrPerRun(172620,173692,0.9909,0.9909,0.9975,0.9977,1.0096,0.9963,1.0013,0.9947,1.0057); photcic->AddEnCorrPerRun(175860,177139,0.9911,0.9911,0.9977,0.9990,1.0109,0.9922,0.9973,0.9967,1.0077); photcic->AddEnCorrPerRun(177140,178421,0.9910,0.9910,0.9975,0.9987,1.0105,0.9921,0.9972,0.9975,1.0085); photcic->AddEnCorrPerRun(178424,999999,0.9903,0.9903,0.9969,0.9976,1.0095,0.9889,0.9940,0.9976,1.0086); photcic->SetDoMCR9Scaling(kTRUE); photcic->SetMCR9Scale(1.0048, 1.00492); photcic->SetDoMCErrScaling(kTRUE); photcic->SetMCErrScale(1.07, 1.045); photcic->SetIsData(isData); PhotonPairSelector *photcicnoeleveto = new PhotonPairSelector("PhotonPairSelectorCiCNoEleVeto"); photcicnoeleveto->SetOutputName("GoodPhotonsCICNoEleVeto"); photcicnoeleveto->SetPhotonSelType("CiCSelection"); photcicnoeleveto->SetVertexSelType("CiCMVASelection"); photcicnoeleveto->DoMCSmear(kTRUE); photcicnoeleveto->DoDataEneCorr(kTRUE); photcicnoeleveto->SetPhotonsFromBranch(kFALSE); photcicnoeleveto->SetInputPhotonsName(photreg->GetOutputName()); photcicnoeleveto->SetMCSmearFactors(0.0089, 0.0089, 0.0109, 0.0156, 0.0203,0.0303,0.0326,0.0318,0.0331); photcicnoeleveto->AddEnCorrPerRun(160000,167913,0.9905,0.9905,0.9971,0.9976,1.0094,0.9994,1.0044,0.9968,1.0079); photcicnoeleveto->AddEnCorrPerRun(170249,172619,0.9909,0.9909,0.9975,0.9994,1.0112,0.9962,1.0012,0.9962,1.0072); photcicnoeleveto->AddEnCorrPerRun(172620,173692,0.9909,0.9909,0.9975,0.9977,1.0096,0.9963,1.0013,0.9947,1.0057); photcicnoeleveto->AddEnCorrPerRun(175860,177139,0.9911,0.9911,0.9977,0.9990,1.0109,0.9922,0.9973,0.9967,1.0077); photcicnoeleveto->AddEnCorrPerRun(177140,178421,0.9910,0.9910,0.9975,0.9987,1.0105,0.9921,0.9972,0.9975,1.0085); photcicnoeleveto->AddEnCorrPerRun(178424,999999,0.9903,0.9903,0.9969,0.9976,1.0095,0.9889,0.9940,0.9976,1.0086); photcicnoeleveto->SetDoMCR9Scaling(kTRUE); photcicnoeleveto->SetMCR9Scale(1.0048, 1.00492); photcicnoeleveto->SetDoMCErrScaling(kTRUE); photcicnoeleveto->SetMCErrScale(1.07, 1.045); photcicnoeleveto->SetApplyEleVeto(kFALSE); photcicnoeleveto->SetIsData(isData); PhotonPairSelector *photpresel = new PhotonPairSelector("PhotonPairSelectorPresel"); photpresel->SetOutputName("GoodPhotonsPresel"); photpresel->SetPhotonSelType("MITSelection"); photpresel->SetVertexSelType("CiCMVASelection"); photpresel->DoMCSmear(kTRUE); photpresel->DoDataEneCorr(kTRUE); photpresel->SetPhotonsFromBranch(kFALSE); photpresel->SetInputPhotonsName(photreg->GetOutputName()); //photpresel->SetMCSmearFactors(0.0045, 0.0084, 0.0109, 0.0156, 0.0203,0.0303,0.0326,0.0318,0.0331); photpresel->SetMCSmearFactors(0.0067,0.0077,0.0096,0.0141,0.0196,0.0268,0.0279,0.0293,0.0301);//ming:smear(sigE/E) //photpresel->AddEnCorrPerRun(160000,167913,0.9905,0.9905,0.9971,0.9976,1.0094,0.9994,1.0044,0.9968,1.0079); //photpresel->AddEnCorrPerRun(170249,172619,0.9909,0.9909,0.9975,0.9994,1.0112,0.9962,1.0012,0.9962,1.0072); //photpresel->AddEnCorrPerRun(172620,173692,0.9909,0.9909,0.9975,0.9977,1.0096,0.9963,1.0013,0.9947,1.0057); //photpresel->AddEnCorrPerRun(175860,177139,0.9911,0.9911,0.9977,0.9990,1.0109,0.9922,0.9973,0.9967,1.0077); //photpresel->AddEnCorrPerRun(177140,178421,0.9910,0.9910,0.9975,0.9987,1.0105,0.9921,0.9972,0.9975,1.0085); //photpresel->AddEnCorrPerRun(178424,999999,0.9903,0.9903,0.9969,0.9976,1.0095,0.9889,0.9940,0.9976,1.0086); photpresel->AddEnCorrPerRun(160431,167913,0.9941,0.9941,1.0004,0.9916,1.0045,1.0033,1.0082,0.9958,1.0064);//ming:Emc/Edata photpresel->AddEnCorrPerRun(170000,172619,0.9954,0.9954,1.0016,0.9937,1.0066,0.9976,1.0025,0.9940,1.0046); photpresel->AddEnCorrPerRun(172620,173692,0.9955,0.9955,1.0017,0.9929,1.0058,0.9986,1.0035,0.9923,1.0029); photpresel->AddEnCorrPerRun(175830,177139,0.9958,0.9958,1.0021,0.9944,1.0073,0.9968,1.0017,0.9933,1.004); photpresel->AddEnCorrPerRun(177140,178421,0.9962,0.9962,1.0025,0.9946,1.0075,0.9960,1.0010,0.9944,1.005); photpresel->AddEnCorrPerRun(178424,180252,0.9961,0.9961,1.0024,0.9942,1.0071,0.9921,0.9970,0.9953,1.0059); photpresel->SetDoMCR9Scaling(kTRUE); photpresel->SetMCR9Scale(1.0035, 1.0035); photpresel->SetDoMCSigIEtaIEtaScaling(kTRUE); photpresel->SetDoMCWidthScaling(kTRUE); photpresel->SetDoMCErrScaling(kTRUE); photpresel->SetMCErrScale(1.07, 1.045); photpresel->SetIsData(isData); PhotonPairSelector *photpreselinverteleveto = new PhotonPairSelector("PhotonPairSelectorPreselInvertEleVeto"); photpreselinverteleveto->SetOutputName("GoodPhotonsPreselInvertEleVeto"); photpreselinverteleveto->SetPhotonSelType("MITSelection"); photpreselinverteleveto->SetVertexSelType("CiCMVASelection"); photpreselinverteleveto->DoMCSmear(kTRUE); photpreselinverteleveto->DoDataEneCorr(kTRUE); photpreselinverteleveto->SetPhotonsFromBranch(kFALSE); photpreselinverteleveto->SetInputPhotonsName(photreg->GetOutputName()); photpreselinverteleveto->SetMCSmearFactors(0.0045, 0.0084, 0.0109, 0.0156, 0.0203,0.0303,0.0326,0.0318,0.0331); photpreselinverteleveto->AddEnCorrPerRun(160000,167913,0.9905,0.9905,0.9971,0.9976,1.0094,0.9994,1.0044,0.9968,1.0079); photpreselinverteleveto->AddEnCorrPerRun(170249,172619,0.9909,0.9909,0.9975,0.9994,1.0112,0.9962,1.0012,0.9962,1.0072); photpreselinverteleveto->AddEnCorrPerRun(172620,173692,0.9909,0.9909,0.9975,0.9977,1.0096,0.9963,1.0013,0.9947,1.0057); photpreselinverteleveto->AddEnCorrPerRun(175860,177139,0.9911,0.9911,0.9977,0.9990,1.0109,0.9922,0.9973,0.9967,1.0077); photpreselinverteleveto->AddEnCorrPerRun(177140,178421,0.9910,0.9910,0.9975,0.9987,1.0105,0.9921,0.9972,0.9975,1.0085); photpreselinverteleveto->AddEnCorrPerRun(178424,999999,0.9903,0.9903,0.9969,0.9976,1.0095,0.9889,0.9940,0.9976,1.0086); photpreselinverteleveto->SetDoMCR9Scaling(kTRUE); photpreselinverteleveto->SetMCR9Scale(1.0035, 1.0035); photpreselinverteleveto->SetDoMCSigIEtaIEtaScaling(kTRUE); photpreselinverteleveto->SetDoMCWidthScaling(kTRUE); photpreselinverteleveto->SetDoMCErrScaling(kTRUE); photpreselinverteleveto->SetMCErrScale(1.07, 1.045); photpreselinverteleveto->SetApplyEleVeto(kFALSE); photpreselinverteleveto->SetInvertElectronVeto(kTRUE); photpreselinverteleveto->SetIsData(isData); PhotonPairSelector *photpreselnosmear = new PhotonPairSelector("PhotonPairSelectorPreselNoSmear"); photpreselnosmear->SetOutputName("GoodPhotonsPreselNoSmear"); photpreselnosmear->SetPhotonSelType("MITSelection"); photpreselnosmear->SetVertexSelType("CiCMVASelection"); photpreselnosmear->SetPhotonsFromBranch(kFALSE); photpreselnosmear->SetInputPhotonsName(photreg->GetOutputName()); photpreselnosmear->SetIsData(isData); PhotonTreeWriter *phottreecic = new PhotonTreeWriter("PhotonTreeWriterCiC"); phottreecic->SetPhotonsFromBranch(kFALSE); phottreecic->SetInputPhotonsName(photcic->GetOutputName()); phottreecic->SetEnableJets(kTRUE); phottreecic->SetPFJetsFromBranch(kFALSE); phottreecic->SetPFJetName(jetCorr->GetOutputName()); phottreecic->SetExcludeDoublePrompt(excludedoubleprompt); phottreecic->SetIsData(isData); PhotonTreeWriter *phottreecicnoeleveto = new PhotonTreeWriter("PhotonTreeWriterCiCNoEleVeto"); phottreecicnoeleveto->SetPhotonsFromBranch(kFALSE); phottreecicnoeleveto->SetInputPhotonsName(photcicnoeleveto->GetOutputName()); phottreecicnoeleveto->SetEnableJets(kTRUE); phottreecicnoeleveto->SetPFJetsFromBranch(kFALSE); phottreecicnoeleveto->SetPFJetName(jetCorr->GetOutputName()); phottreecicnoeleveto->SetApplyElectronVeto(kFALSE); phottreecicnoeleveto->SetExcludeDoublePrompt(excludedoubleprompt); phottreecicnoeleveto->SetIsData(isData); PhotonTreeWriter *phottreepresel = new PhotonTreeWriter("PhotonTreeWriterPresel"); phottreepresel->SetPhotonsFromBranch(kFALSE); phottreepresel->SetInputPhotonsName(photpresel->GetOutputName()); phottreepresel->SetEnableJets(kTRUE); phottreepresel->SetPFJetsFromBranch(kFALSE); phottreepresel->SetPFJetName(jetCorr->GetOutputName()); phottreepresel->SetExcludeDoublePrompt(excludedoubleprompt); phottreepresel->SetIsData(isData); PhotonTreeWriter *phottreepreselinverteleveto = new PhotonTreeWriter("PhotonTreeWriterPreselInvertEleVeto"); phottreepreselinverteleveto->SetPhotonsFromBranch(kFALSE); phottreepreselinverteleveto->SetInputPhotonsName(photpreselinverteleveto->GetOutputName()); phottreepreselinverteleveto->SetEnableJets(kTRUE); phottreepreselinverteleveto->SetPFJetsFromBranch(kFALSE); phottreepreselinverteleveto->SetPFJetName(jetCorr->GetOutputName()); phottreepreselinverteleveto->SetApplyElectronVeto(kFALSE); phottreepreselinverteleveto->SetExcludeDoublePrompt(excludedoubleprompt); phottreepreselinverteleveto->SetIsData(isData); PhotonTreeWriter *phottreepreselnosmear = new PhotonTreeWriter("PhotonTreeWriterPreselNoSmear"); phottreepreselnosmear->SetPhotonsFromBranch(kFALSE); phottreepreselnosmear->SetInputPhotonsName(photpreselnosmear->GetOutputName()); phottreepreselnosmear->SetEnableJets(kTRUE); phottreepreselnosmear->SetPFJetsFromBranch(kFALSE); phottreepreselnosmear->SetPFJetName(jetCorr->GetOutputName()); phottreepreselnosmear->SetExcludeDoublePrompt(excludedoubleprompt); phottreepreselnosmear->SetIsData(isData); PhotonIDMod *photidcic = new PhotonIDMod("PhotonIDModPresel"); photidcic->SetPtMin(25.0); photidcic->SetOutputName("GoodPhotonsPreselid"); photidcic->SetOutputName("MITSelection"); photidcic->SetApplyElectronVeto(kTRUE); photidcic->SetIsData(isData); PhotonTreeWriter *phottreesingle = new PhotonTreeWriter("PhotonTreeWriterSingle"); phottreesingle->SetWriteDiphotonTree(kFALSE); phottreesingle->SetPhotonsFromBranch(kFALSE); phottreesingle->SetInputPhotonsName(photidcic->GetOutputName()); phottreesingle->SetIsData(isData); PhotonTreeWriter *phottreeE = new PhotonTreeWriter("PhotonTreeWriterE"); phottreeE->SetGoodElectronsFromBranch(kFALSE); phottreeE->SetGoodElectronName(elecId->GetOutputName()); phottreeE->SetLoopOnGoodElectrons(kTRUE); phottreeE->SetApplyElectronVeto(kFALSE); phottreeE->SetIsData(isData); PhotonTreeWriter *phottreeES = new PhotonTreeWriter("PhotonTreeWriterES"); phottreeES->SetWriteDiphotonTree(kFALSE); phottreeES->SetGoodElectronsFromBranch(kFALSE); phottreeES->SetGoodElectronName(elecIdS->GetOutputName()); phottreeES->SetLoopOnGoodElectrons(kTRUE); phottreeES->SetApplyElectronVeto(kFALSE); phottreeES->SetIsData(isData); //------------------------------------------------------------------------------------------------ // making analysis chain //------------------------------------------------------------------------------------------------ // this is how it always starts runLumiSel ->Add(mcselmod); if (TString(dataset).Contains("-h")) { mcselmod ->Add(sysMod); } // high level trigger is always first //mcselmod ->Add(hltModE); //mcselmod ->Add(hltModES); mcselmod ->Add(hltModP); hltModP ->Add(goodPVFilterMod); //hltModE ->Add(goodPVFilterModE); //hltModES ->Add(goodPVFilterModES); //goodPVFilterMod ->Add(muonId); goodPVFilterMod->Add(photreg); photreg->Add(pubJet); pubJet->Add(jetCorr); // simple object id modules //goodPVFilterModE ->Add(elecId); //goodPVFilterModES ->Add(elecIdS); //jetCorr ->Add(photcic); //jetCorr ->Add(photcicnoeleveto); jetCorr ->Add(photpresel); //jetCorr ->Add(photpreselinverteleveto); //jetCorr ->Add(photpreselnosmear); //photcic ->Add(phottreecic); //photcicnoeleveto ->Add(phottreecicnoeleveto); photpresel ->Add(phottreepresel); //photpreselinverteleveto ->Add(phottreepreselinverteleveto); //photpreselnosmear ->Add(phottreepreselnosmear); //jetCorr ->Add(photidcic); //photidcic ->Add(phottreesingle); //elecId->Add(phottreeE); //elecIdS->Add(phottreeES); TFile::SetOpenTimeout(0); TFile::SetCacheFileDir("./rootfilecache",kTRUE,kTRUE); TFile::SetReadaheadSize(128*1024*1024); //------------------------------------------------------------------------------------------------ // setup analysis //------------------------------------------------------------------------------------------------ Analysis *ana = new Analysis; ana->SetUseHLT(kTRUE); ana->SetKeepHierarchy(kTRUE); ana->SetSuperModule(runLumiSel); ana->SetPrintScale(100); if (nEvents >= 0) ana->SetProcessNEvents(nEvents); //------------------------------------------------------------------------------------------------ // organize input //------------------------------------------------------------------------------------------------ Catalog *c = new Catalog(catalogDir); TString skimdataset = TString(dataset)+TString("/") +TString(skim); Dataset *d = NULL; TString bookstr = book; //if (TString(dataset).Contains("s11-h")) bookstr.ReplaceAll("local","t2mit"); if (TString(skim).CompareTo("noskim") == 0) d = c->FindDataset(bookstr,dataset,fileset); else d = c->FindDataset(bookstr,skimdataset.Data(),fileset); ana->AddDataset(d); //ana->AddFile("/mnt/hadoop/cmsprod/filefi/025/r11b-pho-n30-v1/4863E9D1-BC1C-E111-99BA-001A92810AF4.root"); //------------------------------------------------------------------------------------------------ // organize output //------------------------------------------------------------------------------------------------ TString rootFile = TString(outputName); rootFile += TString("_") + TString(dataset) + TString("_") + TString(skim); if (TString(fileset) != TString("")) rootFile += TString("_") + TString(fileset); rootFile += TString(".root"); ana->SetOutputName(rootFile.Data()); //ana->SetCacheSize(64*1024*1024); ana->SetCacheSize(0); //------------------------------------------------------------------------------------------------ // Say what we are doing //------------------------------------------------------------------------------------------------ printf("\n==== PARAMETER SUMMARY FOR THIS JOB ====\n"); printf("\n JSON file: %s\n and overlap cut: %f (%s)\n",jsonFile.Data(),overlapCut,overlap); printf("\n Rely on Catalog: %s\n",catalogDir); printf(" -> Book: %s Dataset: %s Skim: %s Fileset: %s <-\n",book,dataset,skim,fileset); printf("\n Root output: %s\n\n",rootFile.Data()); printf("\n========================================\n"); //------------------------------------------------------------------------------------------------ // run the analysis after successful initialisation //------------------------------------------------------------------------------------------------ ana->Run(!gROOT->IsBatch()); return; }
//-------------------------------------------------------------------------------------------------- void runMonoJetTrigger(const char *fileset = "0000", const char *skim = "noskim", const char *dataset = "s12-wglg-v7a", const char *book = "t2mit/filefi/029", const char *catalogDir = "/home/cmsprod/catalog", const char *outputName = "gmet", int nEvents = 1000) { //------------------------------------------------------------------------------------------------ // some parameters get passed through the environment //------------------------------------------------------------------------------------------------ char json[1024], overlap[1024]; float overlapCut = -1; if (gSystem->Getenv("MIT_PROD_JSON")) sprintf(json, "%s",gSystem->Getenv("MIT_PROD_JSON")); else { sprintf(json, "%s", "~"); //printf(" JSON file was not properly defined. EXIT!\n"); //return; } TString jsonFile = TString("/home/cmsprod/cms/json/") + TString(json); //TString jsonFile = TString("/home/cmsprod/cms/json/") + TString("Cert_136033-149442_7TeV_Dec22ReReco_Collisions10_JSON_v4.txt"); Bool_t isData = ( (jsonFile.CompareTo("/home/cmsprod/cms/json/~") != 0) ); if (gSystem->Getenv("MIT_PROD_OVERLAP")) { sprintf(overlap,"%s",gSystem->Getenv("MIT_PROD_OVERLAP")); if (EOF == sscanf(overlap,"%f",&overlapCut)) { printf(" Overlap was not properly defined. EXIT!\n"); return; } } else { sprintf(overlap,"%s", "-1.0"); //printf(" OVERLAP file was not properly defined. EXIT!\n"); //return; } printf("\n Initialization worked \n"); //------------------------------------------------------------------------------------------------ // some global setups //------------------------------------------------------------------------------------------------ using namespace mithep; gDebugMask = Debug::kGeneral; gDebugLevel = 3; //------------------------------------------------------------------------------------------------ // set up information //------------------------------------------------------------------------------------------------ MVASystematicsMod *sysMod = new MVASystematicsMod; sysMod->SetMCR9Scale(1.0035, 1.0035); sysMod->SetIsData(isData); RunLumiSelectionMod *runLumiSel = new RunLumiSelectionMod; runLumiSel->SetAcceptMC(!isData); runLumiSel->SetAbortIfNotAccepted(kFALSE); // accept all events if there is no valid JSON file // only select on run- and lumisection numbers when valid json file present if ((jsonFile.CompareTo("/home/cmsprod/cms/json/~") != 0) && (jsonFile.CompareTo("/home/cmsprod/cms/json/-") != 0) ) { runLumiSel->AddJSONFile(jsonFile.Data()); } if ((jsonFile.CompareTo("/home/cmsprod/cms/json/-") == 0) ) { printf("\n WARNING -- Looking at data without JSON file: always accept.\n\n"); // runLumiSel->SetAbortIfNotAccepted(kFALSE); // accept all events if there is no valid JSON file } printf("\n Run lumi worked\n"); //------------------------------------------------------------------------------------------------ // HLT information : [TBF] //------------------------------------------------------------------------------------------------ HLTMod *hltModP = new HLTMod("HLTModP"); //------------------------------------------------------------------------------------------------ // Run2012 //------------------------------------------------------------------------------------------------ hltModP->AddTrigger("HLT_IsoMu24_eta2p1_v*",0,999999); //store the relevant objects hltModP->AddTrigger("HLT_MET120_HBHENoiseCleaned_v*",0,999999); //met type 87 hltModP->AddTrigger("!HLT_MET120_HBHENoiseCleaned_v*",0,999999); //met type 87 hltModP->AddTrigger("HLT_MonoCentralPFJet80_PFMETnoMu95_NHEF0p95_v*",0,999999); //jet 85 , met 90 hltModP->AddTrigger("!HLT_MonoCentralPFJet80_PFMETnoMu95_NHEF0p95_v*",0,999999); //jet 85 , met 90 hltModP->AddTrigger("HLT_MonoCentralPFJet80_PFMETnoMu105_NHEF0p95_v*",0,999999); //jet 85 , met 90 hltModP->AddTrigger("!HLT_MonoCentralPFJet80_PFMETnoMu105_NHEF0p95_v*",0,999999); //jet 85 , met 90 hltModP->SetTrigObjsName("MyHltObjs"); hltModP->SetAbortIfNotAccepted(isData); hltModP->SetPrintTable(kFALSE); // set to true to print HLT table //------------------------------------------------------------------------------------------------ // split pfcandidates to PFPU and PFnoPU //------------------------------------------------------------------------------------------------ SeparatePileUpMod* SepPUMod = new SeparatePileUpMod; // SepPUMod->SetUseAllVerteces(kFALSE); // SepPUMod->SetVertexName("OutVtxCiC"); SepPUMod->SetPFNoPileUpName("pfnopileupcands"); SepPUMod->SetPFPileUpName("pfpileupcands"); SepPUMod->SetCheckClosestZVertex(kFALSE); //------------------------------------------------------------------------------------------------ // select events with a good primary vertex //------------------------------------------------------------------------------------------------ GoodPVFilterMod *goodPVFilterMod = new GoodPVFilterMod; goodPVFilterMod->SetMinVertexNTracks(0); goodPVFilterMod->SetMinNDof (4.0); goodPVFilterMod->SetMaxAbsZ (24.0); goodPVFilterMod->SetMaxRho (2.0); goodPVFilterMod->SetIsMC(!isData); goodPVFilterMod->SetVertexesName("PrimaryVertexes"); //------------------------------------------------------------------------------------------------ // object id and cleaning sequence //------------------------------------------------------------------------------------------------ //----------------------------------- // Lepton Selection //----------------------------------- ElectronIDMod* eleIdMod = new ElectronIDMod; eleIdMod -> SetPtMin(10); eleIdMod -> SetEtaMax(2.5); eleIdMod -> SetApplyEcalFiducial(true); eleIdMod -> SetIDType("Hgg_LeptonTag_2012IdHCP"); eleIdMod -> SetElectronMVAWeightsSubdet0Pt10To20(TString((getenv("CMSSW_BASE")+string("/src/MitPhysics/data/ElectronMVAWeights/ElectronID_BDTG_EGamma2012NonTrigV0_Cat1.weights.xml")))); eleIdMod -> SetElectronMVAWeightsSubdet1Pt10To20(TString((getenv("CMSSW_BASE")+string("/src/MitPhysics/data/ElectronMVAWeights/ElectronID_BDTG_EGamma2012NonTrigV0_Cat2.weights.xml")))); eleIdMod -> SetElectronMVAWeightsSubdet2Pt10To20(TString((getenv("CMSSW_BASE")+string("/src/MitPhysics/data/ElectronMVAWeights/ElectronID_BDTG_EGamma2012NonTrigV0_Cat3.weights.xml")))); eleIdMod -> SetElectronMVAWeightsSubdet0Pt20ToInf(TString((getenv("CMSSW_BASE")+string("/src/MitPhysics/data/ElectronMVAWeights/ElectronID_BDTG_EGamma2012NonTrigV0_Cat4.weights.xml")))); eleIdMod -> SetElectronMVAWeightsSubdet1Pt20ToInf(TString((getenv("CMSSW_BASE")+string("/src/MitPhysics/data/ElectronMVAWeights/ElectronID_BDTG_EGamma2012NonTrigV0_Cat5.weights.xml")))); eleIdMod -> SetElectronMVAWeightsSubdet2Pt20ToInf(TString((getenv("CMSSW_BASE")+string("/src/MitPhysics/data/ElectronMVAWeights/ElectronID_BDTG_EGamma2012NonTrigV0_Cat6.weights.xml")))); eleIdMod -> SetWhichVertex(-1); eleIdMod -> SetD0Cut(0.02); eleIdMod -> SetDZCut(0.2); //h eleIdMod -> SetIsoType("PFIso_HggLeptonTag2012HCP"); //h eleIdMod -> SetOutputName("HggLeptonTagElectrons"); eleIdMod -> SetRhoType(RhoUtilities::CMS_RHO_RHOKT6PFJETS); eleIdMod -> SetPFNoPileUpName("pfnopileupcands"); eleIdMod -> SetInvertNExpectedHitsInnerCut(kFALSE); eleIdMod -> SetNExpectedHitsInnerCut(1); eleIdMod -> SetApplyConversionFilterType1(kTRUE); eleIdMod -> SetPVName(Names::gkPVBeamSpotBrn); MuonIDMod* muonIdMod = new MuonIDMod; // base kinematics muonIdMod -> SetPtMin(10.); muonIdMod -> SetEtaCut(2.4); // base ID muonIdMod -> SetIDType("Tight"); muonIdMod -> SetWhichVertex(-1); // this is a 'hack'.. but hopefully good enough... muonIdMod -> SetD0Cut(0.02); muonIdMod -> SetDZCut(0.5); muonIdMod -> SetIsoType("PFIsoBetaPUCorrected"); //h muonIdMod -> SetPFIsoCut(0.2); //h muonIdMod -> SetOutputName("HggLeptonTagMuons"); muonIdMod -> SetPFNoPileUpName("pfnopileupcands"); muonIdMod -> SetPFPileUpName("pfpileupcands"); muonIdMod -> SetPVName(Names::gkPVBeamSpotBrn); ElectronCleaningMod *electronCleaning = new ElectronCleaningMod; electronCleaning->SetCleanMuonsName(muonIdMod->GetOutputName()); electronCleaning->SetGoodElectronsName(eleIdMod->GetOutputName()); electronCleaning->SetCleanElectronsName("CleanElectrons"); MergeLeptonsMod *merger = new MergeLeptonsMod; merger->SetMuonsName(muonIdMod->GetOutputName()); merger->SetElectronsName(electronCleaning->GetOutputName()); merger->SetMergedName("MergedLeptons"); //----------------------------------- // Photon Regression + ID //----------------------------------- PhotonMvaMod *photreg = new PhotonMvaMod; photreg->SetRegressionVersion(3); photreg->SetRegressionWeights(std::string((gSystem->Getenv("CMSSW_BASE") + TString("/src/MitPhysics/data/gbrv3ph_52x.root")).Data())); photreg->SetOutputName("GoodPhotonsRegr"); photreg->SetApplyShowerRescaling(kTRUE); photreg->SetMinNumPhotons(0); photreg->SetIsData(isData); PhotonIDMod *photonIDMod = new PhotonIDMod; photonIDMod->SetPtMin(0.0); photonIDMod->SetOutputName("GoodPhotons"); photonIDMod->SetIDType("BaseLineCiCPFNoPresel"); photonIDMod->SetIsoType("NoIso"); photonIDMod->SetApplyElectronVeto(kTRUE); photonIDMod->SetApplyPixelSeed(kTRUE); photonIDMod->SetApplyConversionId(kTRUE); photonIDMod->SetApplyFiduciality(kTRUE); photonIDMod->SetIsData(isData); photonIDMod->SetPhotonsFromBranch(kFALSE); photonIDMod->SetInputName(photreg->GetOutputName()); //get the photon with regression energy photonIDMod->DoMCSmear(kTRUE); photonIDMod->DoDataEneCorr(kTRUE); //------------------------------------------Energy smear and scale-------------------------------------------------------------- photonIDMod->SetMCSmearFactors2012HCP(0.0111,0.0111,0.0107,0.0107,0.0155,0.0194,0.0295,0.0276,0.037,0.0371); photonIDMod->AddEnCorrPerRun2012HCP(190645,190781,0.9964,0.9964,1.0020,1.0020,0.9893,1.0028,0.9871,0.9937,0.9839,0.9958); photonIDMod->AddEnCorrPerRun2012HCP(190782,191042,1.0024,1.0024,1.0079,1.0079,0.9923,1.0058,0.9911,0.9977,0.9886,1.0005); photonIDMod->AddEnCorrPerRun2012HCP(191043,193555,0.9935,0.9935,0.9991,0.9991,0.9861,0.9997,0.9894,0.9960,0.9864,0.9982); photonIDMod->AddEnCorrPerRun2012HCP(193556,194150,0.9920,0.9920,0.9976,0.9976,0.9814,0.9951,0.9896,0.9962,0.9872,0.9990); photonIDMod->AddEnCorrPerRun2012HCP(194151,194532,0.9925,0.9925,0.9981,0.9981,0.9826,0.9963,0.9914,0.9980,0.9874,0.9993); photonIDMod->AddEnCorrPerRun2012HCP(194533,195113,0.9927,0.9927,0.9983,0.9983,0.9844,0.9981,0.9934,0.9999,0.9878,0.9996); photonIDMod->AddEnCorrPerRun2012HCP(195114,195915,0.9929,0.9929,0.9984,0.9984,0.9838,0.9974,0.9942,1.0007,0.9878,0.9997); photonIDMod->AddEnCorrPerRun2012HCP(195916,198115,0.9919,0.9919,0.9975,0.9975,0.9827,0.9964,0.9952,1.0017,0.9869,0.9987); photonIDMod->AddEnCorrPerRun2012HCP(198116,199803,0.9955,0.9955,1.0011,1.0011,0.9859,0.9995,0.9893,0.9959,0.9923,1.0041); photonIDMod->AddEnCorrPerRun2012HCP(199804,200048,0.9967,0.9967,1.0023,1.0023,0.9870,1.0006,0.9893,0.9959,0.9937,1.0055); photonIDMod->AddEnCorrPerRun2012HCP(200049,200151,0.9980,0.9980,1.0036,1.0036,0.9877,1.0012,0.9910,0.9976,0.9980,1.0097); photonIDMod->AddEnCorrPerRun2012HCP(200152,200490,0.9958,0.9958,1.0013,1.0013,0.9868,1.0004,0.9922,0.9988,0.9948,1.0065); photonIDMod->AddEnCorrPerRun2012HCP(200491,200531,0.9979,0.9979,1.0035,1.0035,0.9876,1.0012,0.9915,0.9981,0.9979,1.0096); photonIDMod->AddEnCorrPerRun2012HCP(200532,201656,0.9961,0.9961,1.0017,1.0017,0.9860,0.9996,0.9904,0.9970,0.9945,1.0063); photonIDMod->AddEnCorrPerRun2012HCP(201657,202305,0.9969,0.9969,1.0025,1.0025,0.9866,1.0002,0.9914,0.9980,0.9999,1.0116); photonIDMod->AddEnCorrPerRun2012HCP(202305,203002,0.9982,0.9982,1.0038,1.0038,0.9872,1.0008,0.9934,1.0000,1.0018,1.0135); photonIDMod->AddEnCorrPerRun2012HCP(203003,203984,1.0006,1.0006,1.0061,1.0061,0.9880,1.0017,0.9919,0.9988,0.9992,1.0104); photonIDMod->AddEnCorrPerRun2012HCP(203985,205085,0.9993,0.9993,1.0048,1.0048,0.9903,1.0040,0.9928,0.9997,0.9987,1.0099); photonIDMod->AddEnCorrPerRun2012HCP(205086,205310,1.0004,1.0004,1.0059,1.0059,0.9901,1.0037,0.9987,1.0055,1.0091,1.0202); photonIDMod->AddEnCorrPerRun2012HCP(205311,206207,1.0000,1.0000,1.0055,1.0055,0.9891,1.0028,0.9948,1.0017,1.0032,1.0144); photonIDMod->AddEnCorrPerRun2012HCP(206208,206483,1.0003,1.0003,1.0058,1.0058,0.9895,1.0032,0.9921,0.9989,1.0056,1.0167); photonIDMod->AddEnCorrPerRun2012HCP(206484,206597,1.0005,1.0005,1.0060,1.0060,0.9895,1.0032,0.9968,1.0036,1.0046,1.0158); photonIDMod->AddEnCorrPerRun2012HCP(206598,206896,1.0006,1.0006,1.0061,1.0061,0.9881,1.0017,0.9913,0.9982,1.0050,1.0162); photonIDMod->AddEnCorrPerRun2012HCP(206897,207220,1.0006,1.0006,1.0061,1.0061,0.9884,1.0021,0.9909,0.9978,1.0053,1.0165); photonIDMod->AddEnCorrPerRun2012HCP(207221,208686,1.0006,1.0006,1.0061,1.0061,0.9894,1.0030,0.9951,1.0020,1.0060,1.0172); //---------------------------------shower shape scale-------------------------------------------------------------------------------- photonIDMod->SetDoShowerShapeScaling(kTRUE); photonIDMod->SetShowerShapeType("2012ShowerShape"); photonIDMod->Set2012HCP(kTRUE); PhotonCleaningMod *photonCleaningMod = new PhotonCleaningMod; photonCleaningMod->SetCleanElectronsName(electronCleaning->GetOutputName()); photonCleaningMod->SetGoodPhotonsName(photonIDMod->GetOutputName()); photonCleaningMod->SetCleanPhotonsName("CleanPhotons"); PublisherMod<PFJet,Jet> *pubJet = new PublisherMod<PFJet,Jet>("JetPub"); pubJet->SetInputName("AKt5PFJets"); pubJet->SetOutputName("PubAKt5PFJets"); JetCorrectionMod *jetCorr = new JetCorrectionMod; if(isData){ jetCorr->AddCorrectionFromFile(std::string((gSystem->Getenv("CMSSW_BASE") + TString("/src/MitPhysics/data/Summer12_V7_DATA_L1FastJet_AK5PF.txt")).Data())); jetCorr->AddCorrectionFromFile(std::string((gSystem->Getenv("CMSSW_BASE") + TString("/src/MitPhysics/data/Summer12_V7_DATA_L2Relative_AK5PF.txt")).Data())); jetCorr->AddCorrectionFromFile(std::string((gSystem->Getenv("CMSSW_BASE") + TString("/src/MitPhysics/data/Summer12_V7_DATA_L3Absolute_AK5PF.txt")).Data())); jetCorr->AddCorrectionFromFile(std::string((gSystem->Getenv("CMSSW_BASE") + TString("/src/MitPhysics/data/Summer12_V7_DATA_L2L3Residual_AK5PF.txt")).Data())); } else { jetCorr->AddCorrectionFromFile(std::string((gSystem->Getenv("CMSSW_BASE") + TString("/src/MitPhysics/data/Summer12_V7_MC_L1FastJet_AK5PF.txt")).Data())); jetCorr->AddCorrectionFromFile(std::string((gSystem->Getenv("CMSSW_BASE") + TString("/src/MitPhysics/data/Summer12_V7_MC_L2Relative_AK5PF.txt")).Data())); jetCorr->AddCorrectionFromFile(std::string((gSystem->Getenv("CMSSW_BASE") + TString("/src/MitPhysics/data/Summer12_V7_MC_L3Absolute_AK5PF.txt")).Data())); } jetCorr->SetInputName(pubJet->GetOutputName()); jetCorr->SetCorrectedName("CorrectedJets"); JetIDMod *theJetID = new JetIDMod; theJetID->SetInputName(jetCorr->GetOutputName()); theJetID->SetPtCut(30.0); theJetID->SetEtaMaxCut(4.7); theJetID->SetJetEEMFractionMinCut(0.00); theJetID->SetOutputName("GoodJets"); theJetID->SetApplyBetaCut(kFALSE); theJetID->SetApplyMVACut(kTRUE); JetCleaningMod *theJetCleaning = new JetCleaningMod; theJetCleaning->SetCleanElectronsName(electronCleaning->GetOutputName()); theJetCleaning->SetCleanMuonsName(muonIdMod->GetOutputName()); theJetCleaning->SetCleanPhotonsName(photonCleaningMod->GetOutputName()); theJetCleaning->SetApplyPhotonRemoval(kTRUE); theJetCleaning->SetGoodJetsName(theJetID->GetOutputName()); theJetCleaning->SetCleanJetsName("CleanJets"); //------------------------------------------------------------------------------------------------ // select events with jet+MET //------------------------------------------------------------------------------------------------ MonoJetAnalysisMod *jetplusmet = new MonoJetAnalysisMod("MonoJetSelector"); jetplusmet->SetJetsName(theJetCleaning->GetOutputName()); //identified jets jetplusmet->SetJetsFromBranch(kFALSE); jetplusmet->SetElectronsName(electronCleaning->GetOutputName()); jetplusmet->SetElectronsFromBranch(kFALSE); jetplusmet->SetMuonsName(muonIdMod->GetOutputName()); jetplusmet->SetMuonsFromBranch(kFALSE); jetplusmet->SetLeptonsName(merger->GetOutputName()); jetplusmet->SetMinNumJets(1); jetplusmet->SetMinNumLeptons(0); jetplusmet->SetMinJetEt(30); jetplusmet->SetMaxJetEta(2.7); jetplusmet->SetMinChargedHadronFrac(0.3); jetplusmet->SetMaxNeutralHadronFrac(0.7); jetplusmet->SetMaxNeutralEmFrac(0.7); jetplusmet->SetMinMetEt(30); HLTEvtSelMod *hlttree = new HLTEvtSelMod("MonoJetHLTTreeWriter"); hlttree->SetCleanJetsName(theJetCleaning->GetOutputName()); hlttree->SetVertexName(goodPVFilterMod->GetOutputName()); hlttree->SetTrigObjsName(hltModP->GetOutputName()); //------------------------------------------------------------------------------------------------ // making analysis chain //------------------------------------------------------------------------------------------------ // this is how it always starts runLumiSel ->Add(goodPVFilterMod); goodPVFilterMod->Add(hltModP); // photon regression hltModP->Add(photreg); // simple object id modules photreg ->Add(SepPUMod); SepPUMod ->Add(muonIdMod); muonIdMod ->Add(eleIdMod); eleIdMod ->Add(electronCleaning); electronCleaning ->Add(merger); merger ->Add(photonIDMod); photonIDMod ->Add(photonCleaningMod); photonCleaningMod->Add(pubJet); pubJet ->Add(jetCorr); jetCorr ->Add(theJetID); theJetID ->Add(theJetCleaning); // Jet+met selection theJetCleaning ->Add(jetplusmet); jetplusmet ->Add(hlttree); //------------------------------------------------------------------------------------------------ // setup analysis //------------------------------------------------------------------------------------------------ Analysis *ana = new Analysis; ana->SetUseHLT(kTRUE); ana->SetKeepHierarchy(kTRUE); ana->SetSuperModule(runLumiSel); ana->SetPrintScale(100); if (nEvents >= 0) ana->SetProcessNEvents(nEvents); //------------------------------------------------------------------------------------------------ // organize input //------------------------------------------------------------------------------------------------ Catalog *c = new Catalog(catalogDir); TString skimdataset = TString(dataset)+TString("/") +TString(skim); Dataset *d = NULL; TString bookstr = book; if (TString(skim).CompareTo("noskim") == 0) d = c->FindDataset(bookstr,dataset,fileset, true); else d = c->FindDataset(bookstr,skimdataset.Data(),fileset, true); ana->AddDataset(d); //------------------------------------------------------------------------------------------------ // organize output //------------------------------------------------------------------------------------------------ TString rootFile = TString(outputName); rootFile += TString("_") + TString(dataset) + TString("_") + TString(skim); if (TString(fileset) != TString("")) rootFile += TString("_") + TString(fileset); rootFile += TString(".root"); ana->SetOutputName(rootFile.Data()); //ana->SetCacheSize(64*1024*1024); ana->SetCacheSize(0); //------------------------------------------------------------------------------------------------ // Say what we are doing //------------------------------------------------------------------------------------------------ printf("\n==== PARAMETER SUMMARY FOR THIS JOB ====\n"); printf("\n JSON file: %s\n and overlap cut: %f (%s)\n",jsonFile.Data(),overlapCut,overlap); printf("\n Rely on Catalog: %s\n",catalogDir); printf(" -> Book: %s Dataset: %s Skim: %s Fileset: %s <-\n",book,dataset,skim,fileset); printf("\n Root output: %s\n\n",rootFile.Data()); printf("\n========================================\n"); //------------------------------------------------------------------------------------------------ // run the analysis after successful initialisation //------------------------------------------------------------------------------------------------ ana->Run(!gROOT->IsBatch()); return; }
//-------------------------------------------------------------------------------------------------- void runH2gSkim(const char *fileset = "", const char *skim = "noskim", const char *dataset = "f11--h120gg-gf-v14b-pu", const char *book = "cern/filefi/025", const char *catalogDir = "/home/mitprod/catalog", const char *outputName = "h2g", int nEvents = -1) { //------------------------------------------------------------------------------------------------ // some parameters get passed through the environment //------------------------------------------------------------------------------------------------ char json[1024], overlap[1024]; float overlapCut = -1; if (gSystem->Getenv("MIT_PROD_JSON")) sprintf(json, "%s",gSystem->Getenv("MIT_PROD_JSON")); else { sprintf(json, "%s", "~"); //printf(" JSON file was not properly defined. EXIT!\n"); //return; } TString jsonFile = TString("/home/cmsprod/cms/json/") + TString(json); Bool_t isData = ( (jsonFile.CompareTo("/home/cmsprod/cms/json/~") != 0) ); if (gSystem->Getenv("MIT_PROD_OVERLAP")) { sprintf(overlap,"%s",gSystem->Getenv("MIT_PROD_OVERLAP")); if (EOF == sscanf(overlap,"%f",&overlapCut)) { printf(" Overlap was not properly defined. EXIT!\n"); return; } } else { sprintf(overlap,"%s", "-1.0"); //printf(" OVERLAP file was not properly defined. EXIT!\n"); //return; } printf("\n Initialization worked. \n\n"); //------------------------------------------------------------------------------------------------ // some global setups //------------------------------------------------------------------------------------------------ using namespace mithep; gDebugMask = Debug::kGeneral; gDebugLevel = 3; //------------------------------------------------------------------------------------------------ // set up information //------------------------------------------------------------------------------------------------ RunLumiSelectionMod *runLumiSel = new RunLumiSelectionMod; runLumiSel->SetAcceptMC(kTRUE); // Monte Carlo events are always accepted // only select on run- and lumisection numbers when valid json file present if ((jsonFile.CompareTo("/home/cmsprod/cms/json/~") != 0) && (jsonFile.CompareTo("/home/cmsprod/cms/json/-") != 0) ) { runLumiSel->AddJSONFile(jsonFile.Data()); } if ((jsonFile.CompareTo("/home/cmsprod/cms/json/-") == 0) ) { printf("\n WARNING -- Looking at data without JSON file: always accept.\n\n"); runLumiSel->SetAbortIfNotAccepted(kFALSE); // accept all events if there is no valid JSON file } TwoPhotonSelMod *twophotonsel = new TwoPhotonSelMod; twophotonsel->SetPtMin(20.); twophotonsel->SetMassMin(55.); MCParticleSelMod *mcselmod = new MCParticleSelMod; mcselmod->AddAbsPdgId(11); mcselmod->AddAbsPdgId(12); mcselmod->AddAbsPdgId(13); mcselmod->AddAbsPdgId(14); mcselmod->AddAbsPdgId(15); mcselmod->AddAbsPdgId(16); mcselmod->AddAbsPdgId(23); mcselmod->AddAbsPdgId(24); mcselmod->AddAbsPdgId(25); SkimMod<MCParticle> *skimMod = 0; if (! isData) { skimMod = new SkimMod<MCParticle>; skimMod->SetBranchName("MCParticles"); } OutputMod *outMod = new OutputMod; outMod->Keep("*"); outMod->Drop("CaloTowers"); outMod->Drop("MCParticles"); outMod->Drop("*Jets*"); outMod->Keep("AKT5GenJets"); outMod->Keep("AKt5PFJets"); if (! isData) outMod->AddNewBranch("SkmMCParticles"); TString skmRootFile = TString(outputName); skmRootFile += TString("_") + TString(dataset) + TString("_") + TString(skim); if (TString(fileset) != TString("")) skmRootFile += TString("_") + TString(fileset); outMod->SetFileName(skmRootFile); outMod->SetPathName("."); //------------------------------------------------------------------------------------------------ // making analysis chain //------------------------------------------------------------------------------------------------ // this is how it always starts runLumiSel ->Add(twophotonsel); if (isData) { twophotonsel ->Add(outMod); } else { twophotonsel ->Add(mcselmod); mcselmod ->Add(skimMod); skimMod ->Add(outMod); } //------------------------------------------------------------------------------------------------ // setup analysis //------------------------------------------------------------------------------------------------ Analysis *ana = new Analysis; ana->SetUseHLT (kTRUE); ana->SetKeepHierarchy(kTRUE); ana->SetSuperModule (runLumiSel); ana->SetPrintScale (100); if (nEvents >= 0) ana->SetProcessNEvents(nEvents); //------------------------------------------------------------------------------------------------ // organize input //------------------------------------------------------------------------------------------------ Catalog *c = new Catalog(catalogDir); TString skimdataset = TString(dataset)+TString("/") +TString(skim); Dataset *d = NULL; TString bookstr = book; if (TString(skim).CompareTo("noskim") == 0) d = c->FindDataset(bookstr,dataset,fileset); else d = c->FindDataset(bookstr,skimdataset.Data(),fileset); ana->AddDataset(d); //------------------------------------------------------------------------------------------------ // organize output //------------------------------------------------------------------------------------------------ TString rootFile = TString(outputName); rootFile += TString("_") + TString(dataset) + TString("_") + TString(skim); if (TString(fileset) != TString("")) rootFile += TString("_") + TString(fileset); rootFile += TString(".root"); //ana->SetOutputName(rootFile.Data()); //ana->SetCacheSize(64*1024*1024); //ana->SetCacheSize(0); ana->SetOutputName("test.root"); //------------------------------------------------------------------------------------------------ // Say what we are doing //------------------------------------------------------------------------------------------------ printf("\n==== PARAMETER SUMMARY FOR THIS JOB ====\n"); printf("\n JSON file: %s\n and overlap cut: %f (%s)\n",jsonFile.Data(),overlapCut,overlap); printf("\n Rely on Catalog: %s\n",catalogDir); printf(" -> Book: %s Dataset: %s Skim: %s Fileset: %s <-\n",book,dataset,skim,fileset); printf("\n Root output: %s\n\n",rootFile.Data()); printf("\n========================================\n"); //------------------------------------------------------------------------------------------------ // run the analysis after successful initialisation //------------------------------------------------------------------------------------------------ ana->Run(!gROOT->IsBatch()); return; }
//-------------------------------------------------------------------------------------------------- void runHgg_LT(const char *fileset = "0000", const char *skim = "noskim", //const char *dataset = "f11--h123gg-gf-v14b-pu", const char *dataset = "r11a-pho-j16-v1", const char *book = "local/filefi/025", const char *catalogDir = "/home/cmsprod/catalog", const char *outputName = "hgg", int nEvents = 2000) { //------------------------------------------------------------------------------------------------ // some parameters get passed through the environment //------------------------------------------------------------------------------------------------ char json[1024], overlap[1024]; float overlapCut = -1; if (gSystem->Getenv("MIT_PROD_JSON")) sprintf(json, "%s",gSystem->Getenv("MIT_PROD_JSON")); else { sprintf(json, "%s", "~"); //printf(" JSON file was not properly defined. EXIT!\n"); //return; } TString jsonFile = TString("/home/fabstoec/cms/json/") + TString(json); //TString jsonFile = TString("/home/fabstoec/cms/json/") + TString("Cert_136033-149442_7TeV_Dec22ReReco_Collisions10_JSON_v4.txt"); Bool_t isData = ( (jsonFile.CompareTo("/home/fabstoec/cms/json/~") != 0) ); if (gSystem->Getenv("MIT_PROD_OVERLAP")) { sprintf(overlap,"%s",gSystem->Getenv("MIT_PROD_OVERLAP")); if (EOF == sscanf(overlap,"%f",&overlapCut)) { printf(" Overlap was not properly defined. EXIT!\n"); return; } } else { sprintf(overlap,"%s", "-1.0"); //printf(" OVERLAP file was not properly defined. EXIT!\n"); //return; } printf("\n Initialization worked. \n\n"); //------------------------------------------------------------------------------------------------ // some global setups //------------------------------------------------------------------------------------------------ using namespace mithep; gDebugMask = Debug::kGeneral; gDebugLevel = 3; //------------------------------------------------------------------------------------------------ // set up information //------------------------------------------------------------------------------------------------ RunLumiSelectionMod *runLumiSel = new RunLumiSelectionMod; runLumiSel->SetAcceptMC(kTRUE); // Monte Carlo events are always accepted MCProcessSelectionMod *mcselmod = new MCProcessSelectionMod; MVASystematicsMod *sysMod = new MVASystematicsMod; sysMod->SetMCR9Scale(1.0035, 1.0035); sysMod->SetIsData(isData); // only select on run- and lumisection numbers when valid json file present if ((jsonFile.CompareTo("/home/fabstoec/cms/json/~") != 0) && (jsonFile.CompareTo("/home/fabstoec/cms/json/-") != 0) ) { runLumiSel->AddJSONFile(jsonFile.Data()); } if ((jsonFile.CompareTo("/home/fabstoec/cms/json/-") == 0) ) { printf("\n WARNING -- Looking at data without JSON file: always accept.\n\n"); runLumiSel->SetAbortIfNotAccepted(kFALSE); // accept all events if there is no valid JSON file } printf("\n Run lumi worked. \n\n"); //------------------------------------------------------------------------------------------------ // HLT information //------------------------------------------------------------------------------------------------ HLTMod *hltModP = new HLTMod("HLTModP"); hltModP->AddTrigger("HLT_Photon26_CaloIdL_IsoVL_Photon18_CaloIdL_IsoVL_v*",160000,161176); hltModP->AddTrigger("HLT_Photon26_CaloIdL_IsoVL_Photon18_CaloIdL_IsoVL_v*",161216,165633); hltModP->AddTrigger("HLT_Photon26_CaloIdL_IsoVL_Photon18_R9Id_v*",161216,165633); hltModP->AddTrigger("HLT_Photon26_R9Id_Photon18_CaloIdL_IsoVL_v*",161216,165633); hltModP->AddTrigger("HLT_Photon20_R9Id_Photon18_R9Id_v*",161216,165633); hltModP->AddTrigger("HLT_Photon26_CaloIdL_IsoVL_Photon18_CaloIdL_IsoVL_v*",165970,173198); hltModP->AddTrigger("HLT_Photon26_CaloIdL_IsoVL_Photon18_R9Id_v*",165970,173198); hltModP->AddTrigger("HLT_Photon26_R9Id_Photon18_CaloIdL_IsoVL_v*",165970,173198); hltModP->AddTrigger("HLT_Photon26_R9Id_Photon18_R9Id_v*",165970,173198); hltModP->AddTrigger("HLT_Photon36_CaloIdL_IsoVL_Photon22_CaloIdL_IsoVL_v*",165970,173198); hltModP->AddTrigger("HLT_Photon36_R9Id_Photon22_CaloIdL_IsoVL_v*",165970,173198); hltModP->AddTrigger("HLT_Photon36_R9Id_Photon22_R9Id_v*",165970,173198); hltModP->AddTrigger("HLT_Photon36_CaloId_IsoVL_Photon22_R9Id_v*",165970,166967); hltModP->AddTrigger("HLT_Photon36_CaloIdL_IsoVL_Photon22_R9Id_v*",167039,173198); hltModP->AddTrigger("HLT_Photon26_CaloIdXL_IsoXL_Photon18_CaloIdXL_IsoXL_v*",173236,178380); hltModP->AddTrigger("HLT_Photon26_CaloIdXL_IsoXL_Photon18_R9Id_v*",173236,178380); hltModP->AddTrigger("HLT_Photon26_R9Id_Photon18_CaloIdXL_IsoXL_v*",173236,178380); hltModP->AddTrigger("HLT_Photon26_R9Id_Photon18_R9Id_v*",173236,178380); hltModP->AddTrigger("HLT_Photon36_CaloIdL_IsoVL_Photon22_CaloIdL_IsoVL_v*",173236,178380); hltModP->AddTrigger("HLT_Photon36_CaloIdL_IsoVL_Photon22_R9Id_v*",173236,178380); hltModP->AddTrigger("HLT_Photon36_R9Id_Photon22_CaloIdL_IsoVL_v*",173236,178380); hltModP->AddTrigger("HLT_Photon36_R9Id_Photon22_R9Id_v*",173236,178380); hltModP->AddTrigger("HLT_Photon26_CaloIdXL_IsoXL_Photon18_CaloIdXL_IsoXL_Mass60_v*",178420,999999); hltModP->AddTrigger("HLT_Photon26_CaloIdXL_IsoXL_Photon18_R9IdT_Mass60_v*",178420,999999); hltModP->AddTrigger("HLT_Photon26_R9IdT_Photon18_CaloIdXL_IsoXL_Mass60_v*",178420,999999); hltModP->AddTrigger("HLT_Photon26_R9IdT_Photon18_R9IdT_Mass60_v*",178420,999999); hltModP->AddTrigger("HLT_Photon36_CaloIdL_IsoVL_Photon22_CaloIdL_IsoVL_v*",178420,999999); hltModP->AddTrigger("HLT_Photon36_CaloIdL_IsoVL_Photon22_R9Id_v*",178420,999999); hltModP->AddTrigger("HLT_Photon36_R9Id_Photon22_CaloIdL_IsoVL_v*",178420,999999); hltModP->AddTrigger("HLT_Photon36_R9Id_Photon22_R9Id_v*",178420,999999); hltModP->SetTrigObjsName("MyHltPhotObjs"); hltModP->SetAbortIfNotAccepted(isData); //----------------------------------- // Lepton Selection //----------------------------------- ElectronIDMod* eleIdMod = new ElectronIDMod; eleIdMod -> SetEtMin(20.); eleIdMod -> SetEtaMax(2.5); eleIdMod -> SetApplyEcalFiducial(true); eleIdMod -> SetIDType("Hgg_LeptonTag_WP85Id"); eleIdMod -> SetVertexName("CiCChosenVtx"); eleIdMod -> SetWhichVertex(0); eleIdMod -> SetD0Cut(0.02); eleIdMod -> SetDZCut(0.1); eleIdMod -> SetIsoType("CombinedRelativeConeAreaCorrected"); // Barrel Endcap eleIdMod -> SetCombRelativeIsoCut(0.053, 0.042 ); //eleIdMod -> SetRhoType(RhoUtilities::MIT_RHO_RANDOM_LOW_ETA); eleIdMod -> SetRhoType(RhoUtilities::MIT_RHO_VORONOI_HIGH_ETA); eleIdMod -> SetOutputName("HggLeptonTagElectrons"); MuonIDMod* muonIdMod = new MuonIDMod; // base kinematics muonIdMod -> SetPtMin(20.); muonIdMod -> SetEtaCut(2.4); // base ID muonIdMod -> SetIDType("WMuId"); // distance to Vtx restriction muonIdMod -> SetVertexName("CiCChosenVtx"); muonIdMod -> SetWhichVertex(0); // this is a 'hack'.. but hopefully good enough... muonIdMod -> SetD0Cut(0.02); muonIdMod -> SetDZCut(0.1); // isolation muonIdMod -> SetIsoType("CombinedRelativeConeAreaCorrected"); muonIdMod -> SetCombRelativeIsoCut(0.1); //muonIdMod -> SetRhoType(RhoUtilities::MIT_RHO_RANDOM_LOW_ETA); muonIdMod -> SetRhoType(RhoUtilities::MIT_RHO_VORONOI_HIGH_ETA); muonIdMod -> SetOutputName("HggLeptonTagMuons"); //------------------------------------------------------------------------------------------------ // select events with a good primary vertex //------------------------------------------------------------------------------------------------ GoodPVFilterMod *goodPVFilterMod = new GoodPVFilterMod; goodPVFilterMod->SetMinVertexNTracks(0); goodPVFilterMod->SetMinNDof (4.0); goodPVFilterMod->SetMaxAbsZ (24.0); goodPVFilterMod->SetMaxRho (2.0); goodPVFilterMod->SetAbortIfNotAccepted(kFALSE); goodPVFilterMod->SetIsMC(!isData); PublisherMod<PFJet,Jet> *pubJet = new PublisherMod<PFJet,Jet>("JetPub"); pubJet->SetInputName("AKt5PFJets"); pubJet->SetOutputName("PubAKt5PFJets"); JetCorrectionMod *jetCorr = new JetCorrectionMod; jetCorr->AddCorrectionFromFile(std::string((gSystem->Getenv("CMSSW_BASE") + TString("/src/MitPhysics/data/START42_V12_AK5PF_L1FastJet.txt")).Data())); jetCorr->AddCorrectionFromFile(std::string((gSystem->Getenv("CMSSW_BASE") + TString("/src/MitPhysics/data/START42_V12_AK5PF_L2Relative.txt")).Data())); jetCorr->AddCorrectionFromFile(std::string((gSystem->Getenv("CMSSW_BASE") + TString("/src/MitPhysics/data/START42_V12_AK5PF_L3Absolute.txt")).Data())); if(isData){ jetCorr->AddCorrectionFromFile(std::string((gSystem->Getenv("CMSSW_BASE") + TString("/src/MitPhysics/data/START42_V12_AK5PF_L2L3Residual.txt")).Data())); } jetCorr->SetInputName(pubJet->GetOutputName()); jetCorr->SetRhoType(RhoUtilities::MIT_RHO_RANDOM_HIGH_ETA); jetCorr->SetCorrectedName("CorrectedJets"); Bool_t excludedoubleprompt = kFALSE; if (TString(dataset).Contains("-pj")) { mcselmod->ExcludeProcess(18); mcselmod->ExcludeProcess(114); excludedoubleprompt = kTRUE; } if (TString(dataset).Contains("-qcd2em") || TString(dataset).Contains("-qcd-2em")) { excludedoubleprompt = kTRUE; } PhotonMvaMod *photreg = new PhotonMvaMod; photreg->SetOutputName("GoodPhotonsRegr"); photreg->SetIsData(isData); PhotonPairSelector *photcic = new PhotonPairSelector("PhotonPairSelectorCiC"); photcic->SetOutputName("GoodPhotonsCIC"); photcic->SetOutputVtxName("CiCChosenVtx"); photcic->SetPhotonSelType("CiCSelection"); photcic->SetVertexSelType("CiCMVASelection"); photcic->DoMCSmear(kTRUE); photcic->DoDataEneCorr(kTRUE); photcic->SetPhotonsFromBranch(kFALSE); photcic->SetInputPhotonsName(photreg->GetOutputName()); photcic->SetMCSmearFactors(0.0067,0.0077,0.0096,0.0141,0.0196,0.0268,0.0279,0.0293,0.0301);//ming:smear(sigE/E) photcic->AddEnCorrPerRun(160431,167913,0.9941,0.9941,1.0004,0.9916,1.0045,1.0033,1.0082,0.9958,1.0064);//ming:Emc/Edata photcic->AddEnCorrPerRun(170000,172619,0.9954,0.9954,1.0016,0.9937,1.0066,0.9976,1.0025,0.9940,1.0046); photcic->AddEnCorrPerRun(172620,173692,0.9955,0.9955,1.0017,0.9929,1.0058,0.9986,1.0035,0.9923,1.0029); photcic->AddEnCorrPerRun(175830,177139,0.9958,0.9958,1.0021,0.9944,1.0073,0.9968,1.0017,0.9933,1.004); photcic->AddEnCorrPerRun(177140,178421,0.9962,0.9962,1.0025,0.9946,1.0075,0.9960,1.0010,0.9944,1.005); photcic->AddEnCorrPerRun(178424,180252,0.9961,0.9961,1.0024,0.9942,1.0071,0.9921,0.9970,0.9953,1.0059); photcic->SetDoMCR9Scaling(kTRUE); photcic->SetMCR9Scale(1.0048, 1.00492); photcic->SetDoMCErrScaling(kTRUE); photcic->SetMCErrScale(1.07, 1.045); photcic->SetIsData(isData); PhotonPairSelector *photpresel = new PhotonPairSelector("PhotonPairSelectorPresel"); photpresel->SetOutputName("GoodPhotonsPresel"); photpresel->SetOutputVtxName("PreselChosenVtx"); photpresel->SetPhotonSelType("MITSelection"); photpresel->SetVertexSelType("CiCMVASelection"); photpresel->DoMCSmear(kTRUE); photpresel->DoDataEneCorr(kTRUE); photpresel->SetPhotonsFromBranch(kFALSE); photpresel->SetInputPhotonsName(photreg->GetOutputName()); //photpresel->SetMCSmearFactors(0.0045, 0.0084, 0.0109, 0.0156, 0.0203,0.0303,0.0326,0.0318,0.0331); photpresel->SetMCSmearFactors(0.0067,0.0077,0.0096,0.0141,0.0196,0.0268,0.0279,0.0293,0.0301);//ming:smear(sigE/E) //photpresel->AddEnCorrPerRun(160000,167913,0.9905,0.9905,0.9971,0.9976,1.0094,0.9994,1.0044,0.9968,1.0079); //photpresel->AddEnCorrPerRun(170249,172619,0.9909,0.9909,0.9975,0.9994,1.0112,0.9962,1.0012,0.9962,1.0072); //photpresel->AddEnCorrPerRun(172620,173692,0.9909,0.9909,0.9975,0.9977,1.0096,0.9963,1.0013,0.9947,1.0057); //photpresel->AddEnCorrPerRun(175860,177139,0.9911,0.9911,0.9977,0.9990,1.0109,0.9922,0.9973,0.9967,1.0077); //photpresel->AddEnCorrPerRun(177140,178421,0.9910,0.9910,0.9975,0.9987,1.0105,0.9921,0.9972,0.9975,1.0085); //photpresel->AddEnCorrPerRun(178424,999999,0.9903,0.9903,0.9969,0.9976,1.0095,0.9889,0.9940,0.9976,1.0086); photpresel->AddEnCorrPerRun(160431,167913,0.9941,0.9941,1.0004,0.9916,1.0045,1.0033,1.0082,0.9958,1.0064);//ming:Emc/Edata photpresel->AddEnCorrPerRun(170000,172619,0.9954,0.9954,1.0016,0.9937,1.0066,0.9976,1.0025,0.9940,1.0046); photpresel->AddEnCorrPerRun(172620,173692,0.9955,0.9955,1.0017,0.9929,1.0058,0.9986,1.0035,0.9923,1.0029); photpresel->AddEnCorrPerRun(175830,177139,0.9958,0.9958,1.0021,0.9944,1.0073,0.9968,1.0017,0.9933,1.004); photpresel->AddEnCorrPerRun(177140,178421,0.9962,0.9962,1.0025,0.9946,1.0075,0.9960,1.0010,0.9944,1.005); photpresel->AddEnCorrPerRun(178424,180252,0.9961,0.9961,1.0024,0.9942,1.0071,0.9921,0.9970,0.9953,1.0059); photpresel->SetDoMCR9Scaling(kTRUE); photpresel->SetMCR9Scale(1.0035, 1.0035); photpresel->SetDoMCSigIEtaIEtaScaling(kTRUE); photpresel->SetDoMCWidthScaling(kTRUE); photpresel->SetDoMCErrScaling(kTRUE); photpresel->SetMCErrScale(1.07, 1.045); photpresel->SetIsData(isData); PhotonTreeWriter *phottreecic = new PhotonTreeWriter("PhotonTreeWriterCiC"); phottreecic->SetPhotonsFromBranch(kFALSE); phottreecic->SetInputPhotonsName(photcic->GetOutputName()); phottreecic->SetEnableJets(kTRUE); phottreecic->SetPFJetsFromBranch(kFALSE); phottreecic->SetPFJetName(jetCorr->GetOutputName()); phottreecic->SetExcludeDoublePrompt(excludedoubleprompt); phottreecic->SetIsData(isData); phottreecic->SetApplyBTag(true); phottreecic->SetApplyLeptonTag(true); phottreecic->SetLeptonTagElectronsName("HggLeptonTagElectrons"); phottreecic->SetLeptonTagMuonsName ("HggLeptonTagMuons"); PhotonTreeWriter *phottreepresel = new PhotonTreeWriter("PhotonTreeWriterPresel"); phottreepresel->SetPhotonsFromBranch(kFALSE); phottreepresel->SetInputPhotonsName(photpresel->GetOutputName()); phottreepresel->SetEnableJets(kTRUE); phottreepresel->SetPFJetsFromBranch(kFALSE); phottreepresel->SetPFJetName(jetCorr->GetOutputName()); phottreepresel->SetExcludeDoublePrompt(excludedoubleprompt); phottreepresel->SetIsData(isData); phottreepresel->SetApplyLeptonTag(true); phottreepresel->SetLeptonTagElectronsName("HggLeptonTagElectrons"); phottreepresel->SetLeptonTagMuonsName ("HggLeptonTagMuons"); //------------------------------------------------------------------------------------------------ // making analysis chain //------------------------------------------------------------------------------------------------ // this is how it always starts runLumiSel ->Add(mcselmod); if (TString(dataset).Contains("-h")) { mcselmod ->Add(sysMod); } mcselmod ->Add(hltModP); hltModP ->Add(goodPVFilterMod); goodPVFilterMod ->Add(photreg); photreg ->Add(pubJet); pubJet ->Add(jetCorr); jetCorr ->Add(photcic); photcic ->Add(eleIdMod); eleIdMod ->Add(muonIdMod); muonIdMod ->Add(phottreecic); TFile::SetOpenTimeout(0); TFile::SetCacheFileDir("./rootfilecache",kTRUE,kTRUE); TFile::SetReadaheadSize(128*1024*1024); //------------------------------------------------------------------------------------------------ // setup analysis //------------------------------------------------------------------------------------------------ Analysis *ana = new Analysis; ana->SetUseHLT(kTRUE); ana->SetKeepHierarchy(kTRUE); ana->SetSuperModule(runLumiSel); ana->SetPrintScale(100); if (nEvents >= 0) ana->SetProcessNEvents(nEvents); //------------------------------------------------------------------------------------------------ // organize input //------------------------------------------------------------------------------------------------ Catalog *c = new Catalog(catalogDir); TString skimdataset = TString(dataset)+TString("/") +TString(skim); Dataset *d = NULL; TString bookstr = book; //if (TString(dataset).Contains("s11-h")) bookstr.ReplaceAll("local","t2mit"); if (TString(skim).CompareTo("noskim") == 0) d = c->FindDataset(bookstr,dataset,fileset); else d = c->FindDataset(bookstr,skimdataset.Data(),fileset); ana->AddDataset(d); //ana->AddFile("/mnt/hadoop/cmsprod/filefi/025/r11b-pho-n30-v1/4863E9D1-BC1C-E111-99BA-001A92810AF4.root"); //------------------------------------------------------------------------------------------------ // organize output //------------------------------------------------------------------------------------------------ TString rootFile = TString(outputName); rootFile += TString("_") + TString(dataset) + TString("_") + TString(skim); if (TString(fileset) != TString("")) rootFile += TString("_") + TString(fileset); rootFile += TString(".root"); ana->SetOutputName(rootFile.Data()); //ana->SetCacheSize(64*1024*1024); ana->SetCacheSize(0); //------------------------------------------------------------------------------------------------ // Say what we are doing //------------------------------------------------------------------------------------------------ printf("\n==== PARAMETER SUMMARY FOR THIS JOB ====\n"); printf("\n JSON file: %s\n and overlap cut: %f (%s)\n",jsonFile.Data(),overlapCut,overlap); printf("\n Rely on Catalog: %s\n",catalogDir); printf(" -> Book: %s Dataset: %s Skim: %s Fileset: %s <-\n",book,dataset,skim,fileset); printf("\n Root output: %s\n\n",rootFile.Data()); printf("\n========================================\n"); //------------------------------------------------------------------------------------------------ // run the analysis after successful initialisation //------------------------------------------------------------------------------------------------ ana->Run(!gROOT->IsBatch()); return; }
//-------------------------------------------------------------------------------------------------- void runHggAna(const char *fileset = "0000", const char *skim = "noskim", const char *dataset = "w10-zz-z2-v8-pu", //const char *dataset = "r10b-pho-d22", const char *book = "t2mit/filefi/017", const char *catalogDir = "/home/cmsprod/catalog", const char *outputName = "hgg", int nEvents = 1000) { //------------------------------------------------------------------------------------------------ // some parameters get passed through the environment //------------------------------------------------------------------------------------------------ char json[1024], overlap[1024]; float overlapCut = -1; if (gSystem->Getenv("MIT_PROD_JSON")) sprintf(json, "%s",gSystem->Getenv("MIT_PROD_JSON")); else { printf(" JSON file was not properly defined. EXIT!\n"); return; } //TString jsonFile = TString("/home/cmsprod/json/") + TString(json); TString jsonFile = TString("/home/fabstoec/cms/json/") + TString(json); Bool_t isData = ( (jsonFile.CompareTo("/home/fabstoec/cms/json/~") != 0) ); if (gSystem->Getenv("MIT_PROD_OVERLAP")) { sprintf(overlap,"%s",gSystem->Getenv("MIT_PROD_OVERLAP")); if (EOF == sscanf(overlap,"%f",&overlapCut)) { printf(" Overlap was not properly defined. EXIT!\n"); return; } } else { printf(" OVERLAP file was not properly defined. EXIT!\n"); return; } printf("\n Initialization worked. \n\n"); //------------------------------------------------------------------------------------------------ // some global setups //------------------------------------------------------------------------------------------------ using namespace mithep; gDebugMask = Debug::kGeneral; gDebugLevel = 3; //------------------------------------------------------------------------------------------------ // set up information //------------------------------------------------------------------------------------------------ RunLumiSelectionMod *runLumiSel = new RunLumiSelectionMod; runLumiSel->SetAcceptMC(kTRUE); // Monte Carlo events are always accepted // only select on run- and lumisection numbers when valid json file present if ((jsonFile.CompareTo("/home/fabstoec/cms/json/~") != 0) && (jsonFile.CompareTo("/home/fabstoec/cms/json/-") != 0) ) { runLumiSel->AddJSONFile(jsonFile.Data()); } if ((jsonFile.CompareTo("/home/cmsprod/json/-") == 0) ) { printf("\n WARNING -- Looking at data without JSON file: always accept.\n\n"); runLumiSel->SetAbortIfNotAccepted(kFALSE); // accept all events if there is no valid JSON file } printf("\n Run lumi worked. \n\n"); //------------------------------------------------------------------------------------------------ // HLT information //------------------------------------------------------------------------------------------------ HLTMod *hltModP = new HLTMod("HLTModP"); hltModP->AddTrigger("HLT_Photon26_CaloIdL_IsoVL_Photon18_CaloIdL_IsoVL_v1"); hltModP->AddTrigger("HLT_Photon26_CaloIdL_IsoVL_Photon18_CaloIdL_IsoVL_v2"); hltModP->AddTrigger("HLT_Photon26_CaloIdL_IsoVL_Photon18_CaloIdL_IsoVL_v3"); hltModP->AddTrigger("HLT_Photon26_CaloIdL_IsoVL_Photon18_CaloIdL_IsoVL_v4"); hltModP->AddTrigger("HLT_Photon26_CaloIdL_IsoVL_Photon18_CaloIdL_IsoVL_v5"); hltModP->AddTrigger("HLT_Photon26_CaloIdL_IsoVL_Photon18_CaloIdL_IsoVL_v6"); hltModP->AddTrigger("HLT_Photon26_CaloIdL_IsoVL_Photon18_CaloIdL_IsoVL_v7"); hltModP->AddTrigger("HLT_Photon26_CaloIdL_IsoVL_Photon18_CaloIdL_IsoVL_v8"); hltModP->AddTrigger("HLT_Photon20_R9Id_Photon18_R9Id_v1"); hltModP->AddTrigger("HLT_Photon20_R9Id_Photon18_R9Id_v2"); hltModP->AddTrigger("HLT_Photon20_R9Id_Photon18_R9Id_v3"); hltModP->AddTrigger("HLT_Photon20_R9Id_Photon18_R9Id_v4"); hltModP->AddTrigger("HLT_Photon20_R9Id_Photon18_R9Id_v5"); hltModP->AddTrigger("HLT_Photon20_R9Id_Photon18_R9Id_v6"); hltModP->AddTrigger("HLT_Photon20_R9Id_Photon18_R9Id_v7"); hltModP->AddTrigger("HLT_Photon20_R9Id_Photon18_R9Id_v8"); hltModP->SetTrigObjsName("MyHltPhotObjs"); hltModP->SetAbortIfNotAccepted(isData); //------------------------------------------------------------------------------------------------ // select events with a good primary vertex //------------------------------------------------------------------------------------------------ GoodPVFilterMod *goodPVFilterMod = new GoodPVFilterMod; goodPVFilterMod->SetMinVertexNTracks(0); goodPVFilterMod->SetMinNDof (5); goodPVFilterMod->SetMaxAbsZ (24.0); goodPVFilterMod->SetMaxRho (2.0); goodPVFilterMod->SetIsMC(!isData); PhotonIDMod *photId = new PhotonIDMod; photId-> SetIsoType("MITPUCorrected"); photId-> SetApplySpikeRemoval(false); photId-> SetApplyPixelSeed(false); photId-> SetApplyElectronVetoConvRecovery(true); photId-> SetApplyConversionId(true); photId-> SetHadOverEmMax(0.02); photId-> SetPtMin(20.); photId-> SetEtaWidthEB(0.010); photId-> SetEtaWidthEE(0.028); photId-> SetAbsEtaMax(2.5); photId-> SetApplyR9Min(false); // Pair Selectro for CiC Analysis PhotonPairSelector *photIdCiC = new PhotonPairSelector; photIdCiC-> SetIsData(isData); photIdCiC-> SetMCSmearFactors(0.0092, 0.0170, // EB high/low R9 0.0292, 0.0289); // EE high/low R9 photIdCiC-> AddEnCorrPerRun (160404, 163869, // Run Range -0.0047, 0.0025, // EB high/low R9 0.0058, -0.0010); // EE high/low R9 photIdCiC-> AddEnCorrPerRun (165071, 165970, // Run Range -0.0007, 0.0049, // EB high/low R9 0.0249, 0.0062); // EE high/low R9 photIdCiC-> AddEnCorrPerRun (165971, 166502, // Run Range 0.0003, 0.0067, // EB high/low R9 0.0376, 0.0133); // EE high/low R9 photIdCiC-> AddEnCorrPerRun (166503, 166861, // Run Range 0.0011, 0.0063, // EB high/low R9 0.0450, 0.0178); // EE high/low R9 photIdCiC-> AddEnCorrPerRun (166862, 999999, // Run Range 0.0014, 0.0074, // EB high/low R9 0.0561, 0.0273); // EE high/low R9 photIdCiC-> SetPhotonSelType("CiCSelection"); photIdCiC-> SetVertexSelType("CiCSelection"); photIdCiC-> SetOutputName("CiCPhotons"); photIdCiC-> SetTupleName("CiCtuple"); VertexTools* vtool = VertexTools::instance(gSystem->Getenv("CMSSW_BASE")); // copy the Mod for the MIT selection PhotonPairSelector *photIdMIT = new PhotonPairSelector; photIdMIT-> SetIsData(isData); photIdMIT-> SetMCSmearFactors(0.0092, 0.0170, // EB high/low R9 0.0292, 0.0289); // EE high/low R9 photIdMIT-> AddEnCorrPerRun (160404, 163869, // Run Range -0.0047, 0.0025, // EB high/low R9 0.0058, -0.0010); // EE high/low R9 photIdMIT-> AddEnCorrPerRun (165071, 165970, // Run Range -0.0007, 0.0049, // EB high/low R9 0.0249, 0.0062); // EE high/low R9 photIdMIT-> AddEnCorrPerRun (165971, 166502, // Run Range 0.0003, 0.0067, // EB high/low R9 0.0376, 0.0133); // EE high/low R9 photIdMIT-> AddEnCorrPerRun (166503, 166861, // Run Range 0.0011, 0.0063, // EB high/low R9 0.0450, 0.0178); // EE high/low R9 photIdMIT-> AddEnCorrPerRun (166862, 999999, // Run Range 0.0014, 0.0074, // EB high/low R9 0.0561, 0.0273); // EE high/low R9 photIdMIT-> SetPhotonSelType("MITSelection"); photIdMIT-> SetVertexSelType("StdSelection"); photIdMIT-> SetInputPhotonsName(photId->GetOutputName()); photIdMIT-> SetPhotonsFromBranch(false); photIdMIT-> SetOutputName("MITPhotons"); photIdMIT-> SetPVName(goodPVFilterMod->GetOutputName()); photIdMIT-> SetPVFromBranch(false); photIdMIT-> SetTupleName("MITtuple"); // Two analysis Modules HggAnalysisMod *anaModCiC = new HggAnalysisMod; anaModCiC->SetPhotonName (photIdCiC->GetOutputName()); anaModCiC->SetPhotonsFromBranch(kFALSE); HggAnalysisMod *anaModMIT = new HggAnalysisMod; anaModMIT->SetPhotonName (photIdMIT->GetOutputName()); anaModMIT->SetPhotonsFromBranch(kFALSE); //------------------------------------------------------------------------------------------------ // making analysis chain //------------------------------------------------------------------------------------------------ // this is how it always starts runLumiSel ->Add(hltModP); // the MIT flow... hltModP ->Add(goodPVFilterMod); goodPVFilterMod ->Add(photId); photId ->Add(photIdMIT); photIdMIT ->Add(anaModMIT); // the CiC flow... hltModP ->Add(photIdCiC); photIdCiC ->Add(anaModCiC); //------------------------------------------------------------------------------------------------ // setup analysis //------------------------------------------------------------------------------------------------ Analysis *ana = new Analysis; ana->SetUseHLT(kTRUE); ana->SetKeepHierarchy(kTRUE); ana->SetSuperModule(runLumiSel); ana->SetPrintScale(100); if (nEvents >= 0) ana->SetProcessNEvents(nEvents); //------------------------------------------------------------------------------------------------ // organize input //------------------------------------------------------------------------------------------------ Catalog *c = new Catalog(catalogDir); TString skimdataset = TString(dataset)+TString("/") +TString(skim); Dataset *d = NULL; if (TString(skim).CompareTo("noskim") == 0) d = c->FindDataset(book,dataset,fileset); else d = c->FindDataset(book,skimdataset.Data(),fileset); ana->AddDataset(d); //------------------------------------------------------------------------------------------------ // organize output //------------------------------------------------------------------------------------------------ TString rootFile = TString(outputName); rootFile += TString("_") + TString(dataset) + TString("_") + TString(skim); if (TString(fileset) != TString("")) rootFile += TString("_") + TString(fileset); rootFile += TString(".root"); ana->SetOutputName(rootFile.Data()); ana->SetCacheSize(64*1024*1024); //------------------------------------------------------------------------------------------------ // Say what we are doing //------------------------------------------------------------------------------------------------ printf("\n==== PARAMETER SUMMARY FOR THIS JOB ====\n"); printf("\n JSON file: %s\n and overlap cut: %f (%s)\n",jsonFile.Data(),overlapCut,overlap); printf("\n Rely on Catalog: %s\n",catalogDir); printf(" -> Book: %s Dataset: %s Skim: %s Fileset: %s <-\n",book,dataset,skim,fileset); printf("\n Root output: %s\n\n",rootFile.Data()); printf("\n========================================\n"); //------------------------------------------------------------------------------------------------ // run the analysis after successful initialisation //------------------------------------------------------------------------------------------------ ana->Run(!gROOT->IsBatch()); return; }