Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions Tools/interface/splitPandaExpress.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#include <TROOT.h>
#include <TFile.h>
#include <TTree.h>
#include <TKey.h>
#include <TString.h>
#include <iostream>
#include <string>
#include <cassert>

void splitPandaExpress(std::string inputFile, Long64_t nEvtsPerFile);

24 changes: 11 additions & 13 deletions Tools/python/processes/SM.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
'W2JetsToLNu_LHEWpT_50-150_TuneCP5_13TeV-amcnloFXFX-pythia8':('W2JetsToLNu_WpT50to150_CP5','MC',1275),
'W2JetsToLNu_LHEWpT_100-150_TuneCP5_13TeV-amcnloFXFX-pythia8':('W2JetsToLNu_WpT100to150_CP5','MC',303.7),
'W2JetsToLNu_LHEWpT_150-250_TuneCP5_13TeV-amcnloFXFX-pythia8':('W2JetsToLNu_WpT150to250_CP5','MC',106.4),
'W2JetsToLNu_LHEWpT_250-400_TuneCP5_13TeV-amcnloFXFX-pythia8':('W2JetsToLNu_WpT250to400_CP5','MC',10.98),
'W2JetsToLNu_LHEWpT_250-400_TuneCP5_13TeV-amcnloFXFX-pythia8':('W2JetsToLNu_WpT250to400_CP5','MC',17.93),
'W2JetsToLNu_LHEWpT_400-inf_TuneCP5_13TeV-amcnloFXFX-pythia8':('W2JetsToLNu_WpT400toinf_CP5','MC',3.19),

# NLO Z->ll
Expand Down Expand Up @@ -160,20 +160,16 @@
#'TT_TuneCUETP8M2T4_13TeV-powheg-isrup-pythia8': ('TTbar_PowhegISRUp','MC',831.76),
#'TT_TuneCUETP8M2T4down_13TeV-powheg-pythia8': ('TTbar_PowhegTuneDown','MC',831.76),
#'TT_TuneCUETP8M2T4up_13TeV-powheg-pythia8': ('TTbar_PowhegTuneUp','MC',831.76),
'TTTo2L2Nu_TuneCUETP8M2_ttHtranche3_13TeV-powheg-pythia8':('TTTo2L2Nu','MC',88.288),
'TTTo2L2Nu_TuneCUETP8M2_ttHtranche3_13TeV-powheg-pythia8':('TTTo2L2Nu','MC',88.667),
'TTGJets_TuneCUETP8M1_13TeV-amcatnloFXFX-madspin-pythia8':('TTGJets_TuneCUETP8M1_13TeV-amcatnloFXFX-madspin-pythia8','MC',1.444*3.2),
'TTZToLLNuNu_M-10_TuneCUETP8M1_13TeV-amcatnlo-pythia8':('TTZToLLNuNu_M-10_TuneCUETP8M1_13TeV-amcatnlo-pythia8','MC',0.2529),
'TTZToQQ_TuneCUETP8M1_13TeV-amcatnlo-pythia8':('TTZToQQ_TuneCUETP8M1_13TeV-amcatnlo-pythia8','MC',0.5297),
'TTWJetsToLNu_TuneCUETP8M1_13TeV-amcatnloFXFX-madspin-pythia8':('TTWJetsToLNu_TuneCUETP8M1_13TeV-amcatnloFXFX-madspin-pythia8','MC',0.2043),
'TTWJetsToQQ_TuneCUETP8M1_13TeV-amcatnloFXFX-madspin-pythia8':('TTWJetsToQQ_TuneCUETP8M1_13TeV-amcatnloFXFX-madspin-pythia8','MC',0.4062),

'TTTo2L2Nu_TuneCP5_13TeV-powheg-pythia8':('TTTo2L2Nu_CP5','MC',88.288),
'TTTo2L2Nu_TuneCP5_PSweights_13TeV-powheg-pythia8':('TTTo2L2Nu_CP5_PSweights','MC',88.288),
'TTToSemiLeptonic_TuneCP5_13TeV-powheg-pythia8':('TTToSemiLeptonic_CP5','MC',1),
'TTToSemiLeptonic_TuneCP5_PSweights_13TeV-powheg-pythia8':('TTToSemiLeptonic_CP5_PSweights','MC',1),
'TTToHadronic_TuneCP5_13TeV-powheg-pythia8':('TTToHadronic_CP5','MC',1),
'TTToHadronic_TuneCP5_PSweights_13TeV-powheg-pythia8':('TTToHadronic_CP5_PSweights','MC',1),

'TTTo2L2Nu_TuneCP5_13TeV-powheg-pythia8':('TTTo2L2Nu_CP5','MC',88.667),
'TTToSemiLeptonic_TuneCP5_13TeV-powheg-pythia8':('TTToSemiLeptonic_CP5','MC',365.80), #300.9 in MCM
'TTToHadronic_TuneCP5_13TeV-powheg-pythia8':('TTToHadronic_CP5','MC',377.29), #313.9 in MCM

# exotic top
'tZq_ll_4f_13TeV-amcatnlo-pythia8':('SingleTop_tZll','MC',0.0758),
Expand All @@ -197,6 +193,8 @@

# fancy dibosons
'WWTo2L2Nu_13TeV-powheg':('WWTo2L2Nu','MC',(118.7-3.974)*0.1086*0.1086*9), #12.178
'WWTo2L2Nu_NNPDF31_TuneCP5_PSweights_13TeV-powheg-pythia8':('WWTo2L2Nu_CP5','MC',(118.7-3.974)*0.1086*0.1086*9), #12.178
'WWTo1L1Nu2Q_13TeV_amcatnloFXFX_madspin_pythia8':('WWTo1L1Nu2Q_AMC','MC',40.58),
'WWTo4Q_13TeV-powheg':('WWTo4Q','MC',51.723),
'WWToLNuQQ_13TeV-powheg':('WWToLNuQQ','MC',49.997),
'WZTo1L1Nu2Q_13TeV_amcatnloFXFX_madspin_pythia8':('WZTo1L1Nu2Q','MC',10.71),
Expand Down Expand Up @@ -234,8 +232,8 @@
'ZH_HToBB_ZToLL_M125_13TeV_powheg_pythia8':('ZllHbb_mH125','MC',0.04865),
'ggZH_HToBB_ZToNuNu_M125_13TeV_powheg_pythia8':('ggZvvHbb_mH125','MC',0.014366),
'ggZH_HToBB_ZToLL_M125_13TeV_powheg_pythia8':('ggZllHbb_mH125','MC',0.007842),
'WminusH_HToBB_WToLNu_M125_13TeV_powheg_pythia8':('WmLNuHbb','MC',0.100),
'WplusH_HToBB_WToLNu_M125_13TeV_powheg_pythia8':('WpLNuHbb','MC',0.159),
'WminusH_HToBB_WToLNu_M125_13TeV_powheg_pythia8':('WmLNuHbb_mH125','MC',0.100),
'WplusH_HToBB_WToLNu_M125_13TeV_powheg_pythia8':('WpLNuHbb_mH125','MC',0.159),
'WminusH_HToBB_WToLNu_M125_13TeV_powheg_herwigpp':('WmLNuHbb_herwigpp','MC',0.100),
'WplusH_HToBB_WToLNu_M125_13TeV_powheg_herwigpp':('WpLNuHbb_herwigpp','MC',0.159),
'WminusH_HToBB_WToLNu_M120_13TeV_powheg_pythia8':('WmLNuHbb_mH120','MC',0.100),
Expand All @@ -250,14 +248,14 @@
'ZH_HToBB_ZToQQ_M125_13TeV_powheg_pythia8':('ZQQHbb_mH125','MC',0.04865 * 20.767 / 3),

# B enriched V+jets samples
'DYBJetsToLL_M-50_TuneCUETP8M1_13TeV-madgraphMLM-pythia8':('ZJets_bQuarks','MC',71.77),
'DYBJetsToLL_M-50_TuneCUETP8M1_13TeV-madgraphMLM-pythia8':('ZJets_bQuarks_incl','MC',71.77),
'DYBJetsToLL_M-50_Zpt-100to200_TuneCUETP8M1_13TeV-madgraphMLM-pythia8':('ZJets_bQuarks_pt100to200','MC',3.027),
'DYBJetsToLL_M-50_Zpt-200toInf_TuneCUETP8M1_13TeV-madgraphMLM-pythia8':('ZJets_bQuarks_pt200toinf','MC',0.297),
'WBJetsToLNu_Wpt-100to200_TuneCUETP8M1_13TeV-madgraphMLM-pythia8':('WJets_bQuarks_pt100to200','MC',6.004),
'WBJetsToLNu_Wpt-200toInf_TuneCUETP8M1_13TeV-madgraphMLM-pythia8':('WJets_bQuarks_pt200toinf','MC',0.8524),
'ZBJetsToNuNu_Zpt-100to200_TuneCUETP8M1_13TeV-madgraphMLM-pythia8':('ZtoNuNu_bQuarks_pt100to200','MC',6.03),
'ZBJetsToNuNu_Zpt-200toInf_TuneCUETP8M1_13TeV-madgraphMLM-pythia8':('ZtoNuNu_bQuarks_pt200toinf','MC',0.5946),
'DYJetsToLL_BGenFilter_M-50_TuneCUETP8M1_13TeV-madgraphMLM-pythia8':('ZJets_bHadrons','MC',229.7),
'DYJetsToLL_BGenFilter_M-50_TuneCUETP8M1_13TeV-madgraphMLM-pythia8':('ZJets_bHadrons_incl','MC',229.7),
'DYJetsToLL_BGenFilter_Zpt-100to200_M-50_TuneCUETP8M1_13TeV-madgraphMLM-pythia8':('ZJets_bHadrons_pt100to200','MC',3.506),
'DYJetsToLL_BGenFilter_Zpt-200toInf_M-50_TuneCUETP8M1_13TeV-madgraphMLM-pythia8':('ZJets_bHadrons_pt200toinf','MC',0.5083),
'WJetsToLNu_BGenFilter_Wpt-100to200_TuneCUETP8M1_13TeV-madgraphMLM-pythia8':('WJets_bHadrons_pt100to200','MC',26.1),
Expand Down
3 changes: 3 additions & 0 deletions Tools/src/LinkDef.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
#include "PandaCore/Tools/interface/Cutter.h"
#include "PandaCore/Tools/interface/BranchAdder.h"
#include "PandaCore/Tools/interface/EventSyncher.h"
#include "PandaCore/Tools/interface/splitPandaExpress.h"

#ifdef __CLING__
#pragma link off all globals;
Expand All @@ -24,6 +25,7 @@
#pragma link C++ class EventSyncher;
#pragma link C++ class BranchAdder;
#pragma link C++ class FormulaBranchAdder;
#pragma link C++ class HBranchAdder;
#pragma link C++ class H1BranchAdder;
#pragma link C++ class H2BranchAdder;
#pragma link C++ class ProgressReporter;
Expand All @@ -41,5 +43,6 @@
#pragma link C++ function DeltaR2;
#pragma link C++ function ExpErf;
#pragma link C++ function insertion_sort;
#pragma link C++ function splitPandaExpress;

#endif
59 changes: 59 additions & 0 deletions Tools/src/splitPandaExpress.C
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
#include "../interface/splitPandaExpress.h"
void splitPandaExpress(std::string inputFile, Long64_t nEvtsPerFile) {
printf("Opening file \"%s\" and splitting it into files with %lld events...\n", inputFile.c_str(), nEvtsPerFile);
TFile *f = TFile::Open(inputFile.c_str(),"update"); assert(f);
TTree *events=0, *treebuffer;

// Drop extra cycle numbers so rooteventselector can do its job
printf("\tLooking for extra cycle numbers to drop...\n");
TIter keyList(f->GetListOfKeys());
std::vector<short> extraCycleNumbers; short highestCycleNumber=-1;
TKey *key;
while ((key = (TKey*)keyList())) {
TClass *cl = gROOT->GetClass(key->GetClassName());
if (!cl->InheritsFrom("TTree")) continue;
treebuffer=(TTree*)key->ReadObj();
if(strcmp(treebuffer->GetName(),"events")!=0) continue;
short cycleNumber=key->GetCycle();
printf("\t%s;%d\n",treebuffer->GetName(),cycleNumber);
if(cycleNumber > highestCycleNumber) {
// replace the highest cycle number, putting the previous highest in the list of extras if real
if(highestCycleNumber>0) extraCycleNumbers.push_back(highestCycleNumber);
highestCycleNumber=cycleNumber;
} else {
// this is an extra cycle number
extraCycleNumbers.push_back(cycleNumber);
}
}
std::cout << "Extra cycle numbers: ";
for (std::vector<short>::const_iterator i = extraCycleNumbers.begin(); i != extraCycleNumbers.end(); ++i)
std::cout << *i << ", ";
std::cout << std::endl;
for (std::vector<short>::const_iterator i = extraCycleNumbers.begin(); i != extraCycleNumbers.end(); ++i)
f->Delete(Form("events;%d",*i));
// Done dropping extra cycle numbers


events = (TTree*)f->Get(Form("events;%d",highestCycleNumber)); assert(events);
Long64_t nEntries = events->GetEntries();
unsigned nSplit = ceil( float(nEntries) / nEvtsPerFile);
f->Close();
printf("The file had %lld entries, splitting into %d subfiles\n", nEntries, nSplit);
size_t lastDot = inputFile.find_last_of(".");
size_t lastSlash = inputFile.find_last_of("/");
std::string splitDir = inputFile.substr(0, lastSlash) + std::string("/split/");
std::string rawName = splitDir + inputFile.substr(lastSlash+1, lastDot-lastSlash-1);
system(Form("mkdir -p %s",splitDir.c_str()));
for(unsigned i=0; i<nSplit; i++) {
std::string splitName;
if(lastDot!=std::string::npos) splitName = rawName + std::string(Form("_%d.root", i));
else splitName = rawName + std::string(Form("_%d", i));
Long64_t firstEvt = i*nEvtsPerFile;
Long64_t lastEvt = (i+1)*nEvtsPerFile - 1;
const char * command = Form("rooteventselector --recreate -f %lld -l %lld %s:events %s", firstEvt, lastEvt, inputFile.c_str(), splitName.c_str());
printf("\tSubfile #%d: writing event # %lld-%lld to \"%s\"\n", i+1, firstEvt, lastEvt, splitName.c_str());
system(command);
//printf("\t%s\n",command);
}
printf("Done splitting file \"%s\"\n", inputFile.c_str());
}
1 change: 1 addition & 0 deletions Utils/python/load.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ def __init__(self,name,objects,deps=[]):
'Cutter',
'BranchAdder',
'EventSyncher',
'splitPandaExpress'
]
),
Library(name='PandaCoreLearning', objects = [ 'TMVATrainer',
Expand Down