Analysis Software
Documentation for sPHENIX simulation software
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
JetStructs.h
Go to the documentation of this file. Or view the newest version in sPHENIX GitHub for file JetStructs.h
1 #ifndef JETBASE_JETSTRUCTS_H
2 #define JETBASE_JETSTRUCTS_H
3 
4 // A few convenience structures for either iterating over data, or referencing between classes
5 
6 #include "Jet.h"
7 #include <TClonesArray.h>
8 
9 class Jetv2;
10 
11 
13  Jet::SORT criteria { Jet::SORT::PT };
14  Jet::PROPERTY property { Jet::PROPERTY::no_property }; // when sorted by property
15  Jet::SORT_ORDER order { Jet::SORT_ORDER::DESCENDING }; //
16  unsigned int prop_index { 0 }; // for use when sorting by criteria
17 };
18 
19 // ---------------------------------------------------------------------------------------
20 // Convenience class for iterating over jets in TClonesArray in a JetContainer
21 // ---------------------------------------------------------------------------------------
22 struct IterJetv2TCA {
23  TClonesArray* tca { nullptr };
25  int index { 0 };
26  int size;
27 
28  // build Iterator -- capture reference to current_jet pointer from JetContainer
29  IterJetv2TCA (TClonesArray* _tca, Jetv2*& _in_jet)
30  : tca{_tca}, current_jet{_in_jet}, size { tca->GetEntriesFast() }
31  {
32  current_jet = (Jetv2*) tca->UncheckedAt(0);
33  }
34 
35  void operator++() {
36  current_jet = (Jetv2*) tca->UncheckedAt(++index);
37  };
38 
39  Jetv2* operator*() { return current_jet; };
40 
41  bool operator!=(const IterJetv2TCA& rhs) {
42  if (index == rhs.size) {
43  current_jet = (Jetv2*) tca->UncheckedAt(0);
44  return false;
45  } else {
46  return true;
47  }
48  };
49 };
50 
51 #endif