#include "TObject.h" #include "TArrayI.h" #include "TSystem.h" #include "TThread.h" #include "TCut.h" #include "honlineserver.h" #include "hparoraio.h" #include "htaskset.h" #include "honlineconfig.h" #include "honlinehadespar.h" #include "honlinestarthistbooker.h" #include "honlinestarthistfiller.h" #include "honlinestartmon.h" #include "honlinestartcalibrationmon.h" #include "honlinehodohistbooker.h" #include "honlinehodohistfiller.h" #include "honlinehodomon.h" #include "honlinewallhistbooker.h" #include "honlinewallhistfiller.h" #include "honlinewallmon.h" #include "honlinerichhistbooker.h" #include "honlinerichhistfiller.h" #include "honlinerichmon.h" #include "honlinemdchistbooker.h" #include "honlinemdchistfiller.h" #include "honlinemdcmon.h" #include "honlinemdccalibrationmon.h" #include "honlinetofhistbooker.h" #include "honlinetofhistfiller.h" #include "honlinetofmon.h" #include "honlinetofinohistbooker.h" #include "honlinetofinohistfiller.h" #include "honlinetofinomon.h" #include "honlineshowerhistbooker.h" #include "honlineshowerhistfiller.h" #include "honlineshowermon.h" #include "honlinephysicshistbooker.h" #include "honlinephysicshistfiller.h" #include "honlinephysicsmon.h" #include "htboxdetector.h" #include "hrecevent.h" #include "hpartialevent.h" #include "hstartdetector.h" #include "hstartunpacker.h" #include "hlatchunpacker.h" #include "htboxunpacker.h" #include "hstartcalibrater.h" #include "hstarthitf.h" #include "hstarthitfproton.h" #include "hhododetector.h" #include "hhodounpacker.h" #include "hhodotrbunpacker.h" #include "hhodocalibrater.h" #include "hhodohitffiber.h" #include "hhodohitfdiamond.h" #include "hhodohit2start.h" #include "hwalldetector.h" #include "hwalltrbunpacker.h" #include "hwallcalibrater.h" #include "hwallhitf.h" #include "hwallonehitf.h" #include "hrichdetector.h" #include "hrichunpacker.h" #include "hrichanalysis.h" #include "honlinerichpattern.h" #include "hmdcdetector.h" #include "hmdcsetup.h" #include "hmdctaskset.h" #include "htask.h" #include "hmdcunpacker.h" #include "hmdccalibrater1.h" #include "hmdclookuptb.h" #include "hmdc34clfinder.h" #include "hmdctrackdset.h" #include "hmdctrackfinder.h" #include "htofdetector.h" #include "htofunpacker.h" #include "htofhitf.h" #include "htofclusterf.h" #include "htofinodetector.h" #include "htofinounpacker.h" #include "htofinocalibrater.h" #include "hshowertofinocorrelator.h" #include "hshowerdetector.h" #include "hshowerunpacker.h" #include "hshowerunpackparam.h" #include "hshowercalibrater.h" #include "hshowerhitfinder.h" #include "hshowergeometry.h" #include "hshowercalpar.h" #include "hshowerhitfpar.h" #include "hsplinetrackF2.h" #include "hmetamatchF2.h" #include "hsplinetaskset.h" #include "hmdcdef.h" #include "honlinemonhist.h" #include "honlinetrendhist.h" #include "honlinehistarray.h" #include "TList.h" #include "hldsockremotesource.h" #include "hldfilesource.h" #include "hldgrepfilesource.h" #include "hldsource.h" #include "horainfo.h" #include "hparrootfileio.h" #include "hparasciifileio.h" #include "hadascii.h" #include "hmessagemgr.h" #include "hevent.h" #include "hcategory.h" #include #include ClassImp(HOnlineServer) Bool_t HOnlineServer::kINIT=kFALSE; Int_t HOnlineServer::fCount =0; Int_t HOnlineServer::nLoop =100; HOnlineParam* HOnlineServer::onlineparam=0; HOnlineConfig* HOnlineServer::onlineconfig=0; HOnlineHadesPar* HOnlineServer::hadespar=0; HOnlineStartHistBooker* HOnlineServer::Starthistbooker=0; TList* HOnlineServer::StartactiveHists=0; HOnlineRichHistBooker* HOnlineServer::Richhistbooker=0; TList* HOnlineServer::RichactiveHists=0; HOnlineRichPattern* HOnlineServer::richpattern=0; HOnlineRichFancy* HOnlineServer::richfancy=0; HOnlineMdcHistBooker* HOnlineServer::Mdchistbooker=0; TList* HOnlineServer::MdcactiveHists=0; HOnlineTofHistBooker* HOnlineServer::Tofhistbooker=0; TList* HOnlineServer::TofactiveHists=0; HOnlineTofinoHistBooker* HOnlineServer::Tofinohistbooker=0; TList* HOnlineServer::TofinoactiveHists=0; HOnlineHodoHistBooker* HOnlineServer::Hodohistbooker=0; TList* HOnlineServer::HodoactiveHists=0; HOnlineWallHistBooker* HOnlineServer::Wallhistbooker=0; TList* HOnlineServer::WallactiveHists=0; HOnlineShowerHistBooker* HOnlineServer::Showerhistbooker=0; TList* HOnlineServer::ShoweractiveHists=0; HOnlinePhysicsHistBooker* HOnlineServer::Physicshistbooker=0; TList* HOnlineServer::PhysicsactiveHists=0; HOnlineServer::HOnlineServer(){ // put default values //---------- Grep source parameter -------------------------- distToLast = 2; //! last file - distToLast will be taken timeOffset = 10; //! offset in seconds required to t_current interval = 5; //! time interval in seconds for grep on dir //----------------------------------------------------------- fxTreeSize=500000; // 500kbytes fxRefreshNb=100; // refresh after 100 evt fxReset=0; fxDump=kFALSE; timer = new TStopwatch(); fbInit = kFALSE; spec = gHades->getSetup(); rtdb = gHades->getRuntimeDb(); } Bool_t HOnlineServer::createOnlineHists() { //########################### GLOBAL ################################################ hadespar=new HOnlineHadesPar("HadesParameter","HadesParameter"); onlineconfig= new HOnlineConfig("OnlineConfig","OnlineConfig","OnlineConfigProduction"); hadesconfig=new HOnlineHadesConfigParameter("Hadesconfig","Hadesconfig"); onlineparam=hadesconfig->getPar(); addParameter(hadesconfig); reset=new HOnlineResetParameter("HistReset","HistReset"); reset->setInit(kTRUE); addParameter(reset); //########################### START ################################################# Starthistbooker =new HOnlineStartHistBooker("StartHistBooker","StartHistBooker","StartHistBookerProduction"); StartactiveHists =Starthistbooker->getListOfActiveHists(); //########################### RICH ################################################## Richhistbooker =new HOnlineRichHistBooker("RichHistBooker","RichHistBooker","RichHistBookerProduction"); RichactiveHists =Richhistbooker->getListOfActiveHists(); //########################### MDC ################################################### Mdchistbooker =new HOnlineMdcHistBooker("MdcHistBooker","MdcHistBooker","MdcHistBookerProduction"); MdcactiveHists =Mdchistbooker->getListOfActiveHists(); mdcActive =new HOnlineMdcActiveParameter("MdcActiveHists","MdcActiveHists"); addParameter(mdcActive); //########################### TOF ################################################### Tofhistbooker =new HOnlineTofHistBooker("TofHistBooker","TofHistBooker","TofHistBookerProduction"); TofactiveHists =Tofhistbooker->getListOfActiveHists(); //########################### TOFINO ################################################ Tofinohistbooker =new HOnlineTofinoHistBooker("TofinoHistBooker","TofinoHistBooker","TofinoHistBookerProduction"); TofinoactiveHists =Tofinohistbooker->getListOfActiveHists(); //########################### HODO ################################################ Hodohistbooker =new HOnlineHodoHistBooker("HodoHistBooker","HodoHistBooker","HodoHistBookerProduction"); HodoactiveHists =Hodohistbooker->getListOfActiveHists(); //########################### WALL ################################################ Wallhistbooker =new HOnlineWallHistBooker("WallHistBooker","WallHistBooker","WallHistBookerProduction"); WallactiveHists =Wallhistbooker->getListOfActiveHists(); //########################### SHOWER ################################################ Showerhistbooker =new HOnlineShowerHistBooker("ShowerHistBooker","ShowerHistBooker","ShowerHistBookerProduction"); ShoweractiveHists=Showerhistbooker->getListOfActiveHists(); //########################### PHYSICS ################################################ Physicshistbooker =new HOnlinePhysicsHistBooker("PhysicsHistBooker","PhysicsHistBooker","PhysicsHistBookerProduction"); PhysicsactiveHists=Physicshistbooker->getListOfActiveHists(); physicsActive =new HOnlinePhysicsActiveParameter("PhysicsActiveHists","PhysicsActiveHists"); addParameter(physicsActive); return kTRUE; } Bool_t HOnlineServer::readConfig(){ //read some parameters if (!readAscii((Char_t*)ConfigInput.Data())) return kFALSE; else return kTRUE; } Bool_t HOnlineServer::setDataSource(){ if( kEvtRemote == 0 ){ sourceFile = new HldFileSource; sourceFile->setDirectory((Text_t*) inDir->Data()); sourceFile->addFile((Text_t*) inFile->Data(),refrunID); gHades->setDataSource(sourceFile); } else if ( kEvtRemote == 1 ){ sourceR = new HldSockRemoteSource((Text_t*)eventHost->Data()); sourceR->setRefId(refrunID); gHades->setDataSource(sourceR); } else if ( kEvtRemote == 2 ){ //HldGrepFileSource::setDistToLast(distToLast); sourceGrep = new HldGrepFileSource(*inDir,"Grep",interval,refrunID,timeOffset); gHades->setDataSource(sourceGrep); } return kTRUE; } Bool_t HOnlineServer::initEventClasses(){ onlineconfig->initStandAlone(); if(hadesconfig->hasChanged()) { // do this everytime except the first time onlineparam->setupMdcDetector(); onlineparam->setupStartDetector(); onlineparam->setupHodoDetector(); } if(!hadesconfig->hasChanged()) { // do this only first time onlineparam->copySet(onlineconfig->getOnlineParam()); onlineparam->setupMdcDetector(); onlineparam->setupStartDetector(); onlineparam->setupHodoDetector(); HMdcSetup* myset=hadesconfig->getMdcSet(); Int_t Layers[6][4]={{6,6,6,6},{6,6,6,6},{6,6,6,6},{6,6,6,6},{6,6,6,6},{6,6,6,6}}; Int_t Level[4]={10,50,10,30}; myset->getMdcCalibrater1Set() ->setMdcCalibrater1Set(1,1); myset->getMdcTrackFinderSet() ->setMdcTrackFinderSet(kFALSE,0,&Layers[0][0],&Level[0]); myset->getMdcClusterToHitSet()->setMdcClusterToHitSet(1,3); myset->getMdc12FitSet() ->setMdc12FitSet(2,1,1,kFALSE,kFALSE); myset->getMdcCommonSet() ->setMdcCommonSet(0,3,1); myset->getMdcDigitizerSet()->setTdcModeDigi (2); myset->getMdcDigitizerSet()->setNtupleDigi (kFALSE); myset->getMdcDigitizerSet()->setUseTofDigi (kTRUE); myset->getMdcDigitizerSet()->setUseErrorDigi (kTRUE); myset->getMdcDigitizerSet()->setUseWireOffsetDigi(kTRUE); myset->getMdcDigitizerSet()->setEmbeddingModeDigi(1); myset->getMdcDigitizerSet()->setNoiseModeDigi (1); myset->getMdcDigitizerSet()->setNoiseOffDigi (0); myset->getMdcDigitizerSet()->setNoiseLevelDigi (0,0,0,0); myset->getMdcDigitizerSet()->setNoiseRangeDigi (0,0,0,0,0,0,0,0); myset->getMdcDigitizerSet()->setOffsetsOffDigi (0); myset->getMdcDigitizerSet()->setOffsetsDigi (0,0,0,0); myset->getMdcDigitizerSet()->setCellEffOffDigi (1); myset->getMdcDigitizerSet()->setCellEffDigi (88,88,88,88); hadesconfig->getMdcSet()->getMdcCommonSet()->setAnalysisLevel(onlineparam->getMdcLevel()); } hadesconfig->print(); return kTRUE; } Bool_t HOnlineServer::createUnpackers() { if( kEvtRemote ==0 ) source=(HldSource*) sourceFile; if( kEvtRemote ==1 ) source=(HldSource*) sourceR; if( kEvtRemote ==2 ) source=(HldSource*) sourceGrep; if(onlineparam->getStart()==1) { TArrayI* myunp=onlineparam->getStartUnp(); for(Int_t i=0; iGetSize(); i++){ source->addUnpacker( new HStartUnpacker(myunp->At(i)));} source->addUnpacker(new HLatchUnpacker(myunp->At(0))); source->addUnpacker(new HTBoxUnpacker(myunp->At(0))); } if(onlineparam->getRich()==1) { TArrayI* myunp=onlineparam->getRichUnp(); for(Int_t i=0; iGetSize(); i++){ if(onlineparam->getRichRaw()==1)source->addUnpacker( new HRichUnpacker(myunp->At(i)) ); } } if(onlineparam->getMdc()==1) { HMdcUnpacker* pUnpackers[24]; TArrayI* myunp=onlineparam->getMdcUnp(); for(Int_t i=0; iGetSize(); i++){ pUnpackers[i]=new HMdcUnpacker(myunp->At(i),kTRUE,kFALSE); pUnpackers[i]->setDecodeVersion(1); pUnpackers[i]->setQuietMode(kTRUE); pUnpackers[i]->setContinueDecodingAfterInconsistency(kTRUE); source->addUnpacker(pUnpackers[i]);} } if(onlineparam->getTof()==1) { TArrayI* myunp=onlineparam->getTofUnp(); for(Int_t i=0; iGetSize(); i++){ source->addUnpacker( new HTofUnpacker(myunp->At(i)) );} } if(onlineparam->getTofino()==1) { TArrayI* myunp=onlineparam->getTofinoUnp(); for(Int_t i=0; iGetSize(); i++){ source->addUnpacker( new HTofinoUnpacker(myunp->At(i)) );} } if(onlineparam->getHodo()==1) { TArrayI* myunp=onlineparam->getHodoUnp(); for(Int_t i=0; iGetSize(); i++){ // Note: The whole unpacker and subevt id stuff is crap // The decition which unpacker should be called should not be hardcoded. // This workaround is _maybe_ not needed because Hodo will // probably never run again with a v1190 board if( myunp->At(i)>=800 && myunp->At(i)<900){ // Using TRB Board unpacker HHodoTrbUnpacker* hodounp=new HHodoTrbUnpacker(myunp->At(i)); hodounp->setQuietMode(); source->addUnpacker(hodounp); }else if(myunp->At(i)>600){ // Using V1190 unpacker source->addUnpacker( new HHodoUnpacker(myunp->At(i)) ); }// else <=0 do nothing } } if(onlineparam->getWall()==1) { TArrayI* myunp=onlineparam->getWallUnp(); for(Int_t i=0; iGetSize(); i++){ // Using TRB Board unpacker HWallTrbUnpacker* wallunp=new HWallTrbUnpacker(myunp->At(i)); wallunp->setQuietMode(); source->addUnpacker(wallunp); } } if(onlineparam->getShower()==1) { TArrayI* myunp=onlineparam->getShowerUnp(); for(Int_t i=0; iGetSize(); i++){ source->addUnpacker( new HShowerUnpacker(myunp->At(i)) );} } return kTRUE; } Bool_t HOnlineServer::createTaskList() { HTaskSet* startTasks = new HTaskSet("Start","List of Start tasks"); HTaskSet* startCalTasks = new HTaskSet("Start","List of cal Start tasks"); HTaskSet* richTasks = new HTaskSet("Rich","List of Rich tasks"); HTaskSet* mdcTasks = new HTaskSet("Mdc", "List of mdc tasks"); HTaskSet* tofTasks = new HTaskSet("Tof","List of Tof tasks"); HTaskSet* tofinoTasks = new HTaskSet("Tofino","List of Tofino tasks"); HTaskSet* tofinoMonTasks = new HTaskSet("TofinoMon","List of Tofino Mon tasks"); HTaskSet* hodoTasks = new HTaskSet("Hodo","List of Hodo tasks"); HTaskSet* wallTasks = new HTaskSet("Wall","List of Wall tasks"); HTaskSet* showerTasks = new HTaskSet("Shower", "List of Shower tasks"); HTaskSet* physicsTasks = new HTaskSet("Physics", "List of Physics tasks"); HTaskSet* mdcCalTasks = new HTaskSet("Mdc", "List of mdc cal tasks"); if(onlineparam->getStart()==1) { //--------------------START------------------------------------- if(onlineparam->getStartCal()==1)startTasks->add( new HStartCalibrater("start.cal","Start cal") ); if(onlineparam->getStartHit()==1) { TArrayI* startset=onlineparam->getStartDetSetup(); if((*startset)[0]==1||(*startset)[1]==1||(*startset)[2]==1) { startTasks->add( new HStartHitF("start.hitf","Start hitf") ); } if((*startset)[3]==1||(*startset)[4]==1||(*startset)[5]==1) { startTasks->add( new HStartHitFProton("start.hitf","Start hitf") ); } } startTasks->add(new HOnlineStartMon("start.mon","start.mon")); Starthistbooker->initStandAlone(); startCalTasks->add(new HOnlineStartCalibrationMon("start.moncal","start.moncal")); } if(onlineparam->getHodo()==1) { //--------------------Hodo------------------------------------ if(onlineparam->getHodoCal()==1) hodoTasks->add( new HHodoCalibrater("hodo.cal","hodo") ); if(onlineparam->getHodoHit()==1){ HHodoHitFFiber *tf; HHodoHitFDiamond *td; for(Int_t i=0; igetHodoHitf())[i]){ case 1: tf=new HHodoHitFFiber("hodo.hitfiber","hodo"); tf->set_mod(i); hodoTasks->add(tf); break; case 2: td=new HHodoHitFDiamond("hodo.hitdiamond","hodo"); td->set_mod(i); hodoTasks->add(td); break; default:// 0 or nothing break; } } if(onlineparam->getHodoHit2Start()>=0){ HHodoHit2Start *t; t=new HHodoHit2Start("hodo.hit2start","Hodo hit2start"); t->set_mod(onlineparam->getHodoHit2Start()); hodoTasks->add(t); } } hodoTasks->add(new HOnlineHodoMon("hodo.mon","hodo.mon")); Hodohistbooker->initStandAlone(); } if(onlineparam->getRich()==1) { //--------------------Rich--------------------------------------- if(onlineparam->getRichHit()==1)richTasks->add(new HRichAnalysis("rich.ana","Ring finder",kFALSE)); richTasks->add(new HOnlineRichMon("rich.mon","rich.mon")); Richhistbooker->initStandAlone(); } if(onlineparam->getMdc()==1) { //--------------------MDC--------------------------------------- HMdcTaskSet *mymdctasks=new HMdcTaskSet(); mymdctasks->getMdcSetup()->copySet(hadesconfig->getMdcSet()); //- New version of cluster finder -// HMdcLookUpTb::setUseFloatLevel(); HMdc34ClFinder::setUseFloatLevel(); mdcTasks = (HTaskSet*)(mymdctasks->make("",""));//read cal parameters from file mdcTasks->add(new HOnlineMdcMon("mdc.mon","mdc.mon")); Mdchistbooker->initStandAlone(); mdcActive->setInit(kTRUE); mdcCalTasks->add(new HOnlineMdcCalibrationMon("mdccal.mon","mdccal.mon")); } if(onlineparam->getTof()==1) { //--------------------TOF---------------------------------------- if(onlineparam->getTofHit()==1) { tofTasks->add( new HTofHitF("tof.hitf","tof.hitf") ); tofTasks->add( new HTofClusterF("tof.clusf","tof.clusf") ); } tofTasks->add(new HOnlineTofMon("tof.mon","tof.mon")); Tofhistbooker->initStandAlone(); } if(onlineparam->getTofino()==1) { //--------------------Tofino------------------------------------ if(onlineparam->getTofinoCal()==1)tofinoTasks->add( new HTofinoCalibrater("tofino.cal","tofino") ); if(onlineparam->getShowerTofino()==1)tofinoTasks->add(new HShowerTofinoCorrelator("showtofino.cor","tofinoshower") ); tofinoMonTasks->add(new HOnlineTofinoMon("tofino.mon","tofino.mon")); Tofinohistbooker->initStandAlone(); } if(onlineparam->getWall()==1) { //--------------------Wall------------------------------------ if(onlineparam->getWallCal()==1) wallTasks->add( new HWallCalibrater("wall.cal","wall") ); if(onlineparam->getWallHit()==1){ wallTasks->add( new HWallOneHitF("wall.onehitf","wall.onehitf")); wallTasks->add( new HWallHitF("wall.hitf","wall.hitf")); } wallTasks->add(new HOnlineWallMon("wall.mon","wall.mon")); Wallhistbooker->initStandAlone(); } if(onlineparam->getShower()==1) { //--------------------Shower------------------------------------ if(onlineparam->getShowerCal()==1)showerTasks->add(new HShowerCalibrater("sho.cal","sho.cal")); if(onlineparam->getShowerHit()==1)showerTasks->add(new HShowerHitFinder("sho.hitf","sho.hitf")); // if(onlineparam->getShowerTofino()==1)showerTasks->add(new HShowerTofinoCorrelator("showtofino.cor","tofinoshower") ); showerTasks->add(new HOnlineShowerMon("shower.mon","shower.mon")); Showerhistbooker->initStandAlone(); } if(onlineparam->getPhysics()==1) { //--------------------Physics------------------------------------ HSplineTaskSet *splineTaskSet = new HSplineTaskSet("",""); //HTask *splineTasks = splineTaskSet ->make("","spline,reslowb,&old,tofclust,runge"); // all tracking tasks HTask *splineTasks = splineTaskSet ->make("","spline"); // all tracking tasks physicsTasks->add(splineTasks); physicsTasks->add(new HOnlinePhysicsMon("physics.mon","physics.mon")); Physicshistbooker->initStandAlone(); } HTaskSet *masterTaskSet = gHades->getTaskSet("real"); if(onlineparam->getStart() ==1) masterTaskSet->add(startTasks); if(onlineparam->getHodo() ==1) masterTaskSet->add(hodoTasks); if(onlineparam->getWall() ==1) masterTaskSet->add(wallTasks); if(onlineparam->getRich() ==1) masterTaskSet->add(richTasks); if(onlineparam->getMdc() ==1) masterTaskSet->add(mdcTasks); if(onlineparam->getTof() ==1) masterTaskSet->add(tofTasks); if(onlineparam->getShower() ==1) masterTaskSet->add(showerTasks); if(onlineparam->getTofino() ==1) masterTaskSet->add(tofinoTasks); if(onlineparam->getTofino() ==1) masterTaskSet->add(tofinoMonTasks); if(onlineparam->getPhysics()==1) masterTaskSet->add(physicsTasks); if(onlineparam->getMdc()==1){ HMdcTrackFinder* trackfinder = HMdcTrackDSet::getMdcTrackFinder(); if(trackfinder) { trackfinder->setMetaMatchFlag(kFALSE,kFALSE); // no metamatching, no metamacth plots } } HTaskSet *calibrationTaskSet = gHades->getTaskSet("calibration"); if(onlineparam->getMdc()==1) calibrationTaskSet->add(mdcCalTasks); if(onlineparam->getStart()==1) calibrationTaskSet->add(startCalTasks); // if(onlineparam->getHodo()==1) calibrationTaskSet->add(hodoTasks); // if(onlineparam->getWall()==1) calibrationTaskSet->add(wallTasks); return kTRUE; } HOnlineServer::~HOnlineServer(){ if (gHades) {delete gHades; gHades=0;} } Int_t HOnlineServer::initDetectorSetup(){ // Detectors setup configuration Int_t richMods[1] = {1}; Int_t mdcMods[6][4] = {{1,1,1,1}, {1,1,1,1}, {1,1,1,1}, {1,1,1,1}, {1,1,1,1}, {1,1,1,1} }; Int_t tofMods[22] = {1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0}; Int_t showerMods[3] = {1,2,3}; Int_t tofinoMods[6][1]= { {1},{1},{1},{1},{1},{1} }; Int_t startMods[6] = {0,0,0,1,1,1}; Int_t hodoMods[4] = {1,1,1,1};// why is this crap hardcoded here? Int_t trigMods[1] = {1}; Int_t wallMods[1] = {1}; HSpectrometer* spec = gHades->getSetup(); spec->addDetector(new HStartDetector); spec->addDetector(new HRichDetector); spec->addDetector(new HMdcDetector); spec->addDetector(new HTofDetector); spec->addDetector(new HTofinoDetector); spec->addDetector(new HHodoDetector); spec->addDetector(new HWallDetector); spec->addDetector(new HShowerDetector); spec->addDetector(new HTBoxDetector); spec->getDetector("Start")->setModules(-1,startMods); spec->getDetector("TBox") ->setModules( 0, trigMods); spec->getDetector("Hodo")->setModules(-1,hodoMods); spec->getDetector("Wall")->setModules(-1,wallMods); for (Int_t is=0; is<6; is++) { spec->getDetector("Rich")->setModules(is,richMods); spec->getDetector("Mdc")->setModules(is,mdcMods[is]); spec->getDetector("Tof")->setModules(is,tofMods); spec->getDetector("Tofino")->setModules(is,tofinoMods[is]); spec->getDetector("Shower")->setModules(is,showerMods); } return 0; } Int_t HOnlineServer::initParams(){ FirstInput ->ReplaceAll(" ",""); SecondInput->ReplaceAll(" ",""); FirstInput ->ToLower(); SecondInput->ToLower(); if(FirstInput->CompareTo("ascii")==0) { HParAsciiFileIo* input1= new HParAsciiFileIo(); input1->open((Text_t*) ParFile->Data(),"in"); rtdb->setFirstInput(input1); } else if(FirstInput->CompareTo("root")==0) { HParRootFileIo *input1=new HParRootFileIo; input1->open( ParFile->Data(),"READ"); rtdb->setFirstInput(input1); } else if(FirstInput->CompareTo("ora")==0) { HParOraIo *input1 =new HParOraIo(); input1->open(); rtdb->setFirstInput(input1); input1->setHistoryDate("now"); if( kEvtRemote ==1&& refrunID==-1){ HOraInfo* oracleInfo = input1->getOraInfo(); refrunID = oracleInfo->getLastRun((Text_t*)Beamtime->Data()); sourceR->setRefId(refrunID); } } else {Warning("HOnlineServer::initParams()","FirstInput not set!");} if(SecondInput->CompareTo("ascii")==0) { HParAsciiFileIo* input2= new HParAsciiFileIo(); input2->open((Text_t*) ParFile2->Data(),"in"); rtdb->setSecondInput(input2); } else if(SecondInput->CompareTo("root")==0) { HParRootFileIo *input2=new HParRootFileIo; input2->open((Text_t*) ParFile2->Data(),"READ"); rtdb->setSecondInput(input2); } else if(SecondInput->CompareTo("ora")==0) { HParOraIo *input2 =new HParOraIo(); input2->open(); rtdb->setSecondInput(input2); input2->setHistoryDate("now"); if( kEvtRemote ==1&& refrunID==-1){ HOraInfo* oracleInfo = input2->getOraInfo(); refrunID = oracleInfo->getLastRun((Text_t*)Beamtime->Data()); sourceR->setRefId(refrunID); } } else {Warning("HOnlineServer::initParams()","SecondInput not set!");} kINIT=kTRUE; return 0; } Int_t HOnlineServer::eventLoop(HOnlineClientServerCom* clientservercom) { Int_t stat= gHades->eventLoop(1); if (stat <= 0 ){ return -1; } //---------------------------SENDING TO GUI----------------------------- //---------------------------START-------------------------------------- if(onlineparam->getStart()==1) { if(((fCount)%onlineparam->getStartRefresh()) == 0 ) { Starthistbooker->getStartFiller()->fillTrend(); TIterator* myiter=StartactiveHists->MakeIterator(); HOnlineMonHistAddon* h=0; while ((h=(HOnlineMonHistAddon*)myiter->Next())!= 0) { if(h->getSend()==1) { // if hist is in histpool, don't add it if ( (histpool.FindObject(h->GetName())) == 0 ) { histpool.Add(h); } } } delete myiter; Starthistbooker->resetActiveList(2,fCount); } } //---------------------------RICH--------------------------------------- if(onlineparam->getRich()==1) { if(((fCount)%onlineparam->getRichRefresh()) == 0 ) { Richhistbooker->getRichFiller()->fillTrend(); TIterator* myiter=RichactiveHists->MakeIterator(); HOnlineMonHistAddon* h=0; while ((h=(HOnlineMonHistAddon*)myiter->Next())!= 0) { if(h->getSend()==1) { // if hist is in histpool, don't add it if ( (histpool.FindObject(h->GetName())) == 0 ) { histpool.Add(h); } } } delete myiter; Richhistbooker->resetActiveList(2,fCount); } } //--------------------------MDC------------------------------------------- if(onlineparam->getMdc()==1) { if(((fCount)%onlineparam->getMdcRefresh()) == 0 ) { Mdchistbooker->getMdcFiller()->fillTrend(); Mdchistbooker->getMdcFiller()->fillCutStat(); Mdchistbooker->getMdcFiller()->fillMdcConfig(fCount); //SendObjectToGUI((TNamed*)Mdchistbooker->getMdcFiller()->getMdcLookup()); TIterator* myiter=MdcactiveHists->MakeIterator(); HOnlineMonHistAddon* h=0; while ((h=(HOnlineMonHistAddon*)myiter->Next())!= 0) { if(h->getSend()==1) { // if hist is in histpool, don't add it if ( (histpool.FindObject(h->GetName())) == 0 ) { histpool.Add(h); } } } //SendObjectToGUI((TNamed*)Mdchistbooker->getMdcFiller()->getMdcConfig()); Mdchistbooker->resetActiveList(2,fCount); delete myiter; } } //--------------------------TOF------------------------------------------- if(onlineparam->getTof()==1) { if(((fCount)%onlineparam->getTofRefresh()) == 0 ) { Tofhistbooker->getTofFiller()->fillTrend(); TIterator* myiter=TofactiveHists->MakeIterator(); HOnlineMonHistAddon* h=0; while ((h=(HOnlineMonHistAddon*)myiter->Next())!= 0) { if(h->getSend()==1) { // if hist is in histpool, don't add it if ( (histpool.FindObject(h->GetName())) == 0 ) { histpool.Add(h); } } } Tofhistbooker->resetActiveList(2,fCount); delete myiter; } } //--------------------------TOFINO------------------------------------------- if(onlineparam->getTofino()==1) { if(((fCount)%onlineparam->getTofinoRefresh()) == 0 ) { Tofinohistbooker->getTofinoFiller()->fillTrend(); TIterator* myiter=TofinoactiveHists->MakeIterator(); HOnlineMonHistAddon* h=0; while ((h=(HOnlineMonHistAddon*)myiter->Next())!= 0) { if(h->getSend()==1) { // if hist is in histpool, don't add it if ( (histpool.FindObject(h->GetName())) == 0 ) { histpool.Add(h); } } } Tofinohistbooker->resetActiveList(2,fCount); delete myiter; } } //--------------------------HODO------------------------------------------- if(onlineparam->getHodo()==1) { if(((fCount)%onlineparam->getHodoRefresh()) == 0 ) { Hodohistbooker->getHodoFiller()->fillTrend(); TIterator* myiter=HodoactiveHists->MakeIterator(); HOnlineMonHistAddon* h=0; while ((h=(HOnlineMonHistAddon*)myiter->Next())!= 0) { if(h->getSend()==1) { // if hist is in histpool, don't add it if ( (histpool.FindObject(h->GetName())) == 0 ) { histpool.Add(h); } } } Hodohistbooker->resetActiveList(2,fCount); delete myiter; } } //--------------------------WALL------------------------------------------- if(onlineparam->getWall()==1) { if(((fCount)%onlineparam->getWallRefresh()) == 0 ) { Wallhistbooker->getWallFiller()->fillTrend(); TIterator* myiter=WallactiveHists->MakeIterator(); HOnlineMonHistAddon* h=0; while ((h=(HOnlineMonHistAddon*)myiter->Next())!= 0) { if(h->getSend()==1) { // if hist is in histpool, don't add it if ( (histpool.FindObject(h->GetName())) == 0 ) { histpool.Add(h); } } } Wallhistbooker->resetActiveList(2,fCount); delete myiter; } } //--------------------------SHOWER------------------------------------------- if(onlineparam->getShower()==1) { if(((fCount)%onlineparam->getShowerRefresh()) == 0 ) { Showerhistbooker->getShowerFiller()->fillTrend((fCount)%1000); Showerhistbooker->getShowerFiller()->fillShowerConfig(fCount); TIterator* myiter=ShoweractiveHists->MakeIterator(); HOnlineMonHistAddon* h=0; while ((h=(HOnlineMonHistAddon*)myiter->Next())!= 0) { if(h->getSend()==1) { // if hist is in histpool, don't add it if ( (histpool.FindObject(h->GetName())) == 0 ) { histpool.Add(h); } } } Showerhistbooker->resetActiveList(1,fCount); delete myiter; Showerhistbooker->getShowerFiller()->resetHits(); } } //--------------------------Physics------------------------------------------- if(onlineparam->getPhysics()==1) { if(((fCount)%onlineparam->getPhysicsRefresh()) == 0 ) { TIterator* myiter=PhysicsactiveHists->MakeIterator(); HOnlineMonHistAddon* h=0; while ((h=(HOnlineMonHistAddon*)myiter->Next())!= 0) { if(h->getSend()==1) { // if hist is in histpool, don't add it if ( (histpool.FindObject(h->GetName())) == 0 ) { histpool.Add(h); } } } Physicshistbooker->resetActiveList(2,fCount); delete myiter; } } //----------------------------------------------------------------------- //----------------------------------------------------------------------- // process client requests and send histos to client stat = clientservercom ->processClients(histpool); //----------------------------------------------------------------------- ++fCount; return stat; } Bool_t HOnlineServer::readAscii(const Char_t *fileName){ Bool_t status = kTRUE; try { cout<<"############### HADES ONLINE CONFIG ############################"<