Belle II Software development
CDCWireHitCluster.cc
1/**************************************************************************
2 * basf2 (Belle II Analysis Software Framework) *
3 * Author: The Belle II Collaboration *
4 * *
5 * See git log for contributors and copyright holders. *
6 * This file is licensed under LGPL-3.0, see LICENSE.md. *
7 **************************************************************************/
8#include <tracking/trackingUtilities/eventdata/segments/CDCWireHitCluster.h>
9
10#include <TBuffer.h>
11
12using namespace Belle2;
13using namespace TrackingUtilities;
14
15void CDCWireHitCluster::Streamer(TBuffer& buffer)
16{
17 // Only the cluster's own state is transferred. The inherited
18 // std::vector<CDCWireHit*> is deliberately left out: the cluster borrows its wire hits from
19 // the CDCWireHitVector and does not own them, so streaming the pointers would make ROOT deep
20 // copy every CDCWireHit into the message and allocate a fresh one when reading it back, which
21 // no destructor ever frees. On reading, the vector is therefore left empty rather than filled
22 // with pointers to private copies - which is what the generated streamer used to produce, so
23 // cluster to wire hit identity never survived the transfer in the first place.
24 if (buffer.IsReading()) {
25 UInt_t start = 0;
26 UInt_t count = 0;
27 buffer.ReadVersion(&start, &count, CDCWireHitCluster::Class());
28 buffer >> m_iSuperCluster;
29 buffer >> m_backgroundFlag;
30 clear();
31 buffer.CheckByteCount(start, count, CDCWireHitCluster::Class());
32 } else {
33 const UInt_t start = buffer.WriteVersion(CDCWireHitCluster::Class(), kTRUE);
34 buffer << m_iSuperCluster;
35 buffer << m_backgroundFlag;
36 buffer.SetByteCount(start, kTRUE);
37 }
38}
int m_iSuperCluster
Memory for the super cluster id.
bool m_backgroundFlag
Memory for the flag marking this cluster as background.
Abstract base class for different kinds of events.