#ifndef TCOMETAlignmentLookup_hxx #define TCOMETAlignmentLookup_hxx #include #include #include #include #include #include #include namespace COMET { // General oaApplyAlign exceptions OA_EXCEPTION(EOAApplyAlign,COMET::EoaCore); // Exception for a geometry that already has an alignment OA_EXCEPTION(EGeometryAlreadyHadAlignment,EOAApplyAlign); }; class ICOMETAlignmentLookup: public COMET::IOADatabase::IAlignmentLookup { private: // Flags to decide which alignments to apply (if any); // controlled from parameters file. bool fApplyAlignment; bool fApplyTrackerSurvey; bool fApplyFGDIntAlign; bool fApplyMMSurvey; bool fApplyP0DIntAlign; // Flag for describing test configuration. Flag = 0 means default normal configuration. int fTestFlag; // This is the alignment ID we calculate while deciding alignments to apply. COMET::IAlignmentId fAlignmentId; /// The class to calculate the ISHA1 from alignment constants. COMET::ISHA1 fSHA1; // The run number from when we last computed alignment ID. int fRun; // Helper methods void ApplyFGDInternalAlign(COMET::ICOMETContext context); void ApplyMMSurveyAlign(COMET::ICOMETContext context); void ApplyTrackerSurveyAlign(COMET::ICOMETContext context); void ApplyP0DInternalAlign(COMET::ICOMETContext context); public: unsigned int fCalls; std::vector< std::pair< COMET::IGeometryId, TGeoMatrix* > > fCorrections; public: ICOMETAlignmentLookup(); virtual ~ICOMETAlignmentLookup(); /// Called to find out if the alignment should be reapplied. If the /// alignment should be reapplied this will return true. If the /// geometry has been changed, then the alignment will be reapplied /// regardless of the CheckAlignment return value. bool CheckAlignment(const COMET::ICOMETEvent* const event); /// Called before the geometry alignment for an event is begun. This /// is used to notify the implemented class that a new alignment is /// about to start. It will generally trigger initialization. If an /// alignment should not be applied, then this should return an empty /// alignment. COMET::IAlignmentId StartAlignment(const COMET::ICOMETEvent* const event); TGeoMatrix* Align(const COMET::ICOMETEvent* const event, COMET::IGeometryId& geomId); void AddTranslation(const COMET::IGeometryId& geomId, double dx, double dy, double dz); void AddRotation(const COMET::IGeometryId& geomId, double a, double b, double c); void AddRotation(const COMET::IGeometryId& geomId, TVector3 axis, double angle); void AddTranslationRotation(const COMET::IGeometryId& geomId, double dx, double dy, double dz, double a, double b, double c); void AddTranslationRotation(const COMET::IGeometryId& geomId, double dx, double dy, double dz, TVector3 axis, double angle); void AddTranslationRotation(const COMET::IGeometryId& geomId, TVector3 trans, TVector3 axis, double angle); void Clear(); }; #endif