Back to home page

sPhenix code displayed by LXR

 
 

    


File indexing completed on 2025-08-05 08:16:20

0001 // Tell emacs that this is a C++ source
0002 //  -*- C++ -*-.
0003 #ifndef PHOOLRAW_PHRAWOMANAGER_H
0004 #define PHOOLRAW_PHRAWOMANAGER_H
0005 
0006 //-----------------------------------------------------------------------------
0007 //
0008 //  The PHOOL's Software
0009 //  Copyright (C) PHENIX collaboration, 1999
0010 //
0011 //  Declaration of class PHRawOManager
0012 //
0013 //  Purpose: Write a node-tree into a PRDF file
0014 //
0015 //  Description:
0016 //     - The default constructor sets all pointers to NULL. SetFile() would
0017 //       have to be called in addition.
0018 //     - The second constructor calls the setFile method to which it passes
0019 //       on its arguments. In order of appearance:
0020 //        1. The filename, type std::string, no default
0021 //        2. The runnumber, int, defaults to 0
0022 //        3. The buffersize, int, defaults to 100000
0023 //        4. The eventlength, int, defaults to -1, in which case a quarter
0024 //           of the selected buffersize will be chosen.
0025 //        5. The compression-level. Values can range between 1 and 9, as in
0026 //           gzip, the underlying compression program. Zero means no
0027 //           compression at all, default is 3.
0028 //
0029 //  Author: Matthias Messer
0030 //-----------------------------------------------------------------------------
0031 
0032 #include <phool/PHIOManager.h>
0033 
0034 #include <Event/phenixTypes.h>
0035 
0036 #include <string>
0037 
0038 class PHCompositeNode;
0039 class PHRawDataNode;
0040 class oBuffer;
0041 
0042 class PHRawOManager : public PHIOManager
0043 {
0044  public:
0045   PHRawOManager() = default;
0046   PHRawOManager(const std::string &, const int run = 0, const int bufl = 100000, const int evtl = -1, const int complvl = 3);
0047   virtual ~PHRawOManager();
0048 
0049   bool setFile(const std::string &, const int setRun, const int setBufl, const int setEvtl, const int complvl);
0050 // cppcheck-suppress [virtualCallInConstructor]
0051   virtual void closeFile();
0052   virtual bool write(PHCompositeNode *);
0053   bool write(PHRawDataNode *);
0054 
0055   virtual void print() const;
0056 
0057  private:
0058   int filedesc {-1};
0059   PHDWORD *memBuffer {nullptr};
0060   oBuffer *fileBuffer {nullptr};
0061   int runNumber {0};
0062   int bufferSize {0};
0063   int eventLength {0};
0064   int compressionLevel {0};
0065 };
0066 
0067 #endif