Hi,
lets assume I have a TTree that contains a standard branch Double_t dblVar
, and a std::map mapVar
.
Now, I want to create a histogram of dblVar
applying some cuts to the events fulfilling that any of the second elements of mapVar
fulfils a given condition.
The problem is that if I do
myTree->Draw("dblVar>>histo", "mapVar.second<100" );
This will create an entry at histo
for each element at map (for the corresponding entry) that fulfils the condition. While, I would be willing that for any element (for the corresponding entry) at varMap
fulfilling the condition would create a single entry in my histogram.
I hope the problem is clearly stated.
In brief, if my map would be the following for a given entry {{0,50},{1,50},{1,150}}
, it will create two entries in my histogram because there are two elements bellow 100.
What would be the most elegant way to achieve what I am looking for?
I would expect I could apply something like
myTree->Draw("dblVar>>histo", "MapMin(mapVar)<100" );
where I implement that MapMin
should return the minimum value of the second element of the std::map
, and myTree
is inherited from TTree
so I could implement there my MinMax
method.
Any insight is welcome!
Thanks!