//////////////////////////////////////////////////////////////////// // // 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 // - 2018-08-16: Nuno Barros - Added MultiPath and fastZ results to Ntuple // - 2018-08-16: Logan Lebanowski - Appended position and direction figures of merit // Added number of Cherenkov photons // - 2018-10-10: T Kroupa - Added external bkg classifier results // - 2019-04-10: W. Heintzelman Add provision for a second PEnergy fit // variation and add output of fit error for PEnergy. // - 2019-07-27: Yang Zhang - Add multi-site classifier // - 2020-02-14: Jie Hu - Add position FOM values for multiPath fitter // - 2020-07-29: Meng Luo - Add fitted decay time from AlphaBetaClassifier // - 2020-09-01: Max Smiley - Add Nhit, retrigger flag used for BerkeleyAlphaBeta // - 2020-12-14: Charlie Mills - Add AlphaNReactorIBD classifier // - 2021-11-15: Logan Lebanowski - Add fitter save option // - 2022-08-22: T Kroupa - Add correctedNhits // - 2022-10-01: Z Ye - Add more FOMs for AlphaBetaClassifier ( BiPo - Te130 classification ) // //////////////////////////////////////////////////////////////////// #ifndef __RATOutNtupleProc___ #define __RATOutNtupleProc___ #include #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; std::string fFitterName; 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 necknhits; Int_t nhitsCleaned; Double_t correctedNhits; 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; UInt_t posFOM2; Double_t posFOM_Multipath; UInt_t posFOM2_Multipath; 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 dirFOM; UInt_t dirFOM2; Double_t energy; Double_t penergyEnergy; Double_t penergyError; Double_t penergyAEnergy; Double_t penergyAError; Double_t penergyCEnergy; Double_t penergyCError; 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 xsite; Double_t berkeleyAlphaBeta; UInt_t berkeleyAlphaBetaNhit; Bool_t berkeleyAlphaBetaRetrigger; 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 alphaBeta212_logLTe; Double_t alphaBeta212_logLBiPo; Double_t alphaBeta212_BiPoDT; Double_t alphaBeta212_BiPoER; Bool_t alphaBeta212_Retrigger; UInt_t alphaBeta212_totalNhits; Double_t alphaBeta214; Double_t alphaBeta214_logLTe; Double_t alphaBeta214_logLBiPo; Double_t alphaBeta214_BiPoDT; Double_t alphaBeta214_BiPoER; Bool_t alphaBeta214_Retrigger; UInt_t alphaBeta214_totalNhits; Double_t annR; Double_t nearAV; Double_t skyShine; Double_t topOWLCount; Double_t time_fastZ; Double_t posz_fastZ; Bool_t fitValid_fastZ; Double_t tcen_x; Double_t tcen_y; Double_t tcen_z; Double_t posx_MultiPath; Double_t posy_MultiPath; Double_t posz_MultiPath; Double_t posr_MultiPath; Double_t time_MultiPath; Bool_t fitValid_MultiPath; Double_t ext0NuAngleTl208AV; Double_t ext0NuAngleTl208HDR; Double_t ext0NuAngleTl208ExWater; Double_t ext0NuAnglePMTbg; Double_t ext0NuTimeTl208AV; Double_t ext0NuTimeTl208HDR; Double_t ext0NuTimeTl208ExWater; Double_t ext0NuTimePMTbg; Double_t ext0NuTimeTl208AVNaive; Double_t ext0NuTimeTl208HDRNaive; Double_t ext0NuTimeTl208ExWaterNaive; Double_t ext0NuTimePMTbgNaive; Double_t ext0NuTimeTl208AVOffset; Double_t ext0NuTimeTl208HDROffset; Double_t ext0NuTimeTl208ExWaterOffset; Double_t ext0NuTimePMTbgOffset; Double_t alphaNReactorIBD; Double_t ext0NuTimeBi214Naive; Double_t ext0NuTimeCo60Naive; Double_t ext0NuTimeBi210Bi214Naive; }; 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; UInt_t NCherPhotons; 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 GetPenergyData(DS::EV *rEV); void GetMultiPathData(DS::EV *rEV); void GetFastZData(DS::EV *rEV); void GetEventData(DS::EV *rEV); void GetParticleData(const std::pair index, DS::MC& rmc); MetaHelper fMetaHelper; }; } // namespace RAT #endif