12 #include <boost/algorithm/string.hpp>    30   string baseName = 
"DiskResidentEventList";
    31   string name = baseName;
    37     checkFile.open( name.c_str(), ios::in );
    38     exists = ! checkFile.fail();
    46   : _fname(generateFname())
    51   , _cName(
"DalitzEventList")
    52   , _ntpName(
"DalitzEventList")
    60                                             , 
const std::string& treeName
    61                                             , 
const std::string& opt)
    63   , _opt(boost::to_upper_copy(opt))
    68   , _ntpName(treeName+
"NTP")
    72   cout << 
"DiskResidentEventList created with file " << fname << endl;
    74   if(dbThis)cout << 
" from file done, now init: " << endl;
    76   if(dbThis)cout << 
" finished creation" << endl;
    80                                             , 
const std::string& opt)
    82   , _opt(boost::to_upper_copy(opt))
    86   , _cName(
"DalitzEventList")
    87   , _ntpName(
"DalitzEventList")
    91   cout << 
"DiskResidentEventList created with file " << fname << endl;
    93   if(dbThis)cout << 
" from file done, now init: " << endl;
    95   if(dbThis)cout << 
" finished creation" << endl;
   100   : _fname(generateFname())
   105   , _cName(
"DalitzEventList")
   106   , _ntpName(
"DalitzEventList")
   126                          , 
const std::string& newFname
   127                          , 
const std::string& opt
   130   , _opt(boost::to_upper_copy(opt))
   135   , _cName(
"DalitzEventList")
   136   , _ntpName(
"DalitzEventList")
   139   cout << 
" copy with new filename : " << newFname << endl;
   140   cout << 
" file pointer: " << 
_f << endl;
   178   : _fname(generateFname())
   183   , _cName(
"DalitzEventList")
   184   , _ntpName(
"DalitzEventList")
   193                          , 
const std::string& fname
   194                          , 
const std::string& opt
   197   , _opt(boost::to_upper_copy(opt))
   201   , _cName(
"DalitzEventList")
   202   , _ntpName(
"DalitzEventList")
   218     cout << 
"Hello from DiskResidentEventList::openFile()" << endl;
   219     cout << 
