| # Gaudi Framework, version v20r2
Generated: 18 Jul 2008

- Main Page
- Namespaces
- Classes
- Files
- Directories
- Related Pages

- Search for |

- Namespace List
- Namespace Members

# RootHistCnv Namespace Reference

## Classes
class | DirectoryCnv
class | PersSvc
| Persistency service - to store histograms in ROOT format. More...
class | RConverter
| Root Converter. More...
class | RCWNTupleCnv
| Converter of Column-wise NTuple into ROOT format. More...
class | RDirectoryCnv
| Create persistent and transient representations of data store directories. More...
class | RFileCnv
| NTuple converter class definition. More...
class | RHistogramCnv
| Generic converter to save/read AIDA_ROOT histograms using ROOT. More...
class | RNTupleCnv
| NTuple converter class definition. More...
class | RootObjAddress
class | RRWNTupleCnv
| Row wise NTuple converter class definition. More...
## Typedefs
typedef RHistogramCnv< TProfile, TProfile, Gaudi::HistogramBase > | RootHistCnvP1DCnv
typedef RHistogramCnv< TProfile2D, TProfile2D, Gaudi::HistogramBase > | RootHistCnvP2DCnv
typedef RHistogramCnv< TH1D, TH1, Gaudi::HistogramBase > | RootHistCnvH1DCnv
typedef RHistogramCnv< TH2D, TH2, Gaudi::HistogramBase > | RootHistCnvH2DCnv
typedef RootHistCnv::RHistogramCnv< TH3D, TH3, Gaudi::HistogramBase > | RootHistCnvH3DCnv
## Functions
| DECLARE_CONVERTER_FACTORY (RootHistCnvP1DCnv)
bool | parseName (std::string full, std::string &blk, std::string &var)
template<class TYP>
INTupleItem * | createNTupleItem (std::string itemName, std::string blockName, std::string indexName, int indexRange, int arraySize, TYP min, TYP max, INTuple *ntup)
template<class TYP>
INTupleItem * | createNTupleItem (NTUPLEINFO &tags, long i, INTuple *tuple, TYP minimum, TYP maximum, long &size)
| Add an item of a given type to the N tuple.
bool | RootCd (const std::string &full)
bool | RootMkdir (const std::string &full)
std::string | RootPwd ()
bool | RootTrimLeadingDir (std::string &full, std::string dir)
## Variables
static std::string | stat_dir = "/stat"
static std::string | undefFileName = "UndefinedROOTOutputFileName"

## Typedef Documentation

typedef RHistogramCnv<TH1D,TH1,Gaudi::HistogramBase> RootHistCnv::RootHistCnvH1DCnv

Definition at line 24 of file RHistogramCnv.cpp.

typedef RHistogramCnv<TH2D,TH2,Gaudi::HistogramBase> RootHistCnv::RootHistCnvH2DCnv

Definition at line 32 of file RHistogramCnv.cpp.

typedef RootHistCnv::RHistogramCnv<TH3D,TH3,Gaudi::HistogramBase> RootHistCnv::RootHistCnvH3DCnv

Definition at line 40 of file RHistogramCnv.cpp.

typedef RHistogramCnv<TProfile,TProfile,Gaudi::HistogramBase> RootHistCnv::RootHistCnvP1DCnv

Definition at line 8 of file RHistogramCnv.cpp.

typedef RHistogramCnv<TProfile2D,TProfile2D,Gaudi::HistogramBase> RootHistCnv::RootHistCnvP2DCnv

Definition at line 16 of file RHistogramCnv.cpp.

## Function Documentation

template<class TYP>

INTupleItem* RootHistCnv::createNTupleItem | ( | NTUPLEINFO & | tags,
|  | long | i,
|  | INTuple * | tuple,
|  | TYP | minimum,
|  | TYP | maximum,
|  | long & | size |
| ) |  |  |

Add an item of a given type to the N tuple.

Definition at line 193 of file HNTupleCnv.cpp.

