//*-- AUTHOR : J. Markert //_HADES_CLASS_DESCRIPTION //////////////////////////////////////////////////////////////////////////// // HPhysicsHistBooker // // Container class for the mdc hists //////////////////////////////////////////////////////////////////////////// //#include //#include "hstartdetector.h" #include "hphysicshistbooker.h" #include "hphysicshistfiller.h" #include "hmonhist.h" #include "htrendhist.h" #include "hhistarray.h" #include "hgo4parasciifileio.h" #include "hgo4parrootfileio.h" #include "hades.h" #include "hruntimedb.h" #include "hspectrometer.h" #include "hpario.h" #include "hdetpario.h" #include "hparamlist.h" #include "hmessagemgr.h" #include "hevent.h" #include "hcategory.h" #include "hparasciifileio.h" #include "hparrootfileio.h" #include "hrun.h" #include "hdatasource.h" #include // Container/List pointers HPhysicsHistBooker* HPhysicsHistBooker::fPhysicsHistBooker=0; TList* HPhysicsHistBooker::physicsHistpool=0; TList* HPhysicsHistBooker::physicsActiveHists=0; HPhysicsHistFiller* HPhysicsHistBooker::physicsfiller=0; ClassImp(HPhysicsHistBooker) HPhysicsHistBooker::HPhysicsHistBooker(const char* name,const char* title, const char* context) : HParCond(name,title,context) { strcpy(detName,"Mdc"); clear(); fPhysicsHistBooker=this; physicsHistpool = new TList; physicsActiveHists = new TList; physicsfiller = new HPhysicsHistFiller("PhysicsFiller","PhysicsFiller"); } void HPhysicsHistBooker::setGo4ParIo(HRuntimeDb *rtdb) { //Adds PhysicsHistBookers's Parameter Io to the runtime database. HParIo *io=0; io=rtdb->getFirstInput(); if (io != 0) { if (io->getDetParIo("HGo4ParIo") == 0) { if (strcmp(io->IsA()->GetName(),"HParAsciiFileIo")==0) { HGo4ParAsciiFileIo* p= new HGo4ParAsciiFileIo(((HParAsciiFileIo*)io)->getFile()); io->setDetParIo(p); io->setInputNumber(1); } if (strcmp(io->IsA()->GetName(),"HParRootFileIo")==0) { HGo4ParRootFileIo* p= new HGo4ParRootFileIo(((HParRootFileIo*)io)->getParRootFile()); io->setDetParIo(p); io->setInputNumber(1); } if (strcmp(io->IsA()->GetName(),"HParOraIo")==0) { io->setDetParIo("HGo4ParIo"); io->setInputNumber(1); } } } io=rtdb->getSecondInput(); if (io != 0) { if (io->getDetParIo("HGo4ParIo") == 0) { if (strcmp(io->IsA()->GetName(),"HParAsciiFileIo")==0) { HGo4ParAsciiFileIo* p= new HGo4ParAsciiFileIo(((HParAsciiFileIo*)io)->getFile()); io->setDetParIo(p); io->setInputNumber(2); } if (strcmp(io->IsA()->GetName(),"HParRootFileIo")==0) { HGo4ParRootFileIo* p= new HGo4ParRootFileIo(((HParRootFileIo*)io)->getParRootFile()); io->setDetParIo(p); io->setInputNumber(2); } if (strcmp(io->IsA()->GetName(),"HParOraIo")==0) { io->setDetParIo("HGo4ParIo"); io->setInputNumber(2); } } } io=rtdb->getOutput(); if (io != 0) { if (io->getDetParIo("HGo4ParIo") == 0) { if (strcmp(io->IsA()->GetName(),"HParAsciiFileIo")==0) { HGo4ParAsciiFileIo* p= new HGo4ParAsciiFileIo(((HParAsciiFileIo*)io)->getFile()); io->setDetParIo(p); } if (strcmp(io->IsA()->GetName(),"HParRootFileIo")==0) { HGo4ParRootFileIo* p= new HGo4ParRootFileIo(((HParRootFileIo*)io)->getParRootFile()); io->setDetParIo(p); } if (strcmp(io->IsA()->GetName(),"HParOraIo")==0) io->setDetParIo("HGo4ParIo"); } } } Bool_t HPhysicsHistBooker::initStandAlone() { // intitializes the container from an input HRuntimeDb* rtdb=0; rtdb=gHades->getRuntimeDb(); HDataSource* source=gHades->getDataSource(); Int_t refId=source->getCurrentRefId(); Int_t runId=source->getCurrentRunId(); HRun* run=rtdb->getRun(runId); if(!run)run=rtdb->addRun(runId,refId); Bool_t allFound=kFALSE; HParVersion* vers; if(run) { if (!run->getParVersion((char*)GetName())) { vers=new HParVersion((char*)GetName()); run->addParVersion(vers); } } else { Error("HPhysicsHistBooker:initStandAlone()","NO RUN SET!"); return kFALSE; } if (versions[1]!=-1 && versions[2]!=-1) resetInputVersions(); HParIo* io=rtdb->getFirstInput(); if (io) allFound=init(io,0); if (!allFound) { io=rtdb->getSecondInput(); if (io) { allFound=init(io,0); } }else setInputVersion(-1,2); if (!allFound) { cerr<<"******** "<MakeIterator(); HMonHistAddon* h=0; TString buffer; while ((h=(HMonHistAddon*)myiter->Next())!= 0) { h->reset(level,count); } delete myiter; } void HPhysicsHistBooker::clear() { status=kFALSE; resetInputVersions(); changed=kFALSE; } void HPhysicsHistBooker::printParam(void) { // prints the parameters of HPhysicsHistBooker to the screen. // The printParam() of the subobjects are called to print the // parameters of the corresponding subobject. } void HPhysicsHistBooker::printStatus(void) { // prints the parameters of HPhysicsHistBooker to the screen. cout<<"###############Status PhysicsHistbooker#################"<MakeIterator(); while ((h=(HMonHistAddon*)myiter->Next())!= 0) { cout<<"active: "<getActive()<<" resetable: "<getResetable()<<" "<GetName()<getRuntimeDb(); if(rtdb) { setGo4ParIo(rtdb); } else { Error("HPhysicsHistBooker()","ZERO POINTER FOR RTDB RECEIVED!"); exit(1); } HDetParIo* input=inp->getDetParIo("HGo4ParIo"); if (input) return (input->init(this,set)); return kFALSE; } Int_t HPhysicsHistBooker::write(HParIo* output) { // writes the container to an output HDetParIo* out=output->getDetParIo("HGo4ParIo"); if (out) return out->write(this); return -1; } void HPhysicsHistBooker::putParams(HParamList* l) { // Puts all params of HPhysicsHistBooker to the parameter list of // HParamList (which ist used by the io); if(!l) return; physicsfiller->putPhysicsParams(l,physicsHistpool); } Bool_t HPhysicsHistBooker::getParams(HParamList* l) { if(!l) return kFALSE; if(isStatic()==0) { if(!physicsfiller->getPhysicsParams(l,physicsHistpool,physicsActiveHists)) return kFALSE; setStatic(); } return kTRUE; }