34 #include "TLegendEntry.h"
58 TreePlot::TreePlot(
const std::string& sname,
59 const std::string& stitle)
60 : RFPlot(sname, stitle){
61 m_Type = kVanillaTree;
63 m_CanvasPtr =
nullptr;
64 m_Log.SetSource(
"TreePlot "+
GetName());
67 TreePlot::~TreePlot(){
76 void TreePlot::ClearTree(){
77 int Ntreenode = m_TreeNodes.size();
78 for(
int i = 0; i < Ntreenode; i++){
79 delete m_TreeNodes[i];
83 int Ntreelink = m_TreeLinks.size();
84 for(
int i = 0; i < Ntreelink; i++){
85 delete m_TreeLinks[i];
89 int Nleaflink = m_LeafLinks.size();
90 for(
int i = 0; i < Nleaflink; i++){
91 delete m_LeafLinks[i];
98 m_Type = kVanillaTree;
100 m_SelfAssembling =
false;
102 m_JigsawColorMap.clear();
103 m_FrameColorMap.clear();
106 TCanvas* TreePlot::GetNewCanvas(
const std::string& name,
107 const std::string& title){
108 std::string sname, stitle;
111 sprintf(strn,
"%d",GetNCanvases()+1);
112 sname =
GetName()+std::string(strn);
121 sname = GetUniqueName(sname);
122 TCanvas* can =
new TCanvas(sname.c_str(),stitle.c_str(),600,600);
123 can->Range(0.,0.,1.,1.);
127 void TreePlot::Draw(
const std::string& name,
const std::string& title,
128 bool invert_bkg_color,
129 bool invert_node_color){
130 if(m_Type == kVanillaTree)
133 SetColors(invert_bkg_color,
136 m_CanvasPtr = GetNewCanvas(name,title);
138 if(m_Type == kFrameTree){
139 bool do_jigsaws = (m_Jigsaws.GetN() > 0);
141 if(do_jigsaws) DrawTreeNodes(
true);
142 if(do_jigsaws) DrawLeafLinks();
144 DrawFrameTypeLegend();
145 if(do_jigsaws) DrawJigsawLegend();
148 if(m_Type == kGroupTree){
155 m_CanvasPtr->SetFillColor(m_color_Bkg);
156 m_CanvasPtr->Modified();
157 AddCanvas(m_CanvasPtr);
160 void TreePlot::SetTree(
const RestFrame& frame){
165 FillFrameTree(frame);
167 ConvertNodeCoordinates(m_TreeNodes);
170 void TreePlot::AddJigsaw(
const Jigsaw& jigsaw){
171 if(m_Type != kFrameTree)
175 if(m_Jigsaws.Contains(jigsaw))
177 if(!m_Frames.Contains(jigsaw.GetParentFrames()))
180 FillJigsawLink(jigsaw);
181 m_JigsawColorMap[&jigsaw] = int(m_JigsawColorMap.size());
182 m_Jigsaws.Add(jigsaw);
185 void TreePlot::SetTree(
const Group& group){
187 if(!group.IsSoundMind())
return;
192 FillGroupTree(group);
194 ConvertNodeCoordinates(m_TreeNodes);
197 void TreePlot::SetTree(
const Jigsaw& jigsaw){
199 if(!jigsaw.IsSoundMind())
return;
201 m_GroupPtr = &jigsaw.GetGroup();
204 FillJigsawTree(jigsaw);
206 ConvertNodeCoordinates(m_TreeNodes);
209 void TreePlot::InitTreeGrid(){
211 for(
int irow = 0; irow < m_Nrow; irow++){
212 if(m_Ncol[irow] > NcolMAX) NcolMAX = m_Ncol[irow];
214 m_Node_R = min(min(0.85/
double(2*NcolMAX+1),0.85*0.85/
double(2*m_Nrow+1)),0.12);
215 if(m_Type == kGroupTree)
216 m_Node_R = min(min(0.65/
double(2*NcolMAX+1),0.85/
double(2*m_Nrow+1)),0.12);
219 void TreePlot::ConvertNodeCoordinates(vector<TreePlotNode*>& nodes){
224 if(m_Type == kFrameTree) ymax = 0.8;
225 int Nnode = nodes.size();
226 for(
int i = 0; i < Nnode; i++){
227 double new_x = nodes[i]->GetX();
228 double new_y = nodes[i]->GetY();
229 new_x = xmin + (xmax-xmin)*(new_x+0.5)/double(m_Ncol[
int(new_y)]);
230 new_y = ymin + (ymax-ymin)*(1.-(new_y+0.5)/double(m_Nrow));
231 nodes[i]->SetX(new_x);
232 nodes[i]->SetY(new_y);
236 void TreePlot::AddFrame(
const RestFrame& frame){
238 if(m_FrameColorMap.count(frame.GetType()) <= 0)
239 m_FrameColorMap[frame.GetType()] = int(frame.GetType())-1;
242 void TreePlot::FillFrameTree(
const RestFrame& frame){
246 TreePlotNode* top_nodePtr =
new TreePlotNode();
247 top_nodePtr->SetX(0.);
248 top_nodePtr->SetY(0.);
249 top_nodePtr->SetFrame(frame);
250 top_nodePtr->SetLabel(frame.GetTitle());
251 m_TreeNodes.push_back(top_nodePtr);
254 FillFrameTreeMap(0, frame);
255 m_Nrow = m_Ncol.size();
258 void TreePlot::FillFrameTreeMap(
int irow,
const RestFrame& frame){
259 if(frame.IsDecayFrame() && frame.IsRecoFrame()){
260 const DecayRecoFrame* rframePtr =
dynamic_cast<const DecayRecoFrame*
>(&frame);
262 if(rframePtr->IsSelfAssemblingFrame()){
263 FillFrameTreeMap(irow, *rframePtr);
268 TreePlotNode* frame_nodePtr = m_TreeNodes[m_TreeNodes.size()-1];
270 int Nchild = frame.GetNChildren();
271 for(
int i = 0; i < Nchild; i++){
272 const RestFrame& child = frame.GetChildFrame(i);
273 if(irow+1 >=
int(m_Ncol.size())){
276 TreePlotNode* child_nodePtr =
new TreePlotNode();
277 child_nodePtr->SetX(m_Ncol[irow+1]);
278 child_nodePtr->SetY(irow+1);
279 child_nodePtr->SetFrame(child);
280 child_nodePtr->SetLabel(child.GetTitle());
281 m_TreeNodes.push_back(child_nodePtr);
283 TreePlotLink* linkPtr =
new TreePlotLink(frame_nodePtr,child_nodePtr);
284 m_TreeLinks.push_back(linkPtr);
286 FillFrameTreeMap(irow+1,child);
290 void TreePlot::FillFrameTreeMap(
int irow,
const DecayRecoFrame& frame){
291 TreePlotNode* frame_nodePtr = m_TreeNodes[m_TreeNodes.size()-1];
292 frame_nodePtr->SetSquare(
true);
293 m_SelfAssembling =
true;
294 int Nchild = frame.GetNChildren();
295 for(
int i = 0; i < Nchild; i++){
296 const ReconstructionFrame& child = frame.GetChildFrame(i);
297 bool expand_child =
false;
300 if(child.IsVisibleFrame())
301 if(dynamic_cast<CombinatoricGroup*>(&child.GetGroup())){
302 static_cast<CombinatoricGroup&
>(child.GetGroup())
303 .GetNElementsForFrame(child, N, excl);
304 if( (N >= 2 && excl) || (N >= 1 && !excl) )
307 if(irow+1 >=
int(m_Ncol.size())){
311 for(
int j = 0; j < 3; j++){
312 TreePlotNode* child_nodePtr =
new TreePlotNode();
313 child_nodePtr->SetX(m_Ncol[irow+1]+
double(j-1)*0.08);
314 child_nodePtr->SetY(irow+1);
315 child_nodePtr->SetFrame(child);
316 if(j == 2) child_nodePtr->SetLabel(GetSetTitle(child.GetTitle(),
"i"));
317 m_TreeNodes.push_back(child_nodePtr);
318 TreePlotLink* linkPtr =
new TreePlotLink(frame_nodePtr,child_nodePtr);
319 m_TreeLinks.push_back(linkPtr);
324 TreePlotNode* child_nodePtr =
new TreePlotNode();
325 child_nodePtr->SetX(m_Ncol[irow+1]);
326 child_nodePtr->SetY(irow+1);
327 child_nodePtr->SetFrame(child);
328 child_nodePtr->SetLabel(child.GetTitle());
329 m_TreeNodes.push_back(child_nodePtr);
331 TreePlotLink* linkPtr =
new TreePlotLink(frame_nodePtr,child_nodePtr);
332 m_TreeLinks.push_back(linkPtr);
334 FillFrameTreeMap(irow+1,child);
339 void TreePlot::FillGroupTree(
const Group& group){
343 if(!group.GetParentState())
return;
345 TreePlotNode* top_nodePtr =
new TreePlotNode();
346 top_nodePtr->SetX(0.);
347 top_nodePtr->SetY(0.);
348 top_nodePtr->SetState(group.GetParentState());
349 top_nodePtr->SetLabel(GetStateTitle(group.GetParentState()));
350 m_TreeNodes.push_back(top_nodePtr);
352 FillStateTreeMap(0, group.GetParentState());
354 m_Nrow = m_Ncol.size();
357 void TreePlot::FillJigsawTree(
const Jigsaw& jigsaw){
361 if(!jigsaw.GetParentState())
return;
363 TreePlotNode* top_nodePtr =
new TreePlotNode();
364 top_nodePtr->SetX(0.);
365 top_nodePtr->SetY(0.);
366 top_nodePtr->SetState(jigsaw.GetParentState());
367 top_nodePtr->SetLabel(GetStateTitle(jigsaw.GetParentState()));
368 m_TreeNodes.push_back(top_nodePtr);
370 FillStateTreeMap(0, jigsaw.GetParentState());
372 m_Nrow = m_Ncol.size();
375 void TreePlot::FillStateTreeMap(
int irow,
const State& state){
376 const Jigsaw& jigsaw = state.GetChildJigsaw();
379 TreePlotNode* state_nodePtr = m_TreeNodes[int(m_TreeNodes.size())-1];
380 int Nchild = jigsaw.GetNChildren();
382 for(
int i = 0; i < Nchild; i++){
383 State& child = jigsaw.GetChildState(i);
384 if(child.IsEmpty())
continue;
385 if(irow+1 >=
int(m_Ncol.size())){
388 TreePlotNode *child_nodePtr =
new TreePlotNode();
389 child_nodePtr->SetX(m_Ncol[irow+1]);
390 child_nodePtr->SetY(irow+1);
391 child_nodePtr->SetState(child);
392 child_nodePtr->SetLabel(GetStateTitle(child));
393 m_TreeNodes.push_back(child_nodePtr);
394 TreePlotLink* linkPtr =
new TreePlotLink(state_nodePtr,child_nodePtr);
395 linkPtr->SetJigsaw(jigsaw);
396 linkPtr->SetLabel(jigsaw.GetTitle());
397 m_TreeLinks.push_back(linkPtr);
399 FillStateTreeMap(irow+1, child);
403 void TreePlot::FillJigsawLink(
const Jigsaw& jigsaw){
405 int Nsplit = jigsaw.GetNChildren();
406 if(!jigsaw.GetGroup())
return;
407 TreePlotNode* high_old =
nullptr;
408 TreePlotNode* high_new =
nullptr;
410 for(
int s = 0; s < Nsplit; s++){
411 RestFrameList frames =
412 jigsaw.GetChildFrames(s)+
413 jigsaw.GetDependancyFrames(s);
414 int Nnode = m_TreeNodes.size();
415 TreePlotNode* last_nodePtr =
nullptr;
417 for(
int n = 0; n < Nnode; n++){
418 TreePlotNode* nodePtr = m_TreeNodes[n];
419 const RestFrame& frame = nodePtr->GetFrame();
420 if(frames.Contains(frame)){
421 nodePtr->AddJigsaw(jigsaw);
422 if(jigsaw.GetGroup().ContainsFrame(frame)){
423 if(nodePtr->GetY() > high){
425 high = nodePtr->GetY();
429 if(!(last_nodePtr->GetFrame() == nodePtr->GetFrame())){
430 TreePlotLink* linkPtr =
new TreePlotLink(last_nodePtr,nodePtr);
431 linkPtr->SetJigsaw(jigsaw);
432 m_LeafLinks.push_back(linkPtr);
435 last_nodePtr = nodePtr;
440 TreePlotLink* linkPtr =
new TreePlotLink(high_old,high_new);
441 linkPtr->SetWavy(
true);
442 linkPtr->SetJigsaw(jigsaw);
443 m_LeafLinks.push_back(linkPtr);
449 void TreePlot::SetColors(
bool invert_bkg_color,
450 bool invert_node_color){
452 invert_node_color = !invert_node_color;
456 m_color_Leaf.clear();
458 if(invert_node_color){
459 for(
int i = 0; i < 3; i++){
460 m_color_Node_text[i] = 7000+i*10;
461 m_color_Node_fill[i] = 7003+i*10;
463 m_color_Node_line[i] = 7000+i*10;
465 m_color_Node_line[i] = 7002+i*10;
467 m_color_Node_text[3] = 18;
468 m_color_Node_fill[3] = kGray+3;
470 m_color_Node_line[3] = 18;
472 m_color_Node_line[3] = kGray+1;
474 for(
int i = 0; i < 3; i++){
475 m_color_Node_text[i] = 7004+i*10;
476 m_color_Node_fill[i] = 7001+i*10;
478 m_color_Node_line[i] = 7002+i*10;
480 m_color_Node_line[i] = 7004+i*10;
482 m_color_Node_text[3] = kGray+3;
483 m_color_Node_fill[3] = 18;
485 m_color_Node_line[3] = kGray+2;
487 m_color_Node_line[3] = kGray+3;
490 if(invert_bkg_color){
491 m_color_Text = kWhite;
492 m_color_Bkg = kBlack;
493 for(
int i = 0; i < 2; i++)
494 for(
int j = 0; j < 2; j++)
495 m_color_Leaf.push_back(7040+j*10+i*2);
496 for(
int i = 0; i < 2; i++)
497 for(
int j = 0; j < 2; j++)
498 m_color_Leaf.push_back(7060+j*10+i*2);
499 m_color_Default_text = kWhite;
500 m_color_Default_line = kWhite;
501 m_color_Default_fill = kBlack;
503 m_color_Text = kBlack;
504 m_color_Bkg = kWhite;
505 for(
int i = 0; i < 2; i++)
506 for(
int j = 0; j < 2; j++)
507 m_color_Leaf.push_back(7043+j*10-i*2);
508 for(
int i = 0; i < 2; i++)
509 for(
int j = 0; j < 2; j++)
510 m_color_Leaf.push_back(7063+j*10-i*2);
511 m_color_Default_text = kBlack;
512 m_color_Default_line = kBlack;
513 m_color_Default_fill = kWhite;
517 void TreePlot::DrawTreeNodes(
bool with_rings){
518 int Nnode = m_TreeNodes.size();
519 for(
int i = 0; i < Nnode; i++)
520 DrawNode(m_TreeNodes[i], with_rings);
523 void TreePlot::DrawTreeLinks(){
524 int Nlink = m_TreeLinks.size();
525 for(
int i = 0; i < Nlink; i++)
526 DrawLink(m_TreeLinks[i]);
529 void TreePlot::DrawLeafLinks(){
530 int Nlink = m_LeafLinks.size();
531 for(
int i = 0; i < Nlink; i++)
532 DrawLink(m_LeafLinks[i]);
535 void TreePlot::DrawLink(TreePlotLink* linkPtr){
536 double x0 = linkPtr->GetNode1()->GetX();
537 double y0 = linkPtr->GetNode1()->GetY();
538 double x1 = linkPtr->GetNode2()->GetX();
539 double y1 = linkPtr->GetNode2()->GetY();
541 int icolor_line = m_color_Default_line;
542 int icolor_text = -1;
543 int icolor_fill = -1;
544 int istyle = m_style_Default;
545 int isize = int(m_Node_R*70.);
546 bool DoWavy = linkPtr->DoWavy();
548 const Jigsaw& jigsaw = linkPtr->GetJigsaw();
550 if(!jigsaw.IsEmpty()){
551 if(linkPtr->DoLabel()){
552 int priority = GetJigsawPriority(jigsaw.GetNChildren(), jigsaw.GetNDependancyStates());
553 icolor_line = m_color_Node_line[priority];
554 icolor_text = m_color_Node_text[priority];
555 icolor_fill = m_color_Node_fill[priority];
557 int Nj = m_Jigsaws.GetN();
558 int index = m_Jigsaws.GetIndex(jigsaw);
559 x0 += (double(index+1)-double(Nj+1)/2.)*m_Node_R*1./max(4.,
double(Nj));
560 x1 += (double(index+1)-double(Nj+1)/2.)*m_Node_R*1./max(4.,
double(Nj));
561 icolor_line = m_color_Leaf[m_JigsawColorMap[&jigsaw]%int(m_color_Leaf.size())];
563 istyle = m_style_Leaf;
569 if(fabs(y0-y1) > 1e-10){
570 TLine *line =
new TLine(x0,y0,x1,y1);
571 line->SetLineColor(icolor_line);
572 line->SetLineWidth(isize);
573 line->SetLineStyle(istyle);
579 double c = fabs(x0-x1);
580 double h = 1./double(2*m_Nrow)*0.8;
583 if(h > R+m_Node_R) arc =
new TArc((x0+x1)/2.,y0+m_Node_R,R, 0., 180.);
584 else arc =
new TArc((x0+x1)/2.,y0+h-R,R, 0., 180.);
586 double R = h/2. + c*c/(8.*h);
587 arc =
new TArc((x0+x1)/2.,y0+h-R,R,
588 -asin(c/(2.*R))*180/TMath::Pi()+90.,
589 asin(c/(2.*R))*180/TMath::Pi()+90.);
591 arc->SetLineColor(icolor_line);
592 arc->SetLineStyle(istyle);
593 arc->SetFillStyle(0);
594 arc->SetLineWidth(isize);
600 if(linkPtr->DoLabel()){
602 double y = (y0+y1)/2.;
604 char* slabel =
new char[500];
605 sprintf(slabel,
"#bf{%s}",linkPtr->GetLabel().c_str());
606 TLatex* lat =
new TLatex(x,y,slabel);
607 lat->SetTextAlign(22);
609 lat->SetTextSize(1.);
610 lat->SetTextFont(132);
611 double Xsize = lat->GetXsize();
612 double Ysize = lat->GetYsize();
613 double scale = max(Xsize/(6.*m_Node_R),1.75*Ysize/(fabs(y0-y1)-2.*m_Node_R));
614 lat->SetTextSize(1./scale);
615 lat->SetTextColor(icolor_text);
617 Xsize = lat->GetXsize()*1.05;
618 Ysize = lat->GetYsize()*1.5;
619 TBox *border =
new TBox(x-Xsize/2., y-Ysize/2., x+Xsize/2.,y+Ysize/2.);
620 border->SetLineColor(icolor_line);
621 border->SetLineWidth(2);
622 border->SetLineStyle(1);
623 border->SetFillColor(icolor_fill);
627 lat->DrawLatex(x,y,slabel);
634 void TreePlot::DrawNode(TreePlotNode* nodePtr,
bool with_rings){
635 double x = nodePtr->GetX();
636 double y = nodePtr->GetY();
638 int icolor_line = m_color_Default_line;
639 int icolor_text = m_color_Default_text;
640 int icolor_fill = m_color_Default_fill;
642 int iwidth = int(m_Node_R*50.);;
643 bool square = nodePtr->DoSquare();
645 const RestFrame& frame = nodePtr->GetFrame();
647 if(!frame.IsEmpty()){
648 icolor_text = m_color_Node_text[m_FrameColorMap[frame.GetType()]];
649 icolor_line = m_color_Node_line[m_FrameColorMap[frame.GetType()]];
650 icolor_fill = m_color_Node_fill[m_FrameColorMap[frame.GetType()]];
654 JigsawList jigsaws = nodePtr->GetJigsawList();
655 int Njigsaw = jigsaws.GetN();
656 for(
int i = 0; i < Njigsaw; i++){
657 double R = 1.03 + double(Njigsaw-i)*0.08;
658 const Jigsaw& jigsaw = jigsaws[i];
660 TBox* ring =
new TBox(x-m_Node_R*R*0.88,y-m_Node_R*R*0.88,
661 x+m_Node_R*R*0.88,y+m_Node_R*R*0.88);
662 int jcolor = m_color_Leaf[m_JigsawColorMap[&jigsaw]%int(m_color_Leaf.size())];
663 ring->SetLineColor(jcolor);
664 ring->SetFillColor(jcolor);
670 TArc* ring =
new TArc(x,y,m_Node_R*R);
671 int jcolor = m_color_Leaf[m_JigsawColorMap[&jigsaw]%int(m_color_Leaf.size())];
672 ring->SetLineColor(jcolor);
673 ring->SetFillColor(jcolor);
682 TBox *box =
new TBox(x-m_Node_R*0.88,y-m_Node_R*0.88,
683 x+m_Node_R*0.88,y+m_Node_R*0.88);
684 box->SetLineColor(icolor_line);
685 box->SetFillColor(icolor_fill);
686 box->SetLineStyle(istyle);
687 box->SetLineWidth(iwidth);
692 TArc *circle =
new TArc(x,y,m_Node_R);
693 circle->SetLineColor(icolor_line);
694 circle->SetFillColor(icolor_fill);
695 circle->SetLineStyle(istyle);
696 circle->SetLineWidth(iwidth);
702 if(nodePtr->DoLabel()){
703 char* nodetitle =
new char[200];
704 sprintf(nodetitle,
"#bf{%s}",nodePtr->GetLabel().c_str());
705 TLatex* lat =
new TLatex(x,y,nodetitle);
706 lat->SetTextAlign(22);
708 lat->SetTextSize(1.);
709 lat->SetTextFont(132);
711 sqrt(lat->GetXsize()*lat->GetXsize()+lat->GetYsize()*lat->GetYsize());
712 lat->SetTextSize(1.8*m_Node_R/Rnorm);
713 lat->SetTextColor(icolor_text);
715 lat->DrawLatex(x,y,nodetitle);
721 std::string TreePlot::GetStateTitle(
const State& state){
722 RestFrameList frames = state.GetListFrames();
723 int Nf = frames.GetN();
724 std::string title =
"";
725 if(Nf > 2) title.append(
"#splitline{");
726 title.append(frames.Get(0).GetTitle());
727 for(
int f = 1; f < Nf; f++){
728 if(f%((Nf+1)/2) == 0 && Nf > 2) title.append(
"}{");
732 if(Nf > 2) title.append(
"}");
737 std::string TreePlot::GetSetTitle(
const std::string& set,
738 const std::string& index){
739 std::string title =
"#left{#left(";
741 title.append(
"#right)_{");
743 title.append(
"}#right}");
747 void TreePlot::DrawFrameTypeLegend(){
748 vector<std::string> frame_title;
749 frame_title.push_back(
"Lab State");
750 frame_title.push_back(
"Decay States");
751 frame_title.push_back(
"Visible States");
752 frame_title.push_back(
"Invisible States");
753 vector<FrameType> frame_type;
754 frame_type.push_back(kLabFrame);
755 frame_type.push_back(kDecayFrame);
756 frame_type.push_back(kVisibleFrame);
757 frame_type.push_back(kInvisibleFrame);
759 TLatex* lat =
new TLatex(0.,0.,
"");
761 lat->SetTextAlign(12);
762 lat->SetTextSize(0.045);
763 lat->SetTextFont(132);
764 lat->SetTextColor(m_color_Default_text);
769 for(
int i = 0; i < 4; i++){
770 TBox* white =
new TBox(X-step/2.,Y-step/2.,0.36,Y+step/2.);
771 white->SetFillColor(m_color_Bkg);
772 white->SetLineColor(m_color_Bkg);
775 if(m_FrameColorMap.count(frame_type[i]) <= 0)
continue;
776 TArc* circle =
new TArc(X,Y,R);
777 circle->SetLineColor(m_color_Node_line[m_FrameColorMap[frame_type[i]]]);
778 circle->SetFillColor(m_color_Node_fill[m_FrameColorMap[frame_type[i]]]);
779 circle->SetLineWidth(2);
782 lat->DrawLatex(X+R*1.3,Y,frame_title[i].c_str());
785 if(m_SelfAssembling){
786 TBox* white =
new TBox(X-step/2.,Y-step/2.,0.36,Y+step/2.);
787 white->SetFillColor(m_color_Bkg);
788 white->SetLineColor(m_color_Bkg);
791 TBox* box =
new TBox(X-R*0.88,Y-R*0.88,X+R*0.88,Y+R*0.88);
792 box->SetLineColor(m_color_Node_line[m_FrameColorMap[kDecayFrame]]);
793 box->SetFillColor(m_color_Node_fill[m_FrameColorMap[kDecayFrame]]);
796 lat->DrawLatex(X+R*1.3,Y,
"Self Assembling");
801 void TreePlot::DrawJigsawLegend(){
802 vector<std::string> ititle;
803 vector<int> icolor_line;
804 vector<int> icolor_text;
805 int Nj = m_Jigsaws.GetN();
806 for(
int i = 0; i < Nj; i++){
807 int jcolor = m_color_Leaf[m_JigsawColorMap[&m_Jigsaws[i]]%int(m_color_Leaf.size())];
808 icolor_line.push_back(jcolor);
809 icolor_text.push_back(jcolor);
810 ititle.push_back(m_Jigsaws[i].GetLabel().c_str());
814 for(
int i = 0; i < Nj; i++){
815 dum.push_back(
new TLine(0.0,0.0,0.001,0.001));
816 dum[i]->SetLineWidth(
int(m_Node_R*70.));
817 dum[i]->SetLineColor(icolor_line[i]);
821 TLegend* leg =
new TLegend(0.60235,0.997-Nj*.078,0.8087,0.997);
823 vector<TLegendEntry*> entry;
824 for(
int i = 0; i < Nj; i++){
825 entry.push_back(leg->AddEntry(dum[i], ititle[i].c_str()));
826 entry[i]->SetMarkerSize(0);
827 entry[i]->SetMarkerColor(icolor_line[i]);
828 entry[i]->SetFillColor(m_color_Bkg);
830 leg->SetLineColor(m_color_Bkg);
831 leg->SetFillColor(m_color_Bkg);
832 leg->SetShadowColor(m_color_Bkg);
833 leg->SetTextColor(m_color_Text);
834 leg->SetTextFont(132);
835 leg->SetTextSize(0.042);
839 void TreePlot::DrawTitle(
const std::string& title){
840 TLatex* lat =
new TLatex(0.0,0.0,title.c_str());
841 lat->SetTextAlign(22);
843 lat->SetTextSize(0.045);
844 lat->SetTextFont(132);
845 lat->SetTextColor(m_color_Text);
846 double x = lat->GetXsize()/2. + 0.01;
847 double y = 1. - lat->GetYsize()/2. - 0.01;
849 lat->DrawLatex(x,y,title.c_str());
853 int TreePlot::GetJigsawPriority(
int Nout,
int Ndep)
const {
854 if(Nout == 1 && Ndep == 0)
return 0;
855 if(Nout == 1 && Ndep == 1)
return 1;
std::string GetName() const
Returns object name.
std::string GetTitle() const
Returns object title.
virtual void Clear()
Clears RFBase of all connections to other objects.
virtual void Clear()
Clears RFBase of all connections to other objects.