//-------------------------------------------------------------------------------------------------- void runFlatMonoJet(const char *fileset = "0000", const char *skim = "noskim", const char *dataset = "s12-wjets-ptw100-v7a", const char *book = "t2mit/filefi/031", const char *catalogDir = "/home/cmsprod/catalog", const char *outputName = "MonoJet_August13", int nEvents = 100) { //------------------------------------------------------------------------------------------------ // 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", "~"); } TString jsonFile = TString("/home/cmsprod/cms/json/") + TString(json); std::cout<<"JSON "<<jsonFile<<std::endl; Bool_t isData = ( (jsonFile.CompareTo("/home/cmsprod/cms/json/~") != 0) ); std::cout<<"*********** Is data?? **********"<<isData<<std::endl; 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 //------------------------------------------------------------------------------------------------ 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"); } printf("\n Run lumi worked\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 TString monoJetTriggers[12] = {"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<12; i++) { hltModP->AddTrigger(monoJetTriggers[i],0,999999); //jet 85 , met 90 hltModP->AddTrigger(TString("!"+monoJetTriggers[i]),0,999999); //jet 85 , met 90 } // VBF triggers TString vbfTriggers[12] = {"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<12; i++) { hltModP->AddTrigger(vbfTriggers[i],0,999999); //jet 85 , met 90 hltModP->AddTrigger(TString("!"+vbfTriggers[i]),0,999999); //jet 85 , met 90 } hltModP->SetBitsName("HLTBits"); hltModP->SetTrigObjsName("MyHltPhotObjs"); 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("VBTFWorkingPoint95Id"); eleIdMod->SetIsoType("PFIso"); 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* muonIdGammaGamma = new MuonIDMod; // base kinematics muonIdGammaGamma->SetPtMin(10.); muonIdGammaGamma->SetEtaCut(2.4); // base ID muonIdGammaGamma->SetIDType("NoId"); muonIdGammaGamma->SetClassType("GlobalorTracker"); muonIdGammaGamma->SetWhichVertex(0); // this is a 'hack'.. but hopefully good enough... muonIdGammaGamma->SetD0Cut(0.02); muonIdGammaGamma->SetDZCut(0.5); muonIdGammaGamma->SetIsoType("PFIsoBetaPUCorrected"); //h muonIdGammaGamma->SetPFIsoCut(0.2); //h muonIdGammaGamma->SetOutputName("HggLeptonTagMuons"); muonIdGammaGamma->SetPFNoPileUpName("pfnopileupcands"); muonIdGammaGamma->SetPFPileUpName("pfpileupcands"); muonIdGammaGamma->SetPVName(Names::gkPVBeamSpotBrn); 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 *muonId = muonIdWW; MuonIDMod *muonId = muonIdGammaGamma; 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("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); PFTauIDMod *pftauIDMod = new PFTauIDMod; pftauIDMod->SetPFTausName("HPSTaus"); pftauIDMod->SetIsLooseId(kFALSE); 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 *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(muonId->GetOutputName()); theJetCleaning->SetCleanPhotonsName(photonCleaningMod->GetOutputName()); theJetCleaning->SetApplyPhotonRemoval(kTRUE); theJetCleaning->SetGoodJetsName(theJetID->GetOutputName()); theJetCleaning->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(theJetCleaning->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(theJetID); theJetID ->Add(theJetCleaning); theJetCleaning ->Add(jetplusmettree); //------------------------------------------------------------------------------------------------ // 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); // chaching on //d = c->FindDataset(bookstr,dataset,fileset, false); // chaching off } else { d = c->FindDataset(bookstr,skimdataset.Data(),fileset, true); //d = c->FindDataset(bookstr,skimdataset.Data(),fileset, false); } 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(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 runBavanti(const char *fileset = "0000", const char *skim = "noskim", const char *dataset = "r12b-smu-j22-v1", const char *book = "t2mit/filefi/032", const char *catalogDir = "/home/cmsprod/catalog", const char *outputName = "boostedv", int nEvents = 1000) { //------------------------------------------------------------------------------------------------ // some parameters get passed through the environment //------------------------------------------------------------------------------------------------ TString cataDir = Utils::GetCatalogDir(catalogDir); TString mitData = Utils::GetEnv("MIT_DATA"); TString json = Utils::GetEnv("MIT_PROD_JSON"); TString jsonFile = Utils::GetJsonFile("/home/cmsprod/cms/json"); Bool_t isData = (json.CompareTo("~") != 0); printf("\n Initialization worked. Data?: %d\n\n",isData); //------------------------------------------------------------------------------------------------ // some global setups //------------------------------------------------------------------------------------------------ // debugging config 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 - /mt/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 for master module //------------------------------------------------------------------------------------------------ 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 (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"); //------------------------------------------------------------------------------------------------ // 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 //------------------------------------------------------------------------------------------------ Catalog *c = new Catalog(cataDir.Data()); 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,local); else d = c->FindDataset(bookstr,skimdataset.Data(),fileset,local); ana->AddDataset(d); //------------------------------------------------------------------------------------------------ // organize output //------------------------------------------------------------------------------------------------ TString rootFile = TString(outputName); rootFile += TString("_") + TString(dataset) + TString("_") + TString(skim); if (TString(fileset) != TString("")) rootFile += TString("_") + TString(fileset); ana->SetOutputName(rootFile + TString(".root")); ana->SetCacheSize(0); //------------------------------------------------------------------------------------------------ // 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 //------------------------------------------------------------------------------------------------ MuonIDMod *muonId = new MuonIDMod; muonId->SetOutputName("CleanMuons"); muonId->SetIntRadius(0.0); muonId->SetClassType("GlobalTracker"); muonId->SetIDType("WWMuIdV4"); muonId->SetIsoType("IsoRingsV0_BDTG_Iso"); muonId->SetApplyD0Cut(kTRUE); muonId->SetApplyDZCut(kTRUE); muonId->SetWhichVertex(0); muonId->SetRhoType(RhoUtilities::CMS_RHO_RHOKT6PFJETS); muonId->SetPtMin(10.); muonId->SetEtaCut(2.4); //------------------------------------------------------------------------------------------------ // save the interesting collection using the skim modules and the output module //------------------------------------------------------------------------------------------------ SkimMod<Track> *skmGlobalMuonTracks = new SkimMod<Track>; skmGlobalMuonTracks->SetBranchName("GlobalMuonTracks"); skmGlobalMuonTracks->SetColFromBranch(kTRUE); skmGlobalMuonTracks->SetColMarkFilter(kTRUE); skmGlobalMuonTracks->SetPublishArray(kFALSE); SkimMod<Track> *skmStandaloneMuonTracks = new SkimMod<Track>; skmStandaloneMuonTracks->SetBranchName("StandaloneMuonTracks"); skmStandaloneMuonTracks->SetColFromBranch(kTRUE); skmStandaloneMuonTracks->SetColMarkFilter(kTRUE); skmStandaloneMuonTracks->SetPublishArray(kFALSE); SkimMod<Track> *skmStandaloneMuonTracksWVtxConstraint = new SkimMod<Track>; skmStandaloneMuonTracksWVtxConstraint->SetBranchName("StandaloneMuonTracksWVtxConstraint"); skmStandaloneMuonTracksWVtxConstraint->SetColFromBranch(kTRUE); skmStandaloneMuonTracksWVtxConstraint->SetColMarkFilter(kTRUE); skmStandaloneMuonTracksWVtxConstraint->SetPublishArray(kFALSE); SkimMod<Track> *skmTracks = new SkimMod<Track>; skmTracks->SetBranchName("Tracks"); skmTracks->SetColFromBranch(kTRUE); skmTracks->SetColMarkFilter(kTRUE); skmTracks->SetPublishArray(kFALSE); SkimMod<Muon> *skmMuons = new SkimMod<Muon>; skmMuons->SetBranchName("Muons"); skmMuons->SetColFromBranch(kTRUE); skmMuons->SetColMarkFilter(kTRUE); skmMuons->SetPublishArray(kTRUE); OutputMod *outMod1 = new OutputMod; outMod1->Drop("*"); outMod1->Keep("Muons"); outMod1->Keep("GlobalMuonTracks"); outMod1->Keep("StandaloneMuonTracks"); outMod1->Keep("StandaloneMuonTracksWVtxConstraint"); outMod1->Keep("Tracks"); outMod1->SetKeepTamBr(kTRUE); outMod1->SetFileName("bambu"); OutputMod *outMod2 = new OutputMod; outMod2->Drop("*"); outMod2->AddNewBranch(TString("SkmMuons")); outMod2->AddNewBranch(TString("SkmGlobalMuonTracks")); outMod1->AddNewBranch(TString("SkmStandaloneMuonTracks")); outMod1->AddNewBranch(TString("SkmStandaloneMuonTracksWVtxConstraint")); outMod2->AddNewBranch(TString("SkmTracks")); outMod2->SetKeepTamBr(kFALSE); outMod2->SetFileName("bavanti"); //------------------------------------------------------------------------------------------------ // making analysis chain //------------------------------------------------------------------------------------------------ runLumiSel ->Add(goodPvFilterMod); //goodPvFilterMod ->Add(skmGlobalMuonTracks); goodPvFilterMod ->Add(muonId); muonId ->Add(skmGlobalMuonTracks); skmGlobalMuonTracks ->Add(skmStandaloneMuonTracks); skmStandaloneMuonTracks ->Add(skmStandaloneMuonTracksWVtxConstraint); skmStandaloneMuonTracksWVtxConstraint->Add(skmTracks); skmTracks ->Add(skmMuons); skmMuons ->Add(outMod1); outMod1 ->Add(outMod2); //muonId ->Add(outMod1); //muonId ->Add(skmMuons); //skmMuons ->Add(outMod1); //muonId ->Add(skmMuons); //skmMuons ->Add(skmGlobalMuonTracks); //skmGlobalMuonTracks->Add(outMod1); //outMod1 ->Add(outMod2); //------------------------------------------------------------------------------------------------ // 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",rootFile.Data()); printf("\n========================================\n"); //------------------------------------------------------------------------------------------------ // run the analysis after successful initialisation //------------------------------------------------------------------------------------------------ ana->Run(!gROOT->IsBatch()); return; }
//-------------------------------------------------------------------------------------------------- void runBavantiBoostedV_Synch (const char *fileset = "0000", const char *skim = "noskim", //const char *dataset = "s12-ttj-sl-v1-v7c", const char *dataset = "GJets_HT-400ToInf_8TeV-madgraph+Summer12_DR53X-PU_S10_START53_V7A-v1+AODSIM", const char *book = "t2mit/filefi/032", const char *catalogDir = "/home/cmsprod/catalog", const char *outputName = "boostedv", int nEvents = 10) { //------------------------------------------------------------------------------------------------ // some parameters get passed through the environment //------------------------------------------------------------------------------------------------ TString cataDir = getCatalogDir(catalogDir); TString mitData = Utils::GetEnv("MIT_DATA"); TString json = Utils::GetEnv("MIT_PROD_JSON"); TString jsonFile = getJsonFile("/home/cmsprod/cms/json"); Bool_t isData = (json.CompareTo("~") != 0); // only for synchrionization purposes isData = kFALSE; printf("\n Initialization worked. Data?: %d\n\n",isData); //------------------------------------------------------------------------------------------------ // some global setups //------------------------------------------------------------------------------------------------ // debugging config 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 - /mt/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 for master module //------------------------------------------------------------------------------------------------ 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 (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"); //------------------------------------------------------------------------------------------------ // 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 //------------------------------------------------------------------------------------------------ Catalog *c = new Catalog(cataDir.Data()); 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,local); else d = c->FindDataset(bookstr,skimdataset.Data(),fileset,local); ana->AddDataset(d); //------------------------------------------------------------------------------------------------ // organize output //------------------------------------------------------------------------------------------------ TString rootFile = TString(outputName); rootFile += TString("_") + TString(dataset) + TString("_") + TString(skim); if (TString(fileset) != TString("")) rootFile += TString("_") + TString(fileset); TString ntupleFile = rootFile + TString("_ntuple"); rootFile += TString(".root"); ana->SetOutputName(rootFile.Data()); ana->SetCacheSize(0); //------------------------------------------------------------------------------------------------ // HLT information //------------------------------------------------------------------------------------------------ HLTMod *hltModP = new HLTMod("HLTModP"); hltModP->SetBitsName("HLTBits"); hltModP->SetTrigObjsName("HltObjsMonoJet"); hltModP->SetAbortIfNotAccepted(isData); hltModP->SetPrintTable(kFALSE); // 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); // top semileptonic triggers const int nTopTrigs = 14; TString topTriggers[nTopTrigs] = { "HLT_IsoMu15_v2", "HLT_IsoMu24_v2", "HLT_IsoMu17_v6", "HLT_IsoMu17_v8", "HLT_IsoMu17_v9", "HLT_IsoMu17_eta2p1_v1", "HLT_IsoMu24_v8", "HLT_IsoMu24_eta2p1_v3", "HLT_IsoMu24_eta2p1_v6", "HLT_IsoMu24_eta2p1_v7", "HLT_IsoMu24_eta2p1_v12", "HLT_IsoMu24_eta2p1_v13", "HLT_IsoMu24_eta2p1_v14", "HLT_IsoMu24_eta2p1_v15"}; for (int i=0; i<nTopTrigs; i++) hltModP->AddTrigger(TString("!+"+topTriggers[i]),0,999999); // photon triggers const int nPhotonTrigs = 6; TString photonTriggers[nPhotonTrigs] = { "HLT_Photon135_v4", "HLT_Photon135_v5", "HLT_Photon135_v6", "HLT_Photon135_v7", "HLT_Photon150_v3", "HLT_Photon150_v4"}; for (int i=0; i<nPhotonTrigs; i++) hltModP->AddTrigger(TString("!+"+photonTriggers[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); //------------------------------------------------------------------------------------------------ // 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("VBTFWorkingPoint95Id"); eleIdMod->SetIsoType("PFIso"); 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 *muonIdIsoMod = new MuonIDMod; muonIdIsoMod->SetOutputName("HWWMuons"); muonIdIsoMod->SetIntRadius(0.0); muonIdIsoMod->SetClassType("GlobalTracker"); muonIdIsoMod->SetIDType("WWMuIdV4"); muonIdIsoMod->SetIsoType("IsoRingsV0_BDTG_Iso"); muonIdIsoMod->SetApplyD0Cut(kTRUE); muonIdIsoMod->SetD0Cut(0.02); muonIdIsoMod->SetApplyDZCut(kTRUE); muonIdIsoMod->SetDZCut(0.1); muonIdIsoMod->SetWhichVertex(0); muonIdIsoMod->SetRhoType(RhoUtilities::CMS_RHO_RHOKT6PFJETS); muonIdIsoMod->SetPtMin(10.); muonIdIsoMod->SetEtaCut(2.4); MuonIDMod *muonIdLooseMod = new MuonIDMod; muonIdLooseMod->SetOutputName("POGMuons"); muonIdLooseMod->SetClassType("GlobalTracker"); muonIdLooseMod->SetIDType("NoId"); muonIdLooseMod->SetIsoType("NoIso"); muonIdLooseMod->SetApplyD0Cut(true); muonIdLooseMod->SetD0Cut(0.2); muonIdLooseMod->SetApplyDZCut(true); muonIdLooseMod->SetDZCut(0.5); muonIdLooseMod->SetPtMin(10.); muonIdLooseMod->SetEtaCut(2.4); ElectronCleaningMod *electronCleaning = new ElectronCleaningMod; electronCleaning->SetCleanMuonsName(muonIdLooseMod->GetOutputName()); electronCleaning->SetGoodElectronsName(eleIdMod->GetOutputName()); electronCleaning->SetCleanElectronsName("CleanElectrons"); MergeLeptonsMod *merger = new MergeLeptonsMod; merger->SetMuonsName(muonIdLooseMod->GetOutputName()); merger->SetElectronsName(electronCleaning->GetOutputName()); merger->SetMergedName("MergedLeptons"); //----------------------------------- // Photon Egamma Medium ID //----------------------------------- PhotonIDMod *photonIdMod = new PhotonIDMod; photonIdMod->SetPtMin(10.0); photonIdMod->SetOutputName("GoodPhotons"); photonIdMod->SetIDType("EgammaMedium"); photonIdMod->SetIsoType("NoIso"); photonIdMod->SetApplyElectronVeto(kTRUE); photonIdMod->SetApplyPixelSeed(kFALSE); photonIdMod->SetApplyConversionId(kFALSE); photonIdMod->SetApplyFiduciality(kTRUE); photonIdMod->SetIsData(isData); photonIdMod->SetPhotonsFromBranch(kTRUE); PhotonCleaningMod *photonCleaningMod = new PhotonCleaningMod; photonCleaningMod->SetCleanElectronsName(electronCleaning->GetOutputName()); photonCleaningMod->SetGoodPhotonsName(photonIdMod->GetOutputName()); photonCleaningMod->SetCleanPhotonsName("CleanPhotons"); PFTauIDMod *pftauIdMod = new PFTauIDMod; pftauIdMod->SetPFTausName("HPSTaus"); pftauIdMod->SetIsLooseId(kTRUE); pftauIdMod->SetIsHPSSel(kTRUE); // to get >= 5_3_14 samples running pftauIdMod->SetPtMin(15); // to loosen the WP PFTauCleaningMod *pftauCleaningMod = new PFTauCleaningMod; pftauCleaningMod->SetGoodPFTausName(pftauIdMod->GetGoodPFTausName()); pftauCleaningMod->SetCleanMuonsName(muonIdLooseMod->GetOutputName()); pftauCleaningMod->SetCleanElectronsName(electronCleaning->GetOutputName()); PublisherMod<PFJet,Jet> *pubJet = new PublisherMod<PFJet,Jet>("JetPub"); pubJet->SetInputName("AKt4PFJets"); pubJet->SetOutputName("PubAKt4PFJets"); FastJetMod *pubFastJet = new FastJetMod; pubFastJet->SetPfCandidatesName("pfnopileupcands"); pubFastJet->SetPfCandidatesFromBranch(kFALSE); pubFastJet->SetConeSize(0.8); JetCorrectionMod *jetCorr = new JetCorrectionMod; if (isData){ jetCorr->AddCorrectionFromFile((mitData+TString("/Summer13_V1_DATA_L1FastJet_AK5PF.txt")).Data()); jetCorr->AddCorrectionFromFile((mitData+TString("/Summer13_V1_DATA_L2Relative_AK5PF.txt")).Data()); jetCorr->AddCorrectionFromFile((mitData+TString("/Summer13_V1_DATA_L3Absolute_AK5PF.txt")).Data()); jetCorr->AddCorrectionFromFile((mitData+TString("/Summer13_V1_DATA_L2L3Residual_AK5PF.txt")).Data()); } else { jetCorr->AddCorrectionFromFile((mitData+TString("/Summer13_V1_MC_L1FastJet_AK5PF.txt")).Data()); jetCorr->AddCorrectionFromFile((mitData+TString("/Summer13_V1_MC_L2Relative_AK5PF.txt")).Data()); jetCorr->AddCorrectionFromFile((mitData+TString("/Summer13_V1_MC_L3Absolute_AK5PF.txt")).Data()); } jetCorr->SetInputName(pubJet->GetOutputName()); jetCorr->SetCorrectedName("CorrectedJets"); JetCorrectionMod *fatJetCorr = new JetCorrectionMod; if (isData){ fatJetCorr->AddCorrectionFromFile((mitData+TString("/FT53_V21A_AN6_L1FastJet_AK7PFchs.txt")).Data()); fatJetCorr->AddCorrectionFromFile((mitData+TString("/FT53_V21A_AN6_L2Relative_AK7PFchs.txt")).Data()); fatJetCorr->AddCorrectionFromFile((mitData+TString("/FT53_V21A_AN6_L3Absolute_AK7PFchs.txt")).Data()); fatJetCorr->AddCorrectionFromFile((mitData+TString("/FT53_V21A_AN6_L2L3Residual_AK7PFchs.txt")).Data()); } else { fatJetCorr->AddCorrectionFromFile((mitData+TString("/FT53_V21A_AN6_L1FastJet_AK7PFchs.txt")).Data()); fatJetCorr->AddCorrectionFromFile((mitData+TString("/FT53_V21A_AN6_L2Relative_AK7PFchs.txt")).Data()); fatJetCorr->AddCorrectionFromFile((mitData+TString("/FT53_V21A_AN6_L3Absolute_AK7PFchs.txt")).Data()); } fatJetCorr->SetInputName(pubFastJet->GetOutputJetsName()); fatJetCorr->SetCorrectedName("CorrectedFatJets"); JetIDMod *jetId = new JetIDMod; jetId->SetInputName(jetCorr->GetOutputName()); jetId->SetPtCut(30.0); jetId->SetEtaMaxCut(2.5); jetId->SetJetEEMFractionMinCut(0.00); jetId->SetOutputName("GoodJets"); jetId->SetApplyBetaCut(kFALSE); jetId->SetApplyMVACut(kTRUE); JetIDMod *fatJetId = new JetIDMod; fatJetId->SetInputName(fatJetCorr->GetOutputName()); fatJetId->SetPtCut(30.0); fatJetId->SetEtaMaxCut(2.5); fatJetId->SetJetEEMFractionMinCut(0.00); fatJetId->SetOutputName("GoodFatJets"); fatJetId->SetApplyBetaCut(kFALSE); fatJetId->SetApplyMVACut(kFALSE); fatJetId->SetApplyMVACHS(kFALSE); JetCleaningMod *jetCleaning = new JetCleaningMod; jetCleaning->SetCleanElectronsName(electronCleaning->GetOutputName()); jetCleaning->SetCleanMuonsName(muonIdIsoMod->GetOutputName()); jetCleaning->SetCleanPhotonsName(photonCleaningMod->GetOutputName()); jetCleaning->SetApplyPhotonRemoval(kTRUE); jetCleaning->SetApplyTauRemoval(kFALSE); jetCleaning->SetGoodJetsName(jetId->GetOutputName()); jetCleaning->SetCleanJetsName("CleanJets"); JetCleaningMod *fatJetCleaning = new JetCleaningMod; fatJetCleaning->SetCleanElectronsName(electronCleaning->GetOutputName()); fatJetCleaning->SetCleanMuonsName(muonIdIsoMod->GetOutputName()); fatJetCleaning->SetCleanPhotonsName(photonCleaningMod->GetOutputName()); fatJetCleaning->SetMinDeltaRToElectron(0.5); fatJetCleaning->SetMinDeltaRToMuon(0.5); fatJetCleaning->SetMinDeltaRToPhoton(0.5); fatJetCleaning->SetApplyPhotonRemoval(kTRUE); fatJetCleaning->SetApplyTauRemoval(kFALSE); fatJetCleaning->SetGoodJetsName(fatJetId->GetOutputName()); fatJetCleaning->SetCleanJetsName("CleanFatJets"); //------------------------------------------------------------------------------------------------ // select events with a monojet topology //------------------------------------------------------------------------------------------------ BoostedVAnalysisMod *jetplusmet = new BoostedVAnalysisMod("MonoJetSelector"); jetplusmet->SetFatJetsName(fatJetCleaning->GetOutputName()); //identified fat jets jetplusmet->SetFatJetsFromBranch(kFALSE); jetplusmet->SetJetsName(jetCleaning->GetOutputName()); //identified jets jetplusmet->SetJetsFromBranch(kFALSE); jetplusmet->SetElectronsName(electronCleaning->GetOutputName()); jetplusmet->SetElectronsFromBranch(kFALSE); jetplusmet->SetMuonsName(muonIdLooseMod->GetOutputName()); jetplusmet->SetMuonsFromBranch(kFALSE); jetplusmet->SetPhotonsName(photonCleaningMod->GetOutputName()); jetplusmet->SetPhotonsFromBranch(kFALSE); jetplusmet->ApplyResolvedPresel(kTRUE); jetplusmet->ApplyTopPresel(kFALSE); jetplusmet->ApplyWlepPresel(kTRUE); jetplusmet->ApplyZeePresel(kTRUE); jetplusmet->ApplyZmmPresel(kTRUE); jetplusmet->ApplyMetPresel(kTRUE); jetplusmet->ApplyVbfPresel(kFALSE); jetplusmet->ApplyGjetPresel(kTRUE); jetplusmet->SetMinFatJetPt(200); jetplusmet->SetMinTagJetPt(110); jetplusmet->SetMinMet(150); jetplusmet->SetMinPhotonPt(160); jetplusmet->SkipEvents(kFALSE); //------------------------------------------------------------------------------------------------ // prepare the extended MVA met //------------------------------------------------------------------------------------------------ FillerXlMet *extendedMetFiller = new FillerXlMet(); extendedMetFiller->SetIsData(isData); extendedMetFiller->SetJetsFromBranch(kFALSE); extendedMetFiller->SetJetsName(pubJet->GetOutputName()); extendedMetFiller->SetMuonsFromBranch(kTRUE); //extendedMetFiller->SetMuonsName(muonIdLooseMod->GetOutputName()); extendedMetFiller->SetElectronsFromBranch(kTRUE); //extendedMetFiller->SetElectronsName(electronCleaning->GetOutputName()); extendedMetFiller->SetTausFromBranch(kTRUE); extendedMetFiller->SetTausName("HPSTaus"); extendedMetFiller->SetPhotonsFromBranch(kTRUE); //extendedMetFiller->SetPhotonsName(photonCleaningMod->GetOutputName()); extendedMetFiller->SetPVFromBranch(kFALSE); extendedMetFiller->SetPVName(goodPVFilterMod->GetOutputName()); extendedMetFiller->SetXlMetName("PFMetMVA"); //------------------------------------------------------------------------------------------------ // prepare the extended jets with QG/color pull information //------------------------------------------------------------------------------------------------ FillerXlJets *boostedJetsFiller = new FillerXlJets; boostedJetsFiller->SetJetsName(jetCleaning->GetOutputName()); boostedJetsFiller->SetJetsFromBranch(kFALSE); //------------------------------------------------------------------------------------------------ // prepare the extended jets with substructure information //------------------------------------------------------------------------------------------------ FillerXlFatJets *boostedFatJetsFiller = new FillerXlFatJets; boostedFatJetsFiller->FillTopSubJets(kFALSE); boostedFatJetsFiller->SetJetsName(fatJetCleaning->GetOutputName()); boostedFatJetsFiller->SetJetsFromBranch(kFALSE); boostedFatJetsFiller->SetConeSize(0.8); //------------------------------------------------------------------------------------------------ // prepare the reduced isolated particles //------------------------------------------------------------------------------------------------ FillerXsIsoParticles *boostedXsIsoParticlesFiller = new FillerXsIsoParticles; boostedXsIsoParticlesFiller->FillXsMuons(kTRUE); boostedXsIsoParticlesFiller->FillXsElectrons(kTRUE); boostedXsIsoParticlesFiller->FillXsTaus(kTRUE); boostedXsIsoParticlesFiller->FillXsPhotons(kTRUE); boostedXsIsoParticlesFiller->SetMuonsName(muonIdLooseMod->GetOutputName()); boostedXsIsoParticlesFiller->SetMuonsFromBranch(kFALSE); boostedXsIsoParticlesFiller->SetIsoMuonsName(muonIdIsoMod->GetOutputName()); boostedXsIsoParticlesFiller->SetIsoMuonsFromBranch(kFALSE); boostedXsIsoParticlesFiller->SetElectronsName(eleIdMod->GetOutputName()); boostedXsIsoParticlesFiller->SetElectronsFromBranch(kFALSE); boostedXsIsoParticlesFiller->SetTausName(pftauCleaningMod->GetOutputName()); boostedXsIsoParticlesFiller->SetTausFromBranch(kFALSE); boostedXsIsoParticlesFiller->SetPhotonsName(photonCleaningMod->GetOutputName()); boostedXsIsoParticlesFiller->SetPhotonsFromBranch(kFALSE); //------------------------------------------------------------------------------------------------ // keep the skimmed collections for further usage //------------------------------------------------------------------------------------------------ //SkimMod<PFCandidate> *skmPFCandidates = new SkimMod<PFCandidate>; //skmPFCandidates->SetBranchName(Names::gkPFCandidatesBrn); //skmPFCandidates->SetPublishArray(kTRUE); SkimJetsMod *skmJets = new SkimJetsMod; skmJets->SetBranchName(jetCleaning->GetOutputName()); skmJets->SetColFromBranch(kFALSE); skmJets->SetColMarkFilter(kFALSE); skmJets->SetPublishArray(kTRUE); SkimMod<TriggerObject> *skmTrigger = new SkimMod<TriggerObject>; skmTrigger->SetBranchName(hltModP->GetOutputName()); skmTrigger->SetColFromBranch(kFALSE); skmTrigger->SetColMarkFilter(kFALSE); skmTrigger->SetPublishArray(kTRUE); //------------------------------------------------------------------------------------------------ // save all this in an output ntuple //------------------------------------------------------------------------------------------------ OutputMod *outMod = new OutputMod; outMod->SetUseBrDep(kFALSE); outMod->SetKeepTamBr(kFALSE); outMod->SetFileName(ntupleFile); outMod->SetMaxFileSize(4096); outMod->Drop("*"); outMod->Keep(Names::gkMCEvtInfoBrn); outMod->Keep(Names::gkMCPartBrn); outMod->Keep(Names::gkPVBeamSpotBrn); outMod->Keep(Names::gkPileupInfoBrn); outMod->Keep(Names::gkPileupEnergyDensityBrn); outMod->Keep("PFMet"); outMod->AddNewBranch("XlEvtSelData"); //outMod->AddNewBranch(TString("Skm") + Names::gkPFCandidatesBrn); outMod->AddNewBranch(TString("Skm") + hltModP->GetOutputName()); outMod->AddNewBranch("PFMetMVA"); outMod->AddNewBranch("XlJets"); outMod->AddNewBranch("XlFatJets"); outMod->AddNewBranch("XlSubJets"); outMod->AddNewBranch("XsMuons"); outMod->AddNewBranch("XsElectrons"); outMod->AddNewBranch("XsTaus"); outMod->AddNewBranch("XsPhotons"); //------------------------------------------------------------------------------------------------ // making analysis chain //------------------------------------------------------------------------------------------------ runLumiSel ->Add(goodPVFilterMod); goodPVFilterMod ->Add(hltModP); hltModP ->Add(sepPuMod); sepPuMod ->Add(muonIdIsoMod); muonIdIsoMod ->Add(muonIdLooseMod); muonIdLooseMod ->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(jetId); jetId ->Add(jetCleaning); jetCleaning ->Add(pubFastJet); pubFastJet ->Add(fatJetCorr); fatJetCorr ->Add(fatJetId); fatJetId ->Add(fatJetCleaning); fatJetCleaning ->Add(jetplusmet); jetplusmet ->Add(extendedMetFiller); extendedMetFiller ->Add(boostedJetsFiller); boostedJetsFiller ->Add(boostedFatJetsFiller); boostedFatJetsFiller ->Add(boostedXsIsoParticlesFiller); boostedXsIsoParticlesFiller->Add(skmJets); skmJets ->Add(skmTrigger); skmTrigger ->Add(outMod); //------------------------------------------------------------------------------------------------ // 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",rootFile.Data()); printf("\n Ntuple output: %s\n\n",(ntupleFile + TString(".root")).Data()); printf("\n========================================\n"); //------------------------------------------------------------------------------------------------ // run the analysis after successful initialisation //------------------------------------------------------------------------------------------------ ana->Run(!gROOT->IsBatch()); return; }
//-------------------------------------------------------------------------------------------------- void runMonoJetSkim(const char *fileset = "0000", const char *skim = "noskim", const char *dataset = "s12-zjets-ptz100-v7a", const char *book = "t2mit/filefi/032", const char *catalogDir = "/home/cmsprod/catalog", const char *outputLabel = "monojet", int nEvents = 1000) { //------------------------------------------------------------------------------------------------ // 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; } TString jsonFile = TString("/home/cmsprod/cms/json/") + json; Bool_t isData = (json != "~"); TString MitData(gSystem->Getenv("MIT_DATA")); if(MitData.Length() == 0){ MitData = gSystem->Getenv("CMSSW_BASE"); MitData += "/src/MitPhysics/data"; } printf("\n Initialization worked: \n\n"); printf(" JSON : %s (file: %s)\n", json.Data(), jsonFile.Data()); 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"); // 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->SetPFNoPileUpName("pfnopileupcands"); SepPUMod->SetPFPileUpName("pfpileupcands"); SepPUMod->SetCheckClosestZVertex(kFALSE); //------------------------------------------------------------------------------------------------ // 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->SetIsMC(!isData); goodPvMod->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(mithep::ElectronTools::kVBTFWorkingPoint95Id); eleIdMod->SetIsoType(mithep::ElectronTools::kPFIso); eleIdMod->SetApplyConversionFilterType1(kTRUE); eleIdMod->SetApplyConversionFilterType2(kFALSE); eleIdMod->SetChargeFilter(kFALSE); eleIdMod->SetApplyD0Cut(kTRUE); eleIdMod->SetApplyDZCut(kTRUE); eleIdMod->SetWhichVertex(-1); eleIdMod->SetGoodElectronsName("GoodElectronsBS"); eleIdMod->SetRhoAlgo(mithep::PileupEnergyDensity::kKt6PFJets); MuonIDMod *muonId = new MuonIDMod; muonId->SetOutputName("GoodMuons"); muonId->SetIntRadius(0.0); muonId->SetClassType("GlobalTracker"); muonId->SetIDType("WWMuIdV4"); muonId->SetIsoType("IsoRingsV0_BDTG_Iso"); muonId->SetApplyD0Cut(kTRUE); muonId->SetApplyDZCut(kTRUE); muonId->SetWhichVertex(0); muonId->SetRhoAlgo(mithep::PileupEnergyDensity::kKt6PFJets); muonId->SetPtMin(10.); muonId->SetEtaCut(2.4); 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 *photonReg = new PhotonMvaMod; photonReg->SetRegressionVersion(3); photonReg->SetRegressionWeights((MitData+TString("/gbrv3ph_52x.root")).Data()); photonReg->SetOutputName("GoodPhotonsRegr"); photonReg->SetApplyShowerRescaling(kTRUE); photonReg->SetMinNumPhotons(0); photonReg->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(photonReg->GetOutputName()); //get the photon with regression energy photonIDMod->DoMCSmear(kTRUE); photonIDMod->DoDataEneCorr(kTRUE); //---------------------------------shower shape scale-------------------------------------------------------------------------------- photonIDMod->SetDoShowerShapeScaling(kTRUE); photonIDMod->SetShowerShapeType("2012ShowerShape"); PFTauIDMod *pfTauIDMod = new PFTauIDMod; pfTauIDMod->SetPFTausName("HPSTaus"); pfTauIDMod->SetIsLooseId(kFALSE); 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((MitData+TString("/Summer13_V1_DATA_L1FastJet_AK5PF.txt")).Data()); jetCorr->AddCorrectionFromFile((MitData+TString("/Summer13_V1_DATA_L2Relative_AK5PF.txt")).Data()); jetCorr->AddCorrectionFromFile((MitData+TString("/Summer13_V1_DATA_L3Absolute_AK5PF.txt")).Data()); jetCorr->AddCorrectionFromFile((MitData+TString("/Summer13_V1_DATA_L2L3Residual_AK5PF.txt")).Data()); } else { jetCorr->AddCorrectionFromFile((MitData+TString("/Summer13_V1_MC_L1FastJet_AK5PF.txt")).Data()); jetCorr->AddCorrectionFromFile((MitData+TString("/Summer13_V1_MC_L2Relative_AK5PF.txt")).Data()); jetCorr->AddCorrectionFromFile((MitData+TString("/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(muonId->GetOutputName()); 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); //------------------------------------------------------------------------------------------------ // select events //------------------------------------------------------------------------------------------------ float minLeadingJetEt = 100.; float maxJetEta = 4.7; float minMet = 160.; MonoJetAnalysisMod *monojetSel = new MonoJetAnalysisMod("MonoJetSelector"); monojetSel->SetInputMetName(metCorrT0T1Shift->GetOutputName()); monojetSel->SetMetFromBranch(kFALSE); monojetSel->SetJetsName(jetCleaning->GetOutputName()); monojetSel->SetJetsFromBranch(kFALSE); monojetSel->SetElectronsName(electronCleaning->GetOutputName()); monojetSel->SetElectronsFromBranch(kFALSE); monojetSel->SetMuonsName(muonId->GetOutputName()); monojetSel->SetMuonsFromBranch(kFALSE); monojetSel->SetTausName(pfTauCleaningMod->GetOutputName()); monojetSel->SetTausFromBranch(kFALSE); monojetSel->SetLeptonsName(merger->GetOutputName()); monojetSel->SetCategoriesName("MonoJetEventCategories"); // Jet + MET (signal region) unsigned iCat = 0; monojetSel->SetMinNumLeptons(iCat, 0); monojetSel->SetMaxNumLeptons(iCat, 0); monojetSel->SetMinNumTaus(iCat, 0); monojetSel->SetMaxNumTaus(iCat, 0); monojetSel->SetMinNumJets(iCat, 1); monojetSel->SetMaxNumJets(iCat, 1); monojetSel->SetMinNumGenNeutrinos(iCat, 0); monojetSel->SetMinJetEt(iCat, minLeadingJetEt); monojetSel->SetMaxJetEta(iCat, maxJetEta); monojetSel->SetMinMetEt(iCat, minMet); monojetSel->SetMinEmulMetEt(iCat, 0.); monojetSel->SetMinChargedHadronFrac(iCat, 0.2); monojetSel->SetMaxNeutralHadronFrac(iCat, 0.7); monojetSel->SetMaxNeutralEmFrac(iCat, 0.7); // Dilepton (Z->ll) iCat = 1; monojetSel->SetMinNumLeptons(iCat, 2); monojetSel->SetMaxNumLeptons(iCat, 2); monojetSel->SetMinNumTaus(iCat, 0); monojetSel->SetMaxNumTaus(iCat, 0); monojetSel->SetMinNumJets(iCat, 1); monojetSel->SetMaxNumJets(iCat, 1); monojetSel->SetMinNumGenNeutrinos(iCat, 0); monojetSel->SetMinJetEt(iCat, minLeadingJetEt); monojetSel->SetMaxJetEta(iCat, maxJetEta); monojetSel->SetMinMetEt(iCat, 0.); monojetSel->SetMinEmulMetEt(iCat, minMet); monojetSel->SetMinChargedHadronFrac(iCat, 0.2); monojetSel->SetMaxNeutralHadronFrac(iCat, 0.7); monojetSel->SetMaxNeutralEmFrac(iCat, 0.7); // Single lepton (W->lnu) iCat = 2; monojetSel->SetMinNumLeptons(iCat, 1); monojetSel->SetMaxNumLeptons(iCat, 1); monojetSel->SetMinNumTaus(iCat, 0); monojetSel->SetMaxNumTaus(iCat, 0); monojetSel->SetMinNumJets(iCat, 1); monojetSel->SetMaxNumJets(iCat, 1); monojetSel->SetMinNumGenNeutrinos(iCat, 0); monojetSel->SetMinJetEt(iCat, minLeadingJetEt); monojetSel->SetMaxJetEta(iCat, maxJetEta); monojetSel->SetMinMetEt(iCat, minMet); monojetSel->SetMinEmulMetEt(iCat, 0.); monojetSel->SetMinChargedHadronFrac(iCat, 0.2); monojetSel->SetMaxNeutralHadronFrac(iCat, 0.7); monojetSel->SetMaxNeutralEmFrac(iCat, 0.7); // if dataset is Z MC, skim based on the existence of neutrinos if(TString(dataset).Contains("zjets")){ iCat = 3; monojetSel->SetMinNumLeptons(iCat, 0); monojetSel->SetMaxNumLeptons(iCat, 0); monojetSel->SetMinNumTaus(iCat, 0); monojetSel->SetMaxNumTaus(iCat, 0); monojetSel->SetMinNumJets(iCat, 1); monojetSel->SetMaxNumJets(iCat, 1); // this is what makes this module special monojetSel->SetMinNumGenNeutrinos(iCat, 2); monojetSel->SetMinJetEt(iCat, minLeadingJetEt); monojetSel->SetMaxJetEta(iCat, maxJetEta); monojetSel->SetMinMetEt(iCat, minMet); monojetSel->SetMinEmulMetEt(iCat, 0.); monojetSel->SetMinChargedHadronFrac(iCat, 0.2); monojetSel->SetMaxNeutralHadronFrac(iCat, 0.7); monojetSel->SetMaxNeutralEmFrac(iCat, 0.7); } //------------------------------------------------------------------------------------------------ // making the analysis chain //------------------------------------------------------------------------------------------------ // this is how it always starts runLumiSel ->Add(generatorMod); generatorMod ->Add(goodPvMod); goodPvMod ->Add(hltModP); // photon regression hltModP ->Add(photonReg); // simple object id modules photonReg ->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(jetCleaning); jetCleaning ->Add(monojetSel); //------------------------------------------------------------------------------------------------ // setup analysis //------------------------------------------------------------------------------------------------ Analysis *ana = new Analysis; ana->SetUseCacher(1); 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, 1); // 1 to use smartcache else d = c->FindDataset(book,skimDataset.Data(),fileset, 1); ana->AddDataset(d); ana->SetCacheSize(0); //------------------------------------------------------------------------------------------------ // 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->Drop("*"); skimOutput->Keep("HLT*"); skimOutput->Keep("MC*"); skimOutput->Keep("PileupInfo"); skimOutput->Keep("Rho"); skimOutput->Keep("EvtSelData"); skimOutput->Keep("BeamSpot"); skimOutput->Keep("PrimaryVertexes"); skimOutput->Keep("PFMet"); skimOutput->Keep("AKt5PFJets"); skimOutput->Keep("Electrons"); skimOutput->Keep("Muons"); skimOutput->Keep("HPSTaus"); skimOutput->Keep("Photons"); // TODO find some object that is named and can hold bit mask info skimOutput->AddNewBranch(monojetSel->GetCategoriesName()); skimOutput->SetMaxFileSize(10 * 1024); // 10 GB - should never exceed skimOutput->SetFileName(outputName); skimOutput->SetPathName("."); monojetSel->Add(skimOutput); //------------------------------------------------------------------------------------------------ // 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",catalogDir); printf(" -> Book: %s Dataset: %s Skim: %s Fileset: %s <-\n",book,dataset,skim,fileset); printf("\n========================================\n"); //------------------------------------------------------------------------------------------------ // 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 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; }