" calling: TFile("    230   if(! 
_f->IsWritable()) {
   232     cout << 
"Warning in DiskResidentEventList: file "   233      << 
_fname << 
" not writable!"   237     cout << 
" got _f = " << 
_f << endl;
   238     cout << 
" _f->ls() " << endl;
   248   if(dbThis) cout << 
"DiskResidentEventList::fromFile() called" << endl;
   251     cout << 
"WARNING in DiskResidentEventList::fromFile():"   252      << 
" current file is zombie - making new one" << endl;
   255   if(dbThis) cout << 
" opened file" << endl;
   256   if(dbThis) 
_f->ls(); cout << 
" that's in it" << endl;
   259     cout << 
" cd'ed to file " << endl;
   260     cout << 
" now calling " <<  
"_f->Get(" << 
cName() << 
")" << endl;
   263   if(dbThis) cout << 
" got ntuple : " << 
_ntp << endl;
   268       cout << 
"Success in DiskResidentEventList::fromFile(): "   269        << 
" found ntuple: " << 
_ntp->ClassName() << 
", " << 
cName()
   275   if(dbThis) cout << 
" now calling init" << endl;
   277   if(dbThis) cout << 
"DiskResidentEventList::fromFile() returning 'true'"    288   if(0 == 
_ntp) 
return 0;
   292   return (0 == this->
size());
   303     cout << 
"WARNING DiskResidentEventList::makeNtp - no file. "   304      << 
"That shouldn't happen. I'll have one made." << endl;
   313     cout << 
"made new ntuple" << endl;
   315     cout << 
"found old ntuple" << endl;
   327   vector<Double_t> array(arraySize);
   331     cout << 
"ERROR in DiskResidentEventList::Add(const DalitzEvent& evt)"   332      << 
", call to DalitzEvent::fillNtupleVarArray"   333      << 
" returned failure for event:\n" << evt
   338     _ntp->Fill(&(array[0]));
   339     _f = 
_ntp->GetCurrentFile(); 
   362   if(0 == otherList.
size()) 
return false;
   363   for(
unsigned int i=0; i < otherList.
size(); i++){
   377   if(0 == 
_ntp) 
return false;
   378   if(0 == 
_f) 
return false;
   381     cout << 
"DiskResidentEventList::save() called"   382        << 
" for filename = " << 
_fname << endl;
   388   if(0 == 
_f || (! 
_f->IsWritable()) || (! 
_f->IsOpen())){
   389     cout << 
"big problem with f in DiskResidentEventList::save()" << endl;
   390     throw "Scheibenkartoffel";
   393   if(dbThis)cout << 
" done the saving" << endl;
   402     cout << 
"DiskResidentEventList::Close() called"   403      << 
" for filename = " << 
_fname << endl;
   405   if(0 == 
_f) 
return false;
   406   if(0 == 
_ntp) 
return false;
   409   if(!
_f->IsOpen()) 
return false ;
   411   if(
_opt.size() != 0 && 
_opt != 
"OPEN" && 
_opt != 
"READ"){
   413     if(dbThis && ! success){
   414     cout << 
"DiskResidentEventList::Close() failure in saving when closing"    417     if(dbThis) cout << 
"saved file with success = " << success << endl;
   423     cout << 
"_f " << 
_f << 
" _ntp " << 
_ntp << endl ;
   424     cout << 
"_f->IsOpen() " << 
_f->IsOpen() << endl ;
   425     cout << 
"mustcleanup " << 
_f->TestBit(kMustCleanup) << endl ;
   426     cout << 
"_ntp->GetName() " << 
_ntp->GetName() << endl ;
   427     cout << 
"getting current file" << endl;
   429   _f = 
_ntp->GetCurrentFile();
   430   if(dbThis) cout << 
"_f = " << 
_f << endl;
   432   if(dbThis) cout << 
"cd'ed to _f and now about to Write" << endl;
   434   if(dbThis) cout << 
"written,now closing" <<endl;
   436   if(dbThis) cout << 
"closed." << endl;
   449     cout << 
"FATAL ERROR in DiskResidentEventList::operator()"   450      << 
" index i=" << i << 
" out of range " << 
size()
   452     throw "index out of range";
   455     cout << 
"FATAL ERROR in DiskResidentEventList::operator()"   456      << 
"there is no ntuple "   465   for(
unsigned int i=0; i< this->
size(); i++){
   474   for(
unsigned int i=0; i< this->
size(); i++){
   483   if(0 == w) 
return hs;
   484   for(
unsigned int i=0; i< this->
size(); i++){
   494   if(0 == w) 
return hs;
   495   for(
unsigned int i=0; i< this->
size(); i++){
 
bool makeNtp(const DalitzEvent &evt)
DalitzHistoSet reWeightedHistoSet(MINT::IReturnRealForEvent< IDalitzEvent > *w) const
DalitzHistoSet weighedReWeightedHistoSet(MINT::IReturnRealForEvent< IDalitzEvent > *w) const
DalitzHistoSet weightedHistoSet() const
std::string makeNtupleVarnames() const
bool exists(const string &fname)
bool fillNtupleVarArray(std::vector< Double_t > &array) const
bool makePlots(const std::string &filename)
virtual double RealVal(EVENT_TYPE &evt)=0
virtual bool Add(const DalitzEvent &evt)
virtual unsigned int size() const
virtual double getWeight() const
virtual EVENT_TYPE getEvent(unsigned int i) const =0
static std::string generateFname()
unsigned int ntupleVarArraySize() const
void addEvent(const IDalitzEvent &evt, double weight=1)
virtual ~DiskResidentEventList()
std::string anythingToString(const T &anything)
DalitzHistoSet histoSet() const
DalitzEvent getEvent(unsigned int i) const
virtual unsigned int size() const =0
bool save(const std::string &filename="DalitzHistos.root") const
virtual bool empty() const