ATLAS Offline Software
Public Member Functions | Static Public Member Functions | Static Private Member Functions | List of all members
eflowCaloObjectMaker Class Reference

This class creates eflowCaloObjects and adds them into the eflowCaloObjectContainer. More...

#include <eflowCaloObjectMaker.h>

Collaboration diagram for eflowCaloObjectMaker:

Public Member Functions

 eflowCaloObjectMaker ()
 

Static Public Member Functions

static unsigned int makeTrkCluCaloObjects (eflowRecTrackContainer *eflowTrackContainer, eflowRecClusterContainer *eflowClusterContainer, eflowCaloObjectContainer *caloObjectContainer)
 
static unsigned int makeTrkCluCaloObjects (std::vector< eflowRecTrack * > &tracksToRecover, std::vector< eflowRecCluster * > &clustersToConsider, eflowCaloObjectContainer *caloObjectContainer)
 

Static Private Member Functions

static std::vector< eflowRecCluster * > uniqCluster (const std::vector< eflowRecTrack * > &trackForNextLoop, const std::vector< eflowRecCluster * > &clusterList)
 
static std::vector< eflowRecTrack * > uniqTrack (const std::vector< eflowRecCluster * > &clusterForNextLoop, const std::vector< eflowRecTrack * > &trackList)
 
static void updateTracksToConsider (std::vector< eflowRecTrack * > &total, const std::vector< eflowRecTrack * > &part)
 

Detailed Description

This class creates eflowCaloObjects and adds them into the eflowCaloObjectContainer.

Definition at line 26 of file eflowCaloObjectMaker.h.

Constructor & Destructor Documentation

◆ eflowCaloObjectMaker()

eflowCaloObjectMaker::eflowCaloObjectMaker ( )
inline

Definition at line 30 of file eflowCaloObjectMaker.h.

30 { }

Member Function Documentation

◆ makeTrkCluCaloObjects() [1/2]

unsigned int eflowCaloObjectMaker::makeTrkCluCaloObjects ( eflowRecTrackContainer eflowTrackContainer,
eflowRecClusterContainer eflowClusterContainer,
eflowCaloObjectContainer caloObjectContainer 
)
static

Definition at line 25 of file eflowCaloObjectMaker.cxx.

25  {
26  std::vector<eflowRecTrack*> tracksToRecover;
27  std::vector<eflowRecCluster*> clustersToConsider;
28  for (unsigned int iTrack=0; iTrack<eflowTrackContainer->size(); ++iTrack) {
29  eflowRecTrack *thisEflowRecTrack = static_cast<eflowRecTrack*>(eflowTrackContainer->at(iTrack));
30  tracksToRecover.push_back(thisEflowRecTrack);
31  }
32  for (unsigned int iCluster = 0; iCluster < eflowClusterContainer->size(); ++iCluster) {
33  eflowRecCluster* thisEFRecCluster = eflowClusterContainer->at(iCluster);
34  clustersToConsider.push_back(thisEFRecCluster);
35  }
36 
37  return makeTrkCluCaloObjects(tracksToRecover, clustersToConsider, caloObjectContainer);
38 
39 }

◆ makeTrkCluCaloObjects() [2/2]

unsigned int eflowCaloObjectMaker::makeTrkCluCaloObjects ( std::vector< eflowRecTrack * > &  tracksToRecover,
std::vector< eflowRecCluster * > &  clustersToConsider,
eflowCaloObjectContainer caloObjectContainer 
)
static

Definition at line 41 of file eflowCaloObjectMaker.cxx.

