#include <DybModifyProperties.h>
Inheritance diagram for DybModifyProperties:
Public Member Functions | |
DybModifyProperties (const std::string &name, ISvcLocator *pSvcLocator) | |
StatusCode | initialize () |
StatusCode | execute () |
StatusCode | finalize () |
virtual StatusCode | sysExecute () |
void | put (IDataProviderSvc *svc, DataObject *object, const std::string &address, const bool useRootInTES=true) const |
void | put (DataObject *object, const std::string &address, const bool useRootInTES=true) const |
Gaudi::Utils::GetData< TYPE >::return_type | get (IDataProviderSvc *svc, const std::string &location, const bool useRootInTES=true) const |
Gaudi::Utils::GetData< TYPE >::return_type | get (const std::string &location, const bool useRootInTES=true) const |
TYPE * | getDet (IDataProviderSvc *svc, const std::string &location) const |
TYPE * | getDet (const std::string &location) const |
bool | exist (IDataProviderSvc *svc, const std::string &location, const bool useRootInTES=true) const |
bool | exist (const std::string &location, const bool useRootInTES=true) const |
bool | existDet (IDataProviderSvc *svc, const std::string &location) const |
bool | existDet (const std::string &location) const |
TYPE * | getOrCreate (IDataProviderSvc *svc, const std::string &location, const bool useRootInTES=true) const |
TYPE * | getOrCreate (const std::string &location, const bool useRootInTES=true) const |
bool | registerContext () const |
INTupleSvc * | evtColSvc () const |
IAlgContextSvc * | contextSvc () const |
TOOL * | tool (const std::string &type, const std::string &name, const IInterface *parent=0, bool create=true) const |
TOOL * | tool (const std::string &type, const IInterface *parent=0, bool create=true) const |
SERVICE * | svc (const std::string &name, const bool create=true) const |
IUpdateManagerSvc * | updMgrSvc () const |
IDataProviderSvc * | fastContainersSvc () const |
StatusCode | Error (const std::string &msg, const StatusCode st=StatusCode::FAILURE, const size_t mx=10) const |
StatusCode | Warning (const std::string &msg, const StatusCode st=StatusCode::FAILURE, const size_t mx=10) const |
StatusCode | Print (const std::string &msg, const StatusCode st=StatusCode::SUCCESS, const MSG::Level lev=MSG::INFO) const |
StatusCode | Assert (const bool ok, const std::string &message="", const StatusCode sc=StatusCode(StatusCode::FAILURE, true)) const |
StatusCode | Assert (const bool ok, const char *message, const StatusCode sc=StatusCode(StatusCode::FAILURE, true)) const |
StatusCode | Exception (const std::string &msg, const GaudiException &exc, const StatusCode sc=StatusCode(StatusCode::FAILURE, true)) const |
StatusCode | Exception (const std::string &msg, const std::exception &exc, const StatusCode sc=StatusCode(StatusCode::FAILURE, true)) const |
StatusCode | Exception (const std::string &msg="no message", const StatusCode sc=StatusCode(StatusCode::FAILURE, true)) const |
MsgStream & | msgStream (const MSG::Level level) const |
MsgStream & | always () const |
MsgStream & | fatal () const |
MsgStream & | err () const |
MsgStream & | error () const |
MsgStream & | warning () const |
MsgStream & | info () const |
MsgStream & | debug () const |
MsgStream & | verbose () const |
MsgStream & | msg () const |
const Statistics & | counters () const |
StatEntity & | counter (const std::string &tag) const |
MSG::Level | msgLevel () const |
bool | msgLevel (const MSG::Level level) const |
void | resetMsgStream () const |
bool | typePrint () const |
bool | propsPrint () const |
bool | statPrint () const |
bool | errorsPrint () const |
long | printStat (const MSG::Level level=MSG::ALWAYS) const |
long | printErrors (const MSG::Level level=MSG::ALWAYS) const |
long | printProps (const MSG::Level level=MSG::ALWAYS) const |
void | registerCondition (const std::string &condition, StatusCode(CallerClass::*mf)()=NULL) |
void | registerCondition (const std::string &condition, CondType *&condPtrDest, StatusCode(CallerClass::*mf)()=NULL) |
void | registerCondition (char *condition, StatusCode(CallerClass::*mf)()=NULL) |
void | registerCondition (TargetClass *condition, StatusCode(CallerClass::*mf)()=NULL) |
StatusCode | runUpdate () |
TransientFastContainer< T > * | getFastContainer (const std::string &location, typename TransientFastContainer< T >::size_type initial=0) |
StatusCode | release (const IInterface *interface) const |
unsigned long | release () |
const std::string & | context () const |
const std::string & | rootInTES () const |
double | globalTimeOffset () const |
virtual StatusCode | sysStart () |
virtual StatusCode | sysInitialize () |
virtual StatusCode | sysReinitialize () |
virtual StatusCode | sysRestart () |
virtual StatusCode | sysStop () |
virtual StatusCode | sysFinalize () |
virtual StatusCode | sysBeginRun () |
virtual StatusCode | sysEndRun () |
virtual const std::string & | name () const |
virtual const std::string & | version () const |
virtual StatusCode | configure () |
virtual StatusCode | terminate () |
virtual StatusCode | start () |
virtual StatusCode | stop () |
virtual StatusCode | reinitialize () |
virtual StatusCode | restart () |
virtual bool | isExecuted () const |
virtual void | setExecuted (bool state) |
virtual void | resetExecuted () |
virtual StatusCode | beginRun () |
virtual StatusCode | endRun () |
virtual Gaudi::StateMachine::State | FSMState () const |
virtual Gaudi::StateMachine::State | targetFSMState () const |
virtual bool | isEnabled () const |
virtual bool | filterPassed () const |
virtual void | setFilterPassed (bool state) |
StatusCode | service (const std::string &name, T *&psvc, bool createIf=true) const |
StatusCode | service (const std::string &svcType, const std::string &svcName, T *&psvc) const |
void | setOutputLevel (int level) |
IAuditorSvc * | auditorSvc () const |
IChronoStatSvc * | chronoSvc () const |
IChronoStatSvc * | chronoStatService () const |
IDataProviderSvc * | detSvc () const |
IDataProviderSvc * | detDataService () const |
IConversionSvc * | detCnvSvc () const |
IConversionSvc * | detDataCnvService () const |
IDataProviderSvc * | eventSvc () const |
IDataProviderSvc * | evtSvc () const |
IDataProviderSvc * | eventDataService () const |
IConversionSvc * | eventCnvSvc () const |
IConversionSvc * | eventDataCnvService () const |
IHistogramSvc * | histoSvc () const |
IHistogramSvc * | histogramDataService () const |
IMessageSvc * | msgSvc () const |
IMessageSvc * | messageService () const |
INTupleSvc * | ntupleSvc () const |
INTupleSvc * | ntupleService () const |
IRndmGenSvc * | randSvc () const |
IToolSvc * | toolSvc () const |
IExceptionSvc * | exceptionSvc () const |
ISvcLocator * | serviceLocator () const |
ISvcLocator * | svcLoc () const |
StatusCode | createSubAlgorithm (const std::string &type, const std::string &name, Algorithm *&pSubAlg) |
std::vector< Algorithm * > * | subAlgorithms () const |
virtual StatusCode | setProperty (const Property &p) |
virtual StatusCode | setProperty (const std::string &s) |
virtual StatusCode | setProperty (const std::string &n, const std::string &v) |
StatusCode | setProperty (const std::string &name, const TYPE &value) |
virtual StatusCode | getProperty (Property *p) const |
virtual const Property & | getProperty (const std::string &name) const |
virtual StatusCode | getProperty (const std::string &n, std::string &v) const |
virtual const std::vector< Property * > & | getProperties () const |
StatusCode | setProperties () |
Property * | declareProperty (const std::string &name, T &property, const std::string &doc="none") const |
Property * | declareRemoteProperty (const std::string &name, IProperty *rsvc, const std::string &rname="") const |
IMonitorSvc * | monitorSvc () const |
void | declareInfo (const std::string &name, const T &var, const std::string &desc) const |
void | declareInfo (const std::string &name, const std::string &format, const void *var, int size, const std::string &desc) const |
unsigned long | addRef () |
StatusCode | queryInterface (const InterfaceID &riid, void **) |
Static Public Member Functions | |
static const InterfaceID & | interfaceID () |
static const InterfaceID & | interfaceID () |
static const InterfaceID & | interfaceID () |
Public Attributes | |
SUCCESS | |
NO_INTERFACE | |
VERSMISMATCH | |
LAST_ERROR | |
Protected Types | |
typedef std::map< std::string, StatEntity > | Statistics |
typedef std::map< std::string, unsigned int > | Counter |
typedef std::vector< IAlgTool * > | AlgTools |
typedef std::pair< IInterface *, std::string > | ServiceEntry |
typedef std::vector< ServiceEntry > | Services |
Protected Member Functions | |
StatusCode | releaseTool (const IAlgTool *tool) const |
StatusCode | releaseSvc (const IInterface *svc) const |
bool | isInitialized () const |
bool | isFinalized () const |
int | outputLevel () const |
IntegerProperty & | outputLevelProperty () |
void | initOutputLevel (Property &prop) |
Static Protected Attributes | |
static const bool | IgnoreRootInTES |
static const bool | UseRootInTES |
Private Types | |
typedef std::vector< std::string > | PropVector |
typedef std::map< std::string, PropVector > | PropMap |
Private Attributes | |
PropMap | m_PropMap |
Definition at line 15 of file DybModifyProperties.h.
typedef std::vector<std::string> DybModifyProperties::PropVector [private] |
Definition at line 30 of file DybModifyProperties.h.
typedef std::map<std::string,PropVector> DybModifyProperties::PropMap [private] |
Definition at line 32 of file DybModifyProperties.h.
DybModifyProperties::DybModifyProperties | ( | const std::string & | name, | |
ISvcLocator * | pSvcLocator | |||
) |
Definition at line 32 of file DybModifyProperties.cc.
00032 : 00033 GaudiAlgorithm(name, pSvcLocator), 00034 m_PropMap () 00035 { 00036 00037 // note that PropVector is vector of strings so parameter(s) are in quotes 00038 PropVector v; 00039 v.push_back("ABSLENGTH"); 00040 v.push_back("0.007"); 00041 m_PropMap[ "/dd/Materials/Water" ] = v; 00042 00043 // here is an example of how to change the Acrylic index of refraction to a new, constant value of 1.234 00044 // v.push_back("RINDEX"); 00045 // v.push_back("NEWCONSTANT"); 00046 // v.push_back("1.234") 00047 // m_PropMap[ "/dd/Materials/Acrylic" ] = v; 00048 00049 // Note that you cannot simultaneously change two properties of one material. 00050 00051 declareProperty("ModifyPropertyMap", 00052 m_PropMap, 00053 "Material, Property and parameter(s)"); 00054 }
StatusCode DybModifyProperties::initialize | ( | ) | [virtual] |
Reimplemented from GaudiAlgorithm.
Definition at line 157 of file DybModifyProperties.cc.
00158 { return StatusCode::SUCCESS; }
StatusCode DybModifyProperties::execute | ( | ) | [virtual] |
Reimplemented from GaudiAlgorithm.
Definition at line 58 of file DybModifyProperties.cc.
00059 { 00060 // only want to do this once 00061 static bool doneit = false; 00062 if ( doneit ) return StatusCode::SUCCESS; 00063 doneit = true; 00064 00065 debug() << " Hello from DybModifyProperties......" << endreq; 00066 for ( PropMap::iterator it = m_PropMap.begin(); it != m_PropMap.end() ; ++it ) 00067 { 00068 const std::string Name = (*it).first; 00069 debug() << " Name of material is " << Name << endreq; 00070 00071 DataObject* object; 00072 StatusCode sc = detSvc()->retrieveObject(Name, object); 00073 if ( !object ) { 00074 error() << "Failed to find DataObject with Name " << Name << endreq; 00075 return StatusCode::FAILURE; 00076 } 00077 00078 Material* mat = dynamic_cast<Material*>( &*object); 00079 if ( !mat ) { 00080 error() << "No material for object made from " << Name << endreq; 00081 return StatusCode::FAILURE; 00082 } 00083 00084 debug() << "+++++ Original contents of table for " << Name << endreq; 00085 mat->fillStream( debug() ); 00086 00087 PropVector pv = (*it).second; 00088 00089 00090 for ( SmartRefVector<TabulatedProperty>::const_iterator CIT = mat->tabulatedProperties().begin() ; 00091 CIT != mat->tabulatedProperties().end() ; ++CIT ) 00092 { if ( pv[0] == (*CIT)->type() ) // change this property 00093 // 00094 // There are currently two ways to change the property. 00095 // All values in the table can be changed to a new constant 00096 // or, if the property is ABSLENGTH, the water attenuation algorithm will be applied. 00097 // 00098 { 00099 if ( pv[1] == "NEWCONSTANT" ) 00100 { 00101 00102 double newc = atof(pv[2].c_str()); // should handle units correctly 00103 00104 for ( TabulatedProperty::Table::const_iterator j = ((*CIT)->table()).begin(); j != ((*CIT)->table()).end(); ++j ) 00105 { 00106 const double* V = &((*j).second); 00107 double* val = const_cast<double*> (V); 00108 *val = newc; 00109 } 00110 info() << "For " << Name << " changed all values of " << (*CIT)->type() << " to a constant = " << newc << endreq; 00111 00112 } 00113 else 00114 { 00115 // Apply the water attenuation algorithm of doc992 00116 00117 double a_at_200nm = atof(pv[1].c_str())/cm; // convert string to double 00118 double defa_at_200nm = 0.007/cm; // absorbance at 200nm used to construct table in xml file 00119 00120 double lmax = ((*CIT)->table())[0].second; // keep track of max absorption length before, after 00121 double lmax0 = lmax; 00122 double wlmax, wlmax0; 00123 for ( TabulatedProperty::Table::const_iterator j = ((*CIT)->table()).begin(); 00124 j != ((*CIT)->table()).end() ; ++j) // loop over table of (absorption length,photon energy) 00125 { const double* energy = &((*j).first); 00126 double wl = twopi * hbarc / (*energy); 00127 const double* L = &((*j).second); 00128 double* abslen = const_cast<double*> (L); 00129 if ( (*abslen)>lmax0 ) { lmax0 = *abslen; wlmax0 = wl;} 00130 double adef = defa_at_200nm/pow( (wl/(200.*nm)),4 ); 00131 double b = a_at_200nm/pow( (wl/(200.*nm)), 4 ); 00132 00133 double anew = 1./(*abslen) - adef + b; 00134 double ltot = 1./anew; 00135 if ( ltot > lmax ) { lmax = ltot; wlmax = wl ;} 00136 *abslen = ltot; 00137 } 00138 info() << "For " << Name 00139 << " Original max abs. len. "<< lmax0/m << " (m) at " << wlmax0/nm 00140 << " (nm) for absorbance(200nm) " << defa_at_200nm*cm 00141 << " (1/cm). "<< endreq; 00142 info() << "For " << Name 00143 << " New max abs. len. "<< lmax/m << " (m) at " << wlmax/nm 00144 << " (nm) for absorbance(200nm) " << a_at_200nm*cm << " (1/cm)" << endreq; 00145 } 00146 } 00147 } 00148 debug() << " ++++++ New contents of the table for " << Name << endreq; 00149 mat->fillStream( debug() ); // correct output stream??? 00150 00151 } 00152 return StatusCode::SUCCESS; 00153 }
StatusCode DybModifyProperties::finalize | ( | ) | [virtual] |
Reimplemented from GaudiAlgorithm.
Definition at line 162 of file DybModifyProperties.cc.
00163 { return StatusCode::SUCCESS; }
PropMap DybModifyProperties::m_PropMap [private] |
Definition at line 33 of file DybModifyProperties.h.