g4tools  5.4.0
Classes | Public Types | Public Member Functions | Static Public Member Functions | Protected Types | Protected Member Functions | Static Protected Member Functions | Protected Attributes | List of all members
tools::xml::aidas Class Reference
Inheritance diagram for tools::xml::aidas:
Inheritance graph
[legend]

Classes

class  colbook
 read ntuple /////////////////////////////////////////////// More...
 

Public Types

typedef raxml_out(* reader) (tree &, std::ostream &, bool, void *)
 
typedef std::map< std::string, readerreaders
 

Public Member Functions

 aidas ()
 
virtual ~aidas ()
 
std::vector< raxml_out > & objects ()
 

Static Public Member Functions

static raxml_out read_histo (tree &a_tree, std::ostream &a_out, bool a_verbose, unsigned int a_dim, bool a_is_prof)
 
static raxml_out read_cloud (tree &a_tree, std::ostream &a_out, bool a_verbose, int a_dim)
 

Protected Types

typedef histo::axis< double, unsigned int >::bn_t bn_t
 
typedef histo::profile_data< double, unsigned int, unsigned int, double, double > pd_data
 

Protected Member Functions

 aidas (const aidas &)
 
aidasoperator= (const aidas &)
 
void clear_readers ()
 
void add_reader (const std::string &a_class, reader a_reader, bool a_check=false)
 
reader find_reader (const std::string &a_class) const
 
void set_default_tags (std::vector< std::string > &a_tags)
 
void add_default_readers ()
 

Static Protected Member Functions

static raxml_out read_h1d (tree &a_tree, std::ostream &a_out, bool a_verbose, void *)
 
static raxml_out read_h2d (tree &a_tree, std::ostream &a_out, bool a_verbose, void *)
 
static raxml_out read_h3d (tree &a_tree, std::ostream &a_out, bool a_verbose, void *)
 
static raxml_out read_p1d (tree &a_tree, std::ostream &a_out, bool a_verbose, void *)
 
static raxml_out read_p2d (tree &a_tree, std::ostream &a_out, bool a_verbose, void *)
 
static raxml_out read_cloud1d (tree &a_tree, std::ostream &a_out, bool a_verbose, void *)
 
static raxml_out read_cloud2d (tree &a_tree, std::ostream &a_out, bool a_verbose, void *)
 
static raxml_out read_cloud3d (tree &a_tree, std::ostream &a_out, bool a_verbose, void *)
 
static raxml_out read_dps (tree &a_tree, std::ostream &a_out, bool a_verbose, void *)
 
static bool read_axis (tree &a_tree, unsigned int a_dim, int &aAxis, bn_t &aNumberOfBins, double &aMin, double &aMax, std::vector< double > &aEdges, bool &aVariableBins, std::ostream &)
 read histo //////////////////////////////////////////////// More...
 
static bool to_double (const std::string &a_s, double &a_v, std::ostream &a_out, const std::string &a_what)
 
static bool read_bins (tree &a_tree, pd_data &aData, std::ostream &a_out, bool a_is_prof)
 
static bool axis_index (unsigned int a_dim, const std::string &a_axis, int &a_index)
 
static bool read_ntu_columns (tree &a_tree, bool &a_found, std::vector< colbook > &a_booking, std::ostream &a_out)
 
static bool read_ntu_rows (tree &a_tree, aida::base_ntu &a_ntu, bool &a_found, std::ostream &a_out)
 
static raxml_out read_ntu (tree &a_tree, std::ostream &a_out, bool a_verbose, void *)
 
static bool read_cloud_data (tree &a_tree, histo::c1d &aCloud, bool a_verbose, std::ostream &a_out)
 read cloud //////////////////////////////////////////////// More...
 
static bool read_cloud_data (tree &a_tree, histo::c2d &aCloud, bool a_verbose, std::ostream &a_out)
 
static bool read_cloud_data (tree &a_tree, histo::c3d &aCloud, bool a_verbose, std::ostream &a_out)
 
static bool read_dps_data (tree &a_tree, histo::dps &a_dps)
 

Protected Attributes

readers m_readers
 
std::vector< raxml_outm_objects
 

Detailed Description

Definition at line 31 of file aidas.

Member Typedef Documentation

◆ bn_t

typedef histo::axis<double,unsigned int>::bn_t tools::xml::aidas::bn_t
protected

Definition at line 258 of file aidas.

◆ pd_data

typedef histo::profile_data<double,unsigned int,unsigned int,double,double> tools::xml::aidas::pd_data
protected

Definition at line 570 of file aidas.

◆ reader

typedef raxml_out(* tools::xml::aidas::reader) (tree &, std::ostream &, bool, void *)

Definition at line 34 of file aidas.

◆ readers

typedef std::map<std::string,reader> tools::xml::aidas::readers

Definition at line 35 of file aidas.

Constructor & Destructor Documentation

◆ aidas() [1/2]

tools::xml::aidas::aidas ( )
inline

Definition at line 37 of file aidas.

38  {
40  }

◆ ~aidas()

virtual tools::xml::aidas::~aidas ( )
inlinevirtual

Definition at line 41 of file aidas.

41  {
42  m_objects.clear(); //it may delete histos, etc...
43  }

◆ aidas() [2/2]

tools::xml::aidas::aidas ( const aidas )
inlineprotected

Definition at line 45 of file aidas.

45 {}

Member Function Documentation

◆ add_default_readers()

void tools::xml::aidas::add_default_readers ( )
inlineprotected

Definition at line 173 of file aidas.

173  {
174  add_reader(s_histogram1d(),read_h1d);
175  add_reader(s_histogram2d(),read_h2d);
176  add_reader(s_histogram3d(),read_h3d);
177  add_reader(s_profile1d(),read_p1d);
178  add_reader(s_profile2d(),read_p2d);
179  add_reader(s_cloud1d(),read_cloud1d);
180  add_reader(s_cloud2d(),read_cloud2d);
181  add_reader(s_cloud3d(),read_cloud3d);
182  add_reader(s_tuple(),read_ntu);
183  add_reader(s_dataPointSet(),read_dps);
184  //add_reader(s_function(),read_Function);
185  }

◆ add_reader()

void tools::xml::aidas::add_reader ( const std::string &  a_class,
reader  a_reader,
bool  a_check = false 
)
inlineprotected

Definition at line 51 of file aidas.

53  {
54  if(a_check) {if(find_reader(a_class)) return;}
55  m_readers[a_class] = a_reader;
56  }

◆ axis_index()

static bool tools::xml::aidas::axis_index ( unsigned int  a_dim,
const std::string &  a_axis,
int &  a_index 
)
inlinestaticprotected

Definition at line 976 of file aidas.

976  {
977  if(a_dim==1) {
978  if(a_axis=="x") {a_index = 0;return true;}
979  } else if(a_dim==2) {
980  if(a_axis=="x") {a_index = 0;return true;}
981  else if(a_axis=="y") {a_index = 1;return true;}
982  } else if(a_dim==3) {
983  if(a_axis=="x") {a_index = 0;return true;}
984  else if(a_axis=="y") {a_index = 1;return true;}
985  else if(a_axis=="z") {a_index = 2;return true;}
986  }
987  return false;
988  }

◆ clear_readers()

void tools::xml::aidas::clear_readers ( )
inlineprotected

Definition at line 50 of file aidas.

50 {m_readers.clear();}

◆ find_reader()

reader tools::xml::aidas::find_reader ( const std::string &  a_class) const
inlineprotected

Definition at line 58 of file aidas.

58  {
59  std::map<std::string,reader>::const_iterator it = m_readers.find(a_class);
60  if(it!=m_readers.end()) return (*it).second;
61  return 0;
62  }

◆ objects()

std::vector<raxml_out>& tools::xml::aidas::objects ( )
inline

Definition at line 48 of file aidas.

48 {return m_objects;}

◆ operator=()

aidas& tools::xml::aidas::operator= ( const aidas )
inlineprotected

Definition at line 46 of file aidas.

46 {return *this;}

