9 #include <alignment/GlobalParam.h> 
   11 #include <alignment/Hierarchy.h> 
   12 #include <cdc/dbobjects/CDCLayerAlignment.h> 
   13 #include <framework/database/Database.h> 
   14 #include <framework/geometry/B2Vector3.h> 
   15 #include <framework/logging/Logger.h> 
   16 #include <vxd/geometry/GeoCache.h> 
   38       this->ensureConstructed();
 
   39       if (element != 0 or param > 3) {
 
   40         B2ERROR(
"Invalid global BeamSpot parameter id");
 
   44       if (
auto bp = 
dynamic_cast<BeamSpot*
>(this->getDBObj()))
 
   45         return bp->getIPPosition()[param - 1];
 
   47       B2ERROR(
"Could not get value for BeamSpot");
 
   54       this->ensureConstructed();
 
   55       if (element != 0 or param > 3) {
 
   56         B2ERROR(
"Invalid global BeamSpot id");
 
   59       if (
auto bp = 
dynamic_cast<BeamSpot*
>(this->getDBObj())) {
 
   61         vertex[param - 1] = value;
 
   62         bp->setIP(vertex, bp->getIPPositionCovMatrix());
 
   64         B2ERROR(
"Could not set value for BeamSpot");
 
   72       return {{0, 1}, {0, 2}, {0, 3}};
 
   79                                               short unsigned int param)
 
   86                                            short unsigned int param)
 
   88       auto dbObj = 
m_vector.find(uniqueID);
 
   90         dbObj->second->setGlobalParam(value, element, param);
 
   92         B2WARNING(
"Did not found DB object with unique id " << uniqueID << 
" in global vector. Cannot set value for element " << element <<
 
   93                   " and parameter " << param);
 
   98       auto dbObj = 
m_vector.find(uniqueID);
 
  100         return dbObj->second->getGlobalParam(element, param);
 
  102         B2WARNING(
"Did not found DB object with unique id " << uniqueID << 
" in global vector. Cannot get value for element " << element <<
 
  103                   " and parameter " << param << 
". Returning 0.");
 
  109       std::vector<std::tuple<unsigned short, unsigned short, unsigned short>> params;
 
  111         for (
auto element_param : uID_DBObj.second->listGlobalParams()) {
 
  112           params.push_back({uID_DBObj.first, element_param.first, element_param.second});
 
  119       std::vector<TObject*> result;
 
  121         if (onlyConstructed and not uID_DBObj.second->isConstructed())
 
  124         result.push_back({uID_DBObj.second->releaseObject()});
 
  131         uID_DBObj.second->loadFromDBObjPtr();
 
  137         uID_DBObj.second->loadFromDB(event);
 
  143         interface->setupAlignmentHierarchy(hierarchy);
 
  150         if (not uID_DBObj.second->isConstructed()) uID_DBObj.second->construct();
 
  154       std::vector< std::tuple< short unsigned int, short unsigned int, short unsigned int, double > >& results)
 
  157         interface->readFromResult(results, *
this);
 
  162       VXDGlobalParamInterface::E_VXDHierarchyType::c_Full;
 
  178           for (
auto& sensor : geo.getListOfSensors()) {
 
  188                 geo.get(sensor).getTransformation(
true));
 
  200           for (
auto& halfShellPlacement : geo.getHalfShellPlacements()) {
 
  202             if (halfShellPlacement.first.getLayerNumber() <= 2 and !
s_enablePXD)
 
  205             if (halfShellPlacement.first.getLayerNumber() > 2 and !
s_enableSVD)
 
  208             TGeoHMatrix trafoHalfShell = halfShellPlacement.second;
 
  209             trafoHalfShell *= geo.getTGeoFromRigidBodyParams(
 
  219             for (
auto& ladderPlacement : geo.getLadderPlacements(halfShellPlacement.first)) {
 
  221               TGeoHMatrix trafoLadder = ladderPlacement.second;
 
  222               trafoLadder *= geo.getTGeoFromRigidBodyParams(
 
  233               for (
auto& sensorPlacement : geo.getSensorPlacements(ladderPlacement.first)) {
 
  235                 TGeoHMatrix trafoSensor = sensorPlacement.second;
 
  236                 trafoSensor *= geo.getTGeoFromRigidBodyParams(
 
  245                     trafoLadder * trafoSensor);
 
  263           for (
auto& halfShellPlacement : geo.getHalfShellPlacements()) {
 
  265             if (halfShellPlacement.first.getLayerNumber() <= 2 and !
s_enablePXD)
 
  268             if (halfShellPlacement.first.getLayerNumber() > 2 and !
s_enableSVD)
 
  271             TGeoHMatrix trafoHalfShell = halfShellPlacement.second;
 
  272             trafoHalfShell *= geo.getTGeoFromRigidBodyParams(
 
  282             for (
auto& ladderPlacement : geo.getLadderPlacements(halfShellPlacement.first)) {
 
  284               TGeoHMatrix trafoLadder = ladderPlacement.second;
 
  285               trafoLadder *= geo.getTGeoFromRigidBodyParams(
 
  293               rigidBodyHierarchy.insertTGeoTransform<
VXDAlignment, 
VXDAlignment>(ladderPlacement.first, halfShellPlacement.first, trafoLadder);
 
  295               for (
auto& sensorPlacement : geo.getSensorPlacements(ladderPlacement.first)) {
 
  297                 TGeoHMatrix trafoSensor = sensorPlacement.second;
 
  298                 trafoSensor *= geo.getTGeoFromRigidBodyParams(
 
  306                 rigidBodyHierarchy.insertTGeoTransform<
VXDAlignment, 
VXDAlignment>(sensorPlacement.first, ladderPlacement.first, trafoSensor);
 
  313       } 
catch (
const std::bad_cast& e) {
 
This class contains the beam spot position and size modeled as a gaussian distribution in space.
Class for accessing objects in the database.
VXD alignment (and maybe some calibration) parameters.
static const baseType dAlpha
Sensor/layer/ladder alignment in local alpha.
static const baseType dGamma
Sensor/layer/ladder alignment in local gamma.
static const baseType dW
Sensor/layer/ladder alignment in local w.
static const baseType dBeta
Sensor/layer/ladder alignment in local beta.
static const baseType dU
Sensor/layer/ladder alignment in local u.
static const baseType dV
Sensor/layer/ladder alignment in local v.
static GeoCache & getInstance()
Return a reference to the singleton instance.
Class to uniquely identify a any structure of the PXD and SVD.
Object representing no parameters.
Class for alignment/calibration parameter hierarchy & constraints.
virtual void setGlobalParam(double value, unsigned short element, unsigned short param) override final
Set global parameter of the DB object by its element and parameter number.
virtual double getGlobalParam(unsigned short element, unsigned short param) override final
Get global parameter of the DB object by its element and parameter number Note this is not const,...
virtual unsigned short getGlobalUniqueID() const override final
The DB object unique id in global calibration.
virtual std::vector< std::pair< unsigned short, unsigned short > > listGlobalParams() override final
List global parameters in this DB object.
std::vector< std::tuple< unsigned short, unsigned short, unsigned short > > listGlobalParams()
Create vector of all global parameters maintained by GlobalParamVector.
std::vector< TObject * > releaseObjects(bool onlyConstructed=true)
Get the vector of raw pointers to DB objects Caller takes the ownership of the objects and has to del...
GlobalParamVector(const std::vector< std::string > &components={})
Constructor.
std::map< unsigned short, std::unique_ptr< GlobalParamSetAccess > > m_vector
The vector (well, actually a map) of DB objects.
std::vector< std::shared_ptr< IGlobalParamInterface > > m_subDetectorInterfacesVector
Vector of interfaces to run at specific points in the workflow.
void setGlobalParam(double value, unsigned short uniqueID, unsigned short element, unsigned short param)
Set param value.
double getGlobalParam(unsigned short uniqueID, unsigned short element, unsigned short param)
Get parameter value.
void construct()
Construct all DB objects using default constructors (should be filled with zeros)
void postHierarchyChanged(GlobalDerivativesHierarchy &hierarchy)
Function calling interfaces to build alignment hierarchy after constants changed in DB.
void loadFromDB()
Load content of all objects in vector with values valid at current EventMetaData Uses DBObjPtr<DBObjT...
void updateGlobalParam(double difference, unsigned short uniqueID, unsigned short element, unsigned short param)
Add 'difference' to param value.
void postReadFromResult(std::vector< std::tuple< unsigned short, unsigned short, unsigned short, double >> &result)
Function calling interfaces to do post processing after reading millepede result into GlobalParamVect...
6D Hierarchy of rigid bodies
static bool s_enablePXD
Enable PXD in hierarchy?
static bool s_enableSVD
Enable SVD in hierarchy?
virtual void setupAlignmentHierarchy(GlobalDerivativesHierarchy &hierarchy) override final
Very tentative function: not yet used.
E_VXDHierarchyType
Type of VXD hierarchy.
static E_VXDHierarchyType s_hierarchyType
What type of hierarchy to use for VXD?
Abstract base class for different kinds of events.