Please read tips for efficient and successful posting and posting code
_ROOT Version:_6.18.04
Platform: ubuntu 20
Compiler: g++
Hi,
I am working with MadGraph5_aMC@NLO for a SM process simulation. After launch I got a .root file named tag_1_delphes_events.root.Then I analysis this file by using ROOT to set some cuts,for example I need at least three b quark in final states.
Here is my code :
#include <TROOT.h>
#include <TChain.h>
#include <TFile.h>
#include <TH2.h>
#include <TStyle.h>
#include <TCanvas.h>
#include <TH1F.h>
#include <iostream>
#include "TClonesArray.h"
#include "TObject.h"
#include "TLorentzVector.h"
using namespace std;
void c00004(){
TFile *file = new TFile("tag_1_delphes_events.root");
TTree *tree = (TTree*)file->Get("Delphes");
// int nEntries = tree->GetEntries();
// cout << nEntries << endl;
TTree *fChain; //!pointer to the analyzed TTree or TChain
Int_t fCurrent; //!current Tree number in a TChain
Int_t kMaxJet = 13;
Int_t kMaxElectron = 3;
Int_t kMaxMuon = 2;
UInt_t Jet_BTag[kMaxJet];
Int_t Electron_size;
Int_t Muon_size;
TBranch *b_Jet_BTag;
TBranch *b_Electron_size;
TBranch *b_Muon_size;
fChain->SetBranchAddress("Jet.BTag", Jet_BTag, &b_Jet_BTag);
fChain->SetBranchAddress("Electron_size", &Electron_size, &b_Electron_size);
fChain->SetBranchAddress("Muon_size", &Muon_size, &b_Muon_size);
double numcut1=0;
double effcut1=0;
for(int k=0;k<10000;k++){
if (!fChain) return;
// fChain->Show(k);
fChain->GetEntry(k);
int lnum = Electron_size+Muon_size;
int bnum = Jet_BTag[0]+Jet_BTag[1]+Jet_BTag[2]+Jet_BTag[3]
+Jet_BTag[4]+Jet_BTag[5]+Jet_BTag[6]+Jet_BTag[7]+Jet_BTag[8]+Jet_BTag[9]
+Jet_BTag[10]+Jet_BTag[11]+Jet_BTag[12];
if ( bnum>=3 /*lnum>=2*/){
numcut1=numcut1+1;
effcut1=numcut1/k;
cout<< numcut1 << "**"<< "effcut1:" << effcut1 <<"**"<< k <<endl;
}}}
Here I was useing Tree->MakeClass(“myclass”),and most of code I was copied form myclass.h.
When I execute my code 6660 events passed the select, so the efficiency is 0.666.
But when I use MadAnalysis5 to execute the same cut by using the same file,the efficiency is 0.475.
Then I have tried lepton cut by changing above code to
if ( /*bnum>=3*/lnum>=2){
2588 events passed the select,so the efficiency is 0.2588. then using MadAnalysis5 I do the same cut using the same file,the efficiency is 0.259.that’s works fine.
So I wonder is there something wrong with my code by doing b cuts.
PS: the SM process is
pp → ttt~b~ → (bW+ )(bW− )(bW+ )b → l+ l+ 4b2j
pp → tt~t~b → (bW+ )(bW− )(bW− )b → l− l− 4b2j
PPS: my whole code is too long to post and the above code is not executable
If you need anymore information, ask me freely.
Best Regards.