◆ read_axis()

static bool tools::xml::aidas::read_axis ( tree a_tree,
unsigned int  a_dim,
int &  aAxis,
bn_t aNumberOfBins,
double &  aMin,
double &  aMax,
std::vector< double > &  aEdges,
bool &  aVariableBins,
std::ostream &   
)
inlinestaticprotected

read histo ////////////////////////////////////////////////

Definition at line 574 of file aidas.

584  {
585  int not_found = -1;
586  aAxis = not_found;
587  aNumberOfBins = 0;
588  aMin = 0;
589  aMax = 0;
590  aEdges.clear();
591  aVariableBins = false;
592 
593  const std::string& tagName = a_tree.tag_name();
594 
595  std::string svalue;
596 
597  if(tagName==s_axis()) {
598 
599  {bn_t ival;
600  if(!a_tree.attribute_value(s_numberOfBins(),svalue)) return false;
601  if(!to<bn_t>(svalue,ival)) return false;
602  aNumberOfBins = ival;}
603 
604  if(!a_tree.attribute_value(s_min(),svalue)) return false;
605  if(!to<double>(svalue,aMin)) return false;
606 
607  if(!a_tree.attribute_value(s_max(),svalue)) return false;
608  if(!to<double>(svalue,aMax)) return false;
609 
610  if(!a_tree.attribute_value(s_direction(),svalue)) return false;
611  if(!axis_index(a_dim,svalue,aAxis)) return false;
612 
613  aEdges.push_back(aMin);
614 
615  {looper _for(a_tree);
616  while(element* _elem = _for.next_element()) {
617  if(_elem->name()==s_binBorder()) {
618  if(!_elem->attribute_value(s_value(),svalue)) return false;
619  double value;
620  if(!to<double>(svalue,value)) return false;
621  aEdges.push_back(value);
622  aVariableBins = true;
623  }
624  }}
625 
626  aEdges.push_back(aMax);
627  if(aVariableBins) { // Variable bins histo.
628  if(aEdges.size()!=aNumberOfBins+1) return false;
629  }
630 
631  }
632 
633  return true;
634  }

◆ read_bins()

static bool tools::xml::aidas::read_bins ( tree a_tree,
pd_data aData,
std::ostream &  a_out,
bool  a_is_prof 
)
inlinestaticprotected

Definition at line 647 of file aidas.