References NTuple::_Array< TYP >::create(), NTuple::_Item< TYP >::create(), max(), and min.

    00193                                                                                                                                 {
    00194     size = 0;
    00195     INTupleItem* col = 0;
    00196
    00197     std::string varname;
    00198     std::string blkname = tags.block[i];
    00199
    00200     if (blkname != "AUTO_BLK") {
    00201       varname = blkname + "/" + tags.name[i];
    00202     } else {
    00203       varname = tags.name[i];
    00204     }
    00205
    00206     //if ( tags.isRangeWithin(i, minimum,maximum))
    00207     {
    00208       long ind = tags.getIndex(tags.index[i]);
    00209       long dim1 = 1, dim2 = 1;
    00210       TYP min, max, null;
    00211       tags.getBounds(i, min, max, null);
    00212       switch( tags.dim[i] )   {
    00213       case 0:
    00214         col = NTuple::_Item<TYP>::create (tuple, varname, typeid(TYP), min, max, null);
    00215         break;
    00216       case 1:
    00217         dim1 = (ind>=0) ? tags.idist(ind) : tags.theDim[i][0];
    00218           col = NTuple::_Array<TYP>::create (tuple, varname,typeid(TYP),tags.index[i],dim1,min,max,null);
    00219         break;
    00220       case 2:
    00221         dim1 = (ind>=0) ? tags.idist(ind) : tags.theDim[i][0];
    00222         dim2 = (ind>=0) ? tags.theDim[i][0] : tags.theDim[i][1];
    00223         col = NTuple::_Matrix<TYP>::create (tuple, varname,typeid(TYP),tags.index[i],dim1,dim2,min,max,null);
    00224         break;
    00225       default:
    00226         break;
    00227       }
    00228       size += dim1 * dim2 * ((sizeof(TYP) < 4) ? 4 : sizeof(TYP));
    00229     }
    00230     return col;
    00231   }

template<class TYP>

INTupleItem * RootHistCnv::createNTupleItem | ( | std::string | itemName,
|  | std::string | blockName,
|  | std::string | indexName,
|  | int | indexRange,
|  | int | arraySize,
|  | TYP | min,
|  | TYP | max,
|  | INTuple * | ntup |
| ) |  |  |

Definition at line 269 of file RNTupleCnv.cpp.

References NTuple::_Matrix< TYP >::create(), NTuple::_Array< TYP >::create(), NTuple::_Item< TYP >::create(), NTuple::Range< TYP >::max(), and NTuple::Range< TYP >::min().

Referenced by RootHistCnv::RCWNTupleCnv::load().

    00273                                                 {
    00274
    00275     std::string varName;
    00276     if (blockName != "") {
    00277       varName = blockName + "/" + itemName;
    00278     } else {
    00279       varName = itemName;
    00280     }
    00281
    00282     TYP null = 0;
    00283     INTupleItem* col = 0;
    00284
    00285     if (min == 0 && max == 0) {
    00286       min = NTuple::Range<TYP>::min();
    00287       max = NTuple::Range<TYP>::max();
    00288     }
    00289
    00290
    00291     if (indexName == "") {
    00292
    00293       if (arraySize == 1) {
    00294         // simple items
    00295         col = NTuple::_Item<TYP>::create(ntup, varName,
    00296                                          typeid(TYP),
    00297                                          min, max, null);
    00298
    00299       } else {
    00300         // Arrays of fixed size
    00301         col = NTuple::_Array<TYP>::create(ntup, varName,
    00302                                            typeid(TYP),
    00303                                           "", arraySize,
    00304                                           min, max, null);
    00305       }
    00306
    00307     } else {
    00308
    00309       if (arraySize == 1) {
    00310         // Arrays of variable size
    00311         col = NTuple::_Array<TYP>::create(ntup, varName,
    00312                                            typeid(TYP),
    00313                                           indexName, indexRange,
    00314                                           min, max, null);
    00315       } else {
    00316         // Matrices
    00317         col = NTuple::_Matrix<TYP>::create(ntup, varName,
    00318                                            typeid(TYP),
    00319                                            indexName,
    00320                                            indexRange, arraySize,
    00321                                            min, max, null);
    00322       }
    00323
    00324     }
    00325
    00326     return col;
    00327
    00328   }

RootHistCnv::DECLARE_CONVERTER_FACTORY | ( | RootHistCnvP1DCnv |  | ) |

bool RootHistCnv::parseName | ( | std::string | full,
|  | std::string & | blk,
|  | std::string & | var |
| ) |  |  |

Definition at line 245 of file RNTupleCnv.cpp.

References std::basic_string< _CharT, _Traits, _Alloc >::find(), std::basic_string< _CharT, _Traits, _Alloc >::length(), and std::basic_string< _CharT, _Traits, _Alloc >::substr().

Referenced by analyzeItem().

    00245                                                                           {
    00246 //-----------------------------------------------------------------------------
    00247   int sp;
    00248   if ( (sp=full.find("/")) != -1 ) {
    00249     blk = full.substr(0,sp);
    00250     var = full.substr(sp+1,full.length());
    00251     return true;
    00252   } else {
    00253     blk = "AUTO_BLK";
    00254     var = full;
    00255     return false;
    00256   }
    00257
    00258 }

bool RootHistCnv::RootCd | ( | const std::string & | full | ) |

Definition at line 17 of file RootDirFcn.cpp.

