19 Float_t RminInner = 51.9/2;
20 Float_t RmaxInner = 126.5/2;
21 Float_t RminOuter = 127.5/2;
22 Float_t RmaxOuter = 202.9/2;
27 TPGON *InnerSector =
new TPGON(
"InnerSector",
"TPC inner sector",
"void",-15,360,12,2);
28 InnerSector->DefineSection(0, Zmin, RminInner, RmaxInner);
29 InnerSector->DefineSection(1, Zmax, RminInner, RmaxInner);
30 InnerSector->SetLineColor(2);
31 TNode *m_node1 =
new TNode(
"m_node1",
"inner sector",InnerSector);
33 TPGON *OuterSector =
new TPGON(
"OuterSector",
"TPC outer sector",
"void",-15,360,12,2);
34 OuterSector->DefineSection(0,Zmin,RminOuter,RmaxOuter);
35 OuterSector->DefineSection(1,Zmax,RminOuter,RmaxOuter);
36 OuterSector->SetLineColor(4);
37 TNode *m_node2 =
new TNode(
"m_node2",
"outer sector",OuterSector);
43 int DrawEvent(TPad *padname, Float_t theta, Float_t phi) {
50 Float_t rmin[3]={ -200., -200., -200.};
51 Float_t rmax[3]={ 200., 200., 200.};
53 TView *view =
new TView(rmin,rmax);
54 padname->SetView(view);
55 view->RotateView(phi,theta);
59 m_node2->Draw(
"same");
60 m_node1->Draw(
"same");
64 St_tcl_tphit *hits = NULL;
65 tcl_tphit_st *hit1 = NULL;
66 hits = (St_tcl_tphit* ) tpc_data.Find(
"tphit");
67 if (hits) {hit1 = hits->GetTable();}
68 else { cout <<
"Error: tphit table header does not exist " << endl;
return kStWarn; }
69 if (!hit1) { cout <<
"Error: tphit table does not exist " << endl;
return kStWarn; }
70 Int_t nhits = hits->GetNRows();
71 if (nhits == 0) {cout <<
"Error: tphit table contains zero rows " << endl;
return kStWarn;}
75 St_tpt_track *
track = 0;
76 tpt_track_st *track1 = 0;
77 track = (St_tpt_track *) tpc_tracks.Find(
"tptrack");
78 if (track) {track1 = track->GetTable();}
79 else { cout <<
"Error: tptrack table header does not exist " << endl;
return kStWarn; }
80 if (!track1) { cout <<
"Error: tptrack table does not exist " << endl;
return kStWarn; }
81 Int_t ntracks = track->GetNRows();
82 if (ntracks == 0) {cout <<
"Error: tptrack table contains zero rows " << endl;
return kStWarn;}
87 Float_t *pts =
new Float_t[3*nhits];
88 for (Int_t j = 0; j < nhits; j++) {
89 if (hit1[j]->z > zmin && hit1[j]->z < zmax) {
90 pts[3*k] = hit1[j]->x;
91 pts[3*k+1] = hit1[j]->y;
92 pts[3*k+2] = hit1[j]->z;
96 cout <<
"total hits " << k << endl;
97 TPolyMarker3D *
hit =
new TPolyMarker3D(k,pts,2);
98 hit->SetMarkerColor(1);
103 for (j = 0; j < ntracks; j++) {
104 Int_t trkid = track1[j]->id;
105 Int_t trkflag = track1[j]->flag;
106 Int_t trknrec = track1[j]->nrec;
107 cout <<
" Track #" << j <<
" "<< trknrec <<
" hits" << endl;
108 Float_t *tkpts =
new Float_t[3*trknrec];
111 if (j>11) {mark = j + 8;}
112 if (j>22) {mark = j - 3;}
113 if (j>33) {mark = j - 14;}
114 if (j>44) {mark = j - 25;}
115 Int_t incolor = j + 2;
117 if (incolor == 10) {incolor = 2;}
118 if (incolor > 50) {incolor -= 50;}
121 for (Int_t i = 0; i < trknrec; i++) {
122 Int_t hitid = 1000*trkid + i + 1;
123 Int_t irow_hit = sortrk[hitid];
124 if (irow_hit < 0)
continue;
125 if (hit1[irow_hit]->z > zmin && hit1[irow_hit]->z < zmax) {
126 tkpts[3*k] = hit1[irow_hit]->x;
127 tkpts[3*k+1] = hit1[irow_hit]->y;
128 tkpts[3*k+2] = hit1[irow_hit]->z;
132 TPolyMarker3D *thit =
new TPolyMarker3D(k,tkpts,mark);
133 thit->SetMarkerColor(incolor);
139 if (trkflag < 0) {
continue;}
140 Float_t ay = 1.0/tan(0.0174533*track1[j]->psi);
141 Float_t x0 = track1[j]->r0*cos(0.0174533*track1[j]->phi0);
142 Float_t y0 = track1[j]->r0*sin(0.0174533*track1[j]->phi0);
143 if (track1[j]->z0 >zmin && track1[j]->z0 < zmax) {
146 p[0] = x0 + ay*(p[1]-y0);
147 if (p[0] < rmin[0]) {
149 p[1] = y0 + (p[0]-x0)/ay;
151 if (p[0] > rmax[0]) {
153 p[1] = y0 + (p[0]-x0)/ay;
155 p[2] = track1[j]->tanl*(y0-p[1]) + track1[j]->z0;
156 p[3] = x0 + ay*(p[4]-y0);
157 if (p[3] < rmin[0]) {
159 p[4] = y0 + (p[3]-x0)/ay;
161 if (p[3] > rmax[0]) {
163 p[4] = y0 + (p[3]-x0)/ay;
165 p[5] = track1[j]->tanl*(y0-p[4]) + track1[j]->z0;
166 TPolyLine3D *trk =
new TPolyLine3D(2,p);
167 trk->SetLineColor(incolor);
182 int DrawPixels(Text_t* varexp, Text_t* selection, Text_t* options) {
190 St_tfc_adcxyz *phtfc = 0;
191 tfc_adcxyz_st *ptadcxyz = 0;
192 phtfc = (St_tfc_adcxyz *) Itpc_raw.
Find(
"adcxyz");
194 if (phtfc) {ptadcxyz = phtfc->GetTable();}
195 else { cout <<
"Warning: adcxyz table header does not exist " << endl;
return kStWarn; }
196 if (!ptadcxyz) { cout <<
"Warning: adcxyz table does not exist " << endl;
return kStWarn; }
198 TH1* pPixelHist = phtfc->Draw(varexp,selection,options);
199 pPixelHist->SetMarkerStyle(26);
200 pPixelHist->SetMarkerColor(4);
207 int DrawHits(Text_t* varexp, Text_t* selection, Text_t* options){
215 St_tcl_tphit *phtcl = 0;
216 tcl_tphit_st *pttphit = 0;
217 phtcl = (St_tcl_tphit *) Itpc_hits.
Find(
"tphit");
218 if (phtcl) {pttphit = phtcl->GetTable();}
219 else { cout <<
"Error: tphit table header does not exist " << endl;
return kStWarn; }
220 if (!pttphit) { cout <<
"Error: tphit table does not exist " << endl;
return kStWarn; }
222 TH1* pHitHist = phtcl->Draw(varexp,selection,options);
223 pHitHist->SetMarkerStyle(20);
224 pHitHist->SetMarkerColor(2);
231 int DrawGeantHits(Text_t* varexp, Text_t* selection, Text_t* options) {
238 St_g2t_tpc_hit *phg2t = 0;
239 g2t_tpc_hit_st *ptg2t_tpc_hit = 0;
240 phg2t = (St_g2t_tpc_hit *) Igeant_g2t.
Find(
"g2t_tpc_hit");
241 if (phg2t) {ptg2t_tpc_hit = phg2t->GetTable();}
242 else { cout <<
"Warning: g2t tpc hit table header does not exist " << endl;
return kStWarn; }
243 if (!ptg2t_tpc_hit) { cout <<
"Warning: g2t tpc hit table does not exist " << endl;
return kStWarn; }
245 TH1* pGeantHist = phg2t->Draw(varexp,selection,options);
246 pGeantHist->SetMarkerStyle(24);
247 pGeantHist->SetMarkerColor(3);
267 gStyle->SetCanvasColor(10);
268 gStyle->SetPadColor(10);
269 gStyle->SetFrameFillColor(10);
270 gStyle->SetOptFit(1);
272 TCanvas *c1 =
new TCanvas(
"tpcDraw",
"x y z info",100,100,700,700);
274 c1->SetBorderMode(0);
275 c1->SetBorderSize(0);
277 TPaveText *title =
new TPaveText(.2,0.96,.8,.995);
278 title->SetFillColor(33);
279 title->AddText(
"pixels and hits");
282 TPad *pad1 =
new TPad(
"pad1",
"x vs y",0.01,0.48,0.49,0.95);
283 TPad *pad2 =
new TPad(
"pad2",
"x vs z",0.51,0.48,0.98,0.95);
284 TPad *pad3 =
new TPad(
"pad3",
"tpc view 1",0.01,0.01,0.49,0.48);
285 TPad *pad4 =
new TPad(
"pad4",
"tpc view 2",0.51,0.01,0.98,0.48);
287 pad1->SetFillColor(0);
288 pad1->SetBorderMode(0);
289 pad1->SetBorderSize(0);
292 pad2->SetFillColor(0);
293 pad2->SetBorderMode(0);
294 pad2->SetBorderSize(0);
297 pad3->SetFillColor(0);
298 pad3->SetBorderMode(0);
299 pad3->SetBorderSize(0);
302 pad4->SetFillColor(0);
303 pad4->SetBorderMode(0);
304 pad4->SetBorderSize(0);
308 if (chain->GetOption(
"trs") ||
309 chain->GetOption(
"miniDAQ") || chain->GetOption(
"TDAQ")) {
310 DrawPixels(
"x:y",
"(adc>2)*adc",
"box");
312 if (DrawPixels == 0) { DrawHits(
"y:x",
"",
"same,scat"); }
313 else { DrawHits(
"x:y",
"",
"scat"); }
314 if (!chain->GetOption(
"miniDAQ") && !chain->GetOption(
"TDAQ")) {
315 DrawGeantHits(
"x[0]:x[1]",
"volume_id<2446",
"same,scat");
319 if (chain->GetOption(
"trs") ||
320 chain->GetOption(
"miniDAQ") || chain->GetOption(
"TDAQ")) {
321 DrawPixels(
"x:z",
"(adc>2)*adc",
"box");
323 if (DrawPixels == 0) { DrawHits(
"z:x",
"",
"same,scat"); }
324 else { DrawHits(
"x:z",
"",
"scat"); }
325 if (!chain->GetOption(
"miniDAQ") && !chain->GetOption(
"TDAQ")) {
326 DrawGeantHits(
"x[0]:x[2]",
"volume_id<2446",
"same,scat");
332 DrawEvent(pad3,0.,-90.);
335 DrawEvent(pad4,90.,-90.);
virtual TDataSet * Find(const Char_t *path, TDataSet *rootset=0, Bool_t mkdir=kFALSE, Bool_t titleFlag=kFALSE)