647  {
648  const std::string& tagName = a_tree.tag_name();
649 
650  std::string svalue;
651 
652  if(tagName==s_annotation()) { //FIXME
653 
654  return true;
655 
656  } else if(tagName=="statistics") {
657 
658  if(!a_tree.attribute_value(s_entries(),svalue)) return false;
659  //unsigned int ival;
660  //if(!to<unsigned int>(svalue,ival)) return false;
661  // aData.fEntries = ival;
662 
663  unsigned int found = 0;
664 
665  {looper _for(a_tree);
666  while(element* _elem = _for.next_element()) {
667 
668  if(_elem->name()==s_statistic()) {
669  double mean,rms;
670  if(!_elem->attribute_value(s_mean(),svalue)) return false;
671  if(!to<double>(svalue,mean)) return false;
672 
673  if(!_elem->attribute_value(s_rms(),svalue)) return false;
674  if(!to<double>(svalue,rms)) return false;
675 
676  if(!_elem->attribute_value(s_direction(),svalue)) return false;
677  int iaxis;
678  if(!axis_index(aData.m_dimension,svalue,iaxis)) return false;
679 
680  //aData.m_axes[iaxis].fSxw = mean; //Temporarily put mean on fSxw.
681  //aData.m_axes[iaxis].fSx2w = rms; //Temporarily put mean on fSx2w.
682 
683  found++;
684  }
685  }}
686 
687  if(found!=aData.m_dimension) return false;
688 
689  return true;
690 
691  } else if(tagName==s_axis()) {
692 
693  return true;
694 
695  }
696 
697  unsigned int dimension = 0;
698  if(tagName==s_data1d()) {
699  dimension = 1;
700  } else if(tagName==s_data2d()) {
701  dimension = 2;
702  } else if(tagName==s_data3d()) {
703  dimension = 3;
704  }
705 
706  if(dimension) {
707 
708  if(dimension!=aData.m_dimension) return false;
709 
710  std::string sbin;
711  sprintf(sbin,32,"bin%dd",dimension);
712 
713  {looper _for(a_tree);
714  while(element* _elem = _for.next_element()) {
715 
716  if(_elem->name()==sbin) {
717 
718  std::vector<int> is(dimension);
719 
720  unsigned int entries = 0;
721  double height = 0;
722  double error = 0;
723  double weightedMean = 0;
724  double weightedMeanX = 0;
725  double weightedMeanY = 0;
726  double weightedMeanZ = 0;
727  double weightedRms = 0;
728  double weightedRmsX = 0;
729  double weightedRmsY = 0;
730  double weightedRmsZ = 0;
731  double rms = 0;
732 
733  // Required :
734  if(!_elem->attribute_value(s_entries(),svalue)) {
735  a_out << "tools::xml::aidas::read_bins :"
736  << " a <bin1d> has no " << "entries"
737  << " attribute."
738  << std::endl;
739  return false;
740  }
741  if(!to<unsigned int>(svalue,entries)) {
742  a_out << "tools::xml::aidas::read_bins :"
743  << " problem converting a entries attribute to an unsigned int."
744  << " Value was " << sout(svalue) << "."
745  << std::endl;
746  return false;
747  }
748 
749  // Optional :
750  bool height_given;
751  if(_elem->attribute_value(s_height(),svalue)) { //FIXME : optional ?
752  if(!to_double(svalue,height,a_out,s_height())) return false;
753  height_given = true;
754  } else { // no "height".
755  // It is assumed that at fill time the weight
756  // argument "w" had always been 1.
757  // w = 1
758  // sw = entries*1 = entries
759  height = double(entries);
760  height_given = false;
761  }
762 
763  if(_elem->attribute_value(s_error(),svalue)) { //FIXME : optional ?
764  if(!to_double(svalue,error,a_out,s_error())) return false;
765  } else { // no "error"
766  if(height_given) {
767  // then we are going to have :
768  // sw = height
769  // error = ?
770  // We can assume that at fill time the same weight "w"
771  // had been given to all entries. Then :
772  // sw = entries*w = height
773  // w = height/entries;
774  // sw2 = entries*(w*w) = (height**2)/entries
775  // error = sqrt(sw2) = sqrt((height**2)/entries)
776  if(entries) {
777  error = ::sqrt(::fabs( ((height*height)/entries) ));
778  }
779  } else {
780  // It is assumed that at fill time the weight
781  // argument "w" had always been 1.
782  // w = 1
783  // sw2 = entries*(w*w) = entries;
784  // error = sqrt(sw2) = sqrt(entries);
785  error = ::sqrt(::fabs(double(entries)));
786  }
787  }
788 
789  if(_elem->attribute_value(s_rms(),svalue)) {
790  if(!to_double(svalue,rms,a_out,s_rms())) return false;
791  }
792 
793  if(dimension==1) {
794  if(_elem->attribute_value(s_weightedMean(),svalue)) {
795  if(!to_double(svalue,weightedMean,a_out,s_weightedMean())) return false;
796  }
797  if(_elem->attribute_value(s_weightedRms(),svalue)) {
798  if(!to_double(svalue,weightedRms,a_out,s_weightedRms())) return false;
799  }
800  } else if(dimension==2) {
801  if(_elem->attribute_value(s_weightedMeanX(),svalue)) {
802  if(!to_double(svalue,weightedMeanX,a_out,s_weightedMeanX())) return false;
803  }
804  if(_elem->attribute_value(s_weightedMeanY(),svalue)) {
805  if(!to_double(svalue,weightedMeanY,a_out,s_weightedMeanY())) return false;
806  }
807  if(_elem->attribute_value(s_weightedRmsX(),svalue)) {
808  if(!to_double(svalue,weightedRmsX,a_out,s_weightedRmsX())) return false;
809  }
810  if(_elem->attribute_value(s_weightedRmsY(),svalue)) {
811  if(!to_double(svalue,weightedRmsY,a_out,s_weightedRmsY())) return false;
812  }
813  } else if(dimension==3) {
814  if(_elem->attribute_value(s_weightedMeanX(),svalue)) {
815  if(!to_double(svalue,weightedMeanX,a_out,s_weightedMeanX())) return false;
816  }
817  if(_elem->attribute_value(s_weightedMeanY(),svalue)) {
818  if(!to_double(svalue,weightedMeanY,a_out,s_weightedMeanY())) return false;
819  }
820  if(_elem->attribute_value(s_weightedMeanZ(),svalue)) {
821  if(!to_double(svalue,weightedMeanZ,a_out,s_weightedMeanZ())) return false;
822  }
823  if(_elem->attribute_value(s_weightedRmsX(),svalue)) {
824  if(!to_double(svalue,weightedRmsX,a_out,s_weightedRmsX())) return false;
825  }
826  if(_elem->attribute_value(s_weightedRmsY(),svalue)) {
827  if(!to_double(svalue,weightedRmsY,a_out,s_weightedRmsY())) return false;
828  }
829  if(_elem->attribute_value(s_weightedRmsZ(),svalue)) {
830  if(!to_double(svalue,weightedRmsZ,a_out,s_weightedRmsZ())) return false;
831  }
832  }
833 
834  {for(unsigned int index=0;index<dimension;index++) {
835  std::string s = "binNum";
836  if(dimension!=1) {
837  if(index==0) s += "X";
838  else if(index==1) s += "Y";
839  else if(index==2) s += "Z";
840  }
841  if(!_elem->attribute_value(s,svalue)) {
842  a_out << "tools::xml::aidas::read_bins :"
843  << " a <bin1d> has no " << s << std::endl;
844  return false;
845  }
846  if(svalue=="UNDERFLOW") {
847  is[index] = histo::axis_UNDERFLOW_BIN;
848  } else if(svalue=="OVERFLOW") {
849  is[index] = histo::axis_OVERFLOW_BIN;
850  } else {
851  int ival = 0;
852  if(!to<int>(svalue,ival)) {
853  a_out << "tools::xml::aidas::read_bins :"
854  << " problem converting binNum to an int."
855  << " Value was " << sout(svalue) << "."
856  << std::endl;
857  return false;
858  }
859  int ibin = ival;
860  if( (ibin<0) || (ibin>=(int)aData.m_axes[index].bins()) ) {
861  a_out << "tools::xml::aidas::read_bins :"
862  << " a binNum is out of range."
863  << std::endl;
864  return false;
865  }
866  is[index] = ibin;
867  }
868  }}
869 
870  // If we are here, then we have a valid bin :
871  bn_t offset;
872  histo::get_offset(aData.m_axes,is,offset);
873  aData.m_bin_entries[offset] = entries;
874 
875  if(!a_is_prof) {
876 
877  // From histo::base_histo, we have :
878  // height = sw
879  // error = sqrt(sw)
880  // weightedMean = sxw/sw
881  // weightedRms = sqrt(fabs(sx2w/sw - (sxw/sw)**2))
882 
883  double sw = height;
884  aData.m_bin_Sw[offset] = sw;
885  aData.m_bin_Sw2[offset] = error * error;
886  if(dimension==1) {
887  aData.m_bin_Sxw[offset][0] = weightedMean * sw;
888  aData.m_bin_Sx2w[offset][0] =
889  (weightedRms * weightedRms + weightedMean * weightedMean) * sw;
890  } else if(dimension==2){
891  // X
892  aData.m_bin_Sxw[offset][0] = weightedMeanX * sw;
893  aData.m_bin_Sx2w[offset][0] =
894  (weightedRmsX*weightedRmsX + weightedMeanX*weightedMeanX) * sw;
895  // Y :
896  aData.m_bin_Sxw[offset][1] = weightedMeanY * sw;
897  aData.m_bin_Sx2w[offset][1] =
898  (weightedRmsY*weightedRmsY + weightedMeanY*weightedMeanY) * sw;
899  } else if(dimension==3){
900  // X
901  aData.m_bin_Sxw[offset][0] = weightedMeanX * sw;
902  aData.m_bin_Sx2w[offset][0] =
903  (weightedRmsX*weightedRmsX + weightedMeanX*weightedMeanX) * sw;
904  // Y :
905  aData.m_bin_Sxw[offset][1] = weightedMeanY * sw;
906  aData.m_bin_Sx2w[offset][1] =
907  (weightedRmsY*weightedRmsY + weightedMeanY*weightedMeanY) * sw;
908  // Z :
909  aData.m_bin_Sxw[offset][2] = weightedMeanZ * sw;
910  aData.m_bin_Sx2w[offset][2] =
911  (weightedRmsZ*weightedRmsZ + weightedMeanZ*weightedMeanZ) * sw;
912  }
913 
914  } else { // Profile :
915 
916  // bin writing is :
917  // " height=" << sout(aObj.bin_height(aIndex))
918  // " error=" << sout(aObj.bin_error(aIndex))
919  // " weightedMean=" << sout(aObj.bin_mean(aIndex))
920  // " rms=" << sout(aObj.bin_rms_value(aIndex))
921  // " weightedRms=" << sout(bin_rms(aIndex));
922 
923  // From inlib profile, we have :
924  // height = svw / sw
925  // error = sqrt(fabs(sv2w/sw - (svw/sw)**2))/sqrt(sw)
926  // rms = sqrt(fabs(sv2w/sw - (svw/sw)**2))
927  // weightedMean = sxw/sw
928  // weightedRms = sqrt(fabs(sx2w/sw - (sxw/sw)**2))
929 
930  // Then :
931  // sw = (rms/error)**2
932  // svw = sw * height
933  // sv2w = sw * (rms**2 + height**2)
934  // sxw = weightedMean * sw
935  // sx2w = (weightedRms*weightedRms+weightedMean*weightedMean) * sw;
936 
937  double sw = 0;
938  if(error==0) {
939  // sv2w/sw = (svw/sw)**2
940  // h = svw/sw
941  //FIXME : we lack an info to get sw.
942  // We assume that at fill time weight==1 then :
943  // sw == n
944  sw = (double)entries;
945  } else {
946  double r_e = rms/error;
947  sw = r_e * r_e;
948  }
949  aData.m_bin_Sw[offset] = sw;
950  aData.m_bin_Sw2[offset] = 0; //FIXME
951  if(dimension==1) {
952  aData.m_bin_Sxw[offset][0] = weightedMean * sw;
953  aData.m_bin_Sx2w[offset][0] =
954  (weightedRms * weightedRms + weightedMean * weightedMean) * sw;
955  } else if(dimension==2){
956  aData.m_bin_Sxw[offset][0] = weightedMeanX * sw;
957  aData.m_bin_Sxw[offset][1] = weightedMeanY * sw;
958  aData.m_bin_Sx2w[offset][0] =
959  (weightedRmsX*weightedRmsX + weightedMeanX*weightedMeanX) * sw;
960  aData.m_bin_Sx2w[offset][1] =
961  (weightedRmsY*weightedRmsY + weightedMeanY*weightedMeanY) * sw;
962  }
963  aData.m_bin_Svw[offset] = sw * height;
964  aData.m_bin_Sv2w[offset] = sw * (rms * rms + height * height);
965 
966  }
967  }
968  }}
969 
970  return true;
971  }
972 
973  return false;
974  }

◆ read_cloud()

static raxml_out tools::xml::aidas::read_cloud ( tree a_tree,
std::ostream &  a_out,
bool  a_verbose,
int  a_dim 
)
inlinestatic

Definition at line 478 of file aidas.

478  {
479 
480  std::string sname;
481  a_tree.attribute_value(s_name(),sname);
482 
483  if(a_verbose) {
484  a_out << "tools::xml::aidas::read_cloud :"
485  << " name " << sout(sname)
486  << "..." << std::endl;
487  }
488 
489  std::string spath;
490  a_tree.attribute_value(s_path(),spath);
491 
492  std::string stitle;
493  a_tree.attribute_value(s_title(),stitle);
494 
495  std::string svalue;
496 
497  // Booking parameters :
498  int max_entries = -1; //UNLIMITED
499  if(a_tree.attribute_value(s_maxEntries(),svalue)) {
500  int ival;
501  if(!to<int>(svalue,ival)) return raxml_out();
502  max_entries = ival;
503  }
504 
505  base_handle* hdl = 0;
506  std::string sclass;
507 
508  if(a_dim==1) {
509 
510  histo::c1d* cloud = new histo::c1d(stitle,max_entries);
511 
512  // Data sub items :
513  {looper _for(a_tree);
514  while(tree* _tree = _for.next_tree()) {
515  if(!read_cloud_data(*_tree,*cloud,a_verbose,a_out)) {
516  delete cloud;
517  return raxml_out();
518  }
519  }}
520 
521  hdl = new handle<histo::c1d>(cloud);
522  sclass = histo::c1d::s_class();
523 
524  } else if(a_dim==2) {
525 
526  histo::c2d* cloud = new histo::c2d(stitle,max_entries);
527 
528  // Data sub items :
529  {looper _for(a_tree);
530  while(tree* _tree = _for.next_tree()) {
531  if(!read_cloud_data(*_tree,*cloud,a_verbose,a_out)) {
532  delete cloud;
533  return raxml_out();
534  }
535  }}
536 
537  hdl = new handle<histo::c2d>(cloud);
538  sclass = histo::c2d::s_class();
539 
540  } else if(a_dim==3) {
541 
542  histo::c3d* cloud = new histo::c3d(stitle,max_entries);
543 
544  // Data sub items :
545  {looper _for(a_tree);
546  while(tree* _tree = _for.next_tree()) {
547  if(!read_cloud_data(*_tree,*cloud,a_verbose,a_out)) {
548  delete cloud;
549  return raxml_out();
550  }
551  }}
552 
553  hdl = new handle<histo::c3d>(cloud);
554  sclass = histo::c3d::s_class();
555  }
556 
557  if(!hdl) return raxml_out();
558 
559  if(a_verbose) {
560  a_out << "tools::xml::aidas::read_cloud :"
561  << " with name " << sout(sname)
562  << " and title " << sout(stitle)
563  << " done." << std::endl;
564  }
565 
566  return raxml_out(hdl,sclass,spath,sname);
567  }

◆ read_cloud1d()

static raxml_out tools::xml::aidas::read_cloud1d ( tree a_tree,
std::ostream &  a_out,
bool  a_verbose,
void *   
)
inlinestaticprotected

Definition at line 202 of file aidas.

202  {
203  return read_cloud(a_tree,a_out,a_verbose,1);
204  }

◆ read_cloud2d()

static raxml_out tools::xml::aidas::read_cloud2d ( tree a_tree,
std::ostream &  a_out,
bool  a_verbose,
void *   
)
inlinestaticprotected

Definition at line 205 of file aidas.

205  {
206  return read_cloud(a_tree,a_out,a_verbose,2);
207  }

◆ read_cloud3d()

static raxml_out tools::xml::aidas::read_cloud3d ( tree a_tree,
std::ostream &  a_out,
bool  a_verbose,
void *   
)
inlinestaticprotected

Definition at line 208 of file aidas.

208  {
209  return read_cloud(a_tree,a_out,a_verbose,3);
210  }

◆ read_cloud_data() [1/3]

static bool tools::xml::aidas::read_cloud_data ( tree a_tree,
histo::c1d aCloud,
bool  a_verbose,
std::ostream &  a_out 
)
inlinestaticprotected

read cloud ////////////////////////////////////////////////

Definition at line 1318 of file aidas.

1320  {
1321  const std::string& tagName = a_tree.tag_name();
1322 
1323  std::string svalue;
1324 
1325  if(tagName==s_annotation()) { //FIXME
1326 
1327  return true;
1328 
1329  } else if(tagName==s_entries1d()) {
1330 
1331  {looper _for(a_tree);
1332  while(element* _elem = _for.next_element()) {
1333  if(_elem->name()==s_entry1d()) {
1334  double x;
1335  if(!_elem->attribute_value(s_valueX(),x)) return false;
1336  double w = 1;
1337  if(_elem->attribute_value(s_weight(),svalue)) {
1338  if(!to<double>(svalue,w)) return false;
1339  }
1340  if(!aCloud.fill(x,w)) return false;
1341  }
1342  }}
1343  return true;
1344 
1345  } else if(tagName==s_histogram1d()) {
1346 
1347  raxml_out ro = read_h1d(a_tree,a_out,a_verbose,0);
1348  if(ro.cls()==histo::h1d::s_class()) {
1349  histo::h1d* h = (histo::h1d*)ro.object();
1350  if(h) {
1351  aCloud.set_histogram(h);
1352  ro.disown();
1353  }
1354  }
1355  return true;
1356 
1357  }
1358 
1359  return false;
1360  }

◆ read_cloud_data() [2/3]

static bool tools::xml::aidas::read_cloud_data ( tree a_tree,
histo::c2d aCloud,
bool  a_verbose,
std::ostream &  a_out 
)
inlinestaticprotected

Definition at line 1362 of file aidas.

1365  {
1366  const std::string& tagName = a_tree.tag_name();
1367 
1368  std::string svalue;
1369 
1370  if(tagName==s_annotation()) { //FIXME
1371 
1372  return true;
1373 
1374  } else if(tagName==s_entries2d()) {
1375 
1376  {looper _for(a_tree);
1377  while(element* _elem = _for.next_element()) {
1378  if(_elem->name()==s_entry2d()) {
1379  double x;
1380  if(!_elem->attribute_value(s_valueX(),x)) return false;
1381  double y;
1382  if(!_elem->attribute_value(s_valueY(),y)) return false;
1383  double w = 1;
1384  if(_elem->attribute_value(s_weight(),svalue)) {
1385  if(!to<double>(svalue,w)) return false;
1386  }
1387  if(!aCloud.fill(x,y,w)) return false;
1388  }
1389  }}
1390  return true;
1391 
1392  } else if(tagName==s_histogram2d()) {
1393 
1394  raxml_out ro = read_h2d(a_tree,a_out,a_verbose,0);
1395  if(ro.cls()==histo::h2d::s_class()) {
1396  histo::h2d* h = (histo::h2d*)ro.object();
1397  if(h) {
1398  aCloud.set_histogram(h);
1399  ro.disown();
1400  }
1401  }
1402  return true;
1403 
1404  }
1405 
1406  return false;
1407  }

◆ read_cloud_data() [3/3]

static bool tools::xml::aidas::read_cloud_data ( tree a_tree,
histo::c3d aCloud,
bool  a_verbose,
std::ostream &  a_out 
)
inlinestaticprotected

Definition at line 1409 of file aidas.

1412  {
1413  const std::string& tagName = a_tree.tag_name();
1414 
1415  std::string svalue;
1416 
1417  if(tagName==s_annotation()) { //FIXME
1418 
1419  return true;
1420 
1421  } else if(tagName==s_entries3d()) {
1422 
1423  {looper _for(a_tree);
1424  while(element* _elem = _for.next_element()) {
1425  if(_elem->name()==s_entry3d()) {
1426  double x;
1427  if(!_elem->attribute_value(s_valueX(),x)) return false;
1428  double y;
1429  if(!_elem->attribute_value(s_valueY(),y)) return false;
1430  double z;
1431  if(!_elem->attribute_value(s_valueZ(),z)) return false;
1432  double w = 1;
1433  if(_elem->attribute_value(s_weight(),svalue)) {
1434  if(!to<double>(svalue,w)) return false;
1435  }
1436  if(!aCloud.fill(x,y,z,w)) return false;
1437  }
1438  }}
1439  return true;
1440 
1441  } else if(tagName==s_histogram3d()) {
1442 
1443  raxml_out ro = read_h3d(a_tree,a_out,a_verbose,0);
1444  if(ro.cls()==histo::h3d::s_class()) {
1445  histo::h3d* h = (histo::h3d*)ro.object();
1446  if(h) {
1447  aCloud.set_histogram(h);
1448  ro.disown();
1449  }
1450  }
1451  return true;
1452 
1453  }
1454 
1455  return false;
1456  }

