37 Name(
"OnlMonTrigSig");
38 Title(
"Trigger Signal");
48 const double DT = 40/9.0;
50 const double T0 = 100.5*DT;
51 const double T1 = 200.5*DT;
52 h2_bi_fpga =
new TH2D(
"h2_bi_fpga",
"FPGA Before Inhibit;tdcTime;", NT, T0, T1, 5, 0.5, 5.5);
53 h2_ai_fpga =
new TH2D(
"h2_ai_fpga",
"FPGA After Inhibit;tdcTime;", NT, T0, T1, 5, 0.5, 5.5);
54 h2_bi_nim =
new TH2D(
"h2_bi_nim" ,
"NIM Before Inhibit;tdcTime;", NT, T0, T1, 5, 0.5, 5.5);
55 h2_ai_nim =
new TH2D(
"h2_ai_nim" ,
"NIM After Inhibit;tdcTime;", NT, T0, T1, 5, 0.5, 5.5);
56 for (
int ii = 1; ii <= 5; ii++) {
59 h2_bi_fpga->GetYaxis()->SetBinLabel(ii, oss.str().c_str());
60 h2_ai_fpga->GetYaxis()->SetBinLabel(ii, oss.str().c_str());
63 h2_bi_nim->GetYaxis()->SetBinLabel(ii, oss.str().c_str());
64 h2_ai_nim->GetYaxis()->SetBinLabel(ii, oss.str().c_str());
67 const double DT2 = 1.0;
69 const double T02 = 0.5*DT2;
70 const double T12 = (NT2+0.5)*DT2;
71 h2_rf =
new TH2D(
"h2_rf" ,
"RF on v1495;tdcTime;", NT2, T02, T12, 9, 0.5, 9.5);
72 h2_stop =
new TH2D(
"h2_stop" ,
"STOP on v1495;tdcTime;", NT2, T02, T12, 9, 0.5, 9.5);
73 for (
int ii = 1; ii <= 9; ii++) {
75 oss <<
"Board " << ii;
76 h2_rf ->GetYaxis()->SetBinLabel(ii, oss.str().c_str());
77 h2_stop->GetYaxis()->SetBinLabel(ii, oss.str().c_str());
80 RegisterHist(h2_bi_fpga);
81 RegisterHist(h2_ai_fpga);
82 RegisterHist(h2_bi_nim );
83 RegisterHist(h2_ai_nim );
85 RegisterHist(h2_stop );
92 SQEvent* event_header = findNode::getClass<SQEvent >(topNode,
"SQEvent");
93 SQHitVector* hit_vec = findNode::getClass<SQHitVector>(topNode,
"SQHitVector");
94 SQHitVector* trig_hit_vec = findNode::getClass<SQHitVector>(topNode,
"SQTriggerHitVector");
100 int det_id = (*it)->get_detector_id();
101 int ele_id = (*it)->get_element_id ();
102 double time = (*it)->get_tdc_time ();
103 if (det_id == geom->
getDetectorID(
"BeforeInhNIM" )) h2_bi_nim ->Fill(time, ele_id);
104 else if (det_id == geom->
getDetectorID(
"BeforeInhMatrix")) h2_bi_fpga->Fill(time, ele_id);
105 else if (det_id == geom->
getDetectorID(
"AfterInhNIM" )) h2_ai_nim ->Fill(time, ele_id);
106 else if (det_id == geom->
getDetectorID(
"AfterInhMatrix" )) h2_ai_fpga->Fill(time, ele_id);
110 int det_id = (*it)->get_detector_id();
111 int ele_id = (*it)->get_element_id ();
112 double time = (*it)->get_tdc_time ();
113 if (det_id == geom->
getDetectorID(
"RF" )) h2_rf ->Fill(time, ele_id);
114 else if (det_id == geom->
getDetectorID(
"STOP")) h2_stop->Fill(time, ele_id);
127 h2_bi_fpga = (TH2*)FindMonHist(
"h2_bi_fpga");
128 h2_ai_fpga = (TH2*)FindMonHist(
"h2_ai_fpga");
129 h2_bi_nim = (TH2*)FindMonHist(
"h2_bi_nim" );
130 h2_ai_nim = (TH2*)FindMonHist(
"h2_ai_nim" );
131 h2_rf = (TH2*)FindMonHist(
"h2_rf" );
132 h2_stop = (TH2*)FindMonHist(
"h2_stop" );
133 return (h2_bi_fpga && h2_ai_fpga && h2_bi_nim && h2_ai_nim && h2_rf && h2_stop ? 0 : 1);
149 pad0->cd(1); DrawTH2WithPeakPos(h2_bi_fpga);
150 pad0->cd(2); DrawTH2WithPeakPos(h2_ai_fpga);
157 pad1->cd(1); DrawTH2WithPeakPos(h2_bi_nim);
158 pad1->cd(2); DrawTH2WithPeakPos(h2_ai_nim);
165 pad2->cd(1); DrawTH2WithPeakPos(h2_rf );
166 pad2->cd(2); DrawTH2WithPeakPos(h2_stop);
172 void OnlMonTrigSig::DrawTH2WithPeakPos(TH2* h2,
const double cont_min)
175 int ny = h2->GetNbinsY();
176 for (
int iy = 1; iy <= ny; iy++) {
177 TH1* h1 = h2->ProjectionX(
"h1_draw_th2", iy, iy);
179 if (h1->GetMaximum() >= cont_min) {
180 oss <<
"Peak @ " << h1->GetXaxis()->GetBinCenter(h1->GetMaximumBin());
182 oss <<
"No sizable peak";
184 TText* text =
new TText();
186 text->SetTextAlign(22);
187 text->DrawText(0.3, 0.1+(iy-0.5)*0.8/ny, oss.str().c_str());
void AutoSetRangeX(TH2 *h2, const int margin_lo=5, const int margin_hi=5)
std::vector< SQHit * >::const_iterator ConstIter
int InitRunOnlMon(PHCompositeNode *topNode)
int InitOnlMon(PHCompositeNode *topNode)
int ProcessEventOnlMon(PHCompositeNode *topNode)
int EndOnlMon(PHCompositeNode *topNode)
An SQ interface class to hold a list of SQHit objects.
An SQ interface class to hold one event header.
static GeomSvc * instance()
singlton instance
int getDetectorID(const std::string &detectorName) const
Get the plane position.