//////////////////////////////////////////////////////////////////// // // Standard Ntuple Output Processor. Produces a standardized, reduced // data summary file. // // Author: Kevin Labe - contact person // // REVISION HISTORY: // - 10/04/13: K Labe - New file. // - 10/08/13: K Labe - Added BeginOfRun() method, EdepQuenched. // - 11/01/13: K Labe - Added Momentum variables for MC Particle data. // - 16/09/14: M Mottram - Added fit validity mask and bool; // set all valid fit information. // - 2015/04/08: M Mottram - Added extra classifiers and DS::INVALID // where appropriate. // - 2016/03/08: J Wilson - Added time for the two most energetic MC particles // (needed for BiPo studies) // - 2016/10/18: N Barros - Fixed bug in the parent particle information // - 2016/11/21: R Knapik - Added the data cleaning word as // a TString // - 2017/03/09: M Askins - Switch data cleaning word from TString to ULong64_t // Added the word for applied data cleaning cuts // - 2017-04-26: J Dunger - add end of job meta information, write meta to file // - 2017-10-24: Anthony LaTorre - add inTimeHits100 and inTimeHits20 // - 2018-01-11: N Barros - Change file opening logic to allow to specify a file suffix // - 2018-01-12: N Barros - Moved file creation to BeginOfRun to make sure that // a file is always created, even if it is empty // - 2018-01-17: Logan Lebanowski - Added EnergyRSP figures of merit // - 2018-03-18: Tanner Kaptanoglu - Added PEnergy energy fit result // //////////////////////////////////////////////////////////////////// #ifndef __RATOutNtupleProc___ #define __RATOutNtupleProc___ #include #include #include #include #include class TFile; class TTree; namespace RAT { namespace DS { class EV; } class OutNtupleProc : public Processor { public: static Int_t fRunNum; OutNtupleProc(); virtual ~OutNtupleProc(); virtual void BeginOfRun(DS::Run& run); virtual void EndOfRun(DS::Run& run); // file - string, name of file to open for output, file will be erased virtual void SetS(const std::string& param, const std::string& value); virtual Processor::Result DSEvent(DS::Run& run, DS::Entry& ds); virtual void OpenFile(); protected: std::string fDefaultFileName; std::string fFileName; std::string fFileNameSuffix; TFile *file; TTree *output; DS::Entry *branchDS; DS::Run *branchRun; Int_t fAutoSave; Int_t fAutoFlush; Int_t McIndex, EvIndex, PIndex; // Note that the structures TriggerDS and mcDS, together with a few other // variables, make up the full output data structure. The contents of these // structures are described in OutNtupleProc.cc where branch addresses are set. struct TriggerDS { Int_t eventID; Int_t nhits; Int_t owlnhits; Int_t nhitsCleaned; Double_t inTimeHits100; Double_t inTimeHits20; Bool_t isCal; UInt_t fecdHits; Double_t Q; Int_t trigger; UInt_t tubii; ULong64_t dcApplied; ULong64_t dcFlagged; ULong64_t ClockCount10; ULong64_t ClockCount50; Int_t UTDays; Int_t UTSecs; Int_t UTNSecs; Double_t posx; Double_t posy; Double_t posz; Double_t posr; Double_t posFOM; Double_t posxPosError; Double_t posyPosError; Double_t poszPosError; Double_t posxNegError; Double_t posyNegError; Double_t poszNegError; Double_t dirx; Double_t diry; Double_t dirz; Double_t dirxPosError; Double_t diryPosError; Double_t dirzPosError; Double_t dirxNegError; Double_t diryNegError; Double_t dirzNegError; Double_t energy; Double_t penergyEnergy; Double_t energyFOMmedProb; Double_t energyFOMmedProbHit; Double_t energyFOMmedDev; Double_t energyFOMmedDevHit; Double_t energyFOMGtest; Double_t energyFOMUtest; Double_t energyPosError; Double_t energyNegError; Double_t time; Double_t timePosError; Double_t timeNegError; Double_t timingPeaks; Bool_t waterFit; Bool_t scintFit; Bool_t partialWaterFit; Bool_t partialFit; Bool_t fitValid; UInt_t fitValidityMask; Double_t itr; Double_t berkeleyAlphaBeta; Double_t thetaij; Double_t beta14; Double_t qpdtProbability; Double_t qpdtNhitsEarly; Double_t qpdtQMax; Double_t meanTime; Double_t earlyTime; Double_t preTriggerHits; Double_t isotropyRegions; Double_t latIsotropyRegions; Double_t biPoCumul; Double_t biPoLikelihood212; Double_t biPoLikelihood214; Double_t alphaBeta212; Double_t alphaBeta214; Double_t annR; Double_t nearAV; }; struct mcDS{ Int_t runID; TString ratversion; Bool_t mcvalid; Int_t pdg1; Int_t pdg2; Int_t parentpdg1; Int_t parentpdg2; Double_t parentKE1; Double_t parentKE2; TString parentMetaInfo1; TString parentMetaInfo2; Double_t ke1; Double_t ke2; Double_t mct; Double_t Edep; Double_t EdepQuenched; Double_t mcposx; Double_t mcposy; Double_t mcposz; Double_t mcposr; Double_t mom1x; Double_t mom1y; Double_t mom1z; Double_t mom2x; Double_t mom2y; Double_t mom2z; Double_t time1; Double_t time2; }; TriggerDS data; mcDS mcdata; private: std::pair SearchEnergies(DS::MC& rmc); std::string CheckFits(DS::EV *rEV); void GetFitData(const std::string fittype, DS::EV *rEV); void GetWaterFitterData(const std::string fittype, DS::EV *rEV); void GetPenergyData(DS::EV *rEV); void GetEventData(DS::EV *rEV); void GetParticleData(const std::pair index, DS::MC& rmc); MetaHelper fMetaHelper; }; } // namespace RAT #endif