Skip to content
Snippets Groups Projects
Commit 9879bc9a authored by Andrea Dell'Acqua's avatar Andrea Dell'Acqua
Browse files

GDMLtoGM: adding handlers for <variable... />,<constant... />, <quantity......

GDMLtoGM: adding handlers for <variable... />,<constant... />, <quantity... />, which were initially forgotten

 Changes to be committed:

	new file:   GeoModelTools/GDMLtoGM/GDMLInterface/constantHandler.h

	new file:   GeoModelTools/GDMLtoGM/GDMLInterface/variableHandler.h

	modified:   GeoModelTools/GDMLtoGM/src/GDMLController.cxx

	new file:   GeoModelTools/GDMLtoGM/src/constantHandler.cxx

	new file:   GeoModelTools/GDMLtoGM/src/variableHandler.cxx
parent 67ba60b6
No related branches found
No related tags found
1 merge request!68GDMLtoGM: adding handlers for <variable... />,<constant... />, <quantity......
#ifndef constantHandler_H
#define constantHandler_H
#include "GDMLInterface/GDMLHandler.h"
#include "GDMLInterface/GDMLController.h"
#include <string>
class constantHandler:public GDMLHandler {
public:
constantHandler(std::string, GDMLController*);
void ElementHandle();
};
#endif /* end of include guard: */
#ifndef variableHandler_H
#define variableHandler_H
#include "GDMLInterface/GDMLHandler.h"
#include "GDMLInterface/GDMLController.h"
#include <string>
class variableHandler:public GDMLHandler {
public:
variableHandler(std::string, GDMLController*);
void ElementHandle();
};
#endif /* end of include guard: */
......@@ -246,6 +246,8 @@ GeoVolume GDMLController::retrieveLogicalVolume(std::string name)
#include "GDMLInterface/setupHandler.h"
#include "GDMLInterface/worldHandler.h"
#include "GDMLInterface/physvolHandler.h"
#include "GDMLInterface/variableHandler.h"
#include "GDMLInterface/constantHandler.h"
void GDMLController::registerHandlers()
......@@ -282,5 +284,7 @@ void GDMLController::registerHandlers()
new physvolHandler("physvol",this);
new setupHandler("setup",this);
new worldHandler("world",this);
new variableHandler("variable",this);
new constantHandler("constant",this);
new constantHandler("quantity",this);
}
#include "GDMLInterface/constantHandler.h"
#include "GDMLInterface/GDMLHandler.h"
#include <iostream>
constantHandler::constantHandler(std::string s,GDMLController* g):GDMLHandler(s,g)
{
// std::cout<<"constructing constantHandler!"<<std::endl;
}
void constantHandler::ElementHandle()
{
std::string name=getAttributeAsString("name");
double value=getAttributeAsDouble("value");
double lunit=1.;
if (this->GetName()=="quantity")
{
bool unitTest=true;
lunit=getAttributeAsDouble("unit",unitTest);
if (!unitTest)
std::cout<<" Warning, <quantity /> tag requires an unit attribute to be defined!!!!"<<std::endl;
std::string type=getAttributeAsString("type","density");
}
ExpressionEvaluator::GetEvaluator()->RegisterConstant(name,value*lunit);
}
#include "GDMLInterface/variableHandler.h"
#include "GDMLInterface/GDMLHandler.h"
#include <iostream>
variableHandler::variableHandler(std::string s,GDMLController* g):GDMLHandler(s,g)
{
// std::cout<<"variableHandler!"<<std::endl;
}
void variableHandler::ElementHandle()
{
std::string name=getAttributeAsString("name");
//std::cout << "handling for variable: name "<< name <<'\n';
double value=getAttributeAsDouble("value");
Evaluator()->RegisterVariable(name,value);
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment