18 const vector<string> AnaRealDst::list_det_name = {
"H1T",
"H1B",
"H2T",
"H2B" };
27 f_out =
new TFile(
"output.root",
"RECREATE");
28 tree =
new TTree(
"tree",
"Created by AnaRealDst");
29 tree->Branch(
"det_name", &b_det_name,
"det_name/C");
30 tree->Branch(
"det" , &b_det ,
"det/I");
31 tree->Branch(
"ele" , &b_ele ,
"ele/I");
32 tree->Branch(
"time" , &b_time ,
"time/D");
36 for (
unsigned int i_det = 0; i_det < list_det_name.size(); i_det++) {
37 string name = list_det_name[i_det];
40 cerr <<
"!ERROR! AnaRealDst::InitRun(): Invalid ID (" <<
id <<
"). Probably the detector name that you specified in 'list_det_name' (" << name <<
") is not valid. Abort." << endl;
43 list_det_id.push_back(
id);
45 cout <<
" " << setw(6) << name <<
" = " <<
id << endl;
48 oss <<
"h1_ele_" << name;
49 h1_ele[i_det] =
new TH1D(oss.str().c_str(),
"", n_ele, 0.5, n_ele+0.5);
51 oss << name <<
";Element ID;Hit count";
52 h1_ele[i_det]->SetTitle(oss.str().c_str());
55 oss <<
"h1_nhit_" << name;
56 h1_nhit[i_det] =
new TH1D(oss.str().c_str(),
"", 10, -0.5, 9.5);
58 oss << name <<
";N of hits/plane/event;Hit count";
59 h1_nhit[i_det]->SetTitle(oss.str().c_str());
67 SQEvent*
event = findNode::getClass<SQEvent >(topNode,
"SQEvent");
68 SQHitVector* hit_vec = findNode::getClass<SQHitVector>(topNode,
"SQHitVector");
80 static int did_h3t = 0;
81 static int did_h3b = 0;
86 cout <<
"H3T = " << did_h3t <<
", H3B = " << did_h3b << endl;
96 for (
unsigned int i_det = 0; i_det < list_det_name.size(); i_det++) {
97 strncpy(b_det_name, list_det_name[i_det].c_str(),
sizeof(b_det_name));
98 b_det = list_det_id[i_det];
101 b_ele = (*it)->get_element_id();
102 b_time = (*it)->get_tdc_time ();
105 h1_ele[i_det]->Fill(b_ele);
107 h1_nhit[i_det]->Fill(hv->size());
116 TCanvas*
c1 =
new TCanvas(
"c1",
"");
118 for (
unsigned int i_det = 0; i_det < list_det_id.size(); i_det++) {
119 h1_ele[i_det]->Draw();
121 oss << h1_ele[i_det]->GetName() <<
".png";
122 c1->SaveAs(oss.str().c_str());
124 h1_nhit[i_det]->Draw();
126 oss << h1_nhit[i_det]->GetName() <<
".png";
127 c1->SaveAs(oss.str().c_str());
std::vector< SQHit * >::const_iterator ConstIter
int End(PHCompositeNode *topNode)
Called at the end of all processing.
int Init(PHCompositeNode *topNode)
int InitRun(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.
int process_event(PHCompositeNode *topNode)
int getPlaneNElements(int detectorID)
SQHitVector * FindHits(const SQHitVector *vec_in, const std::string det_name)
Extract a set of hits that are of the given detector (det_name).