//////////////////////////////////////////////////////////////////// /// \class RAT::TPMuonFollowerCut /// /// \brief Flags muon follower events /// /// \author Richie Bonventre /// \contact T Kaptanoglu /// /// REVISION HISTORY:\n /// 27 June 2011 : Richie Bonventre - first version /// 13 Nov 2014 : Eric Marzec - Made myself contact person. /// 20 March 2017 : Rob Knapik- Added in a UpdateMask command /// in case there were zero muon candidates /// 8 Nov 2017 : T Kaptanoglu - Write information to ratdb file /// /// \details This processor attempts to tag events following muons. /// During the first pass it outputs a list of candidates, and /// flags them on the second pass through. /// /// /// /// //////////////////////////////////////////////////////////////////// #ifndef __RAT_TPMuonFollowerCut__ #define __RAT_TPMuonFollowerCut__ #include #include #include #include #include #include //Fix for problems with cint and stdint.h on OSX // See https://root-forum.cern.ch/t/rootcint-on-os-x-10-9-and-stdint-h/16940/7 for more details #ifdef __APPLE__ #include <_types/_uint64_t.h> #else extern "C" { #include } #endif namespace RAT { class TPMuonFollowerCut : public DataCleaningProc { public: TPMuonFollowerCut() : DataCleaningProc("tpmuonfollowercut",1){}; virtual ~TPMuonFollowerCut(){}; 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); // Write Muon and Owl event info to local json file during pass 1 std::vector fMuonOutput; std::vector fOwlOutput; std::vector fMuons; json::Value fOwls; // Write muon event info to ratdb file during pass 1 std::vector fGTIDMuons; std::vector fDayMuons; std::vector fSecMuons; std::vector fNsMuons; // Read in muon event info from ratdb file during pass 2 std::vector fCutMuonGTIDs; std::vector fCutDayMuons; std::vector fCutSecMuons; std::vector fCutNsMuons; // Account for the last muon in the previous run int fLastMuonPreviousRunDay; int fLastMuonPreviousRunSec; int fLastMuonPreviousRunNs; int fCutLastMuonDay; int fCutLastMuonSec; int fCutLastMuonNs; // Run type for current and previous run int fRunTypePreviousRun; int fRunType; // Check for rollover run int validGTID; bool fFirstEvent; unsigned int fMinOwls; ///< min owls for a muon unsigned int fNhitMin; ///< min nhit for a muon unsigned int fMaxNeck; ///< max fired neck tubes to fail neck cut part unsigned int fNeckNhitMax; ///< max NHIT to do a neck cut double fTrmsMax; ///< max RMS time (in adc counts) of normal tubes int fMinQ; ///< min charge for neck cut part int fMaxQ; ///< max charge for neck cut part double fTimeDiff; ///< time diff (ns) for neck cut part double fShortFollowerTime; ///< follower time in seconds double fLongFollowerTime; ///< follower time in seconds int fOwlLockoutTime; ///< ns following an OWL event that candidates are vetoed uint64_t fOwlTime; ///< 50MHz clock count for the OWL event int fShortBit; ///< bit in DataCleanFlags for short followers int fLongBit; ///< bit in DataCleanFlags for long followers bool fFreeMuon; ///< Setting first event as muon bool foundDBFile; ///< Found the muon ratdb file bool foundLastFile; ///< Found the ratdb file specifying the last muon in previous run bool foundJsonFile; ///< Found the json file specifying the last muon in previous run // The calibration type (ECA, PCA, both, or neither) int fCalType; ECACal fECACal; }; } // namespace RAT #endif