Dear Axel,
On 12/14/2011 02:35 PM, Axel Naumann wrote:
> I'd recommend something different (more stable and faster), though. You
> can put your histograms into a struct inside your selector:
>
> class MySelector ... {
> ...
> struct Hists {
> TH1* fHist1;
> TH2* fHist2;
> ...
> } fHists;
> ...
> };
>
> Now all you need to do in your selector's constructor is to (value)
> initialize that struct:
>
> MySelector::MySelector(...): ..., fHists(), ... {...}
>
> The empty set of parentheses after fHists tell the compiler to value
> initialize fHists. See the standard (8.5 [dcl.init]).
thanks for your reply! That's a nice solution, however I don't like to access my histograms via fHists. fHists.fHist1->Fill() is so much more to type than fHist1->Fill(). (Pascal used to have a "with" statement to facilitate access to the members of a struct, but I don't think that in C++ there is something similar...)
Cheers,
Thiemo
-- +-----------------------------------+--------------------------+ | Dipl.-Phys. Thiemo Nagel | | | Technische Universitaet Muenchen | Room PH1 3276 | | Physik-Department E18 | | | James-Franck-Strasse | Phone +49 89 289-12379 | | D-85747 Garching | Fax +49 89 289-12570 | +-----------------------------------+--------------------------+Received on Wed Dec 14 2011 - 16:16:08 CET
This archive was generated by hypermail 2.2.0 : Wed Dec 14 2011 - 17:50:02 CET