/////////////////////////////////////////////////////////////////////////// /// \class RAT::DQSmellieProc /// /// \brief Returns the results of per-subrun checks on SMELLIE dataruns /// /// \author Krish Majumdar /// /// REVISION HISTORY: \n /// 2014-11-04 : K Majumdar: new file // 2016-1-20 : Mark Stringer Modified for use within the Data Quality Framework /// /// \details Analyses all events in a run (split per subrun), calculates various SMELLIE configuration settings, /// and compares these to the desired values from the run-configuration on CouchDB. Then returns a /// summary of desired vs. actual parameters. /// /////////////////////////////////////////////////////////////////////////// #ifndef __RAT_DQSmellieProc__ #define __RAT_DQSmellieProc__ #include #include #include #include #include #include using namespace std; namespace RAT { class DQSmellieProc : public DataQualityProc { public: /// Constructor DQSmellieProc(); /// Destructor virtual ~DQSmellieProc() {} /// Begin of Run action virtual void BeginOfRun(DS::Run& run); /// End of Run action virtual void EndOfRun(DS::Run&); /// Process each event in the run /// /// @param[in] run current run information /// @param[in] ds current DS entry information /// @return is OKTRUE once all event-level information has been stored in the respective vectors virtual DataQualityProc::Result DSEvent(DS::Run& run, DS::Entry& ds); protected: int fRunNumber; ///< run number DU::PMTInfo fPMTInformation; ///< PMT information utility for the run int fRunTriggerCutBit; ///< trigger word cut for selecting SMELLIE events, different for runs in "master" and "slave" mode int fNumberOfSubruns; ///< number of subruns in this run, minimum = 1 vector fSubrunWavelengthsVector; ///< vector of wavelengths, with one entry for each subrun vector fSubrunNumberOfEventsVector; ///< vector of number of events, with one entry for each subrun vector fSubrunLaserFrequenciesVector; ///< vector of trigger frequencies, with one entry for each subrun vector fSubrunFibreIDsVector; ///< vector of fibre IDs used, with one entry for each subrun vector fLaserType; /// fSubrunLaserIntensitiesVector; ///< vector of laser intensities used, with one entry for each subrun vector fSubRunNumbers; ///< Vector containing the subrun numbers //vector fSubrunLaser; double fErrorBound; ///< error bound for comparing measured and actual values of the check results (if measured is +/- [fErrorBound]% of the actual value, it is good) /// General SMELLIE and DataQualityProc-specific parameters int fNumberOfNodes; ///< Number of SMELLIE locations vector fFibreIDs; ///< vector of fibre IDs, used purely for outputting the fibre ID per subrun in a consistent manner double fFirstTimePeak_Low; ///< lower limit of the first Time Peak (originating from backscattering of light from the AV closest to the SMELLIE fibre) double fFirstTimePeak_High; ///< upper limit of the first Time Peak (originating from backscattering of light from the AV closest to the SMELLIE fibre) double fSecondTimePeak_Low; ///< lower limit of the second Time Peak (originating from directly-hit PMTs) double fSecondTimePeak_High; ///< upper limit of the second Time Peak (originating from directly-hit PMTs) UShort_t fSMELLIEDigitiserChannel; ///< CAEN channel number on which the SMELLIE Monitoring PMT is read unsigned int fDigitiserSampleNumber; ///< sample number on each waveform where the monitored voltage has stabilised and can be reliably read vector fNodePositions; ///< vector of node positions as given in the SMELLIE.ratdb file - each node is given the same position as the 0-degree fibre on that node vector fFibreDirections; ///< vector of fibre directions as given in the SMELLIE.ratdb file double fPMTRadius; ///< radius of the PMTs, calculated by taking the mean radius of the nodes from their positions vector fSuperKWavelengths;///< SuperK wavelengths vector fSuperKNHits; ///< SuperK NHits /// Vectors of useful information, each of which has number of entries = total number of events in the entire run, across ALL subruns vector fAllEvents_SubRunIDs; ///< subrun ID of each event vector fAllEvents_Nhits; ///< number of triggered PMTs in each event vector fAllEvents_TrigTypes; ///< trigger type of each event vector fAllEvents_TickCounts; ///< tick count of each event on the 50MHz clock vector< vector > fAllEvents_Waveforms; ///< CAEN digitiser waveform of each event, as a vector of digitiser sample points vector< vector > fAllEvents_pmtTimes; ///< vector of triggered PMT times per event vector< vector > fAllEvents_pmtThetas; ///< vector of triggered PMT theta coordinates per event vector< vector > fAllEvents_pmtPhis; ///< vector of triggered PMT phi coordinates per event int fNTimePeaks; //Variables to store if checks have passed all subruns bool smellieNPeaks; bool smelliePeakRatio; bool smellieFrequencyCheck; bool smellieFibreCheck; bool smellieIntensityCheck; bool smellieNumberOfEvents; //Arrays to store individual subrun checks /// Checking Functions std::vector smellieNPeaksSubrunVector; std::vector smelliePeakRatioSubrunVector; std::vector smellieFrequencyCheckSubrunVector; std::vector smellieFibreCheckSubrunVector; std::vector smellieIntensityCheckSubrunVector; std::vector smellieNumberOfEventsSubrunVector; std::vector subRunMeanNhit; std::vector passedNHitPassedTrigger; std::vector passedNHitFailedTrigger; std::vector failedNHitPassedTrigger; std::vector failedNHitFailedTrigger; std::vector NHitEventAdjacentToTrigger; std::vector NHitEventsMissingTrigger; std::vector TriggerEventsMissingNhits; /// Check the PMT Hit Information across all events in all subruns /// /// @return a vector of fNumberOfSubruns vectors, each containing: [the low bound of the main Nhits peak, the mean Nhits value] for one subrun vector< vector > Check_1_HitInformation(); /// Check the triggering across all events in all subruns /// /// @param[in] allSubruns_nhitsInformation the output of Check_1_HitInformation /// @return a vector of fNumberOfSubruns ints, each one being the calculated number of actual SMELLIE events in one subrun vector Check_2_EventTriggering(vector< vector > allSubruns_nhitsInformation); /// Check the Laser Triggering Frequency of each subrun /// /// @return a vector of fNumberOfSubruns doubles, each one being the calculated laser triggering frequency in one subrun vector Check_3_LaserFrequency(); /// Check the Fibre used in each subrun /// /// @return a vector of fNumberOfSubruns strings, each one being the calculated fibre used in one subrun vector Check_4_FibreID(); /// Check the Laser Intensity used in each subrun /// /// @param[in] allSubruns_nhitsInformation the output of Check_1_HitInformation /// @param[in] allSubruns_fibreIDs the output of Check_4_FibreID /// @return a vector of fNumberOfSubruns double, each one being the calculated laser intensity used in one subrun vector Check_5_LaserIntensity(vector< vector > allSubruns_nhitsInformation, vector allSubruns_fibreIDs); /// Output the CAEN digitiser waveforms of all events in the run, as well as the distribution of sampled voltages at a fixed sample number (check is disabled if no plots are to be saved) /// void Check_6_DigitiserWaveforms(); }; } // namespace RAT #endif