# Filll histo with a list

I’m studing the efficiency of an algorithm and this is my code…
[color=red]std::list<std::pair >
muCombfexReco::giveEfficiencyMatch() const {

``````  std::list<std::pair <float> > lista;

std::list<Ptset>::const_iterator it = m_pt.begin();
while (it != m_pt.end())
{

float Reconstructed = (*it).m_reconstructed_events;
float Matched       = (*it).m_matched_events;

float efficiency = 100*Matched/Reconstructed;
float error      = 0.;

lista.push_back( std::pair<float>(efficiency,error) );

++it;
``````

}

``````return lista;
``````

}[/color]

Now i wanna make a plot .
Cheers

humm … what did you try?
You simply need to iterate through your list and call Fill on your histogram …
possibly something like```for(iter = lista.begin(); iter != lista.end(); ++iter) { histo->Fill(iter->first,iter->second); }```… but I am only guessing at the semantic of your values …
Cheers,
Philippe.

I’m studing the efficiency of an algorithm and this is my code…

[quote]std::list<std::pair >
muCombfexReco::giveEfficiencyMatch() const {

std::list<std::pair > lista;

std::list::const_iterator it = m_pt.begin();
while (it != m_pt.end())
{

float Reconstructed = (*it).m_reconstructed_events;
float Matched = (*it).m_matched_events;

float efficiency = 100*Matched/Reconstructed;
float error = 0.;

lista.push_back( std::pair(efficiency,error) );

++it;

}

return lista;

}[/quote]

Now i wanna make a plot .
Cheers

[quote]Now i wanna make a plot . [/quote]There are many ways to represent your data. You should re-read the User’s guide chapter on histogram and graphs. On the two is bound to be the one you are looking for. You can also look at the tutorials in \$ROOTSYS/tutorials.

Cheers,
Philippe