ATLAS Offline Software
Loading...
Searching...
No Matches
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 22 of file eflowCaloObjectMaker.cxx.

22 {
23 std::vector<eflowRecTrack*> tracksToRecover;
24 std::vector<eflowRecCluster*> clustersToConsider;
25 for (unsigned int iTrack=0; iTrack<eflowTrackContainer->size(); ++iTrack) {
26 eflowRecTrack *thisEflowRecTrack = static_cast<eflowRecTrack*>(eflowTrackContainer->at(iTrack));
27 tracksToRecover.push_back(thisEflowRecTrack);
28 }
29 for (unsigned int iCluster = 0; iCluster < eflowClusterContainer->size(); ++iCluster) {
30 eflowRecCluster* thisEFRecCluster = eflowClusterContainer->at(iCluster);
31 clustersToConsider.push_back(thisEFRecCluster);
32 }
33
34 return makeTrkCluCaloObjects(tracksToRecover, clustersToConsider, caloObjectContainer);
35
36}
const T * at(size_type n) const
Access an element, as an rvalue.
size_type size() const noexcept
Returns the number of elements in the collection.
static unsigned int makeTrkCluCaloObjects(eflowRecTrackContainer *eflowTrackContainer, eflowRecClusterContainer *eflowClusterContainer, eflowCaloObjectContainer *caloObjectContainer)

◆ makeTrkCluCaloObjects() [2/2]

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

Definition at line 38 of file eflowCaloObjectMaker.cxx.

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

◆ uniqCluster()

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

Definition at line 120 of file eflowCaloObjectMaker.cxx.

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

◆ uniqTrack()

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

Definition at line 145 of file eflowCaloObjectMaker.cxx.

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

◆ updateTracksToConsider()

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

Definition at line 170 of file eflowCaloObjectMaker.cxx.

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

The documentation for this class was generated from the following files: