what should I do to the code if i dont want the previous histogram to be overwrite. especially the 1D.
Thanks.
// -*- c++ -*-
#ifndef RootWriter_H_
#define RootWriter_H_ 1
#include <string>
#include <memory>
class TH1;
class TH2;
class TH3;
typedef TH1* TH1p;
typedef TH2* TH2p;
typedef TH3* TH3p;
class Histogram1D;
class Histogram2D;
class Histogram3D;
typedef std::shared_ptr<Histogram1D> Histogram1Dp;
typedef std::shared_ptr<Histogram2D> Histogram2Dp;
typedef std::shared_ptr<Histogram3D> Histogram3Dp;
class Histograms;
//! Functions to write histograms into ROOT files.
//!
/*!
* \class RootWriter
* \brief Class to write hitograms in ROOT files.
* \details This class recives a list of histograms and writes them to a root file.
* \author unknown
* \copyright GNU Public License v. 3
*/
class RootWriter {
public:
//! Write many histograms at once.
/*! All of the histograms in the list will be written. The output
* file will be overwritten if it exists.
*/
static void Write( Histograms& histograms, /*!< The histogram list. */
const std::string& filename /*!< The output filename. */);
//! Create a ROOT histogram from a Histogram1D.
/*! \return the ROOT 1D histogram.
*/
static TH1p CreateTH1(Histogram1Dp h /*!< The Histogram1D to be copied. */);
//! Create a ROOT histogram from a Histogram2D.
/*! \return the ROOT 2D histogram.
*/
static TH2p CreateTH2(Histogram2Dp h /*!< The Histogram2D to be copied. */);
//! Create a ROOT histogram from a Histogram3D.
/*! \return the ROOT 3D histogram.
*/
static TH3p CreateTH3(Histogram3Dp h /*!< The Histogram2D to be copied. */);
};
#endif /* RootWriter_H_ */