Draw TLine Constrained by Axes

See also: “vertical shaded area” thread

You can easily make your example usable as an interpreted code:

#include "TLine.h"

#include <utility>
#include <vector>
#include <iostream>

void RestrictLine(TLine & l, Double_t xmin, Double_t ymin, Double_t xmax, Double_t ymax)
{
#if defined(__CINT__)
  static int RunMeOnce = 0;
  if (!RunMeOnce) {
    RunMeOnce = 1;
    gSystem->Exec("rm -f AutoDict*pair*double*double*");
    // gInterpreter->GenerateDictionary("pair<double,double>;vector<pair<double,double> >", "utility;vector");
    gInterpreter->GenerateDictionary("vector<pair<double,double> >", "utility;vector");
  }
#endif /* defined(__CINT__) */
  
  // ...