Error in macro to add histo files

From: David d'Enterria (enterria@in2p3.fr)
Date: Fri Jan 14 2000 - 17:19:15 MET


Hello,

The macro reported in page
http://root.cern.ch/root/html/examples/hadd.C.html contains an error:

      while (afile) { //loop on all files starting at second file
        char* base=strstr(dact->GetPath(),":"); base+=2;
------------------------^^^

should read:

      while (afile) { //loop on all files starting at second file
        char* base=strstr(root->GetPath(),":"); base+=2;
-----------------------^^^

dact is declared as  "static TDirectory" so, as desired, it does not
change its value when recursively calling the AddRecursive(TDirectory
*root,TDirectory* node) method
but as it is written now it prevents from adding the histograms found in
OTHER (sub)directories (notably in the "root" one) ...

BTW, why not implementing a method, e.g. like "HistosAdd", in class
TFile for performing the same work ?

Best regards,

David d'Enterria
¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬
Groupe Photons Subatech
http://www-subatech.in2p3.fr/~photons/subatech/
mailto:enterria@in2p3.fr      phone: +33.2.51.85.85.60
¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬¬
Grup Física Radiacions UAB    http://cc.uab.es/~iffr2/
mailto:d.enterria@cc.uab.es   phone: +3493.581.13.64

"In science, there is only physics; all the rest is stamp collecting",
Ernest Rutherford



This archive was generated by hypermail 2b29 : Tue Jan 02 2001 - 11:50:17 MET