24 #include <TPolyMarker.h>
29 #include <TGeoVolume.h>
30 #include <TGeoManager.h>
32 #include <TGComboBox.h>
34 #include <TGButtonGroup.h>
35 #include <TGTextEntry.h>
40 #include <TGListView.h>
41 #include <TGTextView.h>
43 extern JApplication *
japp;
62 TGLayoutHints *lhints =
new TGLayoutHints(kLHintsNormal, 2,2,2,2);
63 TGLayoutHints *chints =
new TGLayoutHints(kLHintsCenterY|kLHintsCenterX, 2,2,2,2);
64 TGLayoutHints *xhints =
new TGLayoutHints(kLHintsNormal|kLHintsExpandX, 2,2,2,2);
65 TGHorizontalFrame *topframe =
new TGHorizontalFrame(
this, w, h);
66 TGHorizontalFrame *botframe =
new TGHorizontalFrame(
this, w, h);
67 AddFrame(topframe, lhints);
68 AddFrame(botframe, chints);
70 TGGroupFrame *trackinfo =
new TGGroupFrame(topframe,
"Track Info", kHorizontalFrame);
71 topframe->AddFrame(trackinfo, xhints);
74 throwninfo =
new TGGroupFrame(trackinfo,
"Thrown", kHorizontalFrame);
75 reconinfo =
new TGGroupFrame(trackinfo,
"Reconstructed", kHorizontalFrame);
80 vector<string> colnames;
81 colnames.push_back(
"trk");
82 colnames.push_back(
"type");
83 colnames.push_back(
"p");
84 colnames.push_back(
"theta");
85 colnames.push_back(
"phi");
86 colnames.push_back(
"z");
87 colnames.push_back(
"chisq/Ndof");
88 colnames.push_back(
"Ndof");
89 colnames.push_back(
"FOM");
90 colnames.push_back(
"cand");
92 TGTextView *tview =
new TGTextView(
throwninfo, 700, 400);
95 tview->AddLine(
"Here is a line");
100 TGListView *thrownview =
new TGListView(
throwninfo, 700, 400);
103 TGLVContainer *lvcontainer =
new TGLVContainer(thrownview);
105 thrownview->SetHeaders(6);
106 for(
unsigned int i=0; i<colnames.size(); i++){
107 if(i<6)thrownview->SetHeader(colnames[i].c_str(), 2, 1, i);
110 TGLVEntry *item =
new TGLVEntry(lvcontainer,
"One item",
"TFolder");
111 lvcontainer->AddItem(item);
114 for(
unsigned int i=0; i<colnames.size(); i++){
122 string lab = colnames[i]+
":";
123 TGLabel *tl =
new TGLabel(
tf[colnames[i]], lab.c_str());
124 TGLabel *rl =
new TGLabel(
rf[colnames[i]], lab.c_str());
125 if(i<6)
tf[colnames[i]]->AddFrame(tl, chints);
126 rf[colnames[i]]->AddFrame(rl, chints);
138 TGVerticalFrame *vf =
new TGVerticalFrame(
reconinfo);
140 reconfactory =
new TGComboBox(vf,
"DTrackCandidate:", 0);
146 TGTextButton *
close =
new TGTextButton(botframe,
"Close");
147 botframe->AddFrame(close, chints);
150 close->Connect(
"Clicked()",
"hdv_fulllistframe",
this,
"DoClose()");
151 this->Connect(
"CloseWindow()",
"hdv_fulllistframe",
this,
"DoClose()");
152 this->DontCallClose();
155 SetWindowName(
"Hall-D Event Viewer Full Particle Listing");
156 SetIconName(
"HDView");
159 Resize(GetDefaultSize());
183 map<string, vector<TGLabel*> >::iterator iter =
thrownlabs.begin();
186 vector<TGLabel*> &labels = iter->second;
187 unsigned int max_rows = throwns.size();
188 if(max_rows>20)max_rows=20;
189 for(
unsigned int row = labels.size(); row<max_rows+1; row++){
192 TGLabel *lab =
new TGLabel(
tf[iter->first], iter==
thrownlabs.begin() ? ss.str().c_str():
"--------");
193 tf[iter->first]->AddFrame(lab,
new TGLayoutHints(kLHintsTop|kLHintsCenterX, 2,2,0,0));
194 labels.push_back(lab);
195 _DBG_<<
"Adding row:"<<row<<endl;
201 for(
unsigned int i=0; i<throwns.size(); i++){
207 stringstream trkno, type, p, theta, phi, z;
208 trkno<<setprecision(4)<<i+1;
209 thrownlabs[
"trk"][row]->SetText(trkno.str().c_str());
213 p<<setprecision(4)<<trk->
momentum().Mag();
214 thrownlabs[
"p"][row]->SetText(p.str().c_str());
216 theta<<setprecision(4)<<trk->
momentum().Theta()*TMath::RadToDeg();
217 thrownlabs[
"theta"][row]->SetText(theta.str().c_str());
219 double myphi = trk->
momentum().Phi();
220 if(myphi<0.0)myphi+=2.0*M_PI;
221 phi<<setprecision(4)<<myphi;
222 thrownlabs[
"phi"][row]->SetText(phi.str().c_str());
224 z<<setprecision(4)<<trk->
position().Z();
225 thrownlabs[
"z"][row]->SetText(z.str().c_str());
229 for(
unsigned int i=0; i<trks.size(); i++){
234 stringstream trkno, type, p, theta, phi, z, chisq_per_dof, Ndof;
236 trkno<<setprecision(4)<<i+1;
237 reconlabs[
"trk"][row]->SetText(trkno.str().c_str());
239 double mass = trk->
mass();
240 if(fabs(mass-0.13957)<1.0E-4)type<<
"pi";
241 else if(fabs(mass-0.93827)<1.0E-4)type<<
"proton";
242 else if(fabs(mass-0.493677)<1.0E-4)type<<
"K";
243 else if(fabs(mass-0.000511)<1.0E-4)type<<
"e";
244 else if (fabs(mass)<1.
e-4 && fabs(trk->
charge())<1.
e-4) type <<
"gamma";
246 if (fabs(trk->
charge())>1.
e-4){
247 type<<(trk->
charge()>0 ?
"+":
"-");
249 reconlabs[
"type"][row]->SetText(type.str().c_str());
251 p<<setprecision(4)<<trk->
momentum().Mag();
252 reconlabs[
"p"][row]->SetText(p.str().c_str());
254 theta<<setprecision(4)<<trk->
momentum().Theta()*TMath::RadToDeg();
255 reconlabs[
"theta"][row]->SetText(theta.str().c_str());
257 double myphi = trk->
momentum().Phi();
258 if(myphi<0.0)myphi+=2.0*M_PI;
259 phi<<setprecision(4)<<myphi;
260 reconlabs[
"phi"][row]->SetText(phi.str().c_str());
262 z<<setprecision(4)<<trk->
position().Z();
263 reconlabs[
"z"][row]->SetText(z.str().c_str());
270 chisq_per_dof<<setprecision(4)<<timetrack->
chisq/timetrack->
Ndof;
271 Ndof<<timetrack->
Ndof;
272 fom << timetrack->
FOM;
274 chisq_per_dof<<setprecision(4)<<track->
chisq/track->
Ndof;
278 chisq_per_dof<<
"N/A";
282 reconlabs[
"chisq/Ndof"][row]->SetText(chisq_per_dof.str().c_str());
283 reconlabs[
"Ndof"][row]->SetText(Ndof.str().c_str());
284 reconlabs[
"FOM"][row]->SetText(fom.str().c_str());
289 Resize(GetDefaultSize());
float chisq
Chi-squared for the track (not chisq/dof!)
float chisq
Chi-squared for the track (not chisq/dof!)
hdv_fulllistframe(hdv_mainframe *hdvmf, const TGWindow *p, UInt_t w, UInt_t h)
const DVector3 & position(void) const
static char * ParticleType(Particle_t p)
map< string, TGVerticalFrame * > rf
map< string, vector< TGLabel * > > thrownlabs
void UpdateTrackLabels(vector< const DMCThrown * > &throwns, vector< const DKinematicData * > &trks)
TGComboBox * reconfactory
TGGroupFrame * throwninfo
map< string, TGVerticalFrame * > tf
int Ndof
Number of degrees of freedom in the fit.
double charge(void) const
int Ndof
Number of degrees of freedom in the fit.
const DVector3 & momentum(void) const
int type
GEANT particle ID.
map< string, vector< TGLabel * > > reconlabs