Exemplo n.º 1
0
bool
iAIDA::AIDA_HBookStore::HBook::bookRWNtuple( const int& id, const std::string& title, 
					      const std::vector<std::string>& columnNames,
					      const std::string& zebraDirectory, const int& bufferSize)
{
  if ( columnNames.size() > iAIDA::AIDA_HBookStore::HBook::MAXVAR ) return false;
  int tid = id;
  std::string ttitle = title;
  int ntags = static_cast<int>( columnNames.size() );
  std::string dir = zebraDirectory;
  int bufsize = bufferSize;
  std::ostringstream os;
  for ( std::vector<std::string>::const_iterator iVar = columnNames.begin();
	iVar != columnNames.end(); ++iVar ) {
    if ( iVar->size() > iAIDA::AIDA_HBookStore::HBook::MAXTAGLEN ) return false;
    os << *iVar;
    for ( unsigned int i = iAIDA::AIDA_HBookStore::HBook::MAXTAGLEN; i > iVar->size(); --i ) os << " ";
  }
  os << std::ends;
  const std::string columnString = os.str();
  char* columnCstring = const_cast< char * >( columnString.c_str() );
  hbookn_(&tid, 
          const_cast<char*>(ttitle.c_str()), 
          &ntags,
          const_cast<char*>(dir.c_str()), 
          &bufsize, 
          columnCstring, 
          ttitle.length(), 
          dir.length(), 
          MAXTAGLEN);
  return true;
}
Exemplo n.º 2
0
/* assume CHTAGS is space padded such that each tag is strlen(CHTAGS)/NVAR characters */
void hbookn(int id, char *CHTITL,int NVAR, char *CHRZPA,int NWBUFF,char*CHTAGS)
{
    if(((strlen(CHTAGS)/NVAR)*NVAR)!=strlen(CHTAGS)) {
        fprintf(stderr,"%s:%d Bad string length passed to hbookn()\n",__FILE__,__LINE__);
    }
    hbookn_(&id,CHTITL,&NVAR,CHRZPA,&NWBUFF,CHTAGS,strlen(CHTITL),strlen(CHRZPA),strlen(CHTAGS)/NVAR);
}