CMS 3D CMS Logo

Public Types | Public Member Functions | Private Attributes

ClusterCollectionFP420 Class Reference

#include <ClusterCollectionFP420.h>

List of all members.

Public Types

typedef std::map< unsigned int,
std::vector< ClusterFP420 > > 
ClusterFP420Container
typedef std::vector
< ClusterFP420 >
::const_iterator 
ContainerIterator
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 clear ()
 ClusterCollectionFP420 ()
const std::vector< unsigned int > detIDs () const
const Range get (unsigned int detID) const
void put (Range input, unsigned int detID)
void putclear (Range input, unsigned int detID)

Private Attributes

ClusterFP420Container clusterMap_
std::vector< ClusterFP420container_
Registry map_

Detailed Description

Definition at line 9 of file ClusterCollectionFP420.h.


Member Typedef Documentation

typedef std::map< unsigned int, std::vector<ClusterFP420> > ClusterCollectionFP420::ClusterFP420Container

Definition at line 18 of file ClusterCollectionFP420.h.

typedef std::vector<ClusterFP420>::const_iterator ClusterCollectionFP420::ContainerIterator

Definition at line 13 of file ClusterCollectionFP420.h.

typedef std::pair<unsigned int, unsigned int> ClusterCollectionFP420::IndexRange

Definition at line 15 of file ClusterCollectionFP420.h.

Definition at line 14 of file ClusterCollectionFP420.h.

typedef std::map<unsigned int, IndexRange> ClusterCollectionFP420::Registry

Definition at line 16 of file ClusterCollectionFP420.h.

typedef std::map<unsigned int, IndexRange>::const_iterator ClusterCollectionFP420::RegistryIterator

Definition at line 17 of file ClusterCollectionFP420.h.


Constructor & Destructor Documentation

ClusterCollectionFP420::ClusterCollectionFP420 ( ) [inline]

Definition at line 20 of file ClusterCollectionFP420.h.

{}

Member Function Documentation

void ClusterCollectionFP420::clear ( void  )

Definition at line 101 of file ClusterCollectionFP420.cc.

References container_.

                                   {
container_.clear();
}
const std::vector< unsigned int > ClusterCollectionFP420::detIDs ( ) const

Definition at line 141 of file ClusterCollectionFP420.cc.

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

                                                                   {
  // returns vector of detIDs in map

#ifdef mydigidebug
std::cout <<"ClusterCollectionFP420::detIDs:start " << std::endl;
#endif
  ClusterCollectionFP420::RegistryIterator begin = map_.begin();
  ClusterCollectionFP420::RegistryIterator end   = map_.end();

  std::vector<unsigned int> output;

  for (; begin != end; ++begin) {
    output.push_back(begin->first);
  }

  return output;

}
const ClusterCollectionFP420::Range ClusterCollectionFP420::get ( unsigned int  detID) const

Definition at line 71 of file ClusterCollectionFP420.cc.

References container_, and gather_cfg::cout.

                                                                                      {
  // get RecHits of detID

#ifdef mydigidebug
std::cout <<"ClusterCollectionFP420::get:detID= " << detID << std::endl;
#endif
  ClusterCollectionFP420::RegistryIterator returnIndex = map_.find(detID);
  ClusterCollectionFP420::IndexRange returnIndexRange = returnIndex->second;
#ifdef mydigidebug
   std::cout <<"ClusterCollectionFP420::get1: returnIndexRange.first= " << returnIndexRange.first << std::endl;
   std::cout <<"ClusterCollectionFP420::get1: returnIndexRange.second= " << returnIndexRange.second << std::endl;
#endif

  ClusterCollectionFP420::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 <<"ClusterCollectionFP420::get2: container_.size() = " << container_.size() << std::endl;
   std::cout <<"ClusterCollectionFP420::get2: returnIndexRange.first= " << returnIndexRange.first << std::endl;
   std::cout <<"ClusterCollectionFP420::get2: returnIndexRange.second= " << returnIndexRange.second << std::endl;
#endif
  return returnRange;
}
void ClusterCollectionFP420::put ( ClusterCollectionFP420::Range  input,
unsigned int  detID 
)

Definition at line 13 of file ClusterCollectionFP420.cc.

References begin, container_, gather_cfg::cout, end, first, estimatePileup::inputRange, and python::multivaluedict::sort().

                                                                                      {
  // put in RecHits of detID

  // store size of vector before put
  ClusterCollectionFP420::IndexRange inputRange;
  
  // put in ClusterFP420s from input
  bool first = true;
  
  // fill input in temporary vector for sorting
  std::vector<ClusterFP420> temporary;
  ClusterCollectionFP420::ContainerIterator sort_begin = input.first;
  ClusterCollectionFP420::ContainerIterator sort_end = input.second;
#ifdef mydigidebug
   std::cout <<"   !!!!!!!!!!!!!!!!    ClusterCollectionFP420:: !!!!  put !!!!           start " << std::endl;
#endif
  for ( ;sort_begin != sort_end; ++sort_begin ) {
#ifdef mydigidebug
   std::cout <<"put: temporary.push_back " << std::endl;
#endif
    temporary.push_back(*sort_begin);
  }
  std::sort(temporary.begin(),temporary.end());

  // iterators over input
  ClusterCollectionFP420::ContainerIterator begin = temporary.begin();
  ClusterCollectionFP420::ContainerIterator end = temporary.end();
  for ( ;begin != end; ++begin ) {
    container_.push_back(*begin);
    if ( first ) {
          inputRange.first = container_.size()-1;
 //     inputRange.first = container_.size();
      first = false;
    }
  }

  // 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();
  }
  //inputRange.second = container_.size()-1;

#ifdef mydigidebug
   std::cout <<"put: container_.size() = " << container_.size() << std::endl;
   std::cout <<"put:  inputRange.first = " << inputRange.first << std::endl;
   std::cout <<"put:  inputRange.second = " << inputRange.second << std::endl;
#endif
  
  // fill map
  map_[detID] = inputRange;

}
void ClusterCollectionFP420::putclear ( ClusterCollectionFP420::Range  input,
unsigned int  detID 
)

Definition at line 104 of file ClusterCollectionFP420.cc.

References begin, container_, gather_cfg::cout, end, estimatePileup::inputRange, and python::multivaluedict::sort().

                                                                                           {

  ClusterCollectionFP420::IndexRange inputRange;
  
  std::vector<ClusterFP420> temporary;
  ClusterCollectionFP420::ContainerIterator sort_begin = input.first;
  ClusterCollectionFP420::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();
  ClusterCollectionFP420::ContainerIterator begin = temporary.begin();
  ClusterCollectionFP420::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 <<"putclear: container_.size() = " << container_.size() << std::endl;
   std::cout <<"putclear:  inputRange.first = " << inputRange.first << std::endl;
   std::cout <<"putclear:  inputRange.second = " << inputRange.second << std::endl;
#endif


          map_[detID] = inputRange;
}

Member Data Documentation

Definition at line 41 of file ClusterCollectionFP420.h.

std::vector<ClusterFP420> ClusterCollectionFP420::container_ [mutable, private]

Definition at line 38 of file ClusterCollectionFP420.h.

Definition at line 39 of file ClusterCollectionFP420.h.