TTree::UnsetNotify

I’ve noticed the TTree::SetNotify method is undocumented. Is there any way to unset a notify statement? I have a number of objects that will be deleted and I want to avoid segmentation violations.

Thanks.

SetNotify(nullptr);

Cheers,
Philippe.

1 Like

Ahh, so you can only notify one object?

This won’t work so well for my application.

Yes, you can directly only notify one object. However you can have this ‘one’ object being a collector object that turns around and notify a list.

Working on that now. Thanks for the info. It’s a bit of a bummer one had to create this class.

See for example the TTreeFormulaGroup proposed in TTreeFormula and TChain

1 Like

I was able to produce a more compact class using a vector as a base class. After doing this it occurred to me that a TObjArray should have this Notify functionality.

#ifndef TOBJECTNOTIFYGROUP_HPP
#define TOBJECTNOTIFYGROUP_HPP

#include <vector>

#include <TObject.h>

class TObjectNotifyGroup : public std::vector< TObject* >, public TObject {
   public:
         TObjectNotifyGroup() : TObject() {};
         virtual ~TObjectNotifyGroup() {};

         virtual Bool_t Notify() {
            Bool_t success = true;
            for (auto obj : *this) success &= obj->Notify();
            return success;
         };
};

#endif // TOBJECTNOTIFYGROUP_HPP

I was able to produce a more compact class using a vector as a base class. After doing this it occurred to me that a TObjArray should have this Notify functionality.

This is a good simple idea. I added the function to all ROOT collections. See http://root.cern.ch/gitweb?p=root.git;a=commitdiff;h=5a918e25f8c5df4e51ad837e66d8fd23133dec38 in time for v6.10.

Thanks,
Philippe.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.