◆ read_dps()

static raxml_out tools::xml::aidas::read_dps ( tree a_tree,
std::ostream &  a_out,
bool  a_verbose,
void *   
)
inlinestaticprotected

Definition at line 212 of file aidas.

212  {
213  std::string sname;
214  a_tree.attribute_value(s_name(),sname);
215 
216  if(a_verbose) {
217  a_out << "tools::xml::aidas::read_dps :"
218  << " with name " << sout(sname)
219  << "..." << std::endl;
220  }
221 
222  std::string spath;
223  a_tree.attribute_value(s_path(),spath);
224 
225  std::string stitle;
226  a_tree.attribute_value(s_title(),stitle);
227 
228  // Booking parameters :
229  unsigned int dim = 0;
230  if(!a_tree.attribute_value(s_dimension(),dim)) return raxml_out();
231 
232  // Create a BatchLab::DataPointSet :
233  histo::dps* dps = new histo::dps(stitle,dim);
234 
235  // Data sub items :
236  {looper _for(a_tree);
237  while(tree* _tree = _for.next_tree()) {
238  if(!read_dps_data(*_tree,*dps)) {
239  delete dps;
240  return raxml_out();
241  }
242  }}
243 
244  base_handle* hdl = new handle<histo::dps>(dps);
245  std::string sclass = histo::dps::s_class();
246 
247  if(a_verbose) {
248  a_out << "tools::xml::aidas::read_dps :"
249  << " with name " << sout(sname)
250  << " and title " << sout(stitle)
251  << " done." << std::endl;
252  }
253 
254  return raxml_out(hdl,sclass,spath,sname);
255  }

◆ read_dps_data()

static bool tools::xml::aidas::read_dps_data ( tree a_tree,
histo::dps a_dps 
)
inlinestaticprotected

Definition at line 1458 of file aidas.

1458  {
1459  const std::string& tagName = a_tree.tag_name();
1460 
1461  std::string svalue;
1462 
1463  if(tagName==s_annotation()) { //FIXME
1464 
1465  return true;
1466 
1467  } else if(tagName==s_dataPoint()) {
1468 
1469  histo::data_point& point = a_dps.add_point();
1470 
1471  unsigned int coord = 0;
1472 
1473  {looper _for(a_tree);
1474  while(element* _elem = _for.next_element()) {
1475  if(_elem->name()==s_measurement()) {
1476  if(coord>=a_dps.dimension()) return false;
1477  double value;
1478  if(!_elem->attribute_value(s_value(),value)) return false;
1479  double errorPlus = 0;
1480  if(_elem->attribute_value(s_errorPlus(),svalue)) {
1481  if(!to<double>(svalue,errorPlus)) return false;
1482  }
1483  double errorMinus = 0;
1484  if(_elem->attribute_value(s_errorMinus(),svalue)) {
1485  if(!to<double>(svalue,errorMinus)) return false;
1486  }
1487 
1488  histo::measurement& m = point.coordinate(coord);
1489  m.set_value(value);
1490  m.set_error_plus(errorPlus);
1491  m.set_error_minus(errorMinus);
1492 
1493  coord++;
1494  }
1495  }}
1496  return true;
1497 
1498  }
1499 
1500  return false;
1501  }

◆ read_h1d()

static raxml_out tools::xml::aidas::read_h1d ( tree a_tree,
std::ostream &  a_out,
bool  a_verbose,
void *   
)
inlinestaticprotected

Definition at line 186 of file aidas.

186  {
187  return read_histo(a_tree,a_out,a_verbose,1,false);
188  }

◆ read_h2d()

static raxml_out tools::xml::aidas::read_h2d ( tree a_tree,
std::ostream &  a_out,
bool  a_verbose,
void *   
)
inlinestaticprotected

Definition at line 189 of file aidas.

189  {
190  return read_histo(a_tree,a_out,a_verbose,2,false);
191  }

◆ read_h3d()

static raxml_out tools::xml::aidas::read_h3d ( tree a_tree,
std::ostream &  a_out,
bool  a_verbose,
void *   
)
inlinestaticprotected

Definition at line 192 of file aidas.

192  {
193  return read_histo(a_tree,a_out,a_verbose,3,false);
194  }

◆ read_histo()

static raxml_out tools::xml::aidas::read_histo ( tree a_tree,
std::ostream &  a_out,
bool  a_verbose,
unsigned int  a_dim,
bool  a_is_prof 
)
inlinestatic

Definition at line 260 of file aidas.

