// simple macro to write an array of bools to a TTree as a means of testing // the reading of such an object using PyROOT #include #include #include #include #include #define _NBOOL_ 100 using std::cout; class Data : public TObject { public: int nBool; bool bArray[_NBOOL_]; int iArray[_NBOOL_]; ClassDef(Data,1); }; int boolArray(int NBOOL=20) { Data d; TFile *f = TFile::Open("boolArray.root","RECREATE"); TTree *t = new TTree("boolTree","boolTree"); t->Branch("data",&d); TRandom3 *r = new TRandom3(); r->SetSeed(0); d.nBool = NBOOL; cout<<"nBool = "<Rndm()<0.5) d.bArray[i]=false; else d.bArray[i]=true; d.iArray[i] = i; cout<<"bArray["<Fill(); t->Write(); f->Close(); return 0; }