CMS 3D CMS Logo

DigiCollectionFP420 Class Reference

#include <DataFormats/FP420Digi/interface/DigiCollectionFP420.h>

List of all members.

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 intdetIDs () 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.

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.


Constructor & Destructor Documentation

DigiCollectionFP420::DigiCollectionFP420 (  )  [inline]

Definition at line 25 of file DigiCollectionFP420.h.

00025 {}


Member Function Documentation

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

Definition at line 197 of file DigiCollectionFP420.cc.

References edmNew::copy(), GenMuonPlsPt100GeV_cfg::cout, digiMap_, empty, lat::endl(), and size.

00198                                                               {
00199   
00200 #ifdef mydigidebug
00201   std::cout <<"DigiCollectionFP420::add:    det_id=    " << det_id << std::endl;
00202 #endif
00203   digiMap_[det_id].reserve( digiMap_[det_id].size() + digis.size() );
00204   if ( digiMap_[det_id].empty() ) { 
00205     digiMap_[det_id] = digis;
00206   } else {
00207     copy( digis.begin(), digis.end(), back_inserter(digiMap_[det_id]) );
00208   }
00209 }

void DigiCollectionFP420::clear ( void   ) 

Definition at line 73 of file DigiCollectionFP420.cc.

References container_.

00073                                 {
00074   container_.clear();
00075 }

void DigiCollectionFP420::detIDs ( std::vector< unsigned int > &  det_ids  )  const

Definition at line 227 of file DigiCollectionFP420.cc.

References GenMuonPlsPt100GeV_cfg::cout, digiMap_, lat::endl(), and iter.

00227                                                                          {
00228   det_ids.clear(); 
00229   det_ids.reserve( static_cast<unsigned int>(digiMap_.size()) );
00230 #ifdef mydigidebug
00231   std::cout <<"DigiCollectionFP420::  detIDs:  digiMap    size= " << digiMap_.size() << std::endl;
00232 #endif
00233   HDigiFP420Container::const_iterator iter;
00234   for (iter = digiMap_.begin(); iter != digiMap_.end(); iter++ ) {
00235     det_ids.push_back( iter->first );
00236   }
00237 }

const std::vector< unsigned int > DigiCollectionFP420::detIDs (  )  const

Definition at line 176 of file DigiCollectionFP420.cc.

References GenMuonPlsPt100GeV_cfg::cout, lat::endl(), map_, and output().

00176                                                                 {
00177   // returns vector of detIDs in map
00178   
00179   DigiCollectionFP420::RegistryIterator begin = map_.begin();
00180   DigiCollectionFP420::RegistryIterator end   = map_.end();
00181   
00182 #ifdef mydigidebug
00183   std::cout <<"DigiCollectionFP420::detIDs:start " << std::endl;
00184 #endif
00185   std::vector<unsigned int> output;
00186   
00187   for (; begin != end; ++begin) {
00188     output.push_back(begin->first);
00189   }
00190   
00191   return output;
00192   
00193 }

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

Definition at line 213 of file DigiCollectionFP420.cc.

References GenMuonPlsPt100GeV_cfg::cout, digiMap_, and lat::endl().

00214                                                                       {
00215 #ifdef mydigidebug
00216   std::cout <<"DigiCollectionFP420::digis:det_id= " << det_id << std::endl;
00217 #endif
00218   if ( digiMap_.find( det_id ) != digiMap_.end() ) { 
00219     digis = digiMap_[det_id];
00220   } else {
00221     digis = std::vector<HDigiFP420>();
00222   }
00223 }

const DigiCollectionFP420::Range DigiCollectionFP420::get ( unsigned int  detID  )  const

Definition at line 113 of file DigiCollectionFP420.cc.

References container_, GenMuonPlsPt100GeV_cfg::cout, lat::endl(), and map_.

00113                                                                                 {
00114   // get Digis of detID
00115   
00116 #ifdef mydigidebug
00117   std::cout <<"DigiCollectionFP420::get1:detID= " << detID << std::endl;
00118 #endif
00119   // next 2 lines work OK also:
00120   //  DigiCollectionFP420::RegistryIterator returnIndex = map_.find(detID);
00121   //  DigiCollectionFP420::IndexRange returnIndexRange = returnIndex->second;
00122   // but use one:
00123   DigiCollectionFP420::IndexRange returnIndexRange = map_[detID];
00124   //
00125   DigiCollectionFP420::Range returnRange;
00126   returnRange.first  = container_.begin()+returnIndexRange.first;
00127   if(returnIndexRange.second != 0 ) {
00128     returnRange.second = container_.begin()+returnIndexRange.second+1;
00129   }else{
00130     returnRange.second = container_.begin()+returnIndexRange.second;
00131   }
00132   
00133 #ifdef mydigidebug
00134   std::cout <<"digi get1: container_.size() = " << container_.size() << std::endl;
00135   std::cout <<"digi get1: returnIndexRange.first= " << returnIndexRange.first << std::endl;
00136   std::cout <<"digi get1: returnIndexRange.second= " << returnIndexRange.second << std::endl;
00137 #endif
00138   return returnRange;
00139 }

