Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-24 09:53:32

0001 #include "SimPPS/PPSPixelDigiProducer/interface/RPixLinearChargeCollectionDrifter.h"
0002 
0003 RPixLinearChargeCollectionDrifter::RPixLinearChargeCollectionDrifter(const edm::ParameterSet &params,
0004                                                                      uint32_t det_id,
0005                                                                      const PPSPixelTopology &ppt) {
0006   verbosity_ = params.getParameter<int>("RPixVerbosity");
0007 
0008   GeV_per_electron_ = params.getParameter<double>("RPixGeVPerElectron");
0009   charge_cloud_sigmas_vect_ = params.getParameter<std::vector<double> >("RPixInterSmearing");
0010   det_thickness_ = ppt.getThickness();
0011   det_id_ = det_id;
0012 }
0013 
0014 std::vector<RPixSignalPoint> RPixLinearChargeCollectionDrifter::Drift(
0015     const std::vector<RPixEnergyDepositUnit> &energy_deposition) {
0016   // convert an energy deposit in a point and in a charge of electrons n=E/3.61 (eV)
0017   temp_.resize(energy_deposition.size());
0018   for (unsigned int i = 0; i < energy_deposition.size(); i++) {
0019     temp_[i].setPosition(LocalPoint(energy_deposition[i].Position().x(), energy_deposition[i].Position().y()));
0020     temp_[i].setSigma(getSigma_(energy_deposition[i].Position().z()));
0021     temp_[i].setCharge(energy_deposition[i].Energy() / GeV_per_electron_);
0022     if (verbosity_ > 1) {
0023       edm::LogInfo("PPS") << "RPixLinearChargeCollectionDrifter " << det_id_ << " :" << temp_[i].Position() << " "
0024                           << temp_[i].Sigma() << " " << temp_[i].Charge();
0025     }
0026   }
0027   return temp_;
0028 }
0029 double RPixLinearChargeCollectionDrifter::getSigma_(double z) {
0030   if (charge_cloud_sigmas_vect_.size() == 1)
0031     return charge_cloud_sigmas_vect_[0];
0032 
0033   double factor = (z / det_thickness_) * (charge_cloud_sigmas_vect_.size() - 1);
0034   double lo_i = floor(factor);
0035   double hi_i = ceil(factor);
0036   if (lo_i == hi_i) {
0037     return charge_cloud_sigmas_vect_[(int)factor];
0038   } else {
0039     double lo_weight = hi_i - factor;
0040     double hi_weight = factor - lo_i;
0041 
0042     return charge_cloud_sigmas_vect_[(int)lo_i] * lo_weight + charge_cloud_sigmas_vect_[(int)hi_i] * hi_weight;
0043   }
0044 }