Skip to content

Commit adbe15b

Browse files
committed
[tree] Small cleanups in TEventList.
- Remove unused headers. - Use member initialisers to clean up constructors. - Apply clang-tidy/clang-format fixes for member init.
1 parent 1109e3c commit adbe15b

2 files changed

Lines changed: 16 additions & 36 deletions

File tree

tree/tree/inc/TEventList.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,15 +31,15 @@ class TCollection;
3131
class TEventList : public TNamed {
3232

3333
protected:
34-
Int_t fN; ///< Number of elements in the list
35-
Int_t fSize; ///< Size of array
36-
Int_t fDelta; ///< Increment size
37-
bool fReapply; ///< If true, TTree::Draw will 'reapply' the original cut
38-
Long64_t *fList; ///<[fN]Array of elements
39-
TDirectory *fDirectory; ///<! Pointer to directory holding this tree
34+
Int_t fN = 0; ///< Number of elements in the list
35+
Int_t fSize = 100; ///< Size of array
36+
Int_t fDelta = 100; ///< Increment size
37+
bool fReapply = false; ///< If true, TTree::Draw will 'reapply' the original cut
38+
Long64_t *fList = nullptr; ///<[fN]Array of elements
39+
TDirectory *fDirectory = nullptr; ///<! Pointer to directory holding this tree
4040

4141
public:
42-
TEventList();
42+
TEventList() = default;
4343
TEventList(const char *name, const char *title="",Int_t initsize=0, Int_t delta = 0);
4444
TEventList(const TEventList &list);
4545
~TEventList() override;

tree/tree/src/TEventList.cxx

Lines changed: 9 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -50,34 +50,16 @@ the TEventList object created in the above commands:
5050
#include "TBuffer.h"
5151
#include "TCut.h"
5252
#include "TDirectory.h"
53-
#include "TList.h"
54-
#include "TMath.h"
55-
#include "strlcpy.h"
56-
#include "snprintf.h"
57-
58-
59-
////////////////////////////////////////////////////////////////////////////////
60-
/// Default constructor for a EventList.
61-
62-
TEventList::TEventList(): TNamed()
63-
{
64-
fN = 0;
65-
fSize = 100;
66-
fDelta = 100;
67-
fList = nullptr;
68-
fDirectory = nullptr;
69-
fReapply = false;
70-
}
53+
#include "TCollection.h"
54+
#include "TMathBase.h"
7155

7256
////////////////////////////////////////////////////////////////////////////////
7357
/// Create a EventList.
7458
///
7559
/// This Eventlist is added to the list of objects in current directory.
7660

77-
TEventList::TEventList(const char *name, const char *title, Int_t initsize, Int_t delta)
78-
:TNamed(name,title), fReapply(false)
61+
TEventList::TEventList(const char *name, const char *title, Int_t initsize, Int_t delta) : TNamed(name, title)
7962
{
80-
fN = 0;
8163
if (initsize > 100) fSize = initsize;
8264
else fSize = 100;
8365
if (delta > 100) fDelta = delta;
@@ -90,12 +72,10 @@ TEventList::TEventList(const char *name, const char *title, Int_t initsize, Int_
9072
////////////////////////////////////////////////////////////////////////////////
9173
/// Copy constructor.
9274

93-
TEventList::TEventList(const TEventList &list) : TNamed(list)
75+
TEventList::TEventList(const TEventList &list)
76+
: TNamed(list), fN(list.fN), fSize(list.fSize), fDelta(list.fDelta), fList(new Long64_t[fSize])
9477
{
95-
fN = list.fN;
96-
fSize = list.fSize;
97-
fDelta = list.fDelta;
98-
fList = new Long64_t[fSize];
78+
9979
for (Int_t i=0; i<fN; i++)
10080
fList[i] = list.fList[i];
10181
fReapply = list.fReapply;
@@ -107,9 +87,9 @@ TEventList::TEventList(const TEventList &list) : TNamed(list)
10787

10888
TEventList::~TEventList()
10989
{
110-
delete [] fList; fList = nullptr;
111-
if (fDirectory) fDirectory->Remove(this);
112-
fDirectory = nullptr;
90+
delete[] fList;
91+
if (fDirectory)
92+
fDirectory->Remove(this);
11393
}
11494

11595
////////////////////////////////////////////////////////////////////////////////

0 commit comments

Comments
 (0)