const DigiCollectionFP420::Range DigiCollectionFP420::get1 ( unsigned int  detID  )  const

Definition at line 142 of file DigiCollectionFP420.cc.

References container_, GenMuonPlsPt100GeV_cfg::cout, lat::endl(), and map_.

00142                                                                                  {
00143   // get Digis of detID
00144   
00145 #ifdef mydigidebug
00146   std::cout <<"DigiCollectionFP420::get :detID= " << detID << std::endl;
00147 #endif
00148   DigiCollectionFP420::RegistryIterator returnIndex = map_.find(detID);
00149   DigiCollectionFP420::IndexRange returnIndexRange = returnIndex->second;
00150 #ifdef mydigidebug
00151   std::cout <<"DigiCollectionFP420::get : returnIndexRange.first= " << returnIndexRange.first << std::endl;
00152   std::cout <<"DigiCollectionFP420::get : returnIndexRange.second= " << returnIndexRange.second << std::endl;
00153 #endif
00154   
00155   DigiCollectionFP420::Range returnRange;
00156   returnRange.first  = container_.begin()+returnIndexRange.first;
00157   if(returnIndexRange.second != 0 ) {
00158     returnRange.second = container_.begin()+returnIndexRange.second+1;
00159   }else{
00160     returnRange.second = container_.begin()+returnIndexRange.second;
00161   }
00162 #ifdef mydigidebug
00163   std::cout <<"DigiCollectionFP420::get : container_.size() = " << container_.size() << std::endl;
00164   std::cout <<"DigiCollectionFP420::get : returnIndexRange.first= " << returnIndexRange.first << std::endl;
00165   std::cout <<"DigiCollectionFP420::get : returnIndexRange.second= " << returnIndexRange.second << std::endl;
00166 #endif
00167   return returnRange;
00168 }

void DigiCollectionFP420::put ( Range  input,
unsigned int  detID 
)

Definition at line 14 of file DigiCollectionFP420.cc.

References begin, container_, GenMuonPlsPt100GeV_cfg::cout, end, lat::endl(), first, map_, and python::multivaluedict::sort().

00014                                                              {
00015   // put in Digis of detID
00016   
00017   // store size of vector before put
00018   IndexRange inputRange;
00019   
00020   // put in HDigiFP420s from input
00021   bool first = true;
00022   
00023   // fill input in temporary vector for sorting
00024   std::vector<HDigiFP420> temporary;
00025   DigiCollectionFP420::ContainerIterator sort_begin = input.first;
00026   DigiCollectionFP420::ContainerIterator sort_end = input.second;
00027 #ifdef mydigidebug
00028   std::cout <<"   !!!!!!!!!!!!!!!!    DigiCollectionFP420:: !!!!  put !!!!  start detID=" << detID << std::endl;
00029 #endif
00030   for ( ;sort_begin != sort_end; ++sort_begin ) {
00031     temporary.push_back(*sort_begin);
00032 #ifdef mydigidebug
00033     std::cout <<"digi put: temporary.push_back " << std::endl;
00034 #endif
00035   } // for
00036   std::sort(temporary.begin(),temporary.end());
00037   
00038   // iterators over input
00039   DigiCollectionFP420::ContainerIterator begin = temporary.begin();
00040   DigiCollectionFP420::ContainerIterator end = temporary.end();
00041   for ( ;begin != end; ++begin ) {
00042     container_.push_back(*begin);
00043     if ( first ) {
00044       inputRange.first = container_.size()-1;
00045 #ifdef mydigidebug
00046       std::cout <<"digi put:first  container_.size() = " << container_.size() << std::endl;
00047       std::cout <<"digi put:first  inputRange.first = " << inputRange.first << std::endl;
00048 #endif
00049       first = false;
00050     } // if
00051   } //for
00052   
00053   // since we start from 0, then the last element will be size-1
00054   if(container_.size() != 0) {
00055     inputRange.second = container_.size()-1;
00056   }
00057   else {
00058     inputRange.first = container_.size();
00059     inputRange.second = container_.size();
00060   }
00061 #ifdef mydigidebug
00062   std::cout <<"digi put: container_.size() = " << container_.size() << std::endl;
00063   std::cout <<"digi put:  inputRange.first = " << inputRange.first << std::endl;
00064   std::cout <<"digi put:  inputRange.second = " << inputRange.second << std::endl;
00065 #endif
00066   
00067   // fill map
00068   map_[detID] = inputRange;
00069   
00070 }

void DigiCollectionFP420::putclear ( Range  input,
unsigned int  detID 
)


Member Data Documentation

std::vector<HDigiFP420> DigiCollectionFP420::container_ [mutable, private]

Definition at line 40 of file DigiCollectionFP420.h.

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

HDigiFP420Container DigiCollectionFP420::digiMap_ [mutable, private]

Definition at line 43 of file DigiCollectionFP420.h.

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

Registry DigiCollectionFP420::map_ [mutable, private]

Definition at line 41 of file DigiCollectionFP420.h.

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


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:18:25 2009 for CMSSW by  doxygen 1.5.4