//////////////////////////////////////////////////////////////////////// /// \class RAT::DQTellieProc /// /// \brief Data quality TELLIE processor /// /// \authors Martti Nirkko (since 2017) /// /// REVISION HISTORY: /// - 2014 11 26 - Matt Strait - Doxygen fixes /// - 2016 06 14 - Mark Stringer - Fixes to handle multiple subruns in data /// - 2016 07 20 - M. Mottram - Update for ROOT6 compatibility /// - 2016 11 30 - Mark Stringer (James Waterfield) Changes to code made by /// James Waterfield for his Thesis, also removal of hardcoded values. /// - 2017 02 08 - Mark Stringer - Bug Fixes to DB output and changing the /// filenames of the output images. Removal of the hardcoded /// trigger bit value replaced with a value from DQCHECKS.ratdb /// - 2019 01 29 - Martti Nirkko - Significant makeover, improved many plots and DQ checks /// /// \details Checks TELLIE specific calibration runs. /// Trigger efficiency, run length, NHit, fibre fired /// time profiles are all checked by this processor. /// //////////////////////////////////////////////////////////////////////// #ifndef __RAT_DQTellieProc__ #define __RAT_DQTellieProc__ #include #include #include #include #include #include class TGraph2D; class TH1D; class TH1I; class TVector3; class TVector2; #include #include #include namespace RAT { namespace DS { class Run; class Entry; class EV; } } namespace RAT { class DQTellieProc : public DataQualityProc { public: DQTellieProc(); virtual ~DQTellieProc(); /// /// @param[in] run DS::Run location in data structure virtual void BeginOfRun( DS::Run& run ); /// Access event in run /// /// @param[in] run DS::Run location in data structure /// @param[in] ds DS::Entry location in data structure virtual Processor::Result DSEvent( DS::Run& run, DS::Entry& ds ); /// /// @param[in] run DS::Run location in data structure virtual void EndOfRun( DS::Run& run ); protected: /// @param[in] ds DS::Entry location in data structure /// @param[in] ev DS::EV event location in data structure virtual Processor::Result Event( DS::Entry& ds, DS::EV& ev ); /// Produces .png of PSUP projection hit map /// /// @param[in] directProject TVector2 central direct light spot on PSUP. /// @param[in] reflectedProject TVector2 central reflected light spot on PSUP. /// @param[in] lightOriginProject TVector2 calculated light origin on PSUP. virtual void PlotFibreCheck(const TVector2& directProject, const TVector2& reflectedProject, const std::vector& directCircle, const std::vector& reflectedCircle, const TVector2& assumedFibreProject, const TVector2& actualFibreProject, const string& assumedFibre, int subRunIndex); /// Checks the correct fibre is firing. /// virtual void FibreCheck(int subRunIndex); // Fills PMT hemisphere around a certain point into a TGraph /// virtual void FillHemisphere(const TVector3& center, std::vector &occupancy, TGraph2D* graph); /// Fits intansity profile with 2D Gaussian /// virtual void FitLightSpot(TGraph2D* graph, double radius, double cone, double* params); /// Checks whether the fibre is affected by belly plates /// virtual bool CheckBellyPlate(int subRunIndex); /// Draw a circle around a point in a plane orthogonal to an angle with N dots virtual void DrawCircle(const TVector3&, double, std::vector&, int); /// Gets rotation angles to transfer one 3D frame to another virtual void GetRotationAngles(const TVector3&, double&, double&); /// Display vector as a string virtual string printVector(const TVector3& v); /// Plots the time profile of the run (TAC ADC) /// /// @param[in] xPeaks std::vector tac ADC of time peaks virtual void PlotTac(std::vector xPeaks,int subRunIndex); /// Iterate over v to find its max and min values and assign min_idx and /// max_idx to their corresponding indices. /// /// @param[in] v std::vector vector to check min/max values /// @param[in] min_idx size_t index of minimum value of v /// @param[in] max_idx size_t index of maximum value of v //virtual void MinMaxIndex(std::vector v, size_t& min_idx, size_t& max_idx); /// Iterate over v to find its top 3 peaks virtual void GetTopIndices(std::vector x, std::vector y, size_t& early, size_t& prompt, size_t& late); /// Checks time profile of TAC /// virtual void TimingChecks(int subRunIndex); DBLinkPtr fDQChecks; /// fTellieEvents; /// fTellieCount; /// fStolenTriggerCount; /// fStolenEvents; /// fRecoveredEvents; /// fFailPulseSeparationCount; /// fFirstEventTime; ///