Warning, file /coresoftware/offline/packages/mbd/MbdEvent.h was not indexed
or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).
0001 #ifndef MBD_MBDEVENT_H
0002 #define MBD_MBDEVENT_H
0003
0004 #include "MbdDefs.h"
0005 #include "MbdSig.h"
0006
0007 #include <TFile.h>
0008 #include <TTree.h>
0009
0010 #ifndef ONLINE
0011 #include <fun4all/Fun4AllBase.h>
0012 #endif
0013
0014 #include <array>
0015 #include <limits>
0016 #include <vector>
0017
0018 class PHCompositeNode;
0019 class Event;
0020 class MbdRawContainer;
0021 class MbdPmtContainer;
0022 class MbdOut;
0023 class MbdCalib;
0024 class MbdGeom;
0025 class CDBUtils;
0026 class TF1;
0027 class TCanvas;
0028 #ifndef ONLINE
0029 class CaloPacket;
0030 class CaloPacketContainer;
0031 class Gl1Packet;
0032 class PHG4TruthInfoContainer;
0033 class PHG4VtxPoint;
0034 #endif
0035
0036 class MbdEvent
0037 {
0038 public:
0039 MbdEvent(const int cal_pass = 0, const bool proc_charge = false);
0040 virtual ~MbdEvent();
0041
0042 int InitRun();
0043 int End();
0044 void Clear();
0045
0046 int SetRawData(Event *event, MbdRawContainer *bbcraws, MbdPmtContainer *bbcpmts);
0047 #ifndef ONLINE
0048 int SetRawData(std::array< CaloPacket*,2> &dstp, MbdRawContainer *bbcraws, MbdPmtContainer *bbcpmts, Gl1Packet *gl1raw);
0049 #endif
0050 int ProcessPackets(MbdRawContainer *bbcraws);
0051 int ProcessRawContainer(MbdRawContainer *bbcraws, MbdPmtContainer *bbcpmts);
0052 void PostProcessChannels(MbdPmtContainer *bbcpmts);
0053 int Calculate(MbdPmtContainer *bbcpmts, MbdOut *bbcout, PHCompositeNode *topNode = nullptr);
0054
0055 void SetSim(const int s) { _simflag = s; }
0056 void SetRawDstFlag(const int r) { _rawdstflag = r; }
0057 void SetFitsOnly(const int f) { _fitsonly = f; }
0058
0059 float get_bbcz() { return m_bbcz; }
0060 float get_bbczerr() { return m_bbczerr; }
0061 float get_bbct0() { return m_bbct0; }
0062 float get_bbct0err() { return m_bbct0err; }
0063
0064 int get_bbcn(const int iarm) { return m_bbcn[iarm]; }
0065 float get_bbcq(const int iarm) { return m_bbcq[iarm]; }
0066 float get_bbct(const int iarm) { return m_bbct[iarm]; }
0067 float get_bbcte(const int iarm) { return m_bbcte[iarm]; }
0068
0069 int get_pmtq(const int ipmt) { return m_pmtq[ipmt]; }
0070 float get_pmttt(const int ipmt) { return m_pmttt[ipmt]; }
0071 float get_pmttq(const int ipmt) { return m_pmttq[ipmt]; }
0072
0073 int get_EventNumber(void) const { return m_evt; }
0074 void set_EventNumber(int ievt) { m_evt = ievt; }
0075
0076 void set_debug(const int d) { _debug = d; }
0077
0078 MbdSig *GetSig(const int ipmt) { return &_mbdsig[ipmt]; }
0079
0080 MbdCalib *GetCalib() { return _mbdcal; }
0081
0082 int FillSampMaxCalib();
0083
0084 int calib_is_done() { return _calib_done; }
0085
0086 int Verbosity() { return _verbose; }
0087 void Verbosity(const int v) { _verbose = v; }
0088
0089 private:
0090 static const int NCHPERPKT = 128;
0091
0092 MbdGeom *_mbdgeom{nullptr};
0093 MbdCalib *_mbdcal{nullptr};
0094
0095 int Read_Charge_Calib(const std::string &gainfname);
0096 int Read_TQ_T0_Offsets(const std::string &t0cal_fname);
0097 int Read_TQ_CLK_Offsets(const std::string &t0cal_fname);
0098 int Read_TT_CLK_Offsets(const std::string &t0cal_fname);
0099
0100
0101 bool isbadtch(const int ipmtch);
0102
0103
0104 int _debug{0};
0105 #ifndef ONLINE
0106 PHG4TruthInfoContainer* _truth_container {nullptr};
0107 PHG4VtxPoint* _vtxp {nullptr};
0108 PHG4VtxPoint* GetPrimaryVtx(PHCompositeNode *topNode);
0109 #endif
0110 int epmt[2]{-1, -1};
0111
0112 double tepmt[2]{1e9, 1e9};
0113 double tlpmt[2]{-1e9, -1e9};
0114 void ReadSyncFile(const char *fname = "SYNC_INTTMBD.root");
0115
0116 float gaincorr[MbdDefs::MBD_N_PMT]{};
0117 float tq_t0_offsets[MbdDefs::MBD_N_PMT]{};
0118 float tq_clk_offsets[MbdDefs::MBD_N_PMT]{};
0119 float tt_clk_offsets[MbdDefs::MBD_N_PMT]{};
0120
0121
0122
0123 int _verbose{0};
0124 int _runnum{0};
0125 int _simflag{0};
0126 int _rawdstflag{0};
0127 int _fitsonly{0};
0128 int _nsamples{31};
0129 int _calib_done{0};
0130 unsigned int _no_sampmax{0};
0131 int _is_online{0};
0132
0133
0134 Int_t m_evt{0};
0135 Short_t m_clk{0};
0136 Short_t m_femclk{0};
0137 UInt_t m_xmitclocks[2]{};
0138 UInt_t m_femclocks[2][2]{};
0139
0140
0141 Float_t m_adc[MbdDefs::MBD_N_FEECH][MbdDefs::MAX_SAMPLES]{};
0142 Float_t m_samp[MbdDefs::MBD_N_FEECH][MbdDefs::MAX_SAMPLES]{};
0143
0144 Float_t m_ampl[MbdDefs::MBD_N_FEECH]{};
0145 Float_t m_ttdc[MbdDefs::MBD_N_FEECH]{};
0146 Float_t m_qtdc[MbdDefs::MBD_N_FEECH]{};
0147
0148 std::vector<MbdSig> _mbdsig;
0149
0150 Float_t m_pmtq[MbdDefs::MBD_N_PMT]{};
0151 Float_t m_pmttt[MbdDefs::MBD_N_PMT]{};
0152 Float_t m_pmttq[MbdDefs::MBD_N_PMT]{};
0153
0154 int do_templatefit{1};
0155
0156
0157 Short_t m_bbcn[2]{};
0158 Float_t m_bbcq[2]{};
0159 Float_t m_bbct[2]{};
0160 Float_t m_bbcte[2]{};
0161 Float_t m_bbctl[2]{};
0162 Float_t m_bbcz{std::numeric_limits<Float_t>::quiet_NaN()};
0163 Float_t m_bbczerr{std::numeric_limits<Float_t>::quiet_NaN()};
0164 Float_t m_bbct0{std::numeric_limits<Float_t>::quiet_NaN()};
0165 Float_t m_bbct0err{std::numeric_limits<Float_t>::quiet_NaN()};
0166 Float_t _tres{std::numeric_limits<Float_t>::quiet_NaN()};
0167
0168 TH1 *hevt_bbct[2]{};
0169 TF1 *gausfit[2]{nullptr, nullptr};
0170
0171 float TRIG_SAMP[16]{};
0172
0173
0174 int _calpass{0};
0175 bool _always_process_charge{false};
0176 TString _caldir;
0177
0178
0179
0180 int CalcSampMaxCalib();
0181 std::unique_ptr<TFile> _calpass1_tfile{nullptr};
0182 std::unique_ptr<TFile> _calpass2_tfile{nullptr};
0183 TH1 *h_smax[256]{};
0184 TH2 *h2_smax[2]{};
0185 TH2 *h2_wave[2]{};
0186 TH2 *h2_trange_raw{};
0187 TH2 *h2_trange{};
0188
0189
0190
0191 int CalcPedCalib();
0192
0193
0194 void ClusterEarliest(std::vector<float> ×, double& mean, double& rms, double& rmin, double& rmax);
0195
0196
0197 TCanvas *ac{nullptr};
0198 void PlotDebug();
0199 std::unique_ptr<TFile> _synctfile{nullptr};
0200 TTree *_syncttree{nullptr};
0201 Double_t _refz{ std::numeric_limits<double>::quiet_NaN() };
0202 std::vector<Int_t> bbevt;
0203 std::vector<UShort_t> bbclk;
0204 std::vector<Float_t> mybbz;
0205 std::vector<Long64_t> bco;
0206 std::vector<Double_t> intz;
0207 std::vector<Double_t> bbz;
0208 };
0209
0210 #endif