262  {
263 
264  std::string sname;
265  a_tree.attribute_value(s_name(),sname);
266 
267  if(a_verbose) {
268  a_out << "tools::xml::aidas::read_histo :"
269  << " with name " << sout(sname)
270  << "..." << std::endl;
271  }
272 
273  std::string spath;
274  a_tree.attribute_value(s_path(),spath);
275 
276  std::string stitle;
277  a_tree.attribute_value(s_title(),stitle);
278 
279  // Booking parameters :
280  std::vector<bn_t> bins(a_dim);
281  std::vector<double> mns(a_dim);
282  std::vector<double> mxs(a_dim);
283  std::vector< std::vector<double> > edges(a_dim);
284 
285  // Jump in subitems to find axes items :
286  int not_found = -1;
287  unsigned int found = 0;
288  bool isVariableBins = false;
289 
290  {looper _for(a_tree);
291  while(tree* _tree = _for.next_tree()) {
292 
293  int iaxis;
294  bn_t num;
295  double mn,mx;
296  std::vector<double> borders;
297  bool variableBins;
298  if(!read_axis(*_tree,a_dim,iaxis,num,mn,mx,borders,variableBins,a_out)) return raxml_out();
299  if(iaxis!=not_found) {
300  if((iaxis<0)||(iaxis>=(int)a_dim)) return raxml_out();
301  bins[iaxis] = num;
302  mns[iaxis] = mn;
303  mxs[iaxis] = mx;
304  edges[iaxis] = borders;
305  if(variableBins) isVariableBins = true;
306  found++;
307  }
308  }}
309 
310  if(found!=a_dim) return raxml_out();
311  if(isVariableBins) {
312  // Axes consistency :
313  for(unsigned int iaxis=0;iaxis<a_dim;iaxis++) {
314  if(edges[iaxis].size()<=2) return raxml_out();
315  }
316  }
317 
318  // Create a native histogram :
319 
320  base_handle* hdl = 0;
321  std::string sclass;
322  if(a_is_prof) {
323  if(a_dim==1) {
324  histo::p1d* histo = 0;
325  if(isVariableBins) {
326  histo = new histo::p1d(stitle,edges[0]);
327  } else {
328  histo = new histo::p1d(stitle,bins[0],mns[0],mxs[0]);
329  }
330 
331  // Sub items :
332  pd_data hd = histo->get_histo_data();
333  if(hd.m_bin_number<=0) {delete histo;return raxml_out();}
334 
335  {looper _for(a_tree);
336  while(tree* _tree = _for.next_tree()) {
337 
338  if(!read_bins(*_tree,hd,a_out,a_is_prof)) {
339  delete histo;
340  return raxml_out();
341  }
342 
343  }}
344 
345  //give histo ownership to the handle.
346  hdl = new handle<histo::p1d>(histo);
347  sclass = histo::p1d::s_class();
348 
349  hd.update_fast_getters();
350  histo->copy_from_data(hd);
351 
352  } else if(a_dim==2) {
353  histo::p2d* histo = 0;
354  if(isVariableBins) {
355  histo = new histo::p2d(stitle,edges[0],edges[1]);
356  } else {
357  histo = new histo::p2d(stitle,bins[0],mns[0],mxs[0],bins[1],mns[1],mxs[1]);
358  }
359 
360  pd_data hd = histo->get_histo_data();
361  if(hd.m_bin_number<=0) {delete histo;return raxml_out();}
362 
363  {looper _for(a_tree);
364  while(tree* _tree = _for.next_tree()) {
365 
366  if(!read_bins(*_tree,hd,a_out,a_is_prof)) {
367  delete histo;
368  return raxml_out();
369  }
370 
371  }}
372 
373  hdl = new handle<histo::p2d>(histo);
374  sclass = histo::p2d::s_class();
375 
376  hd.update_fast_getters();
377  histo->copy_from_data(hd);
378  }
379  } else {
380  if(a_dim==1) {
381  histo::h1d* histo = 0;
382  if(isVariableBins) {
383  histo = new histo::h1d(stitle,edges[0]);
384  } else {
385  histo = new histo::h1d(stitle,bins[0],mns[0],mxs[0]);
386  }
387 
388  pd_data hd(histo->dac());
389  if(hd.m_bin_number<=0) {delete histo;return raxml_out();}
390 
391  {looper _for(a_tree);
392  while(tree* _tree = _for.next_tree()) {
393 
394  if(!read_bins(*_tree,hd,a_out,a_is_prof)) {
395  delete histo;
396  return raxml_out();
397  }
398 
399  }}
400 
401  hdl = new handle<histo::h1d>(histo);
402  sclass = histo::h1d::s_class();
403 
404  hd.update_fast_getters();
405  histo->copy_from_data(hd);
406 
407  } else if(a_dim==2) {
408  histo::h2d* histo = 0;
409  if(isVariableBins) {
410  histo = new histo::h2d(stitle,edges[0],edges[1]);
411  } else {
412  histo = new histo::h2d(stitle,bins[0],mns[0],mxs[0],bins[1],mns[1],mxs[1]);
413  }
414 
415  pd_data hd(histo->dac());
416  if(hd.m_bin_number<=0) {delete histo;return raxml_out();}
417 
418  {looper _for(a_tree);
419  while(tree* _tree = _for.next_tree()) {
420 
421  if(!read_bins(*_tree,hd,a_out,a_is_prof)) {
422  delete histo;
423  return raxml_out();
424  }
425 
426  }}
427 
428  hdl = new handle<histo::h2d>(histo);
429  sclass = histo::h2d::s_class();
430 
431  hd.update_fast_getters();
432  histo->copy_from_data(hd);
433 
434  } else if(a_dim==3) {
435  histo::h3d* histo = 0;
436  if(isVariableBins) {
437  histo = new histo::h3d(stitle,edges[0],edges[1],edges[2]);
438  } else {
439  histo = new histo::h3d(stitle,bins[0],mns[0],mxs[0],
440  bins[1],mns[1],mxs[1],
441  bins[2],mns[2],mxs[2]);
442  }
443 
444  pd_data hd(histo->dac());
445  if(hd.m_bin_number<=0) {delete histo;return raxml_out();}
446 
447  {looper _for(a_tree);
448  while(tree* _tree = _for.next_tree()) {
449 
450  if(!read_bins(*_tree,hd,a_out,a_is_prof)) {
451  delete histo;
452  return raxml_out();
453  }
454 
455  }}
456 
457  hdl = new handle<histo::h3d>(histo);
458  sclass = histo::h3d::s_class();
459 
460  hd.update_fast_getters();
461  histo->copy_from_data(hd);
462 
463  }
464  }
465 
466  if(!hdl) return raxml_out();
467 
468  if(a_verbose) {
469  a_out << "tools::xml::aidas::read_histo :"
470  << " with name " << sout(sname)
471  << " and title " << sout(stitle)
472  << " done." << std::endl;
473  }
474 
475  return raxml_out(hdl,sclass,spath,sname);
476  }

◆ read_ntu()

static raxml_out tools::xml::aidas::read_ntu ( tree a_tree,
std::ostream &  a_out,
bool  a_verbose,
void *   
)
inlinestaticprotected

Definition at line 1229 of file aidas.

1229  {
1230  std::string sname;
1231  a_tree.attribute_value(s_name(),sname);
1232 
1233  if(a_verbose) {
1234  a_out << "tools::xml::aidas::read_ntu :"
1235  << " with name " << sout(sname)
1236  << "..." << std::endl;
1237  }
1238 
1239  std::string spath;
1240  a_tree.attribute_value(s_path(),spath);
1241 
1242  std::string stitle;
1243  a_tree.attribute_value(s_title(),stitle);
1244 
1245  //FIXME annotation
1246 
1247  // Booking parameters :
1248  std::vector<colbook> booking;
1249 
1250  // Jump in subitems to find columns items :
1251  bool found = false;
1252 
1253  {looper _for(a_tree);
1254  while(tree* _tree = _for.next_tree()) {
1255  if(!read_ntu_columns(*_tree,found,booking,a_out)) return raxml_out();
1256  if(found) break;
1257  }}
1258 
1259  if(!found) {
1260  a_out << "tools::xml::aidas::read_ntu :"
1261  << " for ntuple name " << sout(sname)
1262  << " unable to read columns..." << std::endl;
1263  return raxml_out();
1264  }
1265 
1266  // Create a aida::ntuple :
1267  aida::ntuple* ntu = new aida::ntuple(a_out,stitle);
1268  {tools_vforcit(colbook,booking,it) {
1269  if(!aida::create_col(*ntu,
1270  (*it).type(),
1271  (*it).name(),
1272  (*it).def_or_bkg(),
1273  (*it).is_ntu())){
1274  delete ntu;
1275  return raxml_out();
1276  }
1277  }}
1278 
1279  if(!ntu->columns().size()) { //??? we could have an empty ntu !
1280  a_out << "tools::xml::aidas::read_ntu :"
1281  << " for ntuple name " << sout(sname)
1282  << " unable to create a aida::ntuple." << std::endl;
1283  delete ntu;
1284  return raxml_out();
1285  }
1286 
1287  // Get rows in sub items :
1288  found = false;
1289 
1290  {looper _for(a_tree);
1291  while(tree* _tree = _for.next_tree()) {
1292 
1293  if(!read_ntu_rows(*_tree,*ntu,found,a_out)) {
1294  a_out << "tools::xml::aidas::read_ntu :"
1295  << " for ntuple name " << sout(sname)
1296  << " unable to read rows." << std::endl;
1297  delete ntu;
1298  return raxml_out();
1299  }
1300  if(found) break;
1301 
1302  }}
1303 
1304  if(a_verbose) {
1305  a_out << "tools::xml::aidas::read_ntu :"
1306  << " name " << sout(sname)
1307  << " done." << std::endl;
1308  }
1309 
1310  std::string sclass = aida::ntuple::s_class();
1311  return raxml_out(new handle<aida::ntuple>(ntu),sclass,spath,sname);
1312  }

◆ read_ntu_columns()

static bool tools::xml::aidas::read_ntu_columns ( tree a_tree,
bool &  a_found,
std::vector< colbook > &  a_booking,
std::ostream &  a_out 
)
inlinestaticprotected

Definition at line 1028 of file aidas.

1031  {
1032  a_found = false;
1033  a_booking.clear();
1034 
1035  const std::string& tag_name = a_tree.tag_name();
1036 
1037  if(tag_name=="columns") {
1038 
1039  {looper _for(a_tree);
1040  while(element* _elem = _for.next_element()) {
1041 
1042  if(_elem->name()=="column") {
1043  std::string stype;
1044  if(!_elem->attribute_value(s_type(),stype)) {
1045  a_out << "tools::xml::aidas::read_ntu_columns :"
1046  << " atb type missing on <column>"
1047  << std::endl;
1048  return false;
1049  }
1050  std::string sname;
1051  if(!_elem->attribute_value(s_name(),sname)) {
1052  a_out << "tools::xml::aidas::read_ntu_columns :"
1053  << " atb name missing on <column>"
1054  << std::endl;
1055  return false;
1056  }
1057 
1058  std::string s;
1059  if(_elem->attribute_value(s_booking(),s)) {
1060  a_booking.push_back(colbook(stype,sname,s,true));
1061  } else if(_elem->attribute_value(s_default(),s)) {
1062  a_booking.push_back(colbook(stype,sname,s,false));
1063  } else {
1064  a_booking.push_back(colbook(stype,sname,"",false));
1065  }
1066  }
1067 
1068  }}
1069 
1070  a_found = true;
1071  }
1072  return true;
1073  }

