00001
00002
00003
00004
00005 #include "TRandom.h"
00006 #include "TFile.h"
00007 #include "TTree.h"
00008 #include "TClass.h"
00009
00010 #include "TBench.h"
00011 #include "Riostream.h"
00012
00013 THit hit;
00014 #ifdef R__HPUX
00015 namespace std {
00016 using ::make_pair;
00017 }
00018 #endif
00019 #ifdef R__WIN32
00020 const char *demofile = "$TMP/bench.root";
00021 #else
00022 const char *demofile = "/tmp/bench.root";
00023 #endif
00024 const char* demofile_name(const char* tit) {
00025 static std::string fn;
00026 #ifdef R__WIN32
00027 fn = "$TMP/bench.";
00028 #else
00029 fn = "/tmp/bench.";
00030 #endif
00031 fn += tit;
00032 fn += ".root";
00033 return fn.c_str();
00034 }
00035 namespace {
00036 struct Counter {
00037 std::string name;
00038 int count;
00039 Counter(const std::string& n) : name(n), count(0) {}
00040 ~Counter() {
00041 print();
00042 }
00043 void print(const std::string& msg="") {
00044 cout << msg << " --- Counter: " << name << " " << count << endl;
00045 }
00046 };
00047 }
00048
00049 Counter hitCount("THit");
00050
00051
00052 ClassImp(THit)
00053
00054 THit::THit() {
00055 fPulses = 0;
00056 fNpulses = 0;
00057 hitCount.count++;
00058 }
00059 THit::THit(const THit &hit) {
00060 hitCount.count++;
00061 fX = hit.fX;
00062 fY = hit.fY;
00063 fZ = hit.fZ;
00064 for (Int_t i=0;i<10;i++) fTime[i] = hit.fTime[i];
00065 fPulses = 0;
00066 fNpulses = hit.fNpulses;
00067 if (fNpulses == 0) return;
00068 if (hit.fPulses == 0) return;
00069 fPulses = new int[fNpulses];
00070 for (int j=0;j<fNpulses;j++) fPulses[j] = hit.fPulses[j];
00071 }
00072
00073 THit& THit::operator=(const THit& hit) {
00074 fX = hit.fX;
00075 fY = hit.fY;
00076 fZ = hit.fZ;
00077 for (Int_t i=0;i<10;i++) fTime[i] = hit.fTime[i];
00078 fPulses = 0;
00079 fNpulses = hit.fNpulses;
00080 if (fNpulses == 0) return *this;
00081 if (hit.fPulses == 0) return *this;
00082 if ( fPulses ) delete [] fPulses;
00083 fPulses = new int[fNpulses];
00084 for (int j=0;j<fNpulses;j++) fPulses[j] = hit.fPulses[j];
00085 return *this;
00086 }
00087
00088 THit::THit(int t) {
00089 hitCount.count++;
00090 fPulses = 0;
00091 Set(t);
00092 }
00093
00094 THit::~THit() {
00095 hitCount.count--;
00096 if (fPulses) delete [] fPulses;
00097 fPulses = 0;
00098 }
00099
00100 void THit::Set(int t) {
00101 fX = gRandom->Gaus(0,1);
00102 fY = gRandom->Gaus(0,1);
00103 fZ = gRandom->Gaus(0,10);
00104 if (fPulses && fNpulses > 0) delete [] fPulses;
00105 fNpulses = t%20 + 1;
00106 fPulses = new int[fNpulses];
00107 for (int j=0;j<fNpulses;j++) fPulses[j] = j+1;
00108 for (int i=0; i<10; i++) fTime[i] = t+i;
00109 }
00110
00111 #if 0
00112 #if defined(R__TEMPLATE_OVERLOAD_BUG)
00113 template <>
00114 #endif
00115 TBuffer &operator>>(TBuffer &buf, THit *&obj)
00116 {
00117 obj = new THit();
00118 obj->Streamer(buf);
00119 return buf;
00120 }
00121 #endif
00122
00123 TBuffer &operator<<(TBuffer &buf, const THit *obj)
00124 {
00125 ((THit*)obj)->Streamer(buf);
00126 return buf;
00127 }
00128
00129
00130 ClassImp(TObjHit)
00131
00132
00133 TObjHit::TObjHit() :THit() {}
00134 TObjHit::TObjHit(int t) :THit(t) {}
00135
00136
00137
00138 ClassImp(TSTLhit)
00139
00140 TSTLhit::TSTLhit()
00141 {
00142 }
00143
00144 TSTLhit::TSTLhit(Int_t nmax)
00145 {
00146 fNhits = nmax;
00147 fList1.reserve(nmax);
00148 }
00149
00150 TSTLhit::~TSTLhit() {
00151 Clear();
00152 hitCount.print();
00153 }
00154
00155 void TSTLhit::Clear(Option_t *)
00156 {
00157 fList1.erase(fList1.begin(),fList1.end());
00158 }
00159
00160 void TSTLhit::MakeEvent(int )
00161 {
00162 Clear();
00163 for (Int_t j=0; j<fNhits; j++) {
00164 hit.Set(j);
00165 fList1.push_back(hit);
00166 }
00167 }
00168
00169 Int_t TSTLhit::MakeTree(int mode, int nevents, int compression, int split, float &cx)
00170 {
00171 TFile *f=0;
00172 TTree *T=0;
00173 TSTLhit *top = this;
00174 if (mode > 0) {
00175 f = new TFile(demofile_name("TSTLhit"),"recreate","STLhit",compression);
00176 T = new TTree("T","Demo tree");
00177 T->Branch("event","TSTLhit",&top,64000,split);
00178 }
00179 for (int ievent=0; ievent<nevents; ievent++) {
00180 MakeEvent(ievent);
00181 if (mode > 0) T->Fill();
00182 }
00183
00184 if (mode == 0) return 0;
00185 T->Write();
00186 delete f;
00187 f = new TFile(demofile_name("TSTLhit"));
00188 Int_t nbytes = f->GetEND();
00189 cx = f->GetCompressionFactor();
00190 delete f;
00191 return nbytes;
00192 }
00193
00194 Int_t TSTLhit::ReadTree()
00195 {
00196 TSTLhit *top = this;
00197 TFile *f = new TFile(demofile_name("TSTLhit"));
00198 TTree *T = (TTree*)f->Get("T");
00199 T->SetBranchAddress("event",&top);
00200 Int_t nevents = (Int_t)T->GetEntries();
00201 Int_t nbytes = 0;
00202 for (int ievent=0; ievent<nevents; ievent++) {
00203 nbytes += T->GetEntry(ievent);
00204 Clear();
00205 }
00206 delete f;
00207 return nbytes;
00208 }
00209
00210
00211
00212 ClassImp(TSTLhitList)
00213
00214 TSTLhitList::TSTLhitList()
00215 {
00216 }
00217
00218 TSTLhitList::TSTLhitList(Int_t nmax)
00219 {
00220 fNhits = nmax;
00221 }
00222
00223 TSTLhitList::~TSTLhitList() {
00224 Clear();
00225 hitCount.print();
00226 }
00227
00228 void TSTLhitList::Clear(Option_t *)
00229 {
00230 fList1.erase(fList1.begin(),fList1.end());
00231 }
00232
00233 void TSTLhitList::MakeEvent(int )
00234 {
00235 Clear();
00236 for (Int_t j=0; j<fNhits; j++) {
00237 hit.Set(j);
00238 fList1.push_back(hit);
00239 }
00240 }
00241
00242 Int_t TSTLhitList::MakeTree(int mode, int nevents, int compression, int split, float &cx)
00243 {
00244 TFile *f=0;
00245 TTree *T=0;
00246 TSTLhitList *top = this;
00247 if (mode > 0) {
00248 f = new TFile(demofile_name("TSTLhitList"),"recreate","STLhit",compression);
00249 T = new TTree("T","Demo tree");
00250 T->Branch("event","TSTLhitList",&top,64000,split);
00251 }
00252 for (int ievent=0; ievent<nevents; ievent++) {
00253 MakeEvent(ievent);
00254 if (mode > 0) T->Fill();
00255 }
00256
00257 if (mode == 0) return 0;
00258 T->Write();
00259 delete f;
00260 f = new TFile(demofile_name("TSTLhitList"));
00261 Int_t nbytes = f->GetEND();
00262 cx = f->GetCompressionFactor();
00263 delete f;
00264 return nbytes;
00265 }
00266
00267 Int_t TSTLhitList::ReadTree()
00268 {
00269 TSTLhitList *top = this;
00270 TFile *f = new TFile(demofile_name("TSTLhitList"));
00271 TTree *T = (TTree*)f->Get("T");
00272 T->SetBranchAddress("event",&top);
00273 Int_t nevents = (Int_t)T->GetEntries();
00274 Int_t nbytes = 0;
00275 for (int ievent=0; ievent<nevents; ievent++) {
00276 nbytes += T->GetEntry(ievent);
00277 Clear();
00278 }
00279 delete f;
00280 return nbytes;
00281 }
00282
00283
00284 ClassImp(TSTLhitDeque)
00285
00286 TSTLhitDeque::TSTLhitDeque()
00287 {
00288 }
00289
00290 TSTLhitDeque::TSTLhitDeque(Int_t nmax)
00291 {
00292 fNhits = nmax;
00293 }
00294
00295 TSTLhitDeque::~TSTLhitDeque() {
00296 Clear();
00297 hitCount.print();
00298 }
00299
00300 void TSTLhitDeque::Clear(Option_t *)
00301 {
00302 fList1.erase(fList1.begin(),fList1.end());
00303 }
00304
00305 void TSTLhitDeque::MakeEvent(int )
00306 {
00307 Clear();
00308 for (Int_t j=0; j<fNhits; j++) {
00309 hit.Set(j);
00310 fList1.push_back(hit);
00311 }
00312 }
00313
00314 Int_t TSTLhitDeque::MakeTree(int mode, int nevents, int compression, int split, float &cx)
00315 {
00316 TFile *f=0;
00317 TTree *T=0;
00318 TSTLhitDeque *top = this;
00319 if (mode > 0) {
00320 f = new TFile(demofile_name("TSTLhitDeque"),"recreate","STLhit",compression);
00321 T = new TTree("T","Demo tree");
00322 T->Branch("event","TSTLhitDeque",&top,64000,split);
00323 }
00324 for (int ievent=0; ievent<nevents; ievent++) {
00325 MakeEvent(ievent);
00326 if (mode > 0) T->Fill();
00327 }
00328
00329 if (mode == 0) return 0;
00330 T->Write();
00331 delete f;
00332 f = new TFile(demofile_name("TSTLhitDeque"));
00333 Int_t nbytes = f->GetEND();
00334 cx = f->GetCompressionFactor();
00335 delete f;
00336 return nbytes;
00337 }
00338
00339 Int_t TSTLhitDeque::ReadTree()
00340 {
00341 TSTLhitDeque *top = this;
00342 TFile *f = new TFile(demofile_name("TSTLhitDeque"));
00343 TTree *T = (TTree*)f->Get("T");
00344 T->SetBranchAddress("event",&top);
00345 Int_t nevents = (Int_t)T->GetEntries();
00346 Int_t nbytes = 0;
00347 for (int ievent=0; ievent<nevents; ievent++) {
00348 nbytes += T->GetEntry(ievent);
00349 Clear();
00350 }
00351 delete f;
00352 return nbytes;
00353 }
00354
00355
00356
00357 ClassImp(TSTLhitSet)
00358
00359 TSTLhitSet::TSTLhitSet()
00360 {
00361 }
00362
00363 TSTLhitSet::TSTLhitSet(Int_t nmax)
00364 {
00365 fNhits = nmax;
00366 }
00367
00368 TSTLhitSet::~TSTLhitSet() {
00369 Clear();
00370 hitCount.print();
00371 }
00372
00373 void TSTLhitSet::Clear(Option_t *)
00374 {
00375 fList1.erase(fList1.begin(),fList1.end());
00376 }
00377
00378 void TSTLhitSet::MakeEvent(int )
00379 {
00380 Clear();
00381 for (Int_t j=0; j<fNhits; j++) {
00382 hit.Set(j);
00383 fList1.insert(hit);
00384 }
00385 }
00386
00387 Int_t TSTLhitSet::MakeTree(int mode, int nevents, int compression, int split, float &cx)
00388 {
00389 TFile *f=0;
00390 TTree *T=0;
00391 TSTLhitSet *top = this;
00392 if (mode > 0) {
00393 f = new TFile(demofile_name("TSTLhitSet"),"recreate","STLhit",compression);
00394 T = new TTree("T","Demo tree");
00395 T->Branch("event","TSTLhitSet",&top,64000,split);
00396 }
00397 for (int ievent=0; ievent<nevents; ievent++) {
00398 MakeEvent(ievent);
00399 if (mode > 0) T->Fill();
00400 }
00401
00402 if (mode == 0) return 0;
00403 T->Write();
00404 delete f;
00405 f = new TFile(demofile_name("TSTLhitSet"));
00406 Int_t nbytes = f->GetEND();
00407 cx = f->GetCompressionFactor();
00408 delete f;
00409 return nbytes;
00410 }
00411
00412 Int_t TSTLhitSet::ReadTree()
00413 {
00414 TSTLhitSet *top = this;
00415 TFile *f = new TFile(demofile_name("TSTLhitSet"));
00416 TTree *T = (TTree*)f->Get("T");
00417 T->SetBranchAddress("event",&top);
00418 Int_t nevents = (Int_t)T->GetEntries();
00419 Int_t nbytes = 0;
00420 for (int ievent=0; ievent<nevents; ievent++) {
00421 nbytes += T->GetEntry(ievent);
00422 Clear();
00423 }
00424 delete f;
00425 return nbytes;
00426 }
00427
00428
00429
00430 ClassImp(TSTLhitMultiset)
00431
00432 TSTLhitMultiset::TSTLhitMultiset()
00433 {
00434 }
00435
00436 TSTLhitMultiset::TSTLhitMultiset(Int_t nmax)
00437 {
00438 fNhits = nmax;
00439 }
00440
00441 TSTLhitMultiset::~TSTLhitMultiset() {
00442 Clear();
00443 hitCount.print();
00444 }
00445
00446 void TSTLhitMultiset::Clear(Option_t *)
00447 {
00448 fList1.erase(fList1.begin(),fList1.end());
00449 }
00450
00451 void TSTLhitMultiset::MakeEvent(int )
00452 {
00453 Clear();
00454 for (Int_t j=0; j<fNhits; j++) {
00455 hit.Set(j);
00456 fList1.insert(hit);
00457 }
00458 }
00459
00460 Int_t TSTLhitMultiset::MakeTree(int mode, int nevents, int compression, int split, float &cx)
00461 {
00462 TFile *f=0;
00463 TTree *T=0;
00464 TSTLhitMultiset *top = this;
00465 if (mode > 0) {
00466 f = new TFile(demofile_name("TSTLhitMultiset"),"recreate","STLhit",compression);
00467 T = new TTree("T","Demo tree");
00468 T->Branch("event","TSTLhitMultiset",&top,64000,split);
00469 }
00470 for (int ievent=0; ievent<nevents; ievent++) {
00471 MakeEvent(ievent);
00472 if (mode > 0) T->Fill();
00473 }
00474
00475 if (mode == 0) return 0;
00476 T->Write();
00477 delete f;
00478 f = new TFile(demofile_name("TSTLhitMultiset"));
00479 Int_t nbytes = f->GetEND();
00480 cx = f->GetCompressionFactor();
00481 delete f;
00482 return nbytes;
00483 }
00484
00485 Int_t TSTLhitMultiset::ReadTree()
00486 {
00487 TSTLhitMultiset *top = this;
00488 TFile *f = new TFile(demofile_name("TSTLhitMultiset"));
00489 TTree *T = (TTree*)f->Get("T");
00490 T->SetBranchAddress("event",&top);
00491 Int_t nevents = (Int_t)T->GetEntries();
00492 Int_t nbytes = 0;
00493 for (int ievent=0; ievent<nevents; ievent++) {
00494 nbytes += T->GetEntry(ievent);
00495 Clear();
00496 }
00497 delete f;
00498 return nbytes;
00499 }
00500
00501
00502
00503 ClassImp(TSTLhitMap)
00504
00505 TSTLhitMap::TSTLhitMap()
00506 {
00507 }
00508
00509 TSTLhitMap::TSTLhitMap(Int_t nmax)
00510 {
00511 fNhits = nmax;
00512 }
00513
00514 TSTLhitMap::~TSTLhitMap() {
00515 Clear();
00516 hitCount.print();
00517 }
00518
00519 void TSTLhitMap::Clear(Option_t *)
00520 {
00521 fList1.clear();
00522 }
00523
00524 void TSTLhitMap::MakeEvent(int )
00525 {
00526 Clear();
00527 for (Int_t j=0; j<fNhits; j++) {
00528 hit.Set(j);
00529 fList1.insert(std::pair<const Int_t ,THit> (j,hit));
00530 }
00531 }
00532
00533 Int_t TSTLhitMap::MakeTree(int mode, int nevents, int compression, int split, float &cx)
00534 {
00535 TFile *f=0;
00536 TTree *T=0;
00537 TSTLhitMap *top = this;
00538 if (mode > 0) {
00539 f = new TFile(demofile_name("TSTLhitMap"),"recreate","STLhit",compression);
00540 T = new TTree("T","Demo tree");
00541 T->Branch("event","TSTLhitMap",&top,64000,split);
00542 }
00543 for (int ievent=0; ievent<nevents; ievent++) {
00544 MakeEvent(ievent);
00545 if (mode > 0) T->Fill();
00546 }
00547
00548 if (mode == 0) return 0;
00549 T->Write();
00550 delete f;
00551 f = new TFile(demofile_name("TSTLhitMap"));
00552 Int_t nbytes = f->GetEND();
00553 cx = f->GetCompressionFactor();
00554 delete f;
00555 return nbytes;
00556 }
00557
00558 Int_t TSTLhitMap::ReadTree()
00559 {
00560 TSTLhitMap *top = this;
00561 TFile *f = new TFile(demofile_name("TSTLhitMap"));
00562 TTree *T = (TTree*)f->Get("T");
00563 T->SetBranchAddress("event",&top);
00564 Int_t nevents = (Int_t)T->GetEntries();
00565 Int_t nbytes = 0;
00566 for (int ievent=0; ievent<nevents; ievent++) {
00567 nbytes += T->GetEntry(ievent);
00568 Clear();
00569 }
00570 delete f;
00571 return nbytes;
00572 }
00573
00574
00575
00576 ClassImp(TSTLhitMultiMap)
00577
00578 TSTLhitMultiMap::TSTLhitMultiMap()
00579 {
00580 }
00581
00582 TSTLhitMultiMap::TSTLhitMultiMap(Int_t nmax)
00583 {
00584 fNhits = nmax;
00585 }
00586
00587 TSTLhitMultiMap::~TSTLhitMultiMap() {
00588 Clear();
00589 hitCount.print();
00590 }
00591
00592 void TSTLhitMultiMap::Clear(Option_t *)
00593 {
00594 fList1.clear();
00595 }
00596
00597 void TSTLhitMultiMap::MakeEvent(int )
00598 {
00599 Clear();
00600 for (Int_t j=0; j<fNhits; j++) {
00601 hit.Set(j);
00602 std::pair <const int, THit> temp(j,hit);
00603 fList1.insert(temp);
00604 }
00605 }
00606
00607 Int_t TSTLhitMultiMap::MakeTree(int mode, int nevents, int compression, int split, float &cx)
00608 {
00609 TFile *f=0;
00610 TTree *T=0;
00611 TSTLhitMultiMap *top = this;
00612 if (mode > 0) {
00613 f = new TFile(demofile_name("TSTLhitMultiMap"),"recreate","STLhit",compression);
00614 T = new TTree("T","Demo tree");
00615 T->Branch("event","TSTLhitMultiMap",&top,64000,split);
00616 }
00617 for (int ievent=0; ievent<nevents; ievent++) {
00618 MakeEvent(ievent);
00619 if (mode > 0) T->Fill();
00620 }
00621
00622 if (mode == 0) return 0;
00623 T->Write();
00624 delete f;
00625 f = new TFile(demofile_name("TSTLhitMultiMap"));
00626 Int_t nbytes = f->GetEND();
00627 cx = f->GetCompressionFactor();
00628 delete f;
00629 return nbytes;
00630 }
00631
00632 Int_t TSTLhitMultiMap::ReadTree()
00633 {
00634 TSTLhitMultiMap *top = this;
00635 TFile *f = new TFile(demofile_name("TSTLhitMultiMap"));
00636 TTree *T = (TTree*)f->Get("T");
00637 T->SetBranchAddress("event",&top);
00638 Int_t nevents = (Int_t)T->GetEntries();
00639 Int_t nbytes = 0;
00640 for (int ievent=0; ievent<nevents; ievent++) {
00641 nbytes += T->GetEntry(ievent);
00642 Clear();
00643 }
00644 delete f;
00645 return nbytes;
00646 }
00647
00648 #if 0
00649
00650 ClassImp(TSTLhitHashSet)
00651
00652 TSTLhitHashSet::TSTLhitHashSet()
00653 {
00654 }
00655
00656 TSTLhitHashSet::TSTLhitHashSet(Int_t nmax)
00657 {
00658 fNhits = nmax;
00659 }
00660
00661 TSTLhitHashSet::~TSTLhitHashSet() {
00662 Clear();
00663 hitCount.print();
00664 }
00665
00666 void TSTLhitHashSet::Clear(Option_t *)
00667 {
00668 fList1.erase(fList1.begin(),fList1.end());
00669 }
00670
00671 void TSTLhitHashSet::MakeEvent(int )
00672 {
00673 Clear();
00674 for (Int_t j=0; j<fNhits; j++) {
00675 hit.Set(j);
00676 fList1.insert(hit);
00677 }
00678 }
00679
00680 Int_t TSTLhitHashSet::MakeTree(int mode, int nevents, int compression, int split, float &cx)
00681 {
00682 TFile *f=0;
00683 TTree *T=0;
00684 TSTLhitHashSet *top = this;
00685 if (mode > 0) {
00686 f = new TFile(demofile,"recreate","STLhit",compression);
00687 T = new TTree("T","Demo tree");
00688 T->Branch("event","TSTLhitHashSet",&top,64000,split);
00689 }
00690 for (int ievent=0; ievent<nevents; ievent++) {
00691 MakeEvent(ievent);
00692 if (mode > 0) T->Fill();
00693 }
00694
00695 if (mode == 0) return 0;
00696 T->Write();
00697 delete f;
00698 f = new TFile(demofile);
00699 Int_t nbytes = f->GetEND();
00700 cx = f->GetCompressionFactor();
00701 delete f;
00702 return nbytes;
00703 }
00704
00705 Int_t TSTLhitHashSet::ReadTree()
00706 {
00707 TSTLhitHashSet *top = this;
00708 TFile *f = new TFile(demofile);
00709 TTree *T = (TTree*)f->Get("T");
00710 T->SetBranchAddress("event",&top);
00711 Int_t nevents = (Int_t)T->GetEntries();
00712 Int_t nbytes = 0;
00713 for (int ievent=0; ievent<nevents; ievent++) {
00714 nbytes += T->GetEntry(ievent);
00715 Clear();
00716 }
00717 delete f;
00718 return nbytes;
00719 }
00720
00721
00722
00723 ClassImp(TSTLhitHashMultiSet)
00724
00725 TSTLhitHashMultiSet::TSTLhitHashMultiSet()
00726 {
00727 }
00728
00729 TSTLhitHashMultiSet::TSTLhitHashMultiSet(Int_t nmax)
00730 {
00731 fNhits = nmax;
00732 }
00733
00734 TSTLhitHashMultiSet::~TSTLhitHashMultiSet() {
00735 Clear();
00736 hitCount.print();
00737 }
00738
00739 void TSTLhitHashMultiSet::Clear(Option_t *)
00740 {
00741 fList1.erase(fList1.begin(),fList1.end());
00742 }
00743
00744 void TSTLhitHashMultiSet::MakeEvent(int )
00745 {
00746 Clear();
00747 for (Int_t j=0; j<fNhits; j++) {
00748 hit.Set(j);
00749 fList1.insert(hit);
00750 }
00751 }
00752
00753 Int_t TSTLhitHashMultiSet::MakeTree(int mode, int nevents, int compression, int split, float &cx)
00754 {
00755 TFile *f=0;
00756 TTree *T=0;
00757 TSTLhitHashMultiSet *top = this;
00758 if (mode > 0) {
00759 f = new TFile(demofile,"recreate","STLhit",compression);
00760 T = new TTree("T","Demo tree");
00761 T->Branch("event","TSTLhitHashMultiSet",&top,64000,split);
00762 }
00763 for (int ievent=0; ievent<nevents; ievent++) {
00764 MakeEvent(ievent);
00765 if (mode > 0) T->Fill();
00766 }
00767
00768 if (mode == 0) return 0;
00769 T->Write();
00770 delete f;
00771 f = new TFile(demofile);
00772 Int_t nbytes = f->GetEND();
00773 cx = f->GetCompressionFactor();
00774 delete f;
00775 return nbytes;
00776 }
00777
00778 Int_t TSTLhitHashMultiSet::ReadTree()
00779 {
00780 TSTLhitHashMultiSet *top = this;
00781 TFile *f = new TFile(demofile);
00782 TTree *T = (TTree*)f->Get("T");
00783 T->SetBranchAddress("event",&top);
00784 Int_t nevents = (Int_t)T->GetEntries();
00785 Int_t nbytes = 0;
00786 for (int ievent=0; ievent<nevents; ievent++) {
00787 nbytes += T->GetEntry(ievent);
00788 Clear();
00789 }
00790 delete f;
00791 return nbytes;
00792 }
00793 #endif
00794
00795
00796 ClassImp(TSTLhitStar)
00797
00798 TSTLhitStar::TSTLhitStar()
00799 {
00800 }
00801
00802 TSTLhitStar::TSTLhitStar(Int_t nmax)
00803 {
00804 fNhits = nmax;
00805 fList2.reserve(nmax);
00806 }
00807
00808 TSTLhitStar::~TSTLhitStar() {
00809 Clear();
00810 hitCount.print();
00811 }
00812
00813 void TSTLhitStar::Clear(Option_t *)
00814 {
00815 for (vector<THit*>::iterator it = fList2.begin(); it<fList2.end(); it++) {
00816 delete (*it);
00817 }
00818 fList2.erase(fList2.begin(),fList2.end());
00819
00820 }
00821
00822 void TSTLhitStar::MakeEvent(int )
00823 {
00824 Clear();
00825 for (Int_t j=0; j<fNhits; j++) {
00826 fList2.push_back(new THit(j));
00827 }
00828 }
00829
00830 Int_t TSTLhitStar::MakeTree(int mode, int nevents, int compression, int split, float &cx)
00831 {
00832 TFile *f=0;
00833 TTree *T=0;
00834 TSTLhitStar *top = this;
00835 if (mode > 0) {
00836 f = new TFile(demofile_name("TSTLhitStar"),"recreate","STLhitStar",compression);
00837 T = new TTree("T","Demo tree");
00838 T->Branch("event","TSTLhitStar",&top,64000,split);
00839 }
00840 for (int ievent=0; ievent<nevents; ievent++) {
00841 MakeEvent(ievent);
00842 if (mode > 0) T->Fill();
00843 }
00844
00845 if (mode == 0) return 0;
00846 T->Write();
00847 delete f;
00848 f = new TFile(demofile_name("TSTLhitStar"));
00849 Int_t nbytes = f->GetEND();
00850 cx = f->GetCompressionFactor();
00851 delete f;
00852 return nbytes;
00853 }
00854
00855 Int_t TSTLhitStar::ReadTree()
00856 {
00857 TSTLhitStar *top = this;
00858 TFile *f = new TFile(demofile_name("TSTLhitStar"));
00859 TTree *T = (TTree*)f->Get("T");
00860 T->SetBranchAddress("event",&top);
00861 Int_t nevents = (Int_t)T->GetEntries();
00862 Int_t nbytes = 0;
00863 for (int ievent=0; ievent<nevents; ievent++) {
00864 nbytes += T->GetEntry(ievent);
00865 Clear();
00866 }
00867 delete f;
00868 return nbytes;
00869 }
00870
00871
00872 ClassImp(TSTLhitStarList)
00873
00874 TSTLhitStarList::TSTLhitStarList()
00875 {
00876 }
00877
00878 TSTLhitStarList::TSTLhitStarList(Int_t nmax)
00879 {
00880 fNhits = nmax;
00881 }
00882
00883 TSTLhitStarList::~TSTLhitStarList() {
00884 Clear();
00885 hitCount.print();
00886 }
00887
00888 void TSTLhitStarList::Clear(Option_t *)
00889 {
00890 for (list<THit*>::iterator it = fList2.begin(); it!=fList2.end(); it++) {
00891 delete (*it);
00892 }
00893 fList2.erase(fList2.begin(),fList2.end());
00894 }
00895
00896 void TSTLhitStarList::MakeEvent(int )
00897 {
00898 Clear();
00899 for (Int_t j=0; j<fNhits; j++) {
00900 fList2.push_back(new THit(j));
00901 }
00902 }
00903
00904 Int_t TSTLhitStarList::MakeTree(int mode, int nevents, int compression, int split, float &cx)
00905 {
00906 TFile *f=0;
00907 TTree *T=0;
00908 TSTLhitStarList *top = this;
00909 if (mode > 0) {
00910 f = new TFile(demofile_name("TSTLhitStarList"),"recreate","STLhitStar",compression);
00911 T = new TTree("T","Demo tree");
00912 T->Branch("event","TSTLhitStarList",&top,64000,split);
00913 }
00914 for (int ievent=0; ievent<nevents; ievent++) {
00915 MakeEvent(ievent);
00916 if (mode > 0) T->Fill();
00917 }
00918
00919 if (mode == 0) return 0;
00920 T->Write();
00921 delete f;
00922 f = new TFile(demofile_name("TSTLhitStarList"));
00923 Int_t nbytes = f->GetEND();
00924 cx = f->GetCompressionFactor();
00925 delete f;
00926 return nbytes;
00927 }
00928
00929 Int_t TSTLhitStarList::ReadTree()
00930 {
00931 TSTLhitStarList *top = this;
00932 TFile *f = new TFile(demofile_name("TSTLhitStarList"));
00933 TTree *T = (TTree*)f->Get("T");
00934 T->SetBranchAddress("event",&top);
00935 Int_t nevents = (Int_t)T->GetEntries();
00936 Int_t nbytes = 0;
00937 for (int ievent=0; ievent<nevents; ievent++) {
00938 nbytes += T->GetEntry(ievent);
00939 Clear();
00940 }
00941 delete f;
00942 return nbytes;
00943 }
00944
00945
00946 ClassImp(TSTLhitStarDeque)
00947
00948 TSTLhitStarDeque::TSTLhitStarDeque()
00949 {
00950 }
00951
00952 TSTLhitStarDeque::TSTLhitStarDeque(Int_t nmax)
00953 {
00954 fNhits = nmax;
00955 }
00956
00957 TSTLhitStarDeque::~TSTLhitStarDeque() {
00958 Clear();
00959 hitCount.print();
00960 }
00961
00962 void TSTLhitStarDeque::Clear(Option_t *)
00963 {
00964 for (deque<THit*>::iterator it = fList2.begin(); it!=fList2.end(); it++) {
00965 delete (*it);
00966 }
00967 fList2.erase(fList2.begin(),fList2.end());
00968 }
00969
00970 void TSTLhitStarDeque::MakeEvent(int )
00971 {
00972 Clear();
00973 for (Int_t j=0; j<fNhits; j++) {
00974 fList2.push_back(new THit(j));
00975 }
00976 }
00977
00978 Int_t TSTLhitStarDeque::MakeTree(int mode, int nevents, int compression, int split, float &cx)
00979 {
00980 TFile *f=0;
00981 TTree *T=0;
00982 TSTLhitStarDeque *top = this;
00983 if (mode > 0) {
00984 f = new TFile(demofile_name("TSTLhitStarDeque"),"recreate","STLhitStar",compression);
00985 T = new TTree("T","Demo tree");
00986 T->Branch("event","TSTLhitStarDeque",&top,64000,split);
00987 }
00988 for (int ievent=0; ievent<nevents; ievent++) {
00989 MakeEvent(ievent);
00990 if (mode > 0) T->Fill();
00991 }
00992
00993 if (mode == 0) return 0;
00994 T->Write();
00995 delete f;
00996 f = new TFile(demofile_name("TSTLhitStarDeque"));
00997 Int_t nbytes = f->GetEND();
00998 cx = f->GetCompressionFactor();
00999 delete f;
01000 return nbytes;
01001 }
01002
01003 Int_t TSTLhitStarDeque::ReadTree()
01004 {
01005 TSTLhitStarDeque *top = this;
01006 TFile *f = new TFile(demofile_name("TSTLhitStarDeque"));
01007 TTree *T = (TTree*)f->Get("T");
01008 T->SetBranchAddress("event",&top);
01009 Int_t nevents = (Int_t)T->GetEntries();
01010 Int_t nbytes = 0;
01011 for (int ievent=0; ievent<nevents; ievent++) {
01012 nbytes += T->GetEntry(ievent);
01013 Clear();
01014 }
01015 delete f;
01016 return nbytes;
01017 }
01018
01019
01020 ClassImp(TSTLhitStarSet)
01021
01022 TSTLhitStarSet::TSTLhitStarSet()
01023 {
01024 }
01025
01026 TSTLhitStarSet::TSTLhitStarSet(Int_t nmax)
01027 {
01028 fNhits = nmax;
01029 }
01030
01031 TSTLhitStarSet::~TSTLhitStarSet() {
01032 Clear();
01033 hitCount.print();
01034 }
01035
01036 void TSTLhitStarSet::Clear(Option_t *)
01037 {
01038 for (set<THit*>::iterator it = fList2.begin(); it!=fList2.end(); it++) {
01039 delete (*it);
01040 }
01041 fList2.erase(fList2.begin(),fList2.end());
01042
01043 }
01044
01045 void TSTLhitStarSet::MakeEvent(int )
01046 {
01047 Clear();
01048 for (Int_t j=0; j<fNhits; j++) {
01049 fList2.insert(new THit(j));
01050 }
01051 }
01052
01053 Int_t TSTLhitStarSet::MakeTree(int mode, int nevents, int compression, int split, float &cx)
01054 {
01055 TFile *f=0;
01056 TTree *T=0;
01057 TSTLhitStarSet *top = this;
01058 if (mode > 0) {
01059 f = new TFile(demofile_name("TSTLhitStarSet"),"recreate","STLhitStar",compression);
01060 T = new TTree("T","Demo tree");
01061 T->Branch("event","TSTLhitStarSet",&top,64000,split);
01062 }
01063 for (int ievent=0; ievent<nevents; ievent++) {
01064 MakeEvent(ievent);
01065 if (mode > 0) T->Fill();
01066 }
01067
01068 if (mode == 0) return 0;
01069 T->Write();
01070 delete f;
01071 f = new TFile(demofile_name("TSTLhitStarSet"));
01072 Int_t nbytes = f->GetEND();
01073 cx = f->GetCompressionFactor();
01074 delete f;
01075 return nbytes;
01076 }
01077
01078 Int_t TSTLhitStarSet::ReadTree()
01079 {
01080 TSTLhitStarSet *top = this;
01081 TFile *f = new TFile(demofile_name("TSTLhitStarSet"));
01082 TTree *T = (TTree*)f->Get("T");
01083 T->SetBranchAddress("event",&top);
01084 Int_t nevents = (Int_t)T->GetEntries();
01085 Int_t nbytes = 0;
01086 for (int ievent=0; ievent<nevents; ievent++) {
01087 nbytes += T->GetEntry(ievent);
01088 Clear();
01089 }
01090 delete f;
01091 return nbytes;
01092 }
01093
01094
01095 ClassImp(TSTLhitStarMultiSet)
01096
01097 TSTLhitStarMultiSet::TSTLhitStarMultiSet()
01098 {
01099 }
01100
01101 TSTLhitStarMultiSet::TSTLhitStarMultiSet(Int_t nmax)
01102 {
01103 fNhits = nmax;
01104 }
01105
01106 TSTLhitStarMultiSet::~TSTLhitStarMultiSet() {
01107 Clear();
01108 hitCount.print();
01109 }
01110
01111 void TSTLhitStarMultiSet::Clear(Option_t *)
01112 {
01113 for (multiset<THit*>::iterator it = fList2.begin(); it!=fList2.end(); it++) {
01114 delete (*it);
01115 }
01116 fList2.erase(fList2.begin(),fList2.end());
01117 }
01118
01119 void TSTLhitStarMultiSet::MakeEvent(int )
01120 {
01121 Clear();
01122 for (Int_t j=0; j<fNhits; j++) {
01123 fList2.insert(new THit(j));
01124 }
01125 }
01126
01127 Int_t TSTLhitStarMultiSet::MakeTree(int mode, int nevents, int compression, int split, float &cx)
01128 {
01129 TFile *f=0;
01130 TTree *T=0;
01131 TSTLhitStarMultiSet *top = this;
01132 if (mode > 0) {
01133 f = new TFile(demofile_name("TSTLhitStarMultiSet"),"recreate","STLhitStar",compression);
01134 T = new TTree("T","Demo tree");
01135 T->Branch("event","TSTLhitStarMultiSet",&top,64000,split);
01136 }
01137 for (int ievent=0; ievent<nevents; ievent++) {
01138 MakeEvent(ievent);
01139 if (mode > 0) T->Fill();
01140 }
01141
01142 if (mode == 0) return 0;
01143 T->Write();
01144 delete f;
01145 f = new TFile(demofile_name("TSTLhitStarMultiSet"));
01146 Int_t nbytes = f->GetEND();
01147 cx = f->GetCompressionFactor();
01148 delete f;
01149 return nbytes;
01150 }
01151
01152 Int_t TSTLhitStarMultiSet::ReadTree()
01153 {
01154 TSTLhitStarMultiSet *top = this;
01155 TFile *f = new TFile(demofile_name("TSTLhitStarMultiSet"));
01156 TTree *T = (TTree*)f->Get("T");
01157 T->SetBranchAddress("event",&top);
01158 Int_t nevents = (Int_t)T->GetEntries();
01159 Int_t nbytes = 0;
01160 for (int ievent=0; ievent<nevents; ievent++) {
01161 nbytes += T->GetEntry(ievent);
01162 Clear();
01163 }
01164 delete f;
01165 return nbytes;
01166 }
01167
01168
01169
01170 ClassImp(TSTLhitStarMap)
01171
01172 TSTLhitStarMap::TSTLhitStarMap()
01173 {
01174 }
01175
01176 TSTLhitStarMap::TSTLhitStarMap(Int_t nmax)
01177 {
01178 fNhits = nmax;
01179 }
01180
01181 TSTLhitStarMap::~TSTLhitStarMap() {
01182 Clear();
01183 hitCount.print();
01184 }
01185
01186 void TSTLhitStarMap::Clear(Option_t *)
01187 {
01188 for (map<int,THit*>::iterator it = fList2.begin(); it!=fList2.end(); it++) {
01189 delete (*it).second;
01190 }
01191 fList2.clear();
01192 }
01193
01194 void TSTLhitStarMap::MakeEvent(int )
01195 {
01196 Clear();
01197 for (Int_t j=0; j<fNhits; j++) {
01198 fList2.insert(std::pair<const Int_t, THit*> (j,new THit(j)));
01199 }
01200 }
01201
01202 Int_t TSTLhitStarMap::MakeTree(int mode, int nevents, int compression, int split, float &cx)
01203 {
01204 TFile *f=0;
01205 TTree *T=0;
01206 TSTLhitStarMap *top = this;
01207 if (mode > 0) {
01208 f = new TFile(demofile_name("TSTLhitStarMap"),"recreate","STLhitStar",compression);
01209 T = new TTree("T","Demo tree");
01210 T->Branch("event","TSTLhitStarMap",&top,64000,split);
01211 }
01212 for (int ievent=0; ievent<nevents; ievent++) {
01213 MakeEvent(ievent);
01214 if (mode > 0) T->Fill();
01215 }
01216
01217 if (mode == 0) return 0;
01218 T->Write();
01219 delete f;
01220 f = new TFile(demofile_name("TSTLhitStarMap"));
01221 Int_t nbytes = f->GetEND();
01222 cx = f->GetCompressionFactor();
01223 delete f;
01224 return nbytes;
01225 }
01226
01227 Int_t TSTLhitStarMap::ReadTree()
01228 {
01229 TSTLhitStarMap *top = this;
01230 TFile *f = new TFile(demofile_name("TSTLhitStarMap"));
01231 TTree *T = (TTree*)f->Get("T");
01232 T->SetBranchAddress("event",&top);
01233 Int_t nevents = (Int_t)T->GetEntries();
01234 Int_t nbytes = 0;
01235 for (int ievent=0; ievent<nevents; ievent++) {
01236 nbytes += T->GetEntry(ievent);
01237 Clear();
01238 }
01239 delete f;
01240 return nbytes;
01241 }
01242
01243
01244 ClassImp(TSTLhitStarMultiMap)
01245
01246 TSTLhitStarMultiMap::TSTLhitStarMultiMap()
01247 {
01248 }
01249
01250 TSTLhitStarMultiMap::TSTLhitStarMultiMap(Int_t nmax)
01251 {
01252 fNhits = nmax;
01253 }
01254
01255 TSTLhitStarMultiMap::~TSTLhitStarMultiMap() {
01256 Clear();
01257 hitCount.print();
01258 }
01259
01260 void TSTLhitStarMultiMap::Clear(Option_t *)
01261 {
01262 for (multimap<int,THit*>::iterator it = fList2.begin(); it!=fList2.end(); it++) {
01263 delete (*it).second;
01264 }
01265 fList2.clear();
01266 }
01267
01268 void TSTLhitStarMultiMap::MakeEvent(int )
01269 {
01270 Clear();
01271 for (Int_t j=0; j<fNhits; j++) {
01272 std::pair<const int,THit*> temp(j,new THit(j));
01273 fList2.insert(temp);
01274 }
01275 }
01276
01277 Int_t TSTLhitStarMultiMap::MakeTree(int mode, int nevents, int compression, int split, float &cx)
01278 {
01279 TFile *f=0;
01280 TTree *T=0;
01281 TSTLhitStarMultiMap *top = this;
01282 if (mode > 0) {
01283 f = new TFile(demofile_name("TSTLhitStarMultiMap"),"recreate","STLhitStar",compression);
01284 T = new TTree("T","Demo tree");
01285 T->Branch("event","TSTLhitStarMultiMap",&top,64000,split);
01286 }
01287 for (int ievent=0; ievent<nevents; ievent++) {
01288 MakeEvent(ievent);
01289 if (mode > 0) T->Fill();
01290 }
01291
01292 if (mode == 0) return 0;
01293 T->Write();
01294 delete f;
01295 f = new TFile(demofile_name("TSTLhitStarMultiMap"));
01296 Int_t nbytes = f->GetEND();
01297 cx = f->GetCompressionFactor();
01298 delete f;
01299 return nbytes;
01300 }
01301
01302 Int_t TSTLhitStarMultiMap::ReadTree()
01303 {
01304 TSTLhitStarMultiMap *top = this;
01305 TFile *f = new TFile(demofile_name("TSTLhitStarMultiMap"));
01306 TTree *T = (TTree*)f->Get("T");
01307 T->SetBranchAddress("event",&top);
01308 Int_t nevents = (Int_t)T->GetEntries();
01309 Int_t nbytes = 0;
01310 for (int ievent=0; ievent<nevents; ievent++) {
01311 nbytes += T->GetEntry(ievent);
01312 Clear();
01313 }
01314 delete f;
01315 return nbytes;
01316 }
01317
01318
01319 ClassImp(TCloneshit)
01320
01321 TCloneshit::TCloneshit()
01322 {
01323 fList3 = new TClonesArray("TObjHit");
01324 }
01325
01326 TCloneshit::TCloneshit(Int_t nmax)
01327 {
01328 fNhits = nmax;
01329 fList3 = new TClonesArray("TObjHit",nmax);
01330 TObjHit::Class()->IgnoreTObjectStreamer();
01331 }
01332
01333 TCloneshit::~TCloneshit() {
01334 Clear();
01335 hitCount.print();
01336 }
01337
01338 void TCloneshit::Clear(Option_t *)
01339 {
01340 fList3->Delete();
01341
01342 }
01343
01344 void TCloneshit::MakeEvent(int )
01345 {
01346 Clear();
01347 for (Int_t j=0; j<fNhits; j++) {
01348 new((*fList3)[j]) TObjHit(j);
01349 }
01350 }
01351
01352 Int_t TCloneshit::MakeTree(int mode, int nevents, int compression, int split, float &cx)
01353 {
01354 TFile *f=0;
01355 TTree *T=0;
01356 TCloneshit *top = this;
01357 if (mode > 0) {
01358 f = new TFile(demofile,"recreate","Cloneshit",compression);
01359 T = new TTree("T","Demo tree");
01360 T->Branch("event","TCloneshit",&top,64000,split);
01361 }
01362 for (int ievent=0; ievent<nevents; ievent++) {
01363 MakeEvent(ievent);
01364 if (mode > 0) T->Fill();
01365 }
01366
01367 if (mode == 0) return 0;
01368 T->Write();
01369 delete f;
01370 f = new TFile(demofile);
01371 Int_t nbytes = f->GetEND();
01372 cx = f->GetCompressionFactor();
01373 delete f;
01374 return nbytes;
01375 }
01376
01377 Int_t TCloneshit::ReadTree()
01378 {
01379 TCloneshit *top = this;
01380 TFile *f = new TFile(demofile);
01381 TTree *T = (TTree*)f->Get("T");
01382 T->SetBranchAddress("event",&top);
01383 Int_t nevents = (Int_t)T->GetEntries();
01384 Int_t nbytes = 0;
01385 for (int ievent=0; ievent<nevents; ievent++) {
01386 nbytes += T->GetEntry(ievent);
01387 }
01388 delete f;
01389 return nbytes;
01390 }
01391