30 T*
Store(TFile& file, Long64_t event)
32 Bool_t ok = file.cd(Form(
"Event%lld",event));
35 AliErrorGeneral(
"Store",Form(
"Cannot cd to Event%lld",event));
39 TObject* key = gDirectory->GetListOfKeys()->First();
41 TTree*
tree =
static_cast<TTree*
>(gDirectory->Get(key->GetName()));
45 AliErrorGeneral(
"Store",Form(
"Cannot get %s from file for event %lld",key->GetName(),event));
49 T* store = T::Create(*tree);
53 AliErrorGeneral(
"Store",
"Cannot get store from tree");
57 store->Connect(*tree);
67 if ( ds1.GetSize() != ds2.GetSize() )
72 TIter next1(ds1.CreateIterator());
73 TIter next2(ds2.CreateIterator());
77 while ( ( d1 = next1()))
79 TObject* d2 = next2();
80 if ( d1->Compare(d2) )
return 2;
86 TFile*
Open(
const char* filename, Long64_t& nevents)
91 AliErrorGeneral(
"Open",Form(
"Cannot open file %s",filename));
94 TIter next(file->GetListOfKeys());
98 while ( ( key = static_cast<TKey*>(next())))
100 if ( TString(key->GetName()).BeginsWith(
"Event") )
116 list.SetOwner(kFALSE);
118 while ( (
object = next() ) )
125 std::ofstream out(Form(
"%s.%lld.txt",filename,event));
127 std::streambuf *coutbuf = std::cout.rdbuf();
128 std::cout.rdbuf(out.rdbuf());
132 std::cout.rdbuf(coutbuf);
136 Int_t
Compare(
const char* file1,
const char* file2, Long64_t maxEvents=0)
141 TFile* f1 =
Open(file1,n1);
142 TFile* f2 =
Open(file2,n2);
146 AliWarningGeneral(
"CompareDigits",Form(
"file1 has %lld events while file2 has %lld ...",
152 maxEvents = TMath::Min(n1,n2);
155 Long64_t n = TMath::Min(maxEvents,n1);
157 n = TMath::Min(n,n2);
159 for ( Long64_t i = 0; i < n; ++i )
161 T* store1 = Store<T>(*f1,i);
164 AliErrorGeneral(
"Compare",Form(
"Cannot get store from file1 for event %lld",i));
167 T* store2 = Store<T>(*f2,i);
170 AliErrorGeneral(
"Compare",Form(
"Cannot get store from file2 for event %lld",i));
174 if ( Compare<T>(*store1,*store2) )
176 AliErrorGeneral(
"Compare",Form(
"differ for event %lld",i));
188 Int_t
CompareDigits(
const char* file1,
const char* file2, Long64_t maxEvents=0)
190 return Compare<AliMUONVDigitStore>(file1,file2,maxEvents);
195 return Compare<AliMUONVClusterStore>(file1,file2,maxEvents);
virtual TIterator * CreateIterator() const =0
Return an iterator to loop over the whole store.
TFile * Open(const char *filename, Long64_t &nevents)
Int_t CompareClusters(const char *file1, const char *file2, Long64_t maxEvents=0)
T * Store(TFile &file, Long64_t event)
void DumpSorted(const char *filename, Long64_t event, const AliMUONVStore &store)
Int_t Compare(const T &ds1, const T &ds2)
Int_t CompareDigits(const char *file1, const char *file2, Long64_t maxEvents=0)
Base class for MUON data stores.