ROOT logo
//*-- AUTHOR : Ilse Koenig
//*-- Modified : 03/02/2000 by Ilse Koenig

//_HADES_CLASS_DESCRIPTION 
///////////////////////////////////////////////////////////////////
//  HRun
//
//  class for the parameter versions of an event file
//
//  The name of each run is the run id converted to a string.
//  The run id number identifies the event file. Each event has
//  this number in the event header. It is also stored in Oracle
//  and can be used to find the name of the corresponding LMD-file
//  and the valid parameter versions.
//  In the parameter ROOT file the valid parameter versions are
//  accessible via the name. 
//  Associated with the run is a list of container
//  names with the versions of the containers in the two
//  possible inputs and the output (class HParVersions).
//  The input versions are used during the initialisation
//  used during the initialisation of the containers.
//
///////////////////////////////////////////////////////////////////

#include "hrun.h"
#include "hades.h"
#include "hmessagemgr.h"

ClassImp(HParVersion)
ClassImp(HRun)

HParVersion::HParVersion(const Text_t* name) : TNamed(name,"version info"){
  // constructor with the name of the container
  rootVersion=0;
  for(Int_t i=0;i<3;i++) {inputVersions[i]=-1;}
}


HRun::HRun(const Text_t* name,const Text_t* refName)
              : TNamed(name,"run parameters") {
  // constructor with the run id and reference run as strings
  parVersions=new TList();
  refRun=refName;
}

HRun::HRun(Int_t r,Int_t rr) {
  // constructor with the run id and reference run as numbers
  parVersions=new TList();
  Char_t name[255];
  sprintf(name,"%i",r);
  SetName(name);
  setRefRun(rr);
}

HRun::HRun(HRun &run):TNamed(run) {
  // copy constructor
  SetName(run.GetName());
  parVersions=new TList();
  TList* lv=run.getParVersions();
  TIter next(lv);
  HParVersion* pv;
  while ((pv=(HParVersion*)next())) {
    parVersions->Add(pv);
  }
  refRun=run.refRun;
}

HRun::~HRun() {
  // destructor
  if (parVersions) {
    parVersions->Delete();
    delete  parVersions;
    parVersions=0;
  }
}

void HRun::addParVersion(HParVersion *pv) {
  // adds a container version object to the list
  parVersions->Add(pv);
}

HParVersion* HRun::getParVersion(const Text_t* name) {
  // return a container version object called by the name of
  // the container
  return (HParVersion*)parVersions->FindObject(name);
}

void HRun::resetInputVersions() {
  TIter next(parVersions);
  HParVersion* v;
  while ((v=(HParVersion*)next())) {
    v->resetInputVersions();
  }
}

void HRun::resetOutputVersions() {
  TIter next(parVersions);
  HParVersion* v;
  while ((v=(HParVersion*)next())) {
    v->setRootVersion(0);
  }
}

void HRun::print() {
  // prints the list of container versions for this run

  //cout<<"run: "<<fName<<'\n';
  gHades->getMsg()->info(10,HMessageMgr::DET_RUNTIMEDB,this->GetName(),"run: %d",getRunId());
  TIter next(parVersions);
  HParVersion* v;
  while ((v=(HParVersion*)next())) {
    gHades->getMsg()->info(10,HMessageMgr::DET_RUNTIMEDB,this->GetName(),"%-22s%10d%11d%9d", v->GetName(),v->getInputVersion(1),v->getInputVersion(2), v->getRootVersion());
  }
}

void HRun::write(fstream& fout) {
  // writes the list of container versions for this run to fstream
  fout<<"run: "<<GetName()<<'\n';
  HParVersion* v;
  TIter next(parVersions);
  while ((v=(HParVersion*)next())) {
    fout.setf(ios::left,ios::adjustfield);
    fout<<"  "<<setw(45)<<v->GetName();
    fout.setf(ios::right,ios::adjustfield);
    fout<<setw(11)<<v->getInputVersion(1)
        <<setw(11)<<v->getInputVersion(2)
        <<setw(11)<<v->getRootVersion()<<'\n';
  }
}
 hrun.cc:1
 hrun.cc:2
 hrun.cc:3
 hrun.cc:4
 hrun.cc:5
 hrun.cc:6
 hrun.cc:7
 hrun.cc:8
 hrun.cc:9
 hrun.cc:10
 hrun.cc:11
 hrun.cc:12
 hrun.cc:13
 hrun.cc:14
 hrun.cc:15
 hrun.cc:16
 hrun.cc:17
 hrun.cc:18
 hrun.cc:19
 hrun.cc:20
 hrun.cc:21
 hrun.cc:22
 hrun.cc:23
 hrun.cc:24
 hrun.cc:25
 hrun.cc:26
 hrun.cc:27
 hrun.cc:28
 hrun.cc:29
 hrun.cc:30
 hrun.cc:31
 hrun.cc:32
 hrun.cc:33
 hrun.cc:34
 hrun.cc:35
 hrun.cc:36
 hrun.cc:37
 hrun.cc:38
 hrun.cc:39
 hrun.cc:40
 hrun.cc:41
 hrun.cc:42
 hrun.cc:43
 hrun.cc:44
 hrun.cc:45
 hrun.cc:46
 hrun.cc:47
 hrun.cc:48
 hrun.cc:49
 hrun.cc:50
 hrun.cc:51
 hrun.cc:52
 hrun.cc:53
 hrun.cc:54
 hrun.cc:55
 hrun.cc:56
 hrun.cc:57
 hrun.cc:58
 hrun.cc:59
 hrun.cc:60
 hrun.cc:61
 hrun.cc:62
 hrun.cc:63
 hrun.cc:64
 hrun.cc:65
 hrun.cc:66
 hrun.cc:67
 hrun.cc:68
 hrun.cc:69
 hrun.cc:70
 hrun.cc:71
 hrun.cc:72
 hrun.cc:73
 hrun.cc:74
 hrun.cc:75
 hrun.cc:76
 hrun.cc:77
 hrun.cc:78
 hrun.cc:79
 hrun.cc:80
 hrun.cc:81
 hrun.cc:82
 hrun.cc:83
 hrun.cc:84
 hrun.cc:85
 hrun.cc:86
 hrun.cc:87
 hrun.cc:88
 hrun.cc:89
 hrun.cc:90
 hrun.cc:91
 hrun.cc:92
 hrun.cc:93
 hrun.cc:94
 hrun.cc:95
 hrun.cc:96
 hrun.cc:97
 hrun.cc:98
 hrun.cc:99
 hrun.cc:100
 hrun.cc:101
 hrun.cc:102
 hrun.cc:103
 hrun.cc:104
 hrun.cc:105
 hrun.cc:106
 hrun.cc:107
 hrun.cc:108
 hrun.cc:109
 hrun.cc:110
 hrun.cc:111
 hrun.cc:112
 hrun.cc:113
 hrun.cc:114
 hrun.cc:115
 hrun.cc:116
 hrun.cc:117
 hrun.cc:118
 hrun.cc:119
 hrun.cc:120
 hrun.cc:121
 hrun.cc:122
 hrun.cc:123
 hrun.cc:124
 hrun.cc:125
 hrun.cc:126
 hrun.cc:127
 hrun.cc:128
 hrun.cc:129