File indexing completed on 2025-02-24 09:24:56
0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023 #include "DD4hep/Printout.h"
0024 #include "DD4hep/Conditions.h"
0025 #include "DD4hep/Alignments.h"
0026 #include "DD4hep/AlignmentData.h"
0027 #include "DD4hep/detail/ConditionsInterna.h"
0028 #include "DD4hep/detail/AlignmentsInterna.h"
0029
0030 #include "DD4hep/Factories.h"
0031
0032 #include <cerrno>
0033
0034 using namespace std;
0035 using namespace dd4hep;
0036
0037
0038
0039
0040
0041
0042
0043
0044
0045 static int Alignment_to_Condition (Detector& , int argc, char** argv) {
0046 for(int i=0; i<argc && argv[i]; ++i) {
0047 if ( 0 == ::strncmp("-help",argv[i],2) || 0 == ::strncmp("-?",argv[i],2) ) {
0048
0049 cout <<
0050 "Usage: -plugin <name> \n"
0051 " name: factory name DD4hep_AlignmentExample_read_xml \n"
0052 "\tArguments given: " << arguments(argc,argv) << endl << flush;
0053 ::exit(EINVAL);
0054 }
0055 }
0056
0057 AlignmentCondition ac("alignment");
0058 ac->hash = ConditionKey(0,ConditionKey::itemCode(ac.name())).hash;
0059
0060 printout(INFO,"Example","Alignment condition: \"%s\" Key:%016llX",ac.name(),ac->hash);
0061 printout(INFO,"Example","Alignment condition ptr: %p",ac.ptr());
0062
0063 Condition con(ac);
0064 AlignmentData& data = ac.data();
0065 printout(INFO,"Example","Alignment condition data: %p",(void*)&data);
0066 printout(INFO,"Example","Condition opaque pointer: %p",(void*)con.data().ptr());
0067 printout(INFO,"Example","Offset to opaque pointer: %uld",con->offset());
0068 printout(INFO,"Example","Computed Pointer: %p",(void*)((char*)con.ptr()+con->offset()));
0069 printout(INFO,"Example","Computed payload pointer: %p",(void*)con->payload());
0070
0071 Alignment align(ac);
0072 printout(INFO,"Example","Alignment object pointer: %p",(void*)align.ptr());
0073 printout(INFO,"Example","Alignment key: %016llX",ac.key());
0074 printout(INFO,"Example","Condition key: %016llX",con.key());
0075
0076 return 1;
0077 }
0078
0079 DECLARE_APPLY(DD4hep_Alignment2Condition,Alignment_to_Condition)