Skip to content

Commit

Permalink
Merge pull request #42146 from iarspider/fix-l1trigger_trackfindingtr…
Browse files Browse the repository at this point in the history
…acklet-cpp20

Make L1Trigger/TrackFindingTracklet compile with C++20
  • Loading branch information
cmsbuild authored Jun 30, 2023
2 parents df68cfc + 24e79d2 commit 20fab37
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 21 deletions.
2 changes: 1 addition & 1 deletion L1Trigger/TrackFindingTracklet/plugins/ProducerTBout.cc
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ namespace trklet {
channelId = 0;
for (const Stream& streamTrack : *handleTracks) {
const int nTracks = accumulate(
streamTrack.begin(), streamTrack.end(), 0, [](int& sum, const Frame& f) { return sum += f.any() ? 1 : 0; });
streamTrack.begin(), streamTrack.end(), 0, [](int sum, const Frame& f) { return sum + (f.any() ? 1 : 0); });
StreamTrack& accepted = streamAcceptedTracks[channelId];
StreamTrack& lost = streamLostTracks[channelId];
auto limit = streamTrack.end();
Expand Down
4 changes: 2 additions & 2 deletions L1Trigger/TrackFindingTracklet/plugins/ProducerTT.cc
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,8 @@ namespace trklet {
// count number of kf tracks
int nTracks(0);
for (const StreamTrack& stream : streamsTracks)
nTracks += accumulate(stream.begin(), stream.end(), 0, [](int& sum, const FrameTrack& frame) {
return sum += frame.first.isNonnull() ? 1 : 0;
nTracks += accumulate(stream.begin(), stream.end(), 0, [](int sum, const FrameTrack& frame) {
return sum + (frame.first.isNonnull() ? 1 : 0);
});
ttTracks.reserve(nTracks);
// convert kf track frames per channel and stub frames per channel and layer to TTTracks
Expand Down
2 changes: 1 addition & 1 deletion L1Trigger/TrackFindingTracklet/src/ChannelAssignment.cc
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ namespace trklet {
seedTypesSeedLayers_.emplace_back(pSetSeedTypesSeedLayers.getParameter<vector<int>>(s));
seedTypesProjectionLayers_.emplace_back(pSetSeedTypesProjectionLayers.getParameter<vector<int>>(s));
}
auto acc = [](int& sum, vector<int> ints) { return sum += (int)ints.size(); };
auto acc = [](int sum, vector<int> ints) { return sum + (int)ints.size(); };
numChannelsStub_ = accumulate(seedTypesProjectionLayers_.begin(), seedTypesProjectionLayers_.end(), 0, acc);
offsetsStubs_.reserve(numSeedTypes_);
for (int seed = 0; seed < numSeedTypes_; seed++) {
Expand Down
4 changes: 2 additions & 2 deletions L1Trigger/TrackFindingTracklet/src/KFin.cc
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,7 @@ namespace trklet {
return FrameStub(stub->ttStubRef_, Frame("1" + r.str() + phi.str() + z.str() + dPhi.str() + dZ.str()));
};
auto invalid = [](Track* track) { return track && !track->valid_; };
auto acc = [invalid](int& sum, Track* track) { return sum += (invalid(track) ? 1 : 0); };
auto acc = [invalid](int sum, Track* track) { return sum + (invalid(track) ? 1 : 0); };
const int offsetTrack = region_ * channelAssignment_->numChannelsTrack();
for (int channel = 0; channel < channelAssignment_->numChannelsTrack(); channel++) {
const int channelTrack = offsetTrack + channel;
Expand Down Expand Up @@ -431,4 +431,4 @@ namespace trklet {
return (floor(val * transform / baseLow) + .5) * baseHigh;
}

} // namespace trklet
} // namespace trklet
10 changes: 5 additions & 5 deletions L1Trigger/TrackFindingTracklet/test/AnalyzerKFin.cc
Original file line number Diff line number Diff line change
Expand Up @@ -200,8 +200,8 @@ namespace trklet {
vector<vector<TTStubRef>> lost;
formTracks(lostTracks, lostStubs, lost, offset + channel);
nTracks += tracks.size();
nStubs += accumulate(tracks.begin(), tracks.end(), 0, [](int& sum, const vector<TTStubRef>& track) {
return sum += (int)track.size();
nStubs += accumulate(tracks.begin(), tracks.end(), 0, [](int sum, const vector<TTStubRef>& track) {
return sum + (int)track.size();
});
nLost += lost.size();
allTracks += tracks.size();
Expand Down Expand Up @@ -283,8 +283,8 @@ namespace trklet {
int channel) const {
const int offset = channel * setup_->numLayers();
const StreamTrack& streamTrack = streamsTrack[channel];
const int numTracks = accumulate(streamTrack.begin(), streamTrack.end(), 0, [](int& sum, const FrameTrack& frame) {
return sum += (frame.first.isNonnull() ? 1 : 0);
const int numTracks = accumulate(streamTrack.begin(), streamTrack.end(), 0, [](int sum, const FrameTrack& frame) {
return sum + (frame.first.isNonnull() ? 1 : 0);
});
tracks.reserve(numTracks);
for (int frame = 0; frame < (int)streamTrack.size(); frame++) {
Expand Down Expand Up @@ -319,4 +319,4 @@ namespace trklet {

} // namespace trklet

DEFINE_FWK_MODULE(trklet::AnalyzerKFin);
DEFINE_FWK_MODULE(trklet::AnalyzerKFin);
6 changes: 3 additions & 3 deletions L1Trigger/TrackFindingTracklet/test/AnalyzerKFout.cc
Original file line number Diff line number Diff line change
Expand Up @@ -166,8 +166,8 @@ namespace trklet {
if (frame.first.isNonnull())
tracks.insert(frame.first);
nTracksRegion += tracks.size();
nStubsRegion += accumulate(tracks.begin(), tracks.end(), 0, [](int& sum, const TTTrackRef& ttTrackRef) {
return sum += (int)ttTrackRef->getStubRefs().size();
nStubsRegion += accumulate(tracks.begin(), tracks.end(), 0, [](int sum, const TTTrackRef& ttTrackRef) {
return sum + (int)ttTrackRef->getStubRefs().size();
});
set<TTTrackRef> tracksLost;
for (const FrameTrack& frame : lost)
Expand Down Expand Up @@ -251,4 +251,4 @@ namespace trklet {

} // namespace trklet

DEFINE_FWK_MODULE(trklet::AnalyzerKFout);
DEFINE_FWK_MODULE(trklet::AnalyzerKFout);
8 changes: 4 additions & 4 deletions L1Trigger/TrackFindingTracklet/test/AnalyzerTBout.cc
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ namespace trklet {
formTracks(lostTracks, lostStubs, lost, offset + channel);
nTracks += tracks.size();
nStubs +=
accumulate(tracks.begin(), tracks.end(), 0, [](int& sum, const auto& v) { return sum += (int)v.size(); });
accumulate(tracks.begin(), tracks.end(), 0, [](int sum, const auto& v) { return sum + (int)v.size(); });
nLost += lost.size();
allTracks += tracks.size();
if (!useMCTruth_)
Expand Down Expand Up @@ -334,8 +334,8 @@ namespace trklet {
const int seedType = channel % channelAssignment_->numChannelsTrack();
const int offset = channelAssignment_->offsetStub(channel);
const StreamTrack& streamTrack = streamsTrack[channel];
const int numTracks = accumulate(streamTrack.begin(), streamTrack.end(), 0, [](int& sum, const FrameTrack& frame) {
return sum += (frame.first.isNonnull() ? 1 : 0);
const int numTracks = accumulate(streamTrack.begin(), streamTrack.end(), 0, [](int sum, const FrameTrack& frame) {
return sum + (frame.first.isNonnull() ? 1 : 0);
});
tracks.reserve(numTracks);
for (int frame = 0; frame < (int)streamTrack.size(); frame++) {
Expand Down Expand Up @@ -443,4 +443,4 @@ namespace trklet {

} // namespace trklet

DEFINE_FWK_MODULE(trklet::AnalyzerTBout);
DEFINE_FWK_MODULE(trklet::AnalyzerTBout);
6 changes: 3 additions & 3 deletions L1Trigger/TrackFindingTracklet/test/AnalyzerTracklet.cc
Original file line number Diff line number Diff line change
Expand Up @@ -174,8 +174,8 @@ namespace trklet {
for (int region = 0; region < setup_->numRegions(); region++) {
const vector<TTTrackRef>& ttTrackRefs = ttTrackRefsRegions[region];
const int nStubs =
accumulate(ttTrackRefs.begin(), ttTrackRefs.end(), 0, [](int& sum, const TTTrackRef& ttTrackRef) {
return sum += ttTrackRef->getStubRefs().size();
accumulate(ttTrackRefs.begin(), ttTrackRefs.end(), 0, [](int sum, const TTTrackRef& ttTrackRef) {
return sum + ttTrackRef->getStubRefs().size();
});
const int nTracks = ttTrackRefs.size();
hisChannel_->Fill(nTracks);
Expand Down Expand Up @@ -271,4 +271,4 @@ namespace trklet {

} // namespace trklet

DEFINE_FWK_MODULE(trklet::AnalyzerTracklet);
DEFINE_FWK_MODULE(trklet::AnalyzerTracklet);

0 comments on commit 20fab37

Please sign in to comment.