test
CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Types | Public Member Functions | Private Attributes
DigiCollectionFP420 Class Reference

#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 ()
 
const std::vector< unsigned int > detIDs () const
 
void detIDs (std::vector< unsigned int > &det_ids) 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< HDigiFP420container_
 
HDigiFP420Container digiMap_
 
Registry map_
 

Detailed Description

Definition at line 14 of file DigiCollectionFP420.h.

Member Typedef Documentation

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.

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.

Constructor & Destructor Documentation

DigiCollectionFP420::DigiCollectionFP420 ( )
inline

Definition at line 25 of file DigiCollectionFP420.h.

25 {}

Member Function Documentation

void DigiCollectionFP420::add ( unsigned int &  det_id,
std::vector< HDigiFP420 > &  digis 
)

Definition at line 199 of file DigiCollectionFP420.cc.

References filterCSVwithJSON::copy, gather_cfg::cout, digiMap_, digis(), relativeConstraints::empty, and findQualityFiles::size.

200  {
201 
202 #ifdef mydigidebug
203  std::cout <<"DigiCollectionFP420::add: det_id= " << det_id << std::endl;
204 #endif
205  digiMap_[det_id].reserve( digiMap_[det_id].size() + digis.size() );
206  if ( digiMap_[det_id].empty() ) {
207  digiMap_[det_id] = digis;
208  } else {
209  copy( digis.begin(), digis.end(), back_inserter(digiMap_[det_id]) );
210  }
211 }
void digis(unsigned int &det_id, std::vector< HDigiFP420 > &digis) const
HDigiFP420Container digiMap_
tuple cout
Definition: gather_cfg.py:121
tuple size
Write out results.
void DigiCollectionFP420::clear ( void  )
const std::vector< unsigned int > DigiCollectionFP420::detIDs ( ) const

Definition at line 178 of file DigiCollectionFP420.cc.

References begin, gather_cfg::cout, end, map_, and convertSQLitetoXML_cfg::output.

178  {
179  // returns vector of detIDs in map
180 
183 
184 #ifdef mydigidebug
185  std::cout <<"DigiCollectionFP420::detIDs:start " << std::endl;
186 #endif
187  std::vector<unsigned int> output;
188 
189  for (; begin != end; ++begin) {
190  output.push_back(begin->first);
191  }
192 
193  return output;
194 
195 }
std::map< unsigned int, IndexRange >::const_iterator RegistryIterator
#define end
Definition: vmac.h:37
#define begin
Definition: vmac.h:30
tuple cout
Definition: gather_cfg.py:121
void DigiCollectionFP420::detIDs ( std::vector< unsigned int > &  det_ids) const

Definition at line 230 of file DigiCollectionFP420.cc.

References gather_cfg::cout, digiMap_, and getDQMSummary::iter.

230  {
231  det_ids.clear();
232  det_ids.reserve( static_cast<unsigned int>(digiMap_.size()) );
233 #ifdef mydigidebug
234  std::cout <<"DigiCollectionFP420:: detIDs: digiMap size= " << digiMap_.size() << std::endl;
235 #endif
236  HDigiFP420Container::const_iterator iter;
237  for (iter = digiMap_.begin(); iter != digiMap_.end(); iter++ ) {
238  det_ids.push_back( iter->first );
239  }
240 }
HDigiFP420Container digiMap_
tuple cout
Definition: gather_cfg.py:121
void DigiCollectionFP420::digis ( unsigned int &  det_id,
std::vector< HDigiFP420 > &  digis 
) const

Definition at line 215 of file DigiCollectionFP420.cc.

References gather_cfg::cout, digiMap_, and newFWLiteAna::found.

Referenced by add().

216  {
217 #ifdef mydigidebug
218  std::cout <<"DigiCollectionFP420::digis:det_id= " << det_id << std::endl;
219 #endif
220  auto found = digiMap_.find( det_id );
221  if ( found != digiMap_.end() ) {
222  digis = found->second;
223  } else {
224  digis = std::vector<HDigiFP420>();
225  }
226 }
void digis(unsigned int &det_id, std::vector< HDigiFP420 > &digis) const
HDigiFP420Container digiMap_
tuple cout
Definition: gather_cfg.py:121
const DigiCollectionFP420::Range DigiCollectionFP420::get ( unsigned int  detID) const