References std::basic_string< _CharT, _Traits, _Alloc >::c_str(), std::basic_string< _CharT, _Traits, _Alloc >::find(), std::basic_string< _CharT, _Traits, _Alloc >::length(), and std::basic_string< _CharT, _Traits, _Alloc >::substr().

    00019 {
    00020   int p,i=1;
    00021   std::string cur,sdir;
    00022
    00023   gDirectory->cd("/");
    00024   while ( (p = full.find("/",i)) != -1) {
    00025     sdir = full.substr(i,p-i);
    00026     if (! gDirectory->GetKey(sdir.c_str()) ) {
    00027       return false;
    00028     }
    00029     gDirectory->cd(sdir.c_str());
    00030
    00031     i = p+1;
    00032   }
    00033   gDirectory->cd( full.substr(i,full.length()-i).c_str() );
    00034
    00035   return true;
    00036
    00037 }

bool RootHistCnv::RootMkdir | ( | const std::string & | full | ) |

Definition at line 41 of file RootDirFcn.cpp.

References std::list< _Tp, _Alloc >::begin(), std::basic_string< _CharT, _Traits, _Alloc >::c_str(), std::list< _Tp, _Alloc >::end(), std::basic_string< _CharT, _Traits, _Alloc >::find(), std::basic_string< _CharT, _Traits, _Alloc >::length(), std::list< _Tp, _Alloc >::push_back(), Gaudi::Units::s, and std::basic_string< _CharT, _Traits, _Alloc >::substr().

    00043 {
    00044
    00045   int p,i;
    00046   std::string fil,cur,s;
    00047   TDirectory *gDir;
    00048
    00049   gDir = gDirectory;
    00050
    00051   std::list<std::string> lpath;
    00052   i = 1;
    00053
    00054   if ( (p=full.find(":",0)) != -1 ) {
    00055     fil = full.substr(0,p);
    00056     i = p+1;
    00057     fil += ":/";
    00058     gDirectory->cd(fil.c_str());
    00059   }
    00060
    00061   while ( (p = full.find("/",i)) != -1) {
    00062     s = full.substr(i,p-i);
    00063     lpath.push_back(s);
    00064     i = p+1;
    00065   }
    00066   lpath.push_back( full.substr(i,full.length()-i) );
    00067
    00068   if ( full.substr(0,1) == "/") {
    00069     gDirectory->cd("/");
    00070   }
    00071
    00072   std::list<std::string>::const_iterator litr;
    00073   for(litr=lpath.begin(); litr!=lpath.end(); ++litr) {
    00074     cur = *litr;
    00075     if (! gDirectory->GetKey(litr->c_str()) ) {
    00076       gDirectory->mkdir(litr->c_str());
    00077     }
    00078     gDirectory->cd(litr->c_str());
    00079   }
    00080
    00081   gDirectory = gDir;
    00082
    00083   return true;
    00084 }

std::string RootHistCnv::RootPwd | ( |  | ) |

Definition at line 87 of file RootDirFcn.cpp.

    00089 {
    00090   std::string dir = gDirectory->GetPath();
    00091
    00092   return (dir);
    00093 }

bool RootHistCnv::RootTrimLeadingDir | ( | std::string & | full,
|  | std::string | dir |
| ) |  |  |

Definition at line 96 of file RootDirFcn.cpp.

References std::basic_string< _CharT, _Traits, _Alloc >::erase(), std::basic_string< _CharT, _Traits, _Alloc >::find(), std::basic_string< _CharT, _Traits, _Alloc >::insert(), std::basic_string< _CharT, _Traits, _Alloc >::length(), and std::basic_string< _CharT, _Traits, _Alloc >::substr().

    00098 {
    00099
    00100   if (dir.substr(0,1) != "/") {
    00101     dir.insert(0,"/");
    00102   }
    00103
    00104   if (dir.substr(dir.length()-1,1) != "/") {
    00105     dir += "/";
    00106   }
    00107
    00108   long ll = full.find(dir);
    00109   if (ll != 0) {
    00110     return false;
    00111   }
    00112
    00113   full.erase(0,dir.length()-1);
    00114
    00115   return true;
    00116
    00117 }

## Variable Documentation

std::string RootHistCnv::stat_dir = "/stat"`[static]`

Definition at line 28 of file PersSvc.cpp.

Referenced by RootHistCnv::PersSvc::createRep().

std::string RootHistCnv::undefFileName = "UndefinedROOTOutputFileName"`[static]`

Definition at line 29 of file PersSvc.cpp.

Referenced by RootHistCnv::PersSvc::createRep(), RootHistCnv::PersSvc::finalize(), RootHistCnv::PersSvc::initialize(), and RootHistCnv::PersSvc::PersSvc().