/////////////////////////////////////////////////////////////////////////// /// \class RAT::BlindProc /// /// \brief Blindness processor designed for use in water. /// /// \author I. T. Coulter /// /// REVISION HISTORY: \n /// 2014-1-26 : I Coulter - Initial commit.\n /// 2014-9-04 : I Coulter - Move to data cleaning processor instead /// while also updating to: /// - use the new DataQCFlags Set method /// which both applies and sets the bit /// in the same command /// - fixing it so the same blindness bits /// are always set irregardless of the pass /// of the data cleaning word /// - use nhits rather the reconstructed /// energy as its stable and independent of /// calibration /// 2015-01-06 : I Coulter -Split the blinded data into ten subsets /// based on run length. In the event that /// run length doesn't exist (as currently /// the case for MC data), all data is put /// into the first "0" subset. /// 2016-03-02: F Descamps - Changed the time from nanosecs to secs to /// work with the default RUN.ratdb, where then /// start_time and stop_time are now timestamps. /// The default run-length is now 28800secs. /// 2016-03-18: F. Descamps - Small bugfix in the section calculation. /// 2017-01-04; F. Descamps - Changed back to the old timeformat. /// 2017-03-20: N. Barros - Modified logic to follow recent blindness discussion. /// * Added checks for run type and trigger word /// * Fixed a logic flaw in the model of reprocessing to unblind /// 2017-03-24: I Coulter - Finished Nuno's changes and made changes for /// the movement of the time segmentation out of this /// processor and into the nearline. /// 2017-05-23: I Coulter - Add a upper limit to the blinded region /// 2017-05-26: I Coulter - Apply correction for number of offline channels. /// /// /// \details Processor checks the event's nhits and marks the event with a /// blindness bit in the data cleaning mask depending on whether /// it falls in to one of four possible regions. /// It also uses a time segment provided by the nearline to allocate /// any blinded events into one of ten bins to allow partial unblinding. /// If the processor is run again for a second pass of the data /// cleaning cuts, it will set the same bits as existed on the /// first pass, ensuring the blindness doesn't change. /// /////////////////////////////////////////////////////////////////////////// #ifndef __RAT_WaterBlind__ #define __RAT_WaterBlind__ #include #include #include namespace RAT { class WaterBlind : public DataCleaningProc { public: /// Create a blindness processor in the data cleaning class WaterBlind(); /// Destroy the processor virtual ~WaterBlind() { }; /// Process the event /// /// Apply data cleaning mask depending on whether the event's nhits falls /// into one of three energy regions /// /// @param run Data structure for the run /// @param ds Data structure for event virtual Processor::Result DSEvent( DS::Run& run, DS::Entry& ds ); /// Initialise parameters from the RATDB such as the two nhit values /// defining the high and low blindness bins /// /// @param run Data structure for the run void BeginOfRun( DS::Run& run ); protected: // Return bit index in the blindness bits based on whether it is on the high region // and the section size_t GetBlindedBitIndex(const size_t &dc_mask_bit, int high); double fHighNhit; double fMedNhit; double fLowNhit; double fOnline; double fPass; unsigned int fBlindnessFlag; unsigned int fRunTypeWord; unsigned int fUnblindTriggerBits; bool fBlindRun; double fFirstTime, fLastTime; size_t fDCBlindnessLow, fDCBlindnessHigh; std::vector fBlind_start; std::vector fBlind_end; bool fChunkFail; }; } // namespace RAT #endif