Definition at line 114 of file DigiCollectionFP420.cc.

References container_, gather_cfg::cout, newFWLiteAna::found, and map_.

Referenced by Options.Options::__getitem__(), betterConfigParser.BetterConfigParser::__updateDict(), rrapi.RRApi::columns(), rrapi.RRApi::count(), rrapi.RRApi::data(), betterConfigParser.BetterConfigParser::getCompares(), betterConfigParser.BetterConfigParser::getGeneral(), betterConfigParser.BetterConfigParser::getResultingSection(), rrapi.RRApi::report(), rrapi.RRApi::reports(), rrapi.RRApi::tables(), rrapi.RRApi::tags(), rrapi.RRApi::templates(), and rrapi.RRApi::workspaces().

114  {
115  // get Digis of detID
116 
117 #ifdef mydigidebug
118  std::cout <<"DigiCollectionFP420::get1:detID= " << detID << std::endl;
119 #endif
120  auto found = map_.find(detID);
121  if(found == map_.end()) {
122  return DigiCollectionFP420::Range{container_.begin(),container_.begin()};
123  }
124 
125  DigiCollectionFP420::IndexRange returnIndexRange = found->second;
126  //
127  DigiCollectionFP420::Range returnRange;
128  returnRange.first = container_.begin()+returnIndexRange.first;
129  if(returnIndexRange.second != 0 ) {
130  returnRange.second = container_.begin()+returnIndexRange.second+1;
131  }else{
132  returnRange.second = container_.begin()+returnIndexRange.second;
133  }
134 
135 #ifdef mydigidebug
136  std::cout <<"digi get1: container_.size() = " << container_.size() << std::endl;
137  std::cout <<"digi get1: returnIndexRange.first= " << returnIndexRange.first << std::endl;
138  std::cout <<"digi get1: returnIndexRange.second= " << returnIndexRange.second << std::endl;
139 #endif
140  return returnRange;
141 }
std::pair< unsigned int, unsigned int > IndexRange
std::pair< ContainerIterator, ContainerIterator > Range
std::vector< HDigiFP420 > container_
tuple cout
Definition: gather_cfg.py:121
const DigiCollectionFP420::Range DigiCollectionFP420::get1 ( unsigned int  detID) const

Definition at line 144 of file DigiCollectionFP420.cc.

References container_, gather_cfg::cout, and map_.

144  {
145  // get Digis of detID
146 
147 #ifdef mydigidebug
148  std::cout <<"DigiCollectionFP420::get :detID= " << detID << std::endl;
149 #endif
150  DigiCollectionFP420::RegistryIterator returnIndex = map_.find(detID);
151  DigiCollectionFP420::IndexRange returnIndexRange = returnIndex->second;
152 #ifdef mydigidebug
153  std::cout <<"DigiCollectionFP420::get : returnIndexRange.first= " << returnIndexRange.first << std::endl;
154  std::cout <<"DigiCollectionFP420::get : returnIndexRange.second= " << returnIndexRange.second << std::endl;
155 #endif
156 
157  DigiCollectionFP420::Range returnRange;
158  returnRange.first = container_.begin()+returnIndexRange.first;
159  if(returnIndexRange.second != 0 ) {
160  returnRange.second = container_.begin()+returnIndexRange.second+1;
161  }else{
162  returnRange.second = container_.begin()+returnIndexRange.second;
163  }
164 #ifdef mydigidebug
165  std::cout <<"DigiCollectionFP420::get : container_.size() = " << container_.size() << std::endl;
166  std::cout <<"DigiCollectionFP420::get : returnIndexRange.first= " << returnIndexRange.first << std::endl;
167  std::cout <<"DigiCollectionFP420::get : returnIndexRange.second= " << returnIndexRange.second << std::endl;
168 #endif
169  return returnRange;
170 }
std::pair< unsigned int, unsigned int > IndexRange
std::map< unsigned int, IndexRange >::const_iterator RegistryIterator
std::pair< ContainerIterator, ContainerIterator > Range
std::vector< HDigiFP420 > container_
tuple cout
Definition: gather_cfg.py:121
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().

