/*************************************************************************** * Copyright (C) 2018 by Jeremie Dudouet * * jeremie.dudouet(AT)csnsm.in2p3.fr * * * * This program is free software; you can redistribute it and/or modify * * it under the terms of the GNU General Public License as published by * * the Free Software Foundation; either version 2 of the License, or * * (at your option) any later version. * * * * This program is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU General Public License for more details. * * * * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * ***************************************************************************/ #ifndef _PreproHist #define _PreproHist #include "AGAPRO_Histogramer.h" #include "NarvalInterface.h" #include "CrystalFrame.h" #include "Trigger.h" #include "CycleServer.h" //! Post preprocessing histogramer /*! */ namespace AGAPRO { class PreproHist : public Histogramer { protected: //Evt properties ULong64_t fFirstTS = 0; ULong64_t fLastTS = 0; UInt_t fTraceLengthPSA; // length of input traces // float version of the traces Float_t *fTracesSG[kNSG]; Float_t *fTracesCC[kNCC]; ADF::GeSegment *seg = nullptr; ADF::GeCore *core = nullptr; Float_t SegE[kNSG]; // in keV Float_t CoreE[kNCC]; // in keV Float_t SegBase[kNSG]; // in keV Float_t CoreBase[kNCC]; // in keV Float_t SegT0[kNSG]; Float_t CoreT[kNCC]; Float_t DeltaT; Float_t fGatedRateEnergy = 0.; Float_t fGatedRateWidth = 0.; private: bool fPlotAmpli = false; bool fPlotAmplivsId = false; bool fPlotBaseline = false; bool fPlotT0 = false; bool fPlotTimeStamps = false; bool fPlotGatedRates = false; bool fPlotDeltaT = false; Float_t fNextCycleSec; Float_t fNextCycleMin; binning_TH1 fAmpliBinning; binning_TH1 fBaselineBinning; binning_TH1 fT0Binning; binning_TH1 fDeltaTBinning; binning_TH2 fAmplivsIdBinning; Float_t fMinSegAmpli; // minimum segment amplitude to detect segment multiplicity enum class HistLib: int { Ampli, Ampli_vs_Id, Baseline, T0, TimeStamps, GatedRates, DeltaT }; /// For T0 calculation (from PreprocessingFilterPSA.cpp const float tStep = 10.f; // ns/sample const float tScale = tStep; // 1ns/ch const int speTTlen = int(100*tScale); const int tGain = 1; const float trigFraction = .05f; // start fitting stright line at this fraction of max amplitude (but not lower than trigLevel1) const int trigChansSG = 5; // normally 4 const float trigLevel1 = 10.f; // lowered to 10 keV because of the gaussian smoothing performend before fitting the stright line const float calcTT_eminCC = 200.f; // energy threshold when making the tCC-tSG analysis int nSegFold; int netChargeSegs[kNSG]; public: PreproHist(); virtual ~PreproHist(); virtual UInt_t Process(); virtual Int_t SetInput(); //! to init your local variables with the ones from the buffers virtual void process_initialise ( UInt_t *error_code ); //! Constructor implementation public: virtual UInt_t GetParameters(const std::string& confFile, Bool_t doList=false) override; private: virtual void InitSMZ(Int_t id) override; int CalcT0(); float FindTriggerTime (float *pTS, float trigFract, int trigChans, float &slope); // stright line of parabola }; } #endif