Back to home page

Project CMSSW displayed by LXR

 
 

    


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

0001 #include "SimPPS/RPDigiProducer/plugins/RPVFATSimulator.h"
0002 #include "Geometry/VeryForwardRPTopology/interface/RPTopology.h"
0003 #include "FWCore/MessageLogger/interface/MessageLogger.h"
0004 #include <vector>
0005 #include <iostream>
0006 
0007 RPVFATSimulator::RPVFATSimulator(const edm::ParameterSet &params, RPDetId det_id) : params_(params), det_id_(det_id) {
0008   threshold_ = params.getParameter<double>("RPVFATThreshold");
0009   dead_strip_probability_ = params.getParameter<double>("RPDeadStripProbability");
0010   dead_strips_simulation_on_ = params.getParameter<bool>("RPDeadStripSimulationOn");
0011   strips_no_ = RPTopology().DetStripNo();
0012   verbosity_ = params.getParameter<int>("RPVerbosity");
0013   links_persistence_ = params.getParameter<bool>("RPDigiSimHitRelationsPresistence");
0014 }
0015 
0016 void RPVFATSimulator::ConvertChargeToHits(const simromanpot::strip_charge_map &signals,
0017                                           simromanpot::strip_charge_map_links_type &theSignalProvenance,
0018                                           std::vector<TotemRPDigi> &output_digi,
0019                                           simromanpot::DigiPrimaryMapType &output_digi_links) {
0020   for (simromanpot::strip_charge_map::const_iterator i = signals.begin(); i != signals.end(); ++i) {
0021     //one threshold per hybrid
0022     unsigned short strip_no = i->first;
0023     if (i->second > threshold_ && (!dead_strips_simulation_on_ || dead_strips_.find(strip_no) == dead_strips_.end())) {
0024       output_digi.push_back(TotemRPDigi(strip_no));
0025       if (links_persistence_) {
0026         output_digi_links.push_back(theSignalProvenance[strip_no]);
0027         if (verbosity_) {
0028           edm::LogInfo("RPVFatSimulator") << " digi links size=" << theSignalProvenance[strip_no].size() << "\n";
0029           for (unsigned int u = 0; u < theSignalProvenance[strip_no].size(); ++u) {
0030             edm::LogInfo("RPVFatSimulator")
0031                 << " digi: particle=" << theSignalProvenance[strip_no][u].first
0032                 << " energy [electrons]=" << theSignalProvenance[strip_no][u].second << "\n";
0033           }
0034         }
0035       }
0036     }
0037   }
0038 
0039   if (verbosity_) {
0040     for (unsigned int i = 0; i < output_digi.size(); ++i) {
0041       edm::LogInfo("RPVFATSimulator") << output_digi[i].stripNumber() << "\n";
0042     }
0043   }
0044 }