CMS 3D CMS Logo

Public Member Functions | Private Member Functions | Private Attributes

GEMSimSetUp Class Reference

#include <GEMSimSetUp.h>

List of all members.

Public Member Functions

 GEMSimSetUp (const edm::ParameterSet &ps)
const std::vector< float > & getCluster (uint32_t id)
const std::map< int,
std::vector< float > > & 
getClusterMap ()
const std::vector< float > & getEfficiency (uint32_t id)
const GEMGeometrygetGeometry ()
const std::vector< float > & getNoise (uint32_t id)
float getTime (uint32_t id)
void setGeometry (const GEMGeometry *geom)
void setup (std::vector< RPCStripNoises::NoiseItem > &vnoise, std::vector< float > &vcluster)
void setup ()
void setup (std::vector< RPCStripNoises::NoiseItem > &vnoise, std::vector< RPCClusterSize::ClusterSizeItem > &vClusterSize)
virtual ~GEMSimSetUp ()

Private Member Functions

void setupNoiseAndEfficiency (std::vector< RPCStripNoises::NoiseItem > &vnoise)
void setupTimeCalibration (GEMDetId id, float timing)

Private Attributes

double averageEfficiency_
double averageNoiseRate_
std::map< GEMDetId, float > bxmap_
std::map< int, std::vector
< float > > 
clusterMap_
const GEMGeometrygeometry_
std::map< uint32_t,
std::vector< float > > 
mapDetClusterMap_
std::map< uint32_t,
std::vector< float > > 
mapDetIdEfficiency_
std::map< uint32_t,
std::vector< float > > 
mapDetIdNoise_
int numberOfStripsPerPartition_
double timeCalibrationOffset_

Detailed Description

Definition at line 15 of file GEMSimSetUp.h.


Constructor & Destructor Documentation

GEMSimSetUp::GEMSimSetUp ( const edm::ParameterSet ps)

Definition at line 5 of file GEMSimSetUp.cc.

References averageEfficiency_, averageNoiseRate_, edm::ParameterSet::getParameter(), numberOfStripsPerPartition_, and timeCalibrationOffset_.

{
  auto pset = config.getParameter<edm::ParameterSet>("digiModelConfig");

  averageEfficiency_ = pset.getParameter<double>("averageEfficiency");
  averageNoiseRate_ = pset.getParameter<double>("averageNoiseRate");
  timeCalibrationOffset_ = pset.getParameter<double>("timeCalibrationOffset");
  numberOfStripsPerPartition_ = pset.getParameter<int>("numberOfStripsPerPartition");
}
virtual GEMSimSetUp::~GEMSimSetUp ( ) [inline, virtual]

Definition at line 21 of file GEMSimSetUp.h.

{}

Member Function Documentation

const std::vector< float > & GEMSimSetUp::getCluster ( uint32_t  id)

Definition at line 164 of file GEMSimSetUp.cc.

References Exception, and mapDetClusterMap_.

{
  auto iter = mapDetClusterMap_.find(id);
  if(iter == mapDetClusterMap_.end())
  {
    throw cms::Exception("DataCorrupt") 
      << "GEMSimSetUp::getCluster() - no cluster size information for DetId "<<id<< "\n";
  }
  if((iter->second).size() != 100)
  {
   throw cms::Exception("DataCorrupt") 
      << "GEMSimSetUp::getCluster() - cluster size information in a wrong format for DetId "<<id<< "\n";
  }
  return iter->second;
}
const std::map< int, std::vector< float > > & GEMSimSetUp::getClusterMap ( )

Definition at line 153 of file GEMSimSetUp.cc.

References clusterMap_, and Exception.

{
  if(clusterMap_.size() != 5)
    {
      throw cms::Exception("DataCorrupt") 
        << "GEMSimSetUp::getClusterMap() - cluster size has the wrong format.\n";
    }
  return clusterMap_;
}
const std::vector< float > & GEMSimSetUp::getEfficiency ( uint32_t  id)

Definition at line 123 of file GEMSimSetUp.cc.

References Exception, mapDetIdEfficiency_, and numberOfStripsPerPartition_.

{
  auto iter = mapDetIdEfficiency_.find(id);
  if(iter == mapDetIdEfficiency_.end())
  {
    throw cms::Exception("DataCorrupt") 
      << "GEMSimSetUp::getEfficiency() - no efficiency information for DetId "<<id<< "\n";
  }
  if((iter->second).size() != (unsigned) numberOfStripsPerPartition_)
  {
    throw cms::Exception("DataCorrupt") 
      << "GEMSimSetUp::getEfficiency() - efficiency information in a wrong format for DetId "<<id<< "\n";
  }
  return iter->second;
}
const GEMGeometry* GEMSimSetUp::getGeometry ( ) [inline]

Definition at line 43 of file GEMSimSetUp.h.

References geometry_.

Referenced by GEMSynchronizer::getSimHitBx().

{ return geometry_; }
const std::vector< float > & GEMSimSetUp::getNoise ( uint32_t  id)

Definition at line 111 of file GEMSimSetUp.cc.

References Exception, and mapDetIdNoise_.

{
  auto iter = mapDetIdNoise_.find(id);
  if(iter == mapDetIdNoise_.end())
  {
    throw cms::Exception("DataCorrupt") 
      << "GEMSimSetUp::getNoise() - no noise information for DetId "<<id<< "\n";
  }
  return iter->second;
}
float GEMSimSetUp::getTime ( uint32_t  id)

Definition at line 140 of file GEMSimSetUp.cc.

References bxmap_, cond::rpcobgas::detid, Exception, and DetId::rawId().

Referenced by GEMSynchronizer::getSimHitBx().

{
  GEMDetId detid(id);
  auto iter = bxmap_.find(detid);
  if(iter == bxmap_.end())
    {
      throw cms::Exception("DataCorrupt") 
        << "GEMSimSetUp::getTime() - no timing information for gemid.rawId() "<<detid.rawId()<< "\n";
    }
  return iter->second;
}
void GEMSimSetUp::setGeometry ( const GEMGeometry geom) [inline]

Definition at line 41 of file GEMSimSetUp.h.

References relativeConstraints::geom, and geometry_.

Referenced by GEMDigiProducer::beginRun().

void GEMSimSetUp::setup ( std::vector< RPCStripNoises::NoiseItem > &  vnoise,
std::vector< float > &  vcluster 
)

Definition at line 15 of file GEMSimSetUp.cc.

References clusterMap_, gather_cfg::cout, n, and setupNoiseAndEfficiency().

{
  std::cout << "GEMSimSetUp::setup()" << std::endl;
  unsigned int counter = 1;
  unsigned int row = 1;
  std::vector<float> sum_clsize;

  for(unsigned int n = 0; n < vcluster.size(); ++n)
    {
      sum_clsize.push_back(vcluster[n]);

      if(counter == row * 20)
        {
          clusterMap_[row] = sum_clsize;
          row++;
          sum_clsize.clear();
        }
      counter++;
    }

  setupNoiseAndEfficiency(vnoise);
}
void GEMSimSetUp::setup ( void  )

Definition at line 63 of file GEMSimSetUp.cc.

References averageEfficiency_, averageNoiseRate_, GEMGeometry::dets(), RPCStripNoises::NoiseItem::dpid, RPCStripNoises::NoiseItem::eff, Exception, geometry_, GEMEtaPartition::id(), RPCStripNoises::NoiseItem::noise, GEMEtaPartition::nstrips(), numberOfStripsPerPartition_, setupNoiseAndEfficiency(), setupTimeCalibration(), RPCStripNoises::NoiseItem::time, and timeCalibrationOffset_.

Referenced by GEMDigiProducer::beginRun().

{
  /*
    Container for the noise items. Its total size is 331776
    - 2 stations
    - 2 layers/station
    - 36 chambers/layer
    - 6 eta partitions/chamber
    - 384 strips/eta partition
  */ 
  std::vector<RPCStripNoises::NoiseItem> vnoise;
  vnoise.reserve(geometry_->dets().size() * numberOfStripsPerPartition_);

  // Loop over the detIds                                                                                                                                             
  for(const auto &det: geometry_->dets())
    {
      GEMEtaPartition* roll = dynamic_cast< GEMEtaPartition* >( det );
      
      // check for valid rolls     
      if(roll == nullptr) continue;

      const int nStrips = roll->nstrips();
      if (numberOfStripsPerPartition_ != nStrips)
        {
          throw cms::Exception("DataCorrupt") 
            << "GEMSimSetUp::setup() - numberOfStripsPerPartition given in configuration "
            <<numberOfStripsPerPartition_ <<" is not the same as in geometry "<<nStrips;
        }
      
      // Loop over the strips                                                                                                                                          
      for(int iStrip=0; iStrip <= nStrips-1; ++iStrip)
        {
          // construct noise item for each strip
          RPCStripNoises::NoiseItem noise;
          noise.dpid = roll->id();
          noise.eff = averageEfficiency_;
          noise.noise = averageNoiseRate_;
          noise.time = timeCalibrationOffset_;
          
          // add noise item to noise vector                                                                                                                         
          vnoise.push_back(noise);
        }
      setupTimeCalibration(det->geographicalId(),timeCalibrationOffset_);
    }
  setupNoiseAndEfficiency(vnoise);
}
void GEMSimSetUp::setup ( std::vector< RPCStripNoises::NoiseItem > &  vnoise,
std::vector< RPCClusterSize::ClusterSizeItem > &  vClusterSize 
)

Definition at line 40 of file GEMSimSetUp.cc.

References mapDetClusterMap_, and setupNoiseAndEfficiency().

{
  int clusterCounter = 1;
  std::vector<float> clusterVect;

  for(auto cluster: vClusterSize)
    {
      clusterVect.push_back(cluster.clusterSize);
      if( !(clusterCounter % 100) && clusterCounter != 0 )
        {
          mapDetClusterMap_[cluster.dpid] = clusterVect;
          clusterVect.clear();
          clusterCounter = 0;
        }
      ++clusterCounter;
    }

  setupNoiseAndEfficiency(vnoise);
}
void GEMSimSetUp::setupNoiseAndEfficiency ( std::vector< RPCStripNoises::NoiseItem > &  vnoise) [private]

Definition at line 181 of file GEMSimSetUp.cc.

References mapDetIdEfficiency_, mapDetIdNoise_, and numberOfStripsPerPartition_.

Referenced by setup().

{
  unsigned int iStrip = 0; 
  uint32_t roll = 0; 
  std::vector<float> vEfficiency, vNoise;
  vEfficiency.clear();
  vNoise.clear();

  // loop over the noise vector
  for(auto noise: vnoise)
    {
      if(iStrip % numberOfStripsPerPartition_ == 0)
        {
          // the first strip of new chamber
          if(iStrip > 0)
            {
              // fill map with noise and efficiency vectors of the previous chamber
              mapDetIdNoise_[roll] = vNoise;
              mapDetIdEfficiency_[roll] = vEfficiency;
              // clear the vectors and start over
              vEfficiency.clear();
              vNoise.clear();
              vNoise.push_back(noise.noise);
              vEfficiency.push_back(noise.eff);
            }
          // the very first strip in the collection
          else if (iStrip == 0 )
            {
              // nothing to add to map yet
              vNoise.push_back(noise.noise);
              vEfficiency.push_back(noise.eff);
            }
        }
      // the very last strip in the collection
      else if (iStrip == vnoise.size() - 1 )
        {
          roll = noise.dpid;
          vNoise.push_back(noise.noise);
          vEfficiency.push_back(noise.eff);
          // fill map with noise and efficiency vectors of the last chamber
          mapDetIdNoise_[roll]= vNoise;
          mapDetIdEfficiency_[roll] = vEfficiency;
        }
      // a regular strip
      else
        {
          roll = noise.dpid;
          vNoise.push_back(noise.noise);
          vEfficiency.push_back(noise.eff);
        }
      iStrip++;
    }
}
void GEMSimSetUp::setupTimeCalibration ( GEMDetId  id,
float  timing 
) [private]

Definition at line 237 of file GEMSimSetUp.cc.

References bxmap_.

Referenced by setup().

{
  bxmap_[id] = timing;      
}

Member Data Documentation

Definition at line 58 of file GEMSimSetUp.h.

Referenced by GEMSimSetUp(), and setup().

Definition at line 59 of file GEMSimSetUp.h.

Referenced by GEMSimSetUp(), and setup().

std::map< GEMDetId, float> GEMSimSetUp::bxmap_ [private]

Definition at line 54 of file GEMSimSetUp.h.

Referenced by getTime(), and setupTimeCalibration().

std::map< int, std::vector<float> > GEMSimSetUp::clusterMap_ [private]

Definition at line 55 of file GEMSimSetUp.h.

Referenced by getClusterMap(), and setup().

Definition at line 50 of file GEMSimSetUp.h.

Referenced by getGeometry(), setGeometry(), and setup().

std::map< uint32_t, std::vector<float> > GEMSimSetUp::mapDetClusterMap_ [private]

Definition at line 56 of file GEMSimSetUp.h.

Referenced by getCluster(), and setup().

std::map< uint32_t, std::vector<float> > GEMSimSetUp::mapDetIdEfficiency_ [private]

Definition at line 53 of file GEMSimSetUp.h.

Referenced by getEfficiency(), and setupNoiseAndEfficiency().

std::map< uint32_t, std::vector<float> > GEMSimSetUp::mapDetIdNoise_ [private]

Definition at line 52 of file GEMSimSetUp.h.

Referenced by getNoise(), and setupNoiseAndEfficiency().

Definition at line 61 of file GEMSimSetUp.h.

Referenced by GEMSimSetUp(), getEfficiency(), setup(), and setupNoiseAndEfficiency().

Definition at line 60 of file GEMSimSetUp.h.

Referenced by GEMSimSetUp(), and setup().