RTTI how to use ?

Jobst Heinrich Koehne (kohne@mail.desy.de)
Fri, 14 Nov 1997 14:55:24 +0100 (MET)


Dear Rene & Fons,

I want to write a routine which fills TClonesArrays of different types
by copying data from different BOS banks (i.e. tables ). The best would
be to have it done by just one routine. How can I ask an TClonesArray of
what type the object are that it stores ? Is there a way to replace the
TDverRow, TDtraRow, ... statements in all this routines by a thing
determned at runtime?

ahoi
Jobst

void Event::SetDver()
{
Bank bank("DVER");
if(!bank.is_open()) { fNDver=0; return; }

TClonesArray& a = *fDver;
for(UInt_t irow=1 ; irow <=bank.nrows() ;irow++) {
new (a[irow-1]) TDverRow(bank.rowStart(irow));
}
fNDver = bank.nrows();
}
void Event::SetDtra()
{
Bank bank("DTRA");
if(!bank.is_open()) { fNDtra=0; return; }

TClonesArray& a = *fDtra;
for(UInt_t irow=1 ; irow <=bank.nrows() ;irow++) {
new (a[irow-1]) TDtraRow(bank.rowStart(irow));
}
fNDtra = bank.nrows();
}
:wq