/////////////////////////////////////////////////////////////////////////// /// \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 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 std::vector fSubrunWavelengthsVector; ///< vector of wavelengths, with one entry for each subrun std::vector fSubrunNumberOfEventsVector; ///< vector of number of events, with one entry for each subrun std::vector fSubrunLaserFrequenciesVector; ///< vector of trigger frequencies, with one entry for each subrun std::vector fSubrunFibreIDsVector; ///< vector of fibre IDs used, with one entry for each subrun std::vector fLaserType; /// fSubrunLaserIntensitiesVector; ///< vector of laser intensities used, with one entry for each subrun std::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 std::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 std::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 std::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 std::vector fSuperKWavelengths;///< SuperK wavelengths std::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 std::vector fAllEvents_SubRunIDs; ///< subrun ID of each event std::vector fAllEvents_Nhits; ///< number of triggered PMTs in each event std::vector fAllEvents_TrigTypes; ///< trigger type of each event std::vector fAllEvents_TickCounts; ///< tick count of each event on the 50MHz clock std::vector< std::vector > fAllEvents_Waveforms; ///< CAEN digitiser waveform of each event, as a vector of digitiser sample points std::vector< std::vector > fAllEvents_pmtTimes; ///< vector of triggered PMT times per event std::vector< std::vector > fAllEvents_pmtThetas; ///< vector of triggered PMT theta coordinates per event std::vector< std::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 std::vector< std::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 std::vector Check_2_EventTriggering(std::vector< std::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 std::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 std::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 std::vector Check_5_LaserIntensity(std::vector< std::vector > allSubruns_nhitsInformation, std::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