#include "htriggerparmommap.h"
#include "hades.h"
#include "hruntimedb.h"
#include "hspectrometer.h"
#include "htriggerdetector.h"
#include "hpario.h"
#include "hdetpario.h"
#include "hmessagemgr.h"
ClassImp(HTriggerParMomMap)
void HTriggerParMomMap::setDefaults(void)
{
for (Int_t xx=0; xx < 63; xx++)
{
for (Int_t yy=0; yy < 63; yy++)
{
for (Int_t zz=0; zz < 7; zz++)
{
mu_mom[xx][yy][zz]=0;
}
}
}
}
HTriggerParMomMap::HTriggerParMomMap(const Char_t* name,const Char_t* title, const Char_t* context)
: HParSet(name,title,context)
{
strcpy(detName,"Trigger");
}
HTriggerParMomMap::~HTriggerParMomMap(void)
{
}
Bool_t HTriggerParMomMap::init(HParIo* inp,Int_t* set)
{
HDetParIo* input=inp->getDetParIo("HTriggerParIo");
if (input) return (input->init(this,set));
return kFALSE;
}
Int_t HTriggerParMomMap::write(HParIo* output)
{
HDetParIo* out=output->getDetParIo("HTriggerParIo");
if (out) return out->write(this);
return -1;
}
void HTriggerParMomMap::clear()
{
setDefaults();
status=kFALSE;
resetInputVersions();
}
void HTriggerParMomMap::readline(const Char_t *buf, Int_t *set)
{
Int_t th,ph,Delta_th;
Int_t theta,phi,Delta_theta;
Float_t mom;
mom = -111;
sscanf(buf,"%i%i%i%f",&th,&Delta_th,&ph,&mom);
if (mom == -111)
{
theta =th;
phi=ph;
Delta_theta=th;
setTheta_bins(th);
setDeltatheta_bins(Delta_th);
setPhi_bins(ph);
gHades->getMsg()->debug(1,HMessageMgr::DET_TRIGGER,GetName(),"%s %i %s %i %s %i",
"READLINE theta bins",th,"delta theta bins",Delta_th,"phi bins",ph);
}
else
{
if(getTheta_bins()>63||getDeltatheta_bins()>63||getPhi_bins()>7)
{
ERROR_msg(HMessageMgr::DET_TRIGGER,"readline():: array out of bounds! skipp!");
return;
}
if( (Delta_th > -1) && (Delta_th < getTheta_bins() )
&& (th > -1) && (th < getDeltatheta_bins() )
&& (ph > -1) && (ph < getPhi_bins() ) )
{
setMom(th,Delta_th,ph,mom);
}
else
{
ERROR_msg(HMessageMgr::DET_TRIGGER,"variables not properly set");
}
}
}
void HTriggerParMomMap::putAsciiHeader(TString& header)
{
header=
"# Parameters for the MU Momentum Mapping\n"
"# Format:\n"
"# theta bins Delta_theta bins phi bins\n"
"# theta Delta_theta phi momentum\n";
}
Bool_t HTriggerParMomMap::writeline(Char_t *buf,Int_t s, Int_t m, Int_t c)
{
if(s>63||m>63||c>7)
{
ERROR_msg(HMessageMgr::DET_TRIGGER,"writeline():: array out of bounds! skipp!");
return kFALSE;
}
sprintf(buf,"%i %i %i %f\n",s,m,c,getMom(s,m,c));
return kTRUE;
}
Bool_t HTriggerParMomMap::writesize(Char_t *buf)
{
sprintf(buf,"%i %i %i\n",getTheta_bins(),getDeltatheta_bins(),getPhi_bins());
return kTRUE;
}
void HTriggerParMomMap::printParam(void)
{
INFO_msg(10,HMessageMgr::DET_TRIGGER,"\n Parameters for the MU Momentun Mapping\n");
INFO_msg(10,HMessageMgr::DET_TRIGGER," Format:\n");
INFO_msg(10,HMessageMgr::DET_TRIGGER," theta bins Delta_theta bins phi bins\n");
INFO_msg(10,HMessageMgr::DET_TRIGGER," theta Delta_theta phi momentum\n");
SEPERATOR_msg("=",60);
gHades->getMsg()->info(10,HMessageMgr::DET_TRIGGER,GetName(),"%s %i %s %i %s %i",
"PRINTPARAM theta bins",getTheta_bins(),"delta theta bins",getDeltatheta_bins(),
"phi bins",getPhi_bins());
for (Int_t xx=0; xx < getTheta_bins(); xx++)
{
for (Int_t yy=0; yy< getDeltatheta_bins(); yy++)
{
for (Int_t zz=0; zz< getPhi_bins(); zz++)
{
if(xx>63||yy>63||zz>7)
{
ERROR_msg(HMessageMgr::DET_TRIGGER,"printParam():: array out of bounds! skipp!");
continue;
}
gHades->getMsg()->info(10,HMessageMgr::DET_TRIGGER,GetName(),"%i %s%i%s%i%s%f",
xx," ",yy," ",zz," ",getMom(xx,yy,zz));
}
}
}
SEPERATOR_msg("=",60);
}
Last change: Sat May 22 13:17:14 2010
Last generated: 2010-05-22 13:17
This page has been automatically generated. If you have any comments or suggestions about the page layout send a mail to ROOT support, or contact the developers with any questions or problems regarding ROOT.