41  {
42  unsigned int result(0);
43 
44  /* Create all eflowCaloObjects that contain only eflowRecTracks and cache eflowRecTracks matched with cluster */
45  std::vector<eflowRecTrack*> tracksToConsider; tracksToConsider.clear();
46  unsigned int nTrack = tracksToRecover.size();
47  for (unsigned int iTrack=0; iTrack<nTrack; ++iTrack) {
48  eflowRecTrack *thisEflowRecTrack = static_cast<eflowRecTrack*>(tracksToRecover.at(iTrack));
49  if(thisEflowRecTrack->getClusterMatches().empty()) {
50  std::unique_ptr<eflowCaloObject> calob = std::make_unique<eflowCaloObject>();
51  calob->addTrack(thisEflowRecTrack);
52  caloObjectContainer->push_back(std::move(calob));
53  result++;
54  } else {
55  tracksToConsider.push_back(thisEflowRecTrack);
56  }
57  }
58 
59  /* Create all eflowCaloObjects that contain only eflowRecCluster*/
60  unsigned int nClusters = clustersToConsider.size();
61  for (unsigned int iCluster = 0; iCluster < nClusters; ++iCluster) {
62  eflowRecCluster* thisEFRecCluster = clustersToConsider.at(iCluster);
63  if(thisEFRecCluster->getTrackMatches().empty()) {
64  std::unique_ptr<eflowCaloObject> thisEflowCaloObject = std::make_unique<eflowCaloObject>();
65  thisEflowCaloObject->addCluster(thisEFRecCluster);
66  caloObjectContainer->push_back(std::move(thisEflowCaloObject));
67  result++;
68  }
69  }
70 
71  // It is possible an event has no tracks to consider
72  if (!tracksToConsider.empty()){
73 
74  /* one loop creates one CaloObject */
75  do {
76  /* temporary vector for next loop */
77  std::vector<eflowRecTrack*> trackForNextLoop; trackForNextLoop.clear();
78  std::vector<eflowRecCluster*> clusterForNextLoop; clusterForNextLoop.clear();
79 
80  /* track/cluster vector for CaloObject */
81  std::vector<eflowRecTrack*> trackList; trackList.clear();
82  std::vector<eflowRecCluster*> clusterList; clusterList.clear();
83 
84  /* initiallize trackForNextLoop by the first track in tracksToConsider */
85  trackForNextLoop.push_back(tracksToConsider.at(0));
86  trackList.insert(trackList.end(), trackForNextLoop.begin(), trackForNextLoop.end());
87 
88  unsigned int time(0);
89  /* iteratively searching tracks and clusters those belong to one CaloObject */
90  do {
91  clusterForNextLoop = uniqCluster(trackForNextLoop, clusterList);
92  if(clusterForNextLoop.empty()) break;
93  clusterList.insert(clusterList.end(), clusterForNextLoop.begin(), clusterForNextLoop.end());
94  trackForNextLoop = uniqTrack(clusterForNextLoop, trackList);
95  if (trackForNextLoop.empty()) break;
96  trackList.insert(trackList.end(), trackForNextLoop.begin(), trackForNextLoop.end());
97  } while (++time);
98 
99  /* store this eflowCaloObject */
100  std::unique_ptr<eflowCaloObject> thisEflowCaloObject = std::make_unique<eflowCaloObject>();
101  thisEflowCaloObject->addTracks(trackList);
102 
103  thisEflowCaloObject->addClusters(clusterList);
104  for(auto *itr_cluster : clusterList) {
105  thisEflowCaloObject->addTrackClusterLinks(itr_cluster->getTrackMatches());
106  }
107  caloObjectContainer->push_back(std::move(thisEflowCaloObject));
108 
109  /* update tracksToConsider */
110  updateTracksToConsider(tracksToConsider, trackList);
111  if(tracksToConsider.empty()) {
112  ++result;
113  break;
114  }
115 
116  } while (++result);
117  }//If tracksToCosider is not empty
118 
119 
120  return result;
121 }

◆ uniqCluster()

std::vector< eflowRecCluster * > eflowCaloObjectMaker::uniqCluster ( const std::vector< eflowRecTrack * > &  trackForNextLoop,
const std::vector< eflowRecCluster * > &  clusterList 
)
staticprivate

Definition at line 123 of file eflowCaloObjectMaker.cxx.

123  {
124  std::vector<eflowRecCluster*> result; result.clear();
125  std::vector<int> allClusterId; allClusterId.clear();
126  for(auto *itr_track : trackForNextLoop) {
127  std::vector<eflowTrackClusterLink*> allLinks = itr_track->getClusterMatches();
128  for(auto *allLink : allLinks) {
129  int id = allLink->getCluster()->getClusterId();
130  bool notInList(true);
131  for (auto *itr_cluster : clusterList) {
132  if (id == itr_cluster->getClusterId()) {
133  notInList = false;
134  break;
135  }
136  }
137  if ((find(allClusterId.begin(), allClusterId.end(), id) == allClusterId.end()) && notInList) {
138  allClusterId.push_back(id);
139  result.push_back(allLink->getCluster());
140  } else {
141  continue;
142  }
143  }
144  }
145  return result;
146 }

◆ uniqTrack()

std::vector< eflowRecTrack * > eflowCaloObjectMaker::uniqTrack ( const std::vector< eflowRecCluster * > &  clusterForNextLoop,
const std::vector< eflowRecTrack * > &  trackList 
)
staticprivate

Definition at line 148 of file eflowCaloObjectMaker.cxx.

148  {
149  std::vector<eflowRecTrack*> result; result.clear();
150  std::vector<int> allTrackId; allTrackId.clear();
151  for(auto *itr_cluster : clusterForNextLoop) {
152  std::vector<eflowTrackClusterLink*> allLinks = itr_cluster->getTrackMatches();
153  for(auto *allLink : allLinks) {
154  int id = allLink->getTrack()->getTrackId();
155  bool notInList(true);
156  for (auto *itr_track : trackList) {
157  if (id == itr_track->getTrackId()) {
158  notInList = false;
159  break;
160  }
161  }
162  if ((find(allTrackId.begin(), allTrackId.end(), id) == allTrackId.end()) && notInList) {
163  allTrackId.push_back(id);
164  result.push_back(allLink->getTrack());
165  } else {
166  continue;
167  }
168  }
169  }
170  return result;
171 }

◆ updateTracksToConsider()

void eflowCaloObjectMaker::updateTracksToConsider ( std::vector< eflowRecTrack * > &  total,
const std::vector< eflowRecTrack * > &  part 
)
staticprivate

Definition at line 173 of file eflowCaloObjectMaker.cxx.

173  {
174  unsigned int nPart = part.size();
175  for(unsigned int i=0; i<nPart; ++i) {
176  std::vector<eflowRecTrack*>::iterator itr = total.begin();
177  while (itr != total.end()) {
178  if ((*itr)->getTrackId() == part.at(i)->getTrackId()) { total.erase(itr); break; }
179  ++itr;
180  }
181  }
182 }

The documentation for this class was generated from the following files:
LArG4FSStartPointFilter.part
part
Definition: LArG4FSStartPointFilter.py:21
xAOD::iterator
JetConstituentVector::iterator iterator
Definition: JetConstituentVector.cxx:68
eflowRecCluster
This class extends the information about a xAOD::CaloCluster.
Definition: eflowRecCluster.h:40
eflowCaloObjectMaker::updateTracksToConsider
static void updateTracksToConsider(std::vector< eflowRecTrack * > &total, const std::vector< eflowRecTrack * > &part)
Definition: eflowCaloObjectMaker.cxx:173
get_generator_info.result
result
Definition: get_generator_info.py:21
find
std::string find(const std::string &s)
return a remapped string
Definition: hcg.cxx:135
eflowRecCluster::getTrackMatches
const std::vector< eflowTrackClusterLink * > & getTrackMatches() const
Definition: eflowRecCluster.h:73
eflowCaloObject::addTrack
void addTrack(eflowRecTrack *track)
Definition: eflowCaloObject.h:39
eflowRecTrack
This class extends the information about a xAOD::Track.
Definition: eflowRecTrack.h:45
eflowRecTrack::getClusterMatches
const std::vector< eflowTrackClusterLink * > & getClusterMatches() const
Definition: eflowRecTrack.h:66
eflowCaloObject::addClusters
void addClusters(const std::vector< eflowRecCluster * > &clusters)
Definition: eflowCaloObject.cxx:36
lumiFormat.i
int i
Definition: lumiFormat.py:92
eflowCaloObjectMaker::uniqCluster
static std::vector< eflowRecCluster * > uniqCluster(const std::vector< eflowRecTrack * > &trackForNextLoop, const std::vector< eflowRecCluster * > &clusterList)
Definition: eflowCaloObjectMaker.cxx:123
eflowCaloObjectMaker::makeTrkCluCaloObjects
static unsigned int makeTrkCluCaloObjects(eflowRecTrackContainer *eflowTrackContainer, eflowRecClusterContainer *eflowClusterContainer, eflowCaloObjectContainer *caloObjectContainer)
Definition: eflowCaloObjectMaker.cxx:25
DataVector::push_back
value_type push_back(value_type pElem)
Add an element to the end of the collection.
CaloSwCorrections.time
def time(flags, cells_name, *args, **kw)
Definition: CaloSwCorrections.py:242
DataVector::at
const T * at(size_type n) const
Access an element, as an rvalue.
eflowCaloObject::addTrackClusterLinks
void addTrackClusterLinks(const std::vector< eflowTrackClusterLink * > &trackClusterLink)
Definition: eflowCaloObject.cxx:26
DataVector::size
size_type size() const noexcept
Returns the number of elements in the collection.
eflowCaloObjectMaker::uniqTrack
static std::vector< eflowRecTrack * > uniqTrack(const std::vector< eflowRecCluster * > &clusterForNextLoop, const std::vector< eflowRecTrack * > &trackList)
Definition: eflowCaloObjectMaker.cxx:148
eflowCaloObject::addCluster
void addCluster(eflowRecCluster *cluster)
Definition: eflowCaloObject.h:40
eflowCaloObject::addTracks
void addTracks(const std::vector< eflowRecTrack * > &tracks)
Definition: eflowCaloObject.cxx:32