23 case H1X:
Name(
"OnlMonV1495H1X" );
Title(
"V1495: H1X" );
break;
24 case H2X:
Name(
"OnlMonV1495H2X" );
Title(
"V1495: H2X" );
break;
25 case H3X:
Name(
"OnlMonV1495H3X" );
Title(
"V1495: H3X" );
break;
26 case H4X:
Name(
"OnlMonV1495H4X" );
Title(
"V1495: H4X" );
break;
27 case H1Y:
Name(
"OnlMonV1495H1Y" );
Title(
"V1495: H1Y" );
break;
28 case H2Y:
Name(
"OnlMonV1495H2Y" );
Title(
"V1495: H2Y" );
break;
29 case H4Y1:
Name(
"OnlMonV1495H4Y1");
Title(
"V1495: H4Y1");
break;
30 case H4Y2:
Name(
"OnlMonV1495H4Y2");
Title(
"V1495: H4Y2");
break;
41 const double DT = 5.0;
46 case H1X: SetDet(
"H1T" ,
"H1B" );
break;
47 case H2X: SetDet(
"H2T" ,
"H2B" );
break;
48 case H3X: SetDet(
"H3T" ,
"H3B" );
break;
49 case H4X: SetDet(
"H4T" ,
"H4B" );
break;
50 case H1Y: SetDet(
"H1L" ,
"H1R" );
break;
51 case H2Y: SetDet(
"H2L" ,
"H2R" );
break;
52 case H4Y1: SetDet(
"H4Y1L",
"H4Y1R");
break;
53 case H4Y2: SetDet(
"H4Y2L",
"H4Y2R"); NT=100; T0=90.5*DT; T1=190.5*DT;
break;
58 for (
int i_det = 0; i_det <
N_DET; i_det++) {
59 string name = list_det_name[i_det];
60 int det_id = list_det_id [i_det];
62 if (det_id <= 0 || n_ele <= 0) {
63 cout <<
"OnlMonV1495::InitRunOnlMon(): Invalid det_id or n_ele: "
64 << det_id <<
" " << n_ele <<
" at name = " << name <<
"." << endl;
69 oss <<
"h1_ele_" << i_det;
70 h1_ele[i_det] =
new TH1D(oss.str().c_str(),
"", n_ele, 0.5, n_ele+0.5);
72 oss << name <<
";Element ID;Hit count";
73 h1_ele[i_det]->SetTitle(oss.str().c_str());
76 oss <<
"h1_ele_in_" << i_det;
77 h1_ele_in[i_det] =
new TH1D(oss.str().c_str(),
"", n_ele, 0.5, n_ele+0.5);
79 oss << name <<
";Element ID;In-time hit count";
80 h1_ele_in[i_det]->SetTitle(oss.str().c_str());
83 oss <<
"h1_time_" << i_det;
84 h1_time[i_det] =
new TH1D(oss.str().c_str(),
"", NT, T0, T1);
87 oss << name <<
";tdcTime;Hit count";
88 h1_time[i_det]->SetTitle(oss.str().c_str());
91 oss <<
"h1_time_in_" << i_det;
92 h1_time_in[i_det] =
new TH1D(oss.str().c_str(),
"", NT, T0, T1);
94 oss << name <<
";tdcTime;In-time hit count";
95 h1_time_in[i_det]->SetTitle(oss.str().c_str());
98 oss <<
"h2_time_ele_" << i_det;
99 h2_time_ele[i_det] =
new TH2D(oss.str().c_str(),
"", n_ele, 0.5, n_ele+0.5, NT, T0, T1);
101 oss << name <<
";Element ID;tdcTime;Hit count";
102 h2_time_ele[i_det]->SetTitle(oss.str().c_str());
116 SQEvent* event_header = findNode::getClass<SQEvent >(topNode,
"SQEvent");
117 SQHitVector* hit_vec = findNode::getClass<SQHitVector>(topNode,
"SQTriggerHitVector");
121 if ((*it)->get_level() != m_lvl)
continue;
122 int det_id = (*it)->get_detector_id();
123 for (
int i_det = 0; i_det <
N_DET; i_det++) {
124 if (list_det_id[i_det] != det_id)
continue;
125 int ele = (*it)->get_element_id();
126 double time = (*it)->get_tdc_time ();
127 h1_ele [i_det]->Fill(ele );
128 h1_time [i_det]->Fill(time);
129 h2_time_ele[i_det]->Fill(ele, time);
130 if ((*it)->is_in_time()) {
131 h1_ele_in [i_det]->Fill(ele );
132 h1_time_in[i_det]->Fill(time);
148 for (
int i_det = 0; i_det <
N_DET; i_det++) {
150 oss <<
"h1_ele_" << i_det;
152 if (! h1_ele[i_det])
return 1;
154 oss <<
"h1_ele_in_" << i_det;
156 if (! h1_ele_in[i_det])
return 1;
158 oss <<
"h1_time_" << i_det;
160 if (! h1_time[i_det])
return 1;
162 oss <<
"h1_time_in_" << i_det;
163 h1_time_in[i_det] =
FindMonHist(oss.str().c_str());
164 if (! h1_time_in[i_det])
return 1;
166 oss <<
"h2_time_ele_" << i_det;
167 h2_time_ele[i_det] = (TH2*)
FindMonHist(oss.str().c_str());
168 if (! h2_time_ele[i_det])
return 1;
179 for (
int i_det = 0; i_det <
N_DET; i_det++) {
181 h1_ele[i_det]->SetLineColor(kBlack);
182 h1_ele[i_det]->Draw();
183 h1_ele_in[i_det]->SetLineColor(kBlue);
184 h1_ele_in[i_det]->SetFillColor(kBlue-7);
185 h1_ele_in[i_det]->Draw(
"same");
188 h2_time_ele[i_det]->Draw(
"colz");
190 oss <<
"pr_" << h2_time_ele[i_det]->GetName();
191 TProfile* pr = h2_time_ele[i_det]->ProfileX(oss.str().c_str());
192 pr->SetLineColor(kBlack);
201 for (
int i_det = 0; i_det <
N_DET; i_det++) {
204 h1_time[i_det]->SetLineColor(kBlack);
205 h1_time[i_det]->Draw();
206 h1_time_in[i_det]->SetLineColor(kBlue);
207 h1_time_in[i_det]->SetFillColor(kBlue-7);
208 h1_time_in[i_det]->Draw(
"same");
215 void OnlMonV1495::SetDet(
const char* det0,
const char* det1)
217 list_det_name[0] = det0;
218 list_det_name[1] = det1;
220 for (
int ii = 0; ii <
N_DET; ii++) {
OnlMonCanvas * GetCanvas(const int num=0)
std::vector< SQHit * >::const_iterator ConstIter
void RegisterHist(TH1 *h1, const HistMode_t mode=MODE_ADD)
virtual const std::string Name() const
Returns the name of this module.
int InitRunOnlMon(PHCompositeNode *topNode)
int ProcessEventOnlMon(PHCompositeNode *topNode)
An SQ interface class to hold a list of SQHit objects.
An SQ interface class to hold one event header.
int EndOnlMon(PHCompositeNode *topNode)
static GeomSvc * instance()
singlton instance
OnlMonV1495(const HodoType_t type, const int lvl)
int getDetectorID(const std::string &detectorName) const
Get the plane position.
TH1 * FindMonHist(const std::string name, const bool non_null=true)
int getPlaneNElements(int detectorID)
int InitOnlMon(PHCompositeNode *topNode)