#include "TLimitDataSource.h"
#include "TH1.h"
#include "TVectorD.h"
#include "TObjString.h"
#include "TRandom3.h"
ClassImp(TLimitDataSource)
TLimitDataSource::TLimitDataSource()
{
fDummyTA.SetOwner();
fDummyIds.SetOwner();
}
TLimitDataSource::TLimitDataSource(TH1 * s, TH1 * b, TH1 * d)
{
fDummyTA.SetOwner();
fDummyIds.SetOwner();
AddChannel(s, b, d);
}
TLimitDataSource::TLimitDataSource(TH1 * s, TH1 * b, TH1 * d,
TVectorD * es, TVectorD * eb, TObjArray * names)
{
fDummyTA.SetOwner();
fDummyIds.SetOwner();
AddChannel(s, b, d, es, eb, names);
}
void TLimitDataSource::AddChannel(TH1 * s, TH1 * b, TH1 * d)
{
TVectorD *empty;
TRandom3 generator;
fSignal.AddLast(s);
fBackground.AddLast(b);
fCandidates.AddLast(d);
char rndname[20];
snprintf(rndname,20, "rndname%f", generator.Rndm());
empty = new TVectorD(1);
fErrorOnSignal.AddLast(empty);
fDummyTA.AddLast(empty);
snprintf(rndname,20, "rndname%f", generator.Rndm());
empty = new TVectorD(1);
fErrorOnBackground.AddLast(empty);
fDummyTA.AddLast(empty);
TObjArray *dummy = new TObjArray(0);
fIds.AddLast(dummy);
fDummyIds.AddLast(dummy);
}
void TLimitDataSource::AddChannel(TH1 * s, TH1 * b, TH1 * d, TVectorD * es,
TVectorD * eb, TObjArray * names)
{
fSignal.AddLast(s);
fBackground.AddLast(b);
fCandidates.AddLast(d);
fErrorOnSignal.AddLast(es);
fErrorOnBackground.AddLast(eb);
fIds.AddLast(names);
}
void TLimitDataSource::SetOwner(bool swtch)
{
fSignal.SetOwner(swtch);
fBackground.SetOwner(swtch);
fCandidates.SetOwner(swtch);
fErrorOnSignal.SetOwner(swtch);
fErrorOnBackground.SetOwner(swtch);
fIds.SetOwner(swtch);
fDummyTA.SetOwner(!swtch);
fDummyIds.SetOwner(!swtch);
}