CMS 3D CMS Logo

SiStripThreshold Namespace Reference


Namespaces

namespace  SiStripThreshold_Fake_cff

Functions

void allThresholds (std::vector< float > &lowThs, std::vector< float > &highThs, const Range &range) const
SiStripThreshold::Container::iterator compact (Container &input)
SiStripThreshold::Data getData (const uint16_t &strip, const Range &range) const
void getDetIds (std::vector< uint32_t > &DetIds_) const
const SiStripThreshold::Range getRange (const uint32_t &DetId) const
bool put (const uint32_t &DetId, InputVector vect)
void setData (const uint16_t &strip, const float &lTh, const float &hTh, Container &vthr)


Function Documentation

void SiStripThreshold::allThresholds ( std::vector< float > &  lowThs,
std::vector< float > &  highThs,
const Range range 
) const

Definition at line 71 of file SiStripThreshold.cc.

References edm::pset::fill(), WenuSkim_TriggerBit_cff::high, and it.

00071                                                                                                                    {
00072     ContainerIterator it = range.first;
00073     size_t strips = lowThs.size(); 
00074     assert(strips == highThs.size());
00075     while (it != range.second) {
00076         size_t firstStrip = it->getFirstStrip();
00077         //std::cout << "First strip is " << firstStrip << std::endl;
00078         float high = it->getHth(), low = it->getLth();
00079         //std::cout << "High is " << high << ", low is " << low << std::endl;
00080         ++it; // increment the pointer
00081         size_t lastStrip = (it == range.second ? strips : it->getFirstStrip());
00082         //std::cout << "Last strip is " << lastStrip << std::endl;
00083         if (lastStrip > strips) { 
00084             it = range.second;  // I should stop here,
00085             lastStrip = strips; // and fill only 'strips' strips
00086         }
00087         std::fill( & lowThs[firstStrip] , & lowThs[lastStrip] , low );
00088         std::fill( & highThs[firstStrip], & highThs[lastStrip], high );
00089     }
00090 }    

SiStripThreshold::Container::iterator SiStripThreshold::compact ( Container &  input  ) 

Definition at line 28 of file SiStripThreshold.cc.

00028                                                                             {
00029   std::stable_sort(input.begin(),input.end());
00030   return std::unique(input.begin(),input.end());
00031 }

SiStripThreshold::Data SiStripThreshold::getData ( const uint16_t &  strip,
const Range range 
) const

Definition at line 59 of file SiStripThreshold.cc.

References Exception, sistrip::FirstThStripMask_, sistrip::FirstThStripShift_, sistrip::HighThStripMask_, and p.

Referenced by HcalTBWriter::extractEventInfo(), and HcalTBSource::produce().

00059                                                                                               {
00060   uint16_t estrip=(strip & sistrip::FirstThStripMask_)<<sistrip::FirstThStripShift_ | (63 & sistrip::HighThStripMask_);
00061   ContainerIterator p = std::upper_bound(range.first,range.second,estrip,SiStripThreshold::dataStrictWeakOrdering());
00062   if (p!=range.first){
00063     return *(--p);
00064   }
00065   else{
00066     throw cms::Exception("CorruptedData")
00067       << "[SiStripThreshold::getData] asking for data for a strip " << strip << " lower then the first stored strip " << p->getFirstStrip();
00068   }
00069 }

void SiStripThreshold::getDetIds ( std::vector< uint32_t > &  DetIds_  )  const

Definition at line 44 of file SiStripThreshold.cc.

References begin, end, indexes, and p.

00044                                                                    {
00045   // returns vector of DetIds in map
00046   SiStripThreshold::RegistryIterator begin = indexes.begin();
00047   SiStripThreshold::RegistryIterator end   = indexes.end();
00048   for (SiStripThreshold::RegistryIterator p=begin; p != end; ++p) {
00049     DetIds_.push_back(p->detid);
00050   }
00051 }

const SiStripThreshold::Range SiStripThreshold::getRange ( const uint32_t &  DetId  )  const

Definition at line 33 of file SiStripThreshold.cc.

References indexes, p, and v_threshold.

Referenced by SiStripThreeThresholdAlgo::add().

00033                                                                                   {
00034   // get SiStripThreshold Range of DetId
00035   
00036   RegistryIterator p = std::lower_bound(indexes.begin(),indexes.end(),DetId,SiStripThreshold::StrictWeakOrdering());
00037   if (p==indexes.end()|| p->detid!=DetId) 
00038     return SiStripThreshold::Range(v_threshold.end(),v_threshold.end()); 
00039   else 
00040     return SiStripThreshold::Range(v_threshold.begin()+p->ibegin,v_threshold.begin()+p->iend);
00041 }

bool SiStripThreshold::put ( const uint32_t &  DetId,
InputVector  vect 
)

Definition at line 6 of file SiStripThreshold.cc.

References compact(), lat::endl(), indexes, p, and v_threshold.

00006                                                                   {
00007   // put in SiStripThreshold::v_threshold of DetId
00008   Registry::iterator p = std::lower_bound(indexes.begin(),indexes.end(),DetId,SiStripThreshold::StrictWeakOrdering());
00009   if (p!=indexes.end() && p->detid==DetId){
00010     edm::LogError("SiStripThreshold") << "[" << __PRETTY_FUNCTION__ << "] SiStripThreshold for DetID " << DetId << " is already stored. Skippig this put" << std::endl;
00011     return false;
00012   }
00013   
00014   SiStripThreshold::Container::iterator new_end=compact(vect);
00015 
00016   size_t sd= new_end-vect.begin();
00017   DetRegistry detregistry;
00018   detregistry.detid=DetId;
00019   detregistry.ibegin=v_threshold.size();
00020   detregistry.iend=v_threshold.size()+sd;
00021   indexes.insert(p,detregistry);
00022   
00023   v_threshold.insert(v_threshold.end(),vect.begin(),new_end);
00024   
00025   return true;
00026 }

void SiStripThreshold::setData ( const uint16_t &  strip,
const float &  lTh,
const float &  hTh,
Container &  vthr 
)

Definition at line 53 of file SiStripThreshold.cc.

References a.

00053                                                                                                        {
00054   Data a;
00055   a.encode(strip,lTh,hTh);
00056   vthr.push_back(a);
00057 }


Generated on Tue Jun 9 18:52:36 2009 for CMSSW by  doxygen 1.5.4