//////////////////////////////////////////////////////////////////// /// \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 /// 4 Nov 2022 : S Riccetto - Tag muons and use clockCount50 /// /// \details This processor attempts to tag muons and followers. /// 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 //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 EventWater(DS::Entry& ds, DS::EV& ev); virtual Processor::Result EventScintillator(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; std::vector fMuonsClock50_bottom_31_bits; std::vector fMuonsClock50_top_bits; // Read in muon event info from ratdb file during pass 2 std::vector fCutMuonGTIDs; std::vector fCutDayMuons; std::vector fCutSecMuons; std::vector fCutNsMuons; std::vector fCutMuonsClock50_bottom_31_bits; std::vector fCutMuonsClock50_top_bits; // Account for the last muon in the previous run int fLastMuonPreviousRunDay; int fLastMuonPreviousRunSec; int fLastMuonPreviousRunNs; int fCutLastMuonDay; int fCutLastMuonSec; int fCutLastMuonNs; int fCutLastMuonClock50_bottom_31_bits; int fCutLastMuonClock50_top_bits; // Run type for current and previous run int fRunTypePreviousRun; int fRunType; // Table version for current and previous run int fTableVersionPreviousRun; ///< version of LAST_MUON table int fTableVersion; ///< version of TPMUONFOLLOWER table // Check for rollover run int validGTID; bool fFirstEvent; unsigned int fRMSR; ///< threshold on spread of R unsigned int fRMSTAC; ///< threshold on spread of TAC 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 // To maintain functionality of water cuts, cannot currently tag missed muons whilst using scintillator checks. LN Aug 2021. int fTagMissedCandidates; ///< if =1 tag missed-muons (i.e. missed PSUP) int fTagMuonCandidates; ///< if =1 tag muon candidates (i.e. went through PSUP) int fShortBit; ///< bit in DataCleanFlags for short followers int fLongBit; ///< bit in DataCleanFlags for long followers int fMuonBit; ///< bit in DataCleanFlags for muons bool fWaterCuts; ///< Active if we are using the water cuts bool fScintillatorCuts; ///Active if we are using the scintillator cuts 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 bool foundLastClock50; ///< Found 50MHz clock in the ratdb file specifying the last muon in previous run bool foundClock50; ///< Found 50MHz clock in the muon ratdb file // The calibration type (ECA, PCA, both, or neither) int fCalType; ECACal fECACal; }; } // namespace RAT #endif