◆ read_ntu_rows()

static bool tools::xml::aidas::read_ntu_rows ( tree a_tree,
aida::base_ntu a_ntu,
bool &  a_found,
std::ostream &  a_out 
)
inlinestaticprotected

Definition at line 1075 of file aidas.

1078  {
1079  a_found = false;
1080 
1081  const std::string& tag_name = a_tree.tag_name();
1082 
1083  if(tag_name==s_annotation()) { //FIXME
1084 
1085  return true;
1086 
1087  } else if(tag_name==s_columns()) {
1088 
1089  return true;
1090 
1091  } else if(tag_name==s_rows()) {
1092 
1093  // Sub items :
1094  {looper _for(a_tree);
1095  while(tree* _tree = _for.next_tree()) {
1096 
1097  if(!read_ntu_rows(*_tree,a_ntu,a_found,a_out)) {
1098  a_out << "tools::xml::aidas::read_ntu_rows :"
1099  << " sub read_ntu_rows failed."
1100  << std::endl;
1101  return false;
1102  }
1103 
1104  }}
1105 
1106  a_found = true;
1107 
1108  return true;
1109 
1110  } else if(tag_name==s_row()) {
1111 
1112  const std::vector<aida::base_col*>& cols = a_ntu.columns();
1113 
1114  std::vector<unsigned int> intus;
1115  std::vector<unsigned int> inot_ntus;
1116  {unsigned int index = 0;
1117  tools_vforcit(aida::base_col*,cols,it) {
1118  if(safe_cast<aida::base_col,aida::aida_col_ntu>(*(*it))) {
1119  intus.push_back(index);
1120  } else {
1121  inot_ntus.push_back(index);
1122  }
1123  index++;
1124  }}
1125 
1126  std::string svalue;
1127 
1128  {unsigned int icol = 0;
1129 
1130  {looper _for(a_tree);
1131  while(element* _elem = _for.next_element()) {
1132 
1133  if(_elem->name()==s_entry()) {
1134  if(!_elem->attribute_value(s_value(),svalue)) {
1135  a_out << "tools::xml::aidas::read_ntu_rows :"
1136  << " can't get \"value\" attribute." << std::endl;
1137  return false;
1138  }
1139  if(icol>=inot_ntus.size()) {
1140  a_out << "tools::xml::aidas::read_ntu_rows :"
1141  << " too much <entry>." << std::endl;
1142  return false;
1143  }
1144  if(inot_ntus[icol]>=cols.size()) {
1145  a_out << "tools::xml::aidas::read_ntu_rows :"
1146  << " too much <entry>." << std::endl;
1147  return false;
1148  }
1149 
1150  aida::base_col* bcol = cols[inot_ntus[icol]];
1151 
1152  aida::aida_base_col* abcol =
1153  safe_cast<aida::base_col,aida::aida_base_col>(*bcol);
1154 
1155  if(!abcol->s_fill(svalue)) {
1156  a_out << "tools::xml::aidas::read_ntu_rows :"
1157  << " can't get \"value\" attribute." << std::endl;
1158  return false;
1159  }
1160  icol++;
1161  }
1162 
1163  }}}
1164 
1165  // Sub items (entryITuple) :
1166  {unsigned int icol = 0;
1167 
1168  {looper _for(a_tree);
1169  while(tree* _tree = _for.next_tree()) {
1170 
1171  const std::string& _tag_name = _tree->tag_name();
1172  if( (_tag_name==s_entryITuple()) || //aida.dtd spec.
1173  (_tag_name==s_entryTuple()) ){ //backward comp.
1174  if(icol>=intus.size()) {
1175  a_out << "tools::xml::aidas::read_ntu_rows :"
1176  << " too much <entry>." << std::endl;
1177  return false;
1178  }
1179  if(intus[icol]>=cols.size()) {
1180  a_out << "tools::xml::aidas::read_ntu_rows :"
1181  << " too much <entry>." << std::endl;
1182  return false;
1183  }
1184 
1185  aida::base_col* bcol = cols[intus[icol]];
1186  aida::aida_col_ntu* col_ntu = safe_cast<aida::base_col,aida::aida_col_ntu>(*bcol);
1187  if(!col_ntu) {
1188  a_out << "tools::xml::aidas::read_ntu_rows :"
1189  << " can't cast to bcol_ntu."
1190  << std::endl;
1191  return false;
1192  }
1193  aida::base_ntu* ntu = col_ntu->get_to_fill();
1194  if(!ntu) {
1195  a_out << "tools::xml::aidas::read_ntu_rows :"
1196  << " get_to_fill() returned null."
1197  << std::endl;
1198  return false;
1199  }
1200 
1201  {looper _for2(*_tree);
1202  while(tree* _tree2 = _for2.next_tree()) {
1203  bool found;
1204  if(!read_ntu_rows(*_tree2,*ntu,found,a_out)) return false;
1205  }}
1206 
1207  icol++;
1208  }
1209 
1210  }}}
1211 
1212  if(!a_ntu.add_row()) {
1213  a_out << "tools::xml::aidas::read_ntu_rows :"
1214  << " can't add row to ntuple."
1215  << std::endl;
1216  return false;
1217  }
1218 
1219  return true;
1220 
1221  }
1222 
1223  a_out << "tools::xml::aidas::read_ntu_rows :"
1224  << " unknown item class " << sout(tag_name) << std::endl;
1225 
1226  return false;
1227  }

◆ read_p1d()

static raxml_out tools::xml::aidas::read_p1d ( tree a_tree,
std::ostream &  a_out,
bool  a_verbose,
void *   
)
inlinestaticprotected

Definition at line 195 of file aidas.

195  {
196  return read_histo(a_tree,a_out,a_verbose,1,true);
197  }

◆ read_p2d()

static raxml_out tools::xml::aidas::read_p2d ( tree a_tree,
std::ostream &  a_out,
bool  a_verbose,
void *   
)
inlinestaticprotected

Definition at line 198 of file aidas.

198  {
199  return read_histo(a_tree,a_out,a_verbose,2,true);
200  }

◆ set_default_tags()

void tools::xml::aidas::set_default_tags ( std::vector< std::string > &  a_tags)
inlineprotected

Definition at line 137 of file aidas.

137  {
138  a_tags.clear();
139  a_tags.push_back(s_aida());
140  a_tags.push_back(s_annotation());
141  a_tags.push_back(s_histogram1d());
142  a_tags.push_back(s_histogram2d());
143  a_tags.push_back(s_histogram3d());
144  a_tags.push_back(s_profile1d());
145  a_tags.push_back(s_profile2d());
146  a_tags.push_back(s_axis());
147  a_tags.push_back(s_statistics());
148  a_tags.push_back(s_data1d());
149  a_tags.push_back(s_data2d());
150  a_tags.push_back(s_data3d());
151 
152  a_tags.push_back(s_tuple());
153  a_tags.push_back(s_columns());
154  a_tags.push_back(s_rows());
155  a_tags.push_back(s_row());
156  a_tags.push_back(s_entryITuple()); //aida.dtd spec.
157  a_tags.push_back(s_entryTuple()); //not in aida.dtd ! Back comp.
158 
159  a_tags.push_back(s_cloud1d());
160  a_tags.push_back(s_cloud2d());
161  a_tags.push_back(s_cloud3d());
162  a_tags.push_back(s_entries1d());
163  a_tags.push_back(s_entries2d());
164  a_tags.push_back(s_entries3d());
165  a_tags.push_back(s_dataPointSet());
166  a_tags.push_back(s_dataPoint());
167  //a_tags.push_back(s_function());
168  //a_tags.push_back(s_arguments());
169  //a_tags.push_back(s_argument());
170  //a_tags.push_back(s_parameters());
171  }

