| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

In This Package:

DybModifyProperties Class Reference

#include <DybModifyProperties.h>

Inheritance diagram for DybModifyProperties:

[legend]
Collaboration diagram for DybModifyProperties:
[legend]
List of all members.

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
INTupleSvcevtColSvc () const
IAlgContextSvccontextSvc () 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
IUpdateManagerSvcupdMgrSvc () const
IDataProviderSvcfastContainersSvc () 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
MsgStreammsgStream (const MSG::Level level) const
MsgStreamalways () const
MsgStreamfatal () const
MsgStreamerr () const
MsgStreamerror () const
MsgStreamwarning () const
MsgStreaminfo () const
MsgStreamdebug () const
MsgStreamverbose () const
MsgStreammsg () const
const Statisticscounters () const
StatEntitycounter (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)
IAuditorSvcauditorSvc () const
IChronoStatSvcchronoSvc () const
IChronoStatSvcchronoStatService () const
IDataProviderSvcdetSvc () const
IDataProviderSvcdetDataService () const
IConversionSvcdetCnvSvc () const
IConversionSvcdetDataCnvService () const
IDataProviderSvceventSvc () const
IDataProviderSvcevtSvc () const
IDataProviderSvceventDataService () const
IConversionSvceventCnvSvc () const
IConversionSvceventDataCnvService () const
IHistogramSvchistoSvc () const
IHistogramSvchistogramDataService () const
IMessageSvcmsgSvc () const
IMessageSvcmessageService () const
INTupleSvcntupleSvc () const
INTupleSvcntupleService () const
IRndmGenSvcrandSvc () const
IToolSvctoolSvc () const
IExceptionSvcexceptionSvc () const
ISvcLocatorserviceLocator () const
ISvcLocatorsvcLoc () 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 PropertygetProperty (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 ()
PropertydeclareProperty (const std::string &name, T &property, const std::string &doc="none") const
PropertydeclareRemoteProperty (const std::string &name, IProperty *rsvc, const std::string &rname="") const
IMonitorSvcmonitorSvc () 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 InterfaceIDinterfaceID ()
static const InterfaceIDinterfaceID ()
static const InterfaceIDinterfaceID ()

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< ServiceEntryServices

Protected Member Functions

StatusCode releaseTool (const IAlgTool *tool) const
StatusCode releaseSvc (const IInterface *svc) const
bool isInitialized () const
bool isFinalized () const
int outputLevel () const
IntegerPropertyoutputLevelProperty ()
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

Detailed Description

Definition at line 15 of file DybModifyProperties.h.


Member Typedef Documentation

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.


Constructor & Destructor Documentation

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  } 


Member Function Documentation

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; }


Member Data Documentation

PropMap DybModifyProperties::m_PropMap [private]

Definition at line 33 of file DybModifyProperties.h.


The documentation for this class was generated from the following files:
| Classes | Job Modules | Data Objects | Services | Algorithms | Tools | Packages | Directories | Tracs |

Generated on Mon Apr 11 20:40:41 2011 for DybAlg by doxygen 1.4.7