15  {
16  // put in Digis of detID
17 
18  // store size of vector before put
20 
21  // put in HDigiFP420s from input
22  bool first = true;
23 
24  // fill input in temporary vector for sorting
25  std::vector<HDigiFP420> temporary;
28 #ifdef mydigidebug
29  std::cout <<" !!!!!!!!!!!!!!!! DigiCollectionFP420:: !!!! put !!!! start detID=" << detID << std::endl;
30 #endif
31  for ( ;sort_begin != sort_end; ++sort_begin ) {
32  temporary.push_back(*sort_begin);
33 #ifdef mydigidebug
34  std::cout <<"digi put: temporary.push_back " << std::endl;
35 #endif
36  } // for
37  std::sort(temporary.begin(),temporary.end());
38 
39  // iterators over input
42  for ( ;begin != end; ++begin ) {
43  container_.push_back(*begin);
44  if ( first ) {
45  inputRange.first = container_.size()-1;
46 #ifdef mydigidebug
47  std::cout <<"digi put:first container_.size() = " << container_.size() << std::endl;
48  std::cout <<"digi put:first inputRange.first = " << inputRange.first << std::endl;
49 #endif
50  first = false;
51  } // if
52  } //for
53 
54  // since we start from 0, then the last element will be size-1
55  if(container_.size() != 0) {
56  inputRange.second = container_.size()-1;
57  }
58  else {
59  inputRange.first = container_.size();
60  inputRange.second = container_.size();
61  }
62 #ifdef mydigidebug
63  std::cout <<"digi put: container_.size() = " << container_.size() << std::endl;
64  std::cout <<"digi put: inputRange.first = " << inputRange.first << std::endl;
65  std::cout <<"digi put: inputRange.second = " << inputRange.second << std::endl;
66 #endif
67 
68  // fill map
69  map_[detID] = inputRange;
70 
71 }
inputRange
Get input source.
std::vector< HDigiFP420 >::const_iterator ContainerIterator
std::pair< unsigned int, unsigned int > IndexRange
static std::string const input
Definition: EdmProvDump.cc:44
#define end
Definition: vmac.h:37
bool first
Definition: L1TdeRCT.cc:75
std::vector< HDigiFP420 > container_
#define begin
Definition: vmac.h:30
tuple cout
Definition: gather_cfg.py:121
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().

77  {
78 
80 
81  std::vector<HDigiFP420> temporary;
84  for ( ;sort_begin != sort_end; ++sort_begin ) {
85  temporary.push_back(*sort_begin);
86  }
87  std::sort(temporary.begin(),temporary.end());
88 
89  // temporary.clear();
92  for ( ;begin != end; ++begin ) {
93  container_.push_back(*begin);
94  }
95  //container_.clear();
96  inputRange.first = container_.size()-container_.size();
97  inputRange.second = container_.size()-container_.size();
98 
99 #ifdef mydigidebug
100  std::cout <<"digi putclear: container_.size() = " << container_.size() << std::endl;
101  std::cout <<"digi putclear: inputRange.first = " << inputRange.first << std::endl;
102  std::cout <<"digi putclear: inputRange.second = " << inputRange.second << std::endl;
103 #endif
104 
105 
106  map_[detID] = inputRange;
107 }
inputRange
Get input source.
std::vector< HDigiFP420 >::const_iterator ContainerIterator
std::pair< unsigned int, unsigned int > IndexRange
static std::string const input
Definition: EdmProvDump.cc:44
#define end
Definition: vmac.h:37
std::vector< HDigiFP420 > container_
#define begin
Definition: vmac.h:30
tuple cout
Definition: gather_cfg.py:121

Member Data Documentation

std::vector<HDigiFP420> DigiCollectionFP420::container_
private

Definition at line 40 of file DigiCollectionFP420.h.

Referenced by clear(), get(), get1(), put(), and putclear().

HDigiFP420Container DigiCollectionFP420::digiMap_
private

Definition at line 43 of file DigiCollectionFP420.h.

Referenced by add(), detIDs(), and digis().

Registry DigiCollectionFP420::map_
private

Definition at line 41 of file DigiCollectionFP420.h.

Referenced by detIDs(), get(), get1(), put(), and putclear().