◆ to_double()

static bool tools::xml::aidas::to_double ( const std::string &  a_s,
double &  a_v,
std::ostream &  a_out,
const std::string &  a_what 
)
inlinestaticprotected

Definition at line 635 of file aidas.

635  {
636  if(!to<double>(a_s,a_v)) {
637  a_out << "tools::xml::aidas::read_bins :"
638  << " problem converting a " << a_what
639  << " attribute to a double."
640  << " Value was " << sout(a_s) << "."
641  << std::endl;
642  return false;
643  }
644  return true;
645  }

Member Data Documentation

◆ m_objects

std::vector<raxml_out> tools::xml::aidas::m_objects
protected

Definition at line 1506 of file aidas.

◆ m_readers

readers tools::xml::aidas::m_readers
protected

Definition at line 1505 of file aidas.


The documentation for this class was generated from the following file:
tools::osc::s_annotation
const std::string & s_annotation()
Definition: osc_streamers:28
tools::xml::aidas::read_ntu
static raxml_out read_ntu(tree &a_tree, std::ostream &a_out, bool a_verbose, void *)
Definition: aidas:1229
tools::jpeg::is
bool is(const std::string &a_file)
Definition: jpeg:216
tools::histo::h3d::s_class
static const std::string & s_class()
Definition: h3d:15
tools::xml::aidas::read_dps
static raxml_out read_dps(tree &a_tree, std::ostream &a_out, bool a_verbose, void *)
Definition: aidas:212
tools::xml::aidas::read_cloud_data
static bool read_cloud_data(tree &a_tree, histo::c1d &aCloud, bool a_verbose, std::ostream &a_out)
read cloud ////////////////////////////////////////////////
Definition: aidas:1318
tools::xml::aidas::find_reader
reader find_reader(const std::string &a_class) const
Definition: aidas:58
tools::histo::axis_UNDERFLOW_BIN
@ axis_UNDERFLOW_BIN
Definition: axis:13
tools::histo::p1d::s_class
static const std::string & s_class()
Definition: p1d:15
tools::histo::get_offset
bool get_offset(const std::vector< axis< TC, TO > > &a_axes, const std::vector< int > &a_is, TO &a_offset)
Definition: axes:50
tools::histo::h2d::s_class
static const std::string & s_class()
Definition: h2d:15
tools::xml::aidas::read_dps_data
static bool read_dps_data(tree &a_tree, histo::dps &a_dps)
Definition: aidas:1458
tools::xml::aidas::m_readers
readers m_readers
Definition: aidas:1505
tools::xml::aidas::add_reader
void add_reader(const std::string &a_class, reader a_reader, bool a_check=false)
Definition: aidas:51
tools::mn
T mn(const T &a, const T &b)
Definition: mnmx:10
tools::histo::c1d::s_class
static const std::string & s_class()
Definition: c1d:18
tools::mx
T mx(const T &a, const T &b)
Definition: mnmx:13
tools::xml::aidas::read_ntu_rows
static bool read_ntu_rows(tree &a_tree, aida::base_ntu &a_ntu, bool &a_found, std::ostream &a_out)
Definition: aidas:1075
tools::xml::aidas::read_cloud2d
static raxml_out read_cloud2d(tree &a_tree, std::ostream &a_out, bool a_verbose, void *)
Definition: aidas:205
tools::xml::aidas::to_double
static bool to_double(const std::string &a_s, double &a_v, std::ostream &a_out, const std::string &a_what)
Definition: aidas:635
tools::xml::aidas::read_h3d
static raxml_out read_h3d(tree &a_tree, std::ostream &a_out, bool a_verbose, void *)
Definition: aidas:192
tools::histo::axis_OVERFLOW_BIN
@ axis_OVERFLOW_BIN
Definition: axis:13
tools::xml::aidas::read_bins
static bool read_bins(tree &a_tree, pd_data &aData, std::ostream &a_out, bool a_is_prof)
Definition: aidas:647
tools::xml::aidas::read_cloud1d
static raxml_out read_cloud1d(tree &a_tree, std::ostream &a_out, bool a_verbose, void *)
Definition: aidas:202
tools::histo::c3d::s_class
static const std::string & s_class()
Definition: c3d:18
tools::histo::dps::s_class
static const std::string & s_class()
Definition: dps:121
tools::histo::p2d::s_class
static const std::string & s_class()
Definition: p2d:15
tools::aida::ntuple::s_class
static const std::string & s_class()
Definition: aida_ntuple:507
tools::xml::aidas::read_ntu_columns
static bool read_ntu_columns(tree &a_tree, bool &a_found, std::vector< colbook > &a_booking, std::ostream &a_out)
Definition: aidas:1028
tools::file::size
bool size(const std::string &a_file, long &a_size)
Definition: fsize:13
tools::xml::aidas::read_h2d
static raxml_out read_h2d(tree &a_tree, std::ostream &a_out, bool a_verbose, void *)
Definition: aidas:189
tools::xml::aidas::read_cloud
static raxml_out read_cloud(tree &a_tree, std::ostream &a_out, bool a_verbose, int a_dim)
Definition: aidas:478
tools::xml::aidas::read_p1d
static raxml_out read_p1d(tree &a_tree, std::ostream &a_out, bool a_verbose, void *)
Definition: aidas:195
tools::xml::aidas::axis_index
static bool axis_index(unsigned int a_dim, const std::string &a_axis, int &a_index)
Definition: aidas:976
tools::xml::aidas::add_default_readers
void add_default_readers()
Definition: aidas:173
tools::histo::h1d::s_class
static const std::string & s_class()
Definition: h1d:17
tools::xml::aidas::read_h1d
static raxml_out read_h1d(tree &a_tree, std::ostream &a_out, bool a_verbose, void *)
Definition: aidas:186
tools::sprintf
bool sprintf(std::string &a_string, int a_length, const char *a_format,...)
Definition: sprintf:34
tools::xml::aidas::m_objects
std::vector< raxml_out > m_objects
Definition: aidas:1506
tools::file::found
bool found(const std::string &a_file, const std::string &a_what, std::vector< std::string > &a_found)
Definition: file:507
tools::xml::aidas::read_axis
static bool read_axis(tree &a_tree, unsigned int a_dim, int &aAxis, bn_t &aNumberOfBins, double &aMin, double &aMax, std::vector< double > &aEdges, bool &aVariableBins, std::ostream &)
read histo ////////////////////////////////////////////////
Definition: aidas:574
tools::xml::aidas::read_histo
static raxml_out read_histo(tree &a_tree, std::ostream &a_out, bool a_verbose, unsigned int a_dim, bool a_is_prof)
Definition: aidas:260
tools::xml::aidas::pd_data
histo::profile_data< double, unsigned int, unsigned int, double, double > pd_data
Definition: aidas:570
tools_vforcit
#define tools_vforcit(a__T, a__v, a__it)
Definition: forit:7
tools::stype
const std::string & stype(const mat4f &)
Definition: mat4f:73
tools::osc::s_axis
const std::string & s_axis()
Definition: osc_streamers:24
tools::histo::c2d::s_class
static const std::string & s_class()
Definition: c2d:18
tools::aida::create_col
bool create_col(ntuple &a_ntu, const std::string &a_type, const std::string &a_name, const std::string &a_s, bool a_is_ntu)
Definition: aida_ntuple:822
tools::xml::aidas::read_p2d
static raxml_out read_p2d(tree &a_tree, std::ostream &a_out, bool a_verbose, void *)
Definition: aidas:198
tools::xml::aidas::bn_t
histo::axis< double, unsigned int >::bn_t bn_t
Definition: aidas:258
tools::xml::aidas::read_cloud3d
static raxml_out read_cloud3d(tree &a_tree, std::ostream &a_out, bool a_verbose, void *)
Definition: aidas:208