Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
Fun4AllEventOutStream.h
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file Fun4AllEventOutStream.h
1 // Tell emacs that this is a C++ source
2 // -*- C++ -*-.
3 #ifndef FUN4ALLRAW_FUN4ALLEVENTOUTSTREAM_H
4 #define FUN4ALLRAW_FUN4ALLEVENTOUTSTREAM_H
5 
6 // base class for output streams writing Events in
7 // one or the other form
8 
9 #include <fun4all/Fun4AllBase.h>
10 
11 #include <Event/phenixTypes.h>
12 
13 #pragma GCC diagnostic push
14 #pragma GCC diagnostic ignored "-Wshadow"
15 #include <boost/numeric/interval.hpp>
16 #pragma GCC diagnostic pop
17 
18 #include <map>
19 #include <string>
20 
21 class Event;
22 class Packet;
24 
26 {
27  public:
28  virtual ~Fun4AllEventOutStream();
29  virtual int StreamStatus() { return 0; }
30  virtual int WriteEvent(Event *evt);
31  virtual int WriteEventOut(Event * /*evt*/) { return 0; }
32  virtual int CloseOutStream() { return 0; }
33 
34  int AddPacket(const int ipkt);
35  int DropPacket(const int ipkt);
36  int AddPacketRange(const int minpacket, const int maxpacket);
37  int DropPacketRange(const int minpacket, const int maxpacket);
39 
40  protected:
41  Fun4AllEventOutStream(const std::string &name = "OUTSTREAM");
42  int resize_evtbuf(const unsigned int newsize);
44 
45  private:
46  PHDWORD *evtbuf = nullptr;
47  Fun4AllEventOutputManager *m_MyManager = nullptr; // pointer to my master
48  unsigned int evtbuf_size = 0;
49  // flag to stear behavior, if 1 only add packets (drop all others), if 0 no filtering,
50  // if -1 accept all, drop selected and afterwards add back selected ones
51  int add_or_remove = 0;
52  Packet **plist = nullptr;
53  int max_npackets = 1000;
54  int npackets = 0;
55  int default_addall = 0;
56  std::map<int, boost::numeric::interval<int> > addpktrange;
57  std::map<int, boost::numeric::interval<int> > droppktrange;
58 };
59 
60 #endif