BmnRoot
Loading...
Searching...
No Matches
BmnHistTrigger.h
Go to the documentation of this file.
1/*
2 * File: BmnHistTrigger.h
3 * Author: ilnur
4 *
5 * Created on November 27, 2016, 4:18 PM
6 */
7
8#ifndef BMNHISTTRIGGER_H
9#define BMNHISTTRIGGER_H 1
10#include "BmnEventHeader.h"
11#include "BmnHist.h"
12#include "BmnRawDataDecoder.h"
13#include "BmnTrigDigit.h"
14#include "BmnTrigRaw2Digit.h"
15#include "TCanvas.h"
16#include "TChain.h"
17#include "TClonesArray.h"
18#include "TFile.h"
19#include "TH1D.h"
20#include "TH1F.h"
21#include "TH2F.h"
22#include "THttpServer.h"
23
24#include <TNamed.h>
25#include <algorithm>
26#include <exception>
27#include <memory>
28#include <regex>
29#include <stdlib.h>
30#include <vector>
31#define TRIG_TIME_WIN 6000
32#define TRIG_TIME_BEAM 2000
33#define TRIG_TIME_BINS 300
34#define TRIG_AMP_BINS 100
35#define TRIG_AMP_BINS_BD 25
36#define SCALER_TIME_WIN 5.5
37#define SCALER_TIME_BINS 1000
38#define AMP_WIN 3000
39#define TRIG_MULTIPL 40
40#define BD_CHANNELS 40
41#define SI_CHANNELS 64
42#define ND_CHANNELS 4
43#define TRIG_ROWS 3
44#define TRIG_COLS 3
45#define LIN_LOG_COLS 2
46
47struct TrigStateDesc
48{
49 TString Name;
50 Color_t Color;
51};
52
53class BmnHistTrigger : public BmnHist
54{
55 public:
56 BmnHistTrigger(TString title = "Triggers",
57 TString path = "",
58 Int_t periodID = 9,
60 BmnTrigRaw2Digit* trigMapper = nullptr);
61 virtual ~BmnHistTrigger();
62
63 void Register(THttpServer* serv);
64 void SetDir(TFile* outFile, TTree* recoTree);
65 void FillFromDigi(DigiArrays* fDigiArrays);
66 void Reset();
67 void DrawBoth();
70
71 void SetBDChannel(Int_t iSelChannel);
72
73 Int_t GetBDChannel() { return fSelectedBDChannel; }
74
75 private:
76 void InitHistsFromArr(vector<TClonesArray*>* trigAr);
77 void InitGrids();
78 void InitTrigMasked();
79 void InitScalers();
80 void FillMSC(DigiArrays* fDigiArrays);
81 void SetDir(TDirectory* Dir);
82 const Int_t MaxTimeTDC = 6000;
83 const Int_t MaxAmpTDC = 50;
84 const Int_t MaxAmpTDC_BD = 25;
85 const Int_t MaxTimeTQDC = 600;
86 const Int_t MaxAmpTQDC = 15000;
87 const Int_t MaxAmpTQDC_Corr = 10000;
88 const Int_t MaxAmpTQDC_Beam = 35000;
89 const Int_t MaxAmpTQDC_BC2 = 15000;
90 const Int_t MaxAmpTQDC_Unit = 60000;
91 const Int_t MaxAmpTQDC_x10 = 33000;
92 const vector<string> ScalerNames{"BC1L_Busy", "pBT_Busy", "BT_Busy", "NiT_Busy",
93 "CCT1_Busy", "MBT_Busy", "BT&nBUSY_Busy", "CCT2_Busy"};
94 const vector<TrigStateDesc> TrigState{{"BT", kCyan}, {"MBT", kGreen + 1}, {"nFD", kRed}};
95 // const vector<TrigStateDesc> TrigState{{"BT", kCyan}, {"MBT", kGreen + 1}, {"CCT1", kRed}, {"CCT2", kBlue}};
96 vector<uint16_t> trig_state_bit_index;
97 Int_t fRows = 0;
98 Int_t fCols = 0;
99 BmnTrigRaw2Digit* fTrigMapper;
100 vector<TString> trigNames;
101 vector<TString> shortNames;
102 TH2I* histBDAmpByChannel;
103 TH1I* histBDChannels;
104 TH1I* histBDSimult;
105 TH1I* histBDCircular;
106 TH2I* histCorrBCBC;
107 TH2I* histCorrBCVC;
108 TH2F* hTDCTimes;
109 TH2F* hTDCAmps;
110 TH2F* hTQDCTimes;
111 TH2F* hTQDCAmps;
112
113 const vector<pair<string, string>> TrigNameCorrTQDC{{"BC1T", "BC1B"}, {"BC2T", "BC2B"}, {"VCT", "VCB"},
114 {"BC1", "BC2"}, {"VC", "BC2"}, {"FD", "BC2"}};
115 vector<double> storeAmpTQDC; // store the TQDC amp in each event to use for correlation
116 vector<pair<uint32_t, uint32_t>> idxCorrTQDC; // indices in the store amp vector
117 vector<TH2I*> histCorrTQDC;
118
119 TCanvas* can2d;
120 TCanvas* canProfile;
121 TCanvas* canTimes;
122 TCanvas* canAmp;
123 bool canInitDone;
124 UInt_t indexBD;
125 unique_ptr<TCanvas> canGridBD;
126 unique_ptr<TCanvas> canGridND;
127 unique_ptr<TCanvas> canTrigStates;
128 unique_ptr<TCanvas> canCorrTQDC;
129 unique_ptr<TCanvas> canScalers;
130 map<string, UInt_t> mapArrayNames;
131 map<UInt_t, PadInfo*> mapGridND;
132 map<UInt_t, PadInfo*> mapAmpLin;
133 map<UInt_t, PadInfo*> mapAmpLog;
134 map<UInt_t, PadInfo*> mapTBLin;
135 map<UInt_t, PadInfo*> mapTBLog;
136 map<UInt_t, TH1*> mapTime;
137 vector<TH1*> histsGridBD;
138 vector<TH1*> hists;
139 vector<vector<TH1*>> histsAux;
140 vector<PadInfo*> padsGridBD;
141 vector<PadInfo*> padsGridND;
142 vector<PadInfo*> padsTrigStates;
143 vector<PadInfo*> padsCorrTQDC;
144 vector<PadInfo*> padsScalers;
145 vector<PadInfo*> canProfilePads;
146 vector<PadInfo*> canTimesPads;
147 vector<PadInfo*> can2dPads;
148 vector<PadInfo*> padsCanAmp;
149 Int_t fSelectedBDChannel;
150 // scaler auxillary data
151 vector<pair<uint16_t, PadInfo*>> fill_scaler_vec_profile;
152 vector<pair<uint16_t, PadInfo*>> fill_scaler_vec_spill;
153 Int_t fLastSpillId;
154 TTimeStamp fLastSpillStartTS;
155
156 ClassDef(BmnHistTrigger, 2)
157};
158
159#endif /* BMNHISTTRIGGER_H */
BmnStatus
Definition BmnEnums.h:24
BmnSetup
Definition BmnEnums.h:89
@ kBMNSETUP
Definition BmnEnums.h:90
void SetDir(TFile *outFile, TTree *recoTree)
void SetBDChannel(Int_t iSelChannel)
void FillFromDigi(DigiArrays *fDigiArrays)
void Register(THttpServer *serv)
BmnHistTrigger(TString title="Triggers", TString path="", Int_t periodID=9, BmnSetup=kBMNSETUP, BmnTrigRaw2Digit *trigMapper=nullptr)
void ClearRefRun()
BmnStatus SetRefRun(Int_t id)
virtual ~BmnHistTrigger()