#include <DigiCollectionFP420.h>
Public Types | |
typedef std::vector < HDigiFP420 >::const_iterator | ContainerIterator |
typedef std::map< unsigned int, std::vector< HDigiFP420 > > | HDigiFP420Container |
typedef std::pair< unsigned int, unsigned int > | IndexRange |
typedef std::pair < ContainerIterator, ContainerIterator > | Range |
typedef std::map< unsigned int, IndexRange > | Registry |
typedef std::map< unsigned int, IndexRange >::const_iterator | RegistryIterator |
Public Member Functions | |
void | add (unsigned int &det_id, std::vector< HDigiFP420 > &digis) |
void | clear () |
void | detIDs (std::vector< unsigned int > &det_ids) const |
const std::vector< unsigned int > | detIDs () const |
DigiCollectionFP420 () | |
void | digis (unsigned int &det_id, std::vector< HDigiFP420 > &digis) const |
const Range | get (unsigned int detID) const |
const Range | get1 (unsigned int detID) const |
void | put (Range input, unsigned int detID) |
void | putclear (Range input, unsigned int detID) |
Private Attributes | |
std::vector< HDigiFP420 > | container_ |
HDigiFP420Container | digiMap_ |
Registry | map_ |
Definition at line 14 of file DigiCollectionFP420.h.
typedef std::vector<HDigiFP420>::const_iterator DigiCollectionFP420::ContainerIterator |
Definition at line 18 of file DigiCollectionFP420.h.
typedef std::map< unsigned int, std::vector<HDigiFP420> > DigiCollectionFP420::HDigiFP420Container |
Definition at line 23 of file DigiCollectionFP420.h.
typedef std::pair<unsigned int, unsigned int> DigiCollectionFP420::IndexRange |
Definition at line 20 of file DigiCollectionFP420.h.
typedef std::pair<ContainerIterator, ContainerIterator> DigiCollectionFP420::Range |
Definition at line 19 of file DigiCollectionFP420.h.
typedef std::map<unsigned int, IndexRange> DigiCollectionFP420::Registry |
Definition at line 21 of file DigiCollectionFP420.h.
typedef std::map<unsigned int, IndexRange>::const_iterator DigiCollectionFP420::RegistryIterator |
Definition at line 22 of file DigiCollectionFP420.h.
DigiCollectionFP420::DigiCollectionFP420 | ( | ) | [inline] |
Definition at line 25 of file DigiCollectionFP420.h.
{}
void DigiCollectionFP420::add | ( | unsigned int & | det_id, |
std::vector< HDigiFP420 > & | digis | ||
) |
Definition at line 198 of file DigiCollectionFP420.cc.
References filterCSVwithJSON::copy, gather_cfg::cout, digiMap_, digis(), relativeConstraints::empty, and findQualityFiles::size.
{ #ifdef mydigidebug std::cout <<"DigiCollectionFP420::add: det_id= " << det_id << std::endl; #endif digiMap_[det_id].reserve( digiMap_[det_id].size() + digis.size() ); if ( digiMap_[det_id].empty() ) { digiMap_[det_id] = digis; } else { copy( digis.begin(), digis.end(), back_inserter(digiMap_[det_id]) ); } }
void DigiCollectionFP420::clear | ( | void | ) |
Definition at line 74 of file DigiCollectionFP420.cc.
References container_.
{ container_.clear(); }
const std::vector< unsigned int > DigiCollectionFP420::detIDs | ( | ) | const |
Definition at line 177 of file DigiCollectionFP420.cc.
References begin, gather_cfg::cout, end, map_, and convertSQLitetoXML_cfg::output.
{ // returns vector of detIDs in map DigiCollectionFP420::RegistryIterator begin = map_.begin(); DigiCollectionFP420::RegistryIterator end = map_.end(); #ifdef mydigidebug std::cout <<"DigiCollectionFP420::detIDs:start " << std::endl; #endif std::vector<unsigned int> output; for (; begin != end; ++begin) { output.push_back(begin->first); } return output; }
void DigiCollectionFP420::detIDs | ( | std::vector< unsigned int > & | det_ids | ) | const |
Definition at line 228 of file DigiCollectionFP420.cc.
References gather_cfg::cout, and digiMap_.
{ det_ids.clear(); det_ids.reserve( static_cast<unsigned int>(digiMap_.size()) ); #ifdef mydigidebug std::cout <<"DigiCollectionFP420:: detIDs: digiMap size= " << digiMap_.size() << std::endl; #endif HDigiFP420Container::const_iterator iter; for (iter = digiMap_.begin(); iter != digiMap_.end(); iter++ ) { det_ids.push_back( iter->first ); } }
void DigiCollectionFP420::digis | ( | unsigned int & | det_id, |
std::vector< HDigiFP420 > & | digis | ||
) | const |
Definition at line 214 of file DigiCollectionFP420.cc.
References gather_cfg::cout, and digiMap_.
Referenced by add().
const DigiCollectionFP420::Range DigiCollectionFP420::get | ( | unsigned int | detID | ) | const |
Definition at line 114 of file DigiCollectionFP420.cc.
References container_, gather_cfg::cout, and map_.
{ // get Digis of detID #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]; // DigiCollectionFP420::Range returnRange; returnRange.first = container_.begin()+returnIndexRange.first; if(returnIndexRange.second != 0 ) { returnRange.second = container_.begin()+returnIndexRange.second+1; }else{ returnRange.second = container_.begin()+returnIndexRange.second; } #ifdef mydigidebug std::cout <<"digi get1: container_.size() = " << container_.size() << std::endl; std::cout <<"digi get1: returnIndexRange.first= " << returnIndexRange.first << std::endl; std::cout <<"digi get1: returnIndexRange.second= " << returnIndexRange.second << std::endl; #endif return returnRange; }
const DigiCollectionFP420::Range DigiCollectionFP420::get1 | ( | unsigned int | detID | ) | const |
Definition at line 143 of file DigiCollectionFP420.cc.
References container_, gather_cfg::cout, and map_.
{ // get Digis of detID #ifdef mydigidebug std::cout <<"DigiCollectionFP420::get :detID= " << detID << std::endl; #endif DigiCollectionFP420::RegistryIterator returnIndex = map_.find(detID); DigiCollectionFP420::IndexRange returnIndexRange = returnIndex->second; #ifdef mydigidebug std::cout <<"DigiCollectionFP420::get : returnIndexRange.first= " << returnIndexRange.first << std::endl; std::cout <<"DigiCollectionFP420::get : returnIndexRange.second= " << returnIndexRange.second << std::endl; #endif DigiCollectionFP420::Range returnRange; returnRange.first = container_.begin()+returnIndexRange.first; if(returnIndexRange.second != 0 ) { returnRange.second = container_.begin()+returnIndexRange.second+1; }else{ returnRange.second = container_.begin()+returnIndexRange.second; } #ifdef mydigidebug std::cout <<"DigiCollectionFP420::get : container_.size() = " << container_.size() << std::endl; std::cout <<"DigiCollectionFP420::get : returnIndexRange.first= " << returnIndexRange.first << std::endl; std::cout <<"DigiCollectionFP420::get : returnIndexRange.second= " << returnIndexRange.second << std::endl; #endif return returnRange; }
void DigiCollectionFP420::put | ( | Range | input, |
unsigned int | detID | ||
) |
Definition at line 15 of file DigiCollectionFP420.cc.
References begin, container_, gather_cfg::cout, end, first, estimatePileup::inputRange, map_, and python::multivaluedict::sort().
{ // put in Digis of detID // store size of vector before put IndexRange inputRange; // put in HDigiFP420s from input bool first = true; // fill input in temporary vector for sorting std::vector<HDigiFP420> temporary; DigiCollectionFP420::ContainerIterator sort_begin = input.first; DigiCollectionFP420::ContainerIterator sort_end = input.second; #ifdef mydigidebug std::cout <<" !!!!!!!!!!!!!!!! DigiCollectionFP420:: !!!! put !!!! start detID=" << detID << std::endl; #endif for ( ;sort_begin != sort_end; ++sort_begin ) { temporary.push_back(*sort_begin); #ifdef mydigidebug std::cout <<"digi put: temporary.push_back " << std::endl; #endif } // for std::sort(temporary.begin(),temporary.end()); // iterators over input DigiCollectionFP420::ContainerIterator begin = temporary.begin(); DigiCollectionFP420::ContainerIterator end = temporary.end(); for ( ;begin != end; ++begin ) { container_.push_back(*begin); if ( first ) { inputRange.first = container_.size()-1; #ifdef mydigidebug std::cout <<"digi put:first container_.size() = " << container_.size() << std::endl; std::cout <<"digi put:first inputRange.first = " << inputRange.first << std::endl; #endif first = false; } // if } //for // since we start from 0, then the last element will be size-1 if(container_.size() != 0) { inputRange.second = container_.size()-1; } else { inputRange.first = container_.size(); inputRange.second = container_.size(); } #ifdef mydigidebug std::cout <<"digi put: container_.size() = " << container_.size() << std::endl; std::cout <<"digi put: inputRange.first = " << inputRange.first << std::endl; std::cout <<"digi put: inputRange.second = " << inputRange.second << std::endl; #endif // fill map map_[detID] = inputRange; }
void DigiCollectionFP420::putclear | ( | DigiCollectionFP420::Range | input, |
unsigned int | detID | ||
) |
Definition at line 77 of file DigiCollectionFP420.cc.
References begin, container_, gather_cfg::cout, end, estimatePileup::inputRange, map_, and python::multivaluedict::sort().
{ DigiCollectionFP420::IndexRange inputRange; std::vector<HDigiFP420> temporary; DigiCollectionFP420::ContainerIterator sort_begin = input.first; DigiCollectionFP420::ContainerIterator sort_end = input.second; for ( ;sort_begin != sort_end; ++sort_begin ) { temporary.push_back(*sort_begin); } std::sort(temporary.begin(),temporary.end()); // temporary.clear(); DigiCollectionFP420::ContainerIterator begin = temporary.begin(); DigiCollectionFP420::ContainerIterator end = temporary.end(); for ( ;begin != end; ++begin ) { container_.push_back(*begin); } //container_.clear(); inputRange.first = container_.size()-container_.size(); inputRange.second = container_.size()-container_.size(); #ifdef mydigidebug std::cout <<"digi putclear: container_.size() = " << container_.size() << std::endl; std::cout <<"digi putclear: inputRange.first = " << inputRange.first << std::endl; std::cout <<"digi putclear: inputRange.second = " << inputRange.second << std::endl; #endif map_[detID] = inputRange; }
std::vector<HDigiFP420> DigiCollectionFP420::container_ [mutable, private] |
Definition at line 40 of file DigiCollectionFP420.h.
Referenced by clear(), get(), get1(), put(), and putclear().
HDigiFP420Container DigiCollectionFP420::digiMap_ [mutable, private] |
Definition at line 43 of file DigiCollectionFP420.h.
Registry DigiCollectionFP420::map_ [mutable, private] |
Definition at line 41 of file DigiCollectionFP420.h.
Referenced by detIDs(), get(), get1(), put(), and putclear().