//////////////////////////////////////////////////////////////////// /// \class RAT::MissedMuonFollowerCut /// /// \brief Flags high nhit events when they're close in time /// /// \author Eric Marzec /// \contact Eric Marzec /// /// REVISION HISTORY:\n /// 26 Aug 2017 : Eric Marzec - first version /// /// \details This cut will tag any high nhit events that are near /// other high nhit events in time. The idea is that most /// interesting (high nhit) physics events happen at a /// low enough rate that if you do see two high nhit events /// near in time its probably worth flagging. /// This cut is similar to the Muon Follower cuts in that it /// requires two passes. After the first pass it will produce /// a ratdb file with all the GTIDs to be flagged. In the 2nd /// pass it does the flagging. /// //////////////////////////////////////////////////////////////////// #ifndef __RAT_MissedMuonFollowerCut__ #define __RAT_MissedMuonFollowerCut__ #include #include #include #include #include namespace RAT { class MissedMuonFollowerCut : public DataCleaningProc { public: MissedMuonFollowerCut() : DataCleaningProc("missedmuonfollower",1){}; virtual ~MissedMuonFollowerCut(){}; virtual Processor::Result DSEvent(DS::Run& run, DS::Entry& ds); void BeginOfRun(DS::Run& run); void EndOfRun(DS::Run& run); protected: virtual Processor::Result Event(DS::Entry& ds, DS::EV& ev); double TimeDiff(DS::UniversalTime time_a, DS::UniversalTime time_b); std::vector fEventStore; //< stores gtids of events to be flagged std::vector fDaysTimeStore; //< stores day of events to be flagged std::vector fSecsTimeStore; //< stores seconds of events to be flagged std::vector fNSecsTimeStore; //< stores nano-seconds of events to be flagged unsigned int fNhitMin; ///< min nhit for a muon unsigned int fSecondaryNhitMin; ///< min nhit for muon follower double fTimeWindow; ///< time window after high nhit event (ns) int fLastHighNHitGTID; ///< most recent high nhit event bool fInWindow; ///< indicates if you've recently seen a high nhit event DS::UniversalTime fTimeOfLastHighNhit; ///< time of last high nhit event // A bunch of strings to specify the various DB table/column names // required by this cut string fDBName; ///< name of RATDB/JSON file to load/save info string fDBTableName; ///< name of table used by this cut string fDBGTIDColumnName; ///< name of column that stores relevant gtids string fDBDaysColumnName; ///< name of column that stores days for relevant events string fDBSecondsColumnName; ///< name of column that stores seconds of relevant events string fDBNanoSecondsColumnName; ///< name of column that stores seconds of relevant events }; } // namespace RAT #endif