DD4hep - The AIDA detector description toolkit for high energy physics experiments
DD4hep  Rev:Unversioneddirectory
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
AlignmentUpdateCall.cpp
Go to the documentation of this file.
1 //==========================================================================
2 // AIDA Detector description implementation for LCD
3 //--------------------------------------------------------------------------
4 // Copyright (C) Organisation europeenne pour la Recherche nucleaire (CERN)
5 // All rights reserved.
6 //
7 // For the licensing terms see $DD4hepINSTALL/LICENSE.
8 // For the list of contributors see $DD4hepINSTALL/doc/CREDITS.
9 //
10 // Author : M.Frank
11 //
12 //==========================================================================
13 
14 // Framework include files
18 #include "DD4hep/InstanceCount.h"
19 #include "DD4hep/Printout.h"
20 
21 using namespace DD4hep::Alignments;
22 
24 AlignmentUpdateCall::AlignmentUpdateCall() : DD4hep::Conditions::ConditionUpdateCall()
25 {
27 }
28 
32 }
33 
35 AlignmentUpdateCall::handle(const ConditionKey& key, const UpdateContext& ctxt, const Delta& delta)
36 {
37  AlignmentCondition target(key.name);
38  AlignmentData& data = target.data();
39  data.delta = delta;
41  data.detector = ctxt.dependency.detector;
42  // We MUST register the undigested condition to the alignment manager in order to
43  // later be able to compute the derived transformations.
44  // The derived transfomrations can only be computed 'later' once all delta stubs
45  // are present in a second pass. This is necessary, because the parent information
46  // may actually be supplied also 'later'.
47  AlignmentsManager::newEntry(ctxt, data.detector, &ctxt.dependency, target);
48  return target;
49 }
50 
54  // Here only print and return an empty alignment condition.
55  // Otherwise the return is not accepted!
56  // TODO: To be decided how to handle this error
57  Condition cond = context.condition(0);
58  DetElement det = context.dependency.detector;
60  Data& data = target.data();
61  data.detector = det;
62  printout(ERROR,"AlignmentUpdate","++ Failed to access alignment-Delta for %s from %s",
63  det.path().c_str(), cond->value.c_str());
64  printout(ERROR,"AlignmentUpdate","++ The true data type is: %s",typeName(cond.typeInfo()).c_str());
66  return target;
67 }
Data & data()
Data accessor for the use of decorators.
Definition: Alignments.cpp:86
BitMask flag
Flag to remember internally calculated quatities.
Generic Conditions data dumper.
static void decrement(T *)
Decrement count according to type information.
const std::string & value() const
Access the value field of the condition as a string.
Definition: Conditions.cpp:112
virtual ~AlignmentUpdateCall()
Default destructor.
Condition condition(size_t which) const
Access to condition object by dependency index.
std::string typeName(const std::type_info &type)
ABI information about type names.
Definition: Primitives.cpp:186
Main condition object handle.
Definition: Conditions.h:70
const ConditionDependency & dependency
DD4hep::Geometry::DetElement DetElement
DetElement detector
Reference to the next hosting detector element.
Key definition to optimize ans simplyfy the access to conditions entities.
Definition: Conditions.h:273
Delta delta
Alignment changes.
const std::type_info & typeInfo() const
Access to the type information.
Definition: Conditions.cpp:127
ConditionUpdateContext class used by the derived conditions calculation mechanism.
Class describing an condition to re-adjust an alignment.
Definition: AlignmentData.h:49
static void newEntry(const Context &parameter, DetElement &det, const Dependency *dep, AlignmentCondition &con)
Register new updated derived alignment during the computation step.
virtual Condition handle(const ConditionKey &key, const UpdateContext &context, const Delta &delta)
Callback to build the alignment conditions object and assign the delta.
DetElement detector
Reference to the target's detector element.
static void increment(T *)
Increment count according to type information.
Definition: InstanceCount.h:98
std::string name
String representation of the key object.
Definition: Conditions.h:279
virtual Condition invalidDataType(const ConditionKey &key, const UpdateContext &context)
Handler to be called if the Alignment cannot be created due to a bad underlying data type...
Main handle class to hold an alignment conditions object.
Definition: Alignments.h:142
int printout(PrintLevel severity, const char *src, const char *fmt,...)
Calls the display action with a given severity level.
Definition: Printout.cpp:111
Derived condition data-object definition.