void runWWAnalysisChain(TString inputfiles, TString outputfileName, TString PlotType, TString JetsName) { //Trigger HLTMod *hltmod = new HLTMod; hltmod->SetPrintTable(kFALSE); // hltmod->AddTrigger("HLT_IsoMu15"); // hltmod->AddTrigger("HLT_IsoEle15_L1I"); hltmod->AddTrigger("HLT_Mu5"); hltmod->AddTrigger("HLT_Ele10_SW_L1R"); hltmod->SetTrigObjsName("myhltobjs"); //PreSelection HwwEvtPreSelMod *preSelectionMod = new HwwEvtPreSelMod; //Object ID and Cleaning Sequence; MuonIDMod *muonID = new MuonIDMod; ElectronIDMod *electronID = new ElectronIDMod; JetIDMod *JetID = new JetIDMod; //default names are IC5 JetID->SetJetName(JetsName); //for SC5 I have to set the names JetID->SetGoodJetsName(TString("GoodJets")); ElectronCleaningMod *electronCleaning = new ElectronCleaningMod; JetCleaningMod *JetCleaning = new JetCleaningMod; //default names are ok for IC5 JetCleaning->SetGoodJetsName(TString("GoodJets")); JetCleaning->SetCleanJetsName(TString("CleanJets")); //Event Selection modules WWEvtSelMod *eventSelectionMod = new WWEvtSelMod; eventSelectionMod->SetLoadGenParticles(false); eventSelectionMod->SetCleanJetsName(TString("CleanJets")); eventSelectionMod->SetPlotType(PlotType); eventSelectionMod->SetPrintDebug(false); //chain modules together hltmod->Add(preSelectionMod); preSelectionMod->Add(muonID); muonID->Add(electronID); electronID->Add(JetID); JetID->Add(electronCleaning); electronCleaning->Add(JetCleaning); JetCleaning->Add(eventSelectionMod); // set up analysis Analysis *ana = new Analysis; //ana->SetUseHLT(false); ana->SetKeepHierarchy(kFALSE); ana->SetSuperModule(preSelectionMod); ana->AddFile(inputfiles); ana->SetOutputName(outputfileName.Data()); // run the analysis after successful initialisation ana->Run(! gROOT->IsBatch()); cout << "HLTMod: Accepted " << hltmod->GetNAccepted() << " of " << hltmod->GetNEvents() << " events" << endl; return; }
//-------------------------------------------------------------------------------------------------- void WWSelection(const char *fileset = "", const char *dataset = "s8-ttbar-id9", const char *book = "mit/filler/004", const char *catalogDir = "/home/mitprod/catalog", const char *outputName = "WWSelection", int nEvents = -1) { //------------------------------------------------------------------------------------------------ // some global setups //------------------------------------------------------------------------------------------------ using namespace mithep; gDebugMask = Debug::kAnalysis; gDebugLevel = 3; //------------------------------------------------------------------------------------------------ // generator information //------------------------------------------------------------------------------------------------ GeneratorMod *GeneratorMod = new GeneratorMod; //------------------------------------------------------------------------------------------------ // HLT information //------------------------------------------------------------------------------------------------ HLTMod *hltmod = new HLTMod; hltmod->SetPrintTable(kTRUE); hltmod->AddTrigger("HLT_IsoEle15_L1I"); hltmod->AddTrigger("HLT_Ele15_SW_L1R"); hltmod->AddTrigger("HLT_IsoEle15_LW_L1I"); hltmod->AddTrigger("HLT_IsoEle18_L1R"); hltmod->AddTrigger("HLT_Ele15_LW_L1R"); hltmod->AddTrigger("HLT_LooseIsoEle15_LW_L1R"); hltmod->AddTrigger("HLT_IsoMu15"); hltmod->AddTrigger("HLT_Mu15"); hltmod->SetTrigObjsName("myhltobjs"); //------------------------------------------------------------------------------------------------ // object id and cleaning sequence //------------------------------------------------------------------------------------------------ MuonIDMod *muonID = new MuonIDMod; muonID->SetMuonIDType("Loose"); muonID->SetMuonIsoType("TrackCaloSliding"); ElectronIDMod *electronID = new ElectronIDMod; electronID->SetElectronIDType(TString("Tight")); electronID->SetElectronIsoType(TString("TrackJuraSliding")); JetIDMod *JetID = new JetIDMod; JetID->SetJetBranchName(TString("SisCone5Jets")); //name of jet algorithm JetID->SetGoodJetsName(TString("GoodJets")); JetID->SetUseJetCorrection(true); JetID->SetJetEtCut(30.0); ElectronCleaningMod *electronCleaning = new ElectronCleaningMod; JetCleaningMod *JetCleaning = new JetCleaningMod; JetCleaning->SetGoodJetsName (TString("GoodJets")); JetCleaning->SetCleanJetsName(TString("CleanJets")); //------------------------------------------------------------------------------------------------ // analyses modules //------------------------------------------------------------------------------------------------ WWEvtSelMod *analysisMod = new WWEvtSelMod; analysisMod->SetLoadGenParticles(false); analysisMod->SetCleanJetsName(TString("CleanJets")); analysisMod->SetPrintDebug(false); //------------------------------------------------------------------------------------------------ // making analysis chain //------------------------------------------------------------------------------------------------ //GeneratorMod->Add(hltmod); hltmod->Add(muonID); GeneratorMod->Add(muonID); muonID->Add(electronID); electronID->Add(JetID); JetID->Add(electronCleaning); electronCleaning->Add(JetCleaning); JetCleaning->Add(analysisMod); //------------------------------------------------------------------------------------------------ // setup analysis //------------------------------------------------------------------------------------------------ Analysis *ana = new Analysis; ana->SetUseHLT(true); ana->SetKeepHierarchy(false); if (nEvents >= 0) ana->SetProcessNEvents(nEvents); ana->SetSuperModule(GeneratorMod); //------------------------------------------------------------------------------------------------ // organize input //------------------------------------------------------------------------------------------------ printf("\nRely on Catalog: %s\n",catalogDir); printf(" -> Book: %s Dataset: %s Fileset: %s <-\n\n",book,dataset,fileset); Catalog *c = new Catalog(catalogDir); Dataset *d = c->FindDataset(book,dataset,fileset); ana->AddDataset(d); //------------------------------------------------------------------------------------------------ // organize output //------------------------------------------------------------------------------------------------ TString rootFile = TString(outputName); rootFile += TString("_") + TString(dataset); if (TString(fileset) != TString("")) rootFile += TString("_") + TString(fileset); rootFile += TString(".root"); printf("\nRoot output: %s\n\n",rootFile.Data()); ana->SetOutputName(rootFile.Data()); //------------------------------------------------------------------------------------------------ // run the analysis after successful initialisation //------------------------------------------------------------------------------------------------ ana->Run(!gROOT->IsBatch()); return; }