I have a sample of electrons(with no cuts). I want to generate a histogram with the number of electrons along X and number of events along Y axis. I am using xAOD for my analysis.
Under histInitialize(), I gave h_el_no= new TH1F(“nel”.“nel”,10,0,10)
Under execute() I have,
EL::StatusCode ZMassAnalysis :: execute ()
// Here you do everything that needs to be done on every single
// events, e.g. read input variables, apply cuts, and fill
// histograms and trees. This is where most of your actual analysis
// code will go.
// run QuickAna for the current event:
ANA_CHECK (quickAna->process ());
unsigned el_num = 0;
for (auto electron : *quickAna->electrons())
// QuickAna marks good objects by setting ana_select
// ana::SelectType is the type QuickAna uses for boolean decorations
if (electron->auxdataana::SelectType (“ana_select”))
h_el_pt->Fill(electron->pt()*0.001);// this is to plot the histogram for transverse momentum
I am not sure how to fill the histogram with the number of events from the above for loop.