57 std::cerr <<
"No input file specified! Exiting." << std::endl;
61 TString fileNameFullPath =
argv[1];
64 #ifdef XAOD_STANDALONE
70 std::cerr <<
"Invalid root file! Exiting." << std::endl;
75 TString
sample =
"tree_NoSys";
77 std::cout <<
"Running sample: " <<
sample << std::endl;
83 std::vector<std::string> ff_file = {
"FakeBkgTools/testValuesFF.root" };
85 ANA_CHECK( ffTool->setProperty(
"InputFiles", ff_file) );
86 ANA_CHECK( ffTool->setProperty(
"EnergyUnit",
"GeV") );
87 ANA_CHECK( ffTool->setProperty(
"SkipUncertainties",
true) );
92 float convertToMeV = 1000.;
96 TChain*
chain =
new TChain(
"chain");
97 std::vector<TString> datasets = {};
101 for(TString
dataset : datasets){
163 chain->SetBranchStatus(
"*",1);
165 TFile* outFile_nominal =
new TFile(
"antiIDTimesFF_"+
sample+
"_nominal.root",
"RECREATE");
166 TTree* outTree_nominal =
chain->CloneTree(0);
167 outTree_nominal->SetTitle(
"fakes");
168 outTree_nominal->SetName(
"fakes");
176 std::unique_ptr<xAOD::EventInfo> eventInfo = std::make_unique<xAOD::EventInfo>();
177 std::unique_ptr<xAOD::EventAuxInfo> eventAuxInfo = std::make_unique<xAOD::EventAuxInfo>();
179 eventInfo->
setStore(eventAuxInfo.get());
191 int nEventsProcessed(0);
192 int nEventsPassed(0);
196 std::cout <<
"processed " << nEventsProcessed <<
" events" << std::endl;
199 int getEntry =
chain->GetEntry(
i);
201 std::cerr <<
"GetEntry() error!! Either an I/O issue, or an invalid entry. Aborting." << std::endl;
206 runNumberDecor(*eventInfo) = 507;
208 std::vector<float> lepPt = {lep1Pt, lep2Pt, lep3Pt};
209 std::vector<float> lepEta = {lep1Eta, lep2Eta, lep3Eta};
210 std::vector<float> lepPhi = {lep1Phi, lep2Phi, lep3Phi};
211 std::vector<float> lepD0Sig = {lep1D0Sig, lep2D0Sig, lep3D0Sig};
212 std::vector<float> lepZ0SinTheta = {lep1Z0SinTheta, lep2Z0SinTheta, lep3Z0SinTheta};
213 std::vector<int> lepFlavor = {lep1Flavor, lep2Flavor, lep3Flavor};
214 std::vector<int> lepCharge = {lep1Charge, lep2Charge, lep3Charge};
215 std::vector<int> lepPassOR = {lep1PassOR, lep2PassOR, lep3PassOR};
216 std::vector<int> lepPassBL = {lep1PassBL, lep2PassBL, lep3PassBL};
217 std::vector<int> lepLoose = {lep1Loose, lep2Loose, lep3Loose};
218 std::vector<int> lepMedium = {lep1Medium, lep2Medium, lep3Medium};
219 std::vector<int> lepSignal = {lep1Signal, lep2Signal, lep3Signal};
220 std::vector<int> lepTruthMatched = {lep1TruthMatched, lep2TruthMatched, lep3TruthMatched};
234 std::vector<int> lepPassSigID(nTotalLeps, 0);
235 std::vector<int> lepPassAntiID(nTotalLeps, 0);
244 for(
int i = 0;
i < nTotalLeps; ++
i){
246 bool passesSignal =
false;
247 bool passesAntiID =
false;
251 if( (lepFlavor).at(
i) == 1 ){
255 passesSignal = (lepSignal).at(
i);
256 passesAntiID = !(lepSignal).at(
i);
260 lepPassSigID.at(
i) = passesSignal;
261 lepPassAntiID.at(
i) = passesAntiID;
265 else if( (lepFlavor).at(
i) == 2){
269 passesSignal = (lepSignal).at(
i);
270 passesAntiID = !(lepSignal).at(
i);
274 lepPassSigID.at(
i) = passesSignal;
275 lepPassAntiID.at(
i) = passesAntiID;
281 if(!passesSignal && !passesAntiID)
continue;
288 particle->setP4(lepPt.at(
i)*convertToMeV,lepEta.at(
i),lepPhi.at(
i),0.511);
290 tightDecor(*
particle) = passesSignal;
296 particle->setP4(lepPt.at(
i)*convertToMeV,lepEta.at(
i),lepPhi.at(
i));
298 tightDecor(*
particle) = passesSignal;
302 std::cerr <<
"invalid lepton type!" << std::endl;
330 if(nLep_antiID == 0)
continue;
340 FFWeight = fbtWeight;
341 std::cout <<
"nLep_antiID " << nLep_antiID << std::endl;
342 std::cout <<
"FFWeight " << FFWeight << std::endl;
345 outTree_nominal->Fill();
352 std::cout <<
"nEventsProcessed is " << nEventsProcessed <<
" and nEventsPassed is " << nEventsPassed << std::endl;
354 outFile_nominal->Write();
358 delete outFile_nominal;