55int main(
int argc,
char* argv[])
58 std::cerr <<
"No input file specified! Exiting." << std::endl;
62 TString fileNameFullPath = argv[1];
63 TString fileName = fileNameFullPath;
69 TFile *inFile = TFile::Open(fileName,
"READ");
71 std::cerr <<
"Invalid root file! Exiting." << std::endl;
76 TString sample =
"tree_NoSys";
78 std::cout <<
"Running sample: " << sample << std::endl;
84 std::vector<std::string> ff_file = {
"FakeBkgTools/testValuesFF.root" };
86 ANA_CHECK( ffTool->setProperty(
"InputFiles", ff_file) );
87 ANA_CHECK( ffTool->setProperty(
"EnergyUnit",
"GeV") );
88 ANA_CHECK( ffTool->setProperty(
"SkipUncertainties",
true) );
89 ANA_CHECK( ffTool->setProperty(
"OutputLevel", MSG::FATAL) );
93 float convertToMeV = 1000.;
97 TChain* chain =
new TChain(
"chain");
98 std::vector<TString> datasets = {};
102 for(TString
dataset : datasets){
103 chain->Add(fileNameFullPath+
"/"+
dataset);
164 chain->SetBranchStatus(
"*",1);
166 TFile* outFile_nominal =
new TFile(
"antiIDTimesFF_"+sample+
"_nominal.root",
"RECREATE");
167 TTree* outTree_nominal = chain->CloneTree(0);
168 outTree_nominal->SetTitle(
"fakes");
169 outTree_nominal->SetName(
"fakes");
177 std::unique_ptr<xAOD::EventInfo> eventInfo = std::make_unique<xAOD::EventInfo>();
178 std::unique_ptr<xAOD::EventAuxInfo> eventAuxInfo = std::make_unique<xAOD::EventAuxInfo>();
180 eventInfo->setStore(eventAuxInfo.get());
192 int nEventsProcessed(0);
193 int nEventsPassed(0);
195 Long64_t nentries = chain->GetEntries();
196 for(Long64_t i(0); i < nentries; ++i){
197 std::cout <<
"processed " << nEventsProcessed <<
" events" << std::endl;
200 int getEntry = chain->GetEntry(i);
202 std::cerr <<
"GetEntry() error!! Either an I/O issue, or an invalid entry. Aborting." << std::endl;
207 runNumberDecor(*eventInfo) = 507;
209 std::vector<float> lepPt = {lep1Pt, lep2Pt, lep3Pt};
210 std::vector<float> lepEta = {lep1Eta, lep2Eta, lep3Eta};
211 std::vector<float> lepPhi = {lep1Phi, lep2Phi, lep3Phi};
212 std::vector<float> lepD0Sig = {lep1D0Sig, lep2D0Sig, lep3D0Sig};
213 std::vector<float> lepZ0SinTheta = {lep1Z0SinTheta, lep2Z0SinTheta, lep3Z0SinTheta};
214 std::vector<int> lepFlavor = {lep1Flavor, lep2Flavor, lep3Flavor};
215 std::vector<int> lepCharge = {lep1Charge, lep2Charge, lep3Charge};
216 std::vector<int> lepPassOR = {lep1PassOR, lep2PassOR, lep3PassOR};
217 std::vector<int> lepPassBL = {lep1PassBL, lep2PassBL, lep3PassBL};
218 std::vector<int> lepLoose = {lep1Loose, lep2Loose, lep3Loose};
219 std::vector<int> lepMedium = {lep1Medium, lep2Medium, lep3Medium};
220 std::vector<int> lepSignal = {lep1Signal, lep2Signal, lep3Signal};
221 std::vector<int> lepTruthMatched = {lep1TruthMatched, lep2TruthMatched, lep3TruthMatched};
235 std::vector<int> lepPassSigID(nTotalLeps, 0);
236 std::vector<int> lepPassAntiID(nTotalLeps, 0);
239 for(
auto part : particles){
245 for(
int i = 0; i < nTotalLeps; ++i){
247 bool passesSignal =
false;
248 bool passesAntiID =
false;
252 if( (lepFlavor).at(i) == 1 ){
256 passesSignal = (lepSignal).at(i);
257 passesAntiID = !(lepSignal).at(i);
261 lepPassSigID.at(i) = passesSignal;
262 lepPassAntiID.at(i) = passesAntiID;
266 else if( (lepFlavor).at(i) == 2){
270 passesSignal = (lepSignal).at(i);
271 passesAntiID = !(lepSignal).at(i);
275 lepPassSigID.at(i) = passesSignal;
276 lepPassAntiID.at(i) = passesAntiID;
282 if(!passesSignal && !passesAntiID)
continue;
288 particle->makePrivateStore();
289 particle->setPtEtaPhi(lepPt.at(i)*convertToMeV,lepEta.at(i),lepPhi.at(i));
290 particle->setCharge(lepCharge.at(i));
291 tightDecor(*particle) = passesSignal;
296 particle->makePrivateStore();
297 particle->setP4(lepPt.at(i)*convertToMeV,lepEta.at(i),lepPhi.at(i));
298 particle->setCharge(lepCharge.at(i));
299 tightDecor(*particle) = passesSignal;
303 std::cerr <<
"invalid lepton type!" << std::endl;
331 if(nLep_antiID == 0)
continue;
341 FFWeight = fbtWeight;
342 std::cout <<
"nLep_antiID " << nLep_antiID << std::endl;
343 std::cout <<
"FFWeight " << FFWeight << std::endl;
346 outTree_nominal->Fill();
353 std::cout <<
"nEventsProcessed is " << nEventsProcessed <<
" and nEventsPassed is " << nEventsPassed << std::endl;
355 outFile_nominal->Write();
359 delete outFile_nominal;
A number of constexpr particle constants to avoid hardcoding them directly in various places.
Class providing the definition of the 4-vector interface.