Back to home page

Project CMSSW displayed by LXR

 
 

    


File indexing completed on 2021-02-14 14:30:27

0001 #include "SimPPS/RPDigiProducer/plugins/RPLinearChargeCollectionDrifter.h"
0002 #include "Geometry/VeryForwardRPTopology/interface/RPTopology.h"
0003 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0004 #include <iostream>
0005 #include <vector>
0006 
0007 RPLinearChargeCollectionDrifter::RPLinearChargeCollectionDrifter(const edm::ParameterSet &params, RPDetId det_id) {
0008   verbosity_ = params.getParameter<int>("RPVerbosity");
0009   GeV_per_electron_ = params.getParameter<double>("RPGeVPerElectron");
0010   charge_cloud_sigmas_vect_ = params.getParameter<std::vector<double> >("RPInterStripSmearing");
0011   det_thickness_ = RPTopology().DetThickness();
0012   det_id_ = det_id;
0013 }
0014 
0015 simromanpot::charge_induced_on_surface RPLinearChargeCollectionDrifter::Drift(
0016     const simromanpot::energy_path_distribution &energy_deposition) {
0017   simromanpot::charge_induced_on_surface temp_;
0018   temp_.resize(energy_deposition.size());
0019   for (unsigned int i = 0; i < energy_deposition.size(); i++) {
0020     temp_[i].setPosition(LocalPoint(energy_deposition[i].Position().x(), energy_deposition[i].Position().y()));
0021     temp_[i].setSigma(
0022         getSigma(energy_deposition[i].Position().z()));  //befor charge_cloud_sigma_ used, now a vector of sigmas;
0023     temp_[i].setCharge(energy_deposition[i].Energy() / GeV_per_electron_);
0024     if (verbosity_) {
0025       edm::LogInfo("RPLinearChargeCollectionDrifter")
0026           << det_id_ << " :" << temp_[i].Position() << " " << temp_[i].Sigma() << " " << temp_[i].Charge() << "\n";
0027     }
0028   }
0029   return temp_;
0030 }
0031 double RPLinearChargeCollectionDrifter::getSigma(double z) {
0032   if (charge_cloud_sigmas_vect_.size() == 1)
0033     return charge_cloud_sigmas_vect_[0];
0034 
0035   double factor = (z / det_thickness_) * (charge_cloud_sigmas_vect_.size() - 1);
0036   double lo_i = floor(factor);
0037   double hi_i = ceil(factor);
0038   if (lo_i == hi_i) {
0039     return charge_cloud_sigmas_vect_[(int)factor];
0040   } else {
0041     double lo_weight = hi_i - factor;
0042     double hi_weight = factor - lo_i;
0043 
0044     return charge_cloud_sigmas_vect_[(int)lo_i] * lo_weight + charge_cloud_sigmas_vect_[(int)hi_i] * hi_weight;
0045   }
0046 }