Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removed mutable from DigiCollectionFP420 #3440

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 3 additions & 3 deletions DataFormats/FP420Digi/interface/DigiCollectionFP420.h
Expand Up @@ -37,10 +37,10 @@ class DigiCollectionFP420 {
void clear();
private:

mutable std::vector<HDigiFP420> container_;
mutable Registry map_;
std::vector<HDigiFP420> container_;
Registry map_;

mutable HDigiFP420Container digiMap_;
HDigiFP420Container digiMap_;


};
Expand Down
16 changes: 9 additions & 7 deletions DataFormats/FP420Digi/src/DigiCollectionFP420.cc
Expand Up @@ -117,11 +117,12 @@ const DigiCollectionFP420::Range DigiCollectionFP420::get(unsigned int detID) co
#ifdef mydigidebug
std::cout <<"DigiCollectionFP420::get1:detID= " << detID << std::endl;
#endif
// next 2 lines work OK also:
// DigiCollectionFP420::RegistryIterator returnIndex = map_.find(detID);
// DigiCollectionFP420::IndexRange returnIndexRange = returnIndex->second;
// but use one:
DigiCollectionFP420::IndexRange returnIndexRange = map_[detID];
auto found = map_.find(detID);
if(found == map_.end()) {
return DigiCollectionFP420::Range{container_.begin(),container_.begin()};
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To the best of my ability, I believe this to be the same return value as the original code. The original code would have gotten a defaultly constructed IndexRange (which is std::pair<unsigned int, unsigned int>). That default would have been (0,0). The code then takes those values and adds them to container_.begin() to get the return values. [NOTE: in the original code the .second value is compared against 0 and if it is equal the 0 is added to container_.begin().]

}

DigiCollectionFP420::IndexRange returnIndexRange = found->second;
//
DigiCollectionFP420::Range returnRange;
returnRange.first = container_.begin()+returnIndexRange.first;
Expand Down Expand Up @@ -216,8 +217,9 @@ void DigiCollectionFP420::digis( unsigned int& det_id,
#ifdef mydigidebug
std::cout <<"DigiCollectionFP420::digis:det_id= " << det_id << std::endl;
#endif
if ( digiMap_.find( det_id ) != digiMap_.end() ) {
digis = digiMap_[det_id];
auto found = digiMap_.find( det_id );
if ( found != digiMap_.end() ) {
digis = found->second;
} else {
digis = std::vector<HDigiFP420>();
}
Expand Down