583 unsigned int signalSize =
fNTicks;
586 std::vector<short> adcvec(signalSize, 0);
587 std::vector<const sim::SimChannel*> chanHandle;
598 for(
size_t c = 0;
c < chanHandle.size(); ++
c){
599 channels[chanHandle[
c]->Channel()] = chanHandle[
c];
604 std::unique_ptr< std::vector<raw::RawDigit> > digcol(
new std::vector<raw::RawDigit>);
606 unsigned int chan = 0;
611 std::vector<double> fChargeWorkCollInd;
627 std::vector<std::vector<short>> adcvec_inductionplanestart;
629 unsigned int plane_number = 0;
635 for(chan = 0; chan < geo->
Nchannels(); chan++) {
643 fChargeWorkCollInd.clear();
658 for (
auto const &ide : ides)
692 throw cet::exception(
"SimWireDUNE35t") <<
"ILLEGAL VIEW Type: " << view <<
"\n";
721 throw cet::exception(
"SimWireDUNE35t") <<
"ILLEGAL VIEW Type: " << view <<
"\n";
750 throw cet::exception(
"SimWireDUNE35t") <<
"ILLEGAL VIEW Type: " << view <<
"\n";
779 throw cet::exception(
"SimWireDUNE35t") <<
"ILLEGAL VIEW Type: " << view <<
"\n";
809 fChargeWorkCollInd.resize(
fNTicks,0);
834 double *fChargeWork_a=0;
835 double *fChargeWorkCollInd_a=0;
843 fChargeWorkCollInd_a = fChargeWorkCollInd.data();
844 adcvec_a = adcvec.data();
856 mf::LogError(
"SimWireDUNE35t") <<
"ERROR: CHANNEL NUMBER " << chan <<
" OUTSIDE OF PLANE";
860 for(
unsigned int i = 0; i < signalSize; ++i){
861 if(view==
geo::kU) { tnoise = noise_a_U[i]; }
862 else if (view==
geo::kV) { tnoise = noise_a_V[i]; }
863 else { tnoise = noise_a_Z[i]; }
864 tmpfv = tnoise + fChargeWork_a[i] ;
865 if (
fSimCombs) tmpfv += fChargeWorkCollInd_a[i];
870 if ( tmpfv < 0 - ped_mean)
873 adcvec_a[i] = (tmpfv >=0) ? (
short) (tmpfv+0.5) : (short) (tmpfv-0.5);
880 std::map< double, int > fShapingTimeOrder;
881 fShapingTimeOrder = { {0.5, 0}, {1.0, 1}, {2.0, 2}, {3.0, 3} };
888 if ( fShapingTimeOrder.find( fShapingTime ) != fShapingTimeOrder.end() ){
890 fNoiseFactVec.resize(2);
891 for (
auto& item : tempNoiseVec) {
892 fNoiseFactVec[i] = item.at( fShapingTimeOrder.find( fShapingTime )->second );
893 fNoiseFactVec[i] *= fASICGain/4.7;
900 <<
"Shaping Time received from signalservices_dune.fcl is not one of allowed values" 902 <<
"Allowed values: 0.5, 1.0, 2.0, 3.0 usec" 908 CLHEP::RandGaussQ rGauss_Ind(
fEngine, 0.0, fNoiseFactVec[0]);
909 CLHEP::RandGaussQ rGauss_Col(
fEngine, 0.0, fNoiseFactVec[1]);
912 for(
unsigned int i = 0; i < signalSize; ++i){
913 if(view==
geo::kU) { tnoise = rGauss_Ind.fire(); }
914 else if (view==
geo::kV) { tnoise = rGauss_Ind.fire(); }
915 else { tnoise = rGauss_Col.fire(); }
916 tmpfv = tnoise + fChargeWork_a[i] ;
917 if (
fSimCombs) tmpfv += fChargeWorkCollInd_a[i];
922 if ( tmpfv < 0 - ped_mean)
924 adcvec_a[i] = (tmpfv >=0) ? (
short) (tmpfv+0.5) : (short) (tmpfv-0.5);
927 for(
unsigned int i = 0; i < signalSize; ++i){
928 tmpfv = fChargeWork_a[i];
929 if (
fSimCombs) tmpfv += fChargeWorkCollInd_a[i] ;
934 if ( tmpfv < 0 - ped_mean)
936 adcvec_a[i] = (tmpfv >=0) ? (
short) (tmpfv+0.5) : (short) (tmpfv-0.5);
946 float calibrated_pedestal_value = 0;
947 float calibrated_pedestal_rms_value = 0;
948 int calibrated_integer_pedestal_value = 0;
954 CLHEP::RandGaussQ rGauss_Ped(
fEngine, 0.0, ped_rms);
955 for(
unsigned int i = 0; i < signalSize; ++i){
956 float ped_variation = rGauss_Ped.fire();
957 tmpfv = adcvec_a[i] + ped_mean + ped_variation;
959 adcvec_a[i] = (short) tmpfv;
964 for(
unsigned int i = 0; i < signalSize; ++i){
965 tmpfv = adcvec_a[i] + ped_mean;
966 adcvec_a[i] = (short) tmpfv;
984 calibrated_pedestal_value = 0;
985 calibrated_pedestal_rms_value = 0;
989 calibrated_integer_pedestal_value = (
int) calibrated_pedestal_value;
995 for(
size_t i = 0; i < adcvec.size(); ++i){
999 double rnd =
flat.fire(0,1);
1002 unsigned int zeromask = 0xffc0;
1003 unsigned int onemask = 0x003f;
1005 unsigned int sixlsbs = adcvec_a[i] &
onemask;
1007 int probability_index = (
int)sixlsbs;
1010 adcvec_a[i] = adcvec_a[i] |
onemask;
1014 adcvec_a[i] = adcvec_a[i] & zeromask;
1039 rd.SetPedestal(calibrated_pedestal_value,calibrated_pedestal_rms_value);
1042 adcvec.resize(signalSize);
1044 digcol->push_back(rd);
1057 adcvec_neighbors.push_back(adcvec);
1060 if(!(adcvec_neighbors.full()))
1074 rd.SetPedestal(calibrated_pedestal_value,calibrated_pedestal_rms_value);
1077 digcol->push_back(rd);
1096 rd.SetPedestal(calibrated_pedestal_value,calibrated_pedestal_rms_value);
1099 digcol->push_back(rd);
1111 adcvec_neighbors.pop_front();
1113 adcvec = adcvec_neighbors.at(fNeighboringChannels);
1122 rd2.SetPedestal(calibrated_pedestal_value,calibrated_pedestal_rms_value);
1125 digcol->push_back(rd2);
1129 adcvec_neighbors.clear();
1139 adcvec_neighbors.push_back(adcvec);
1140 if(!(adcvec_neighbors.full()))
1142 adcvec_inductionplanestart.push_back(adcvec);
1153 adcvec = adcvec_neighbors.at(fNeighboringChannels);
1162 rd.SetPedestal(calibrated_pedestal_value,calibrated_pedestal_rms_value);
1165 digcol->push_back(rd);
1182 adcvec_neighbors.push_back(adcvec_inductionplanestart.at(lastentries));
1184 adcvec = adcvec_neighbors.at(fNeighboringChannels);
1194 rd2.SetPedestal(calibrated_pedestal_value,calibrated_pedestal_rms_value);
1197 digcol->push_back(rd2);
1201 adcvec_neighbors.clear();
1202 adcvec_inductionplanestart.clear();
1209 adcvec.resize(signalSize);
float fInductionCalibPedRMS
Assumed measured value for ind plane pedestal RMS.
int fNTicks
number of ticks of the clock
std::vector< float > fFractUVCollect
std::vector< std::vector< float > > fNoiseU
noise on each channel for each time for U plane
double GetShapingTime(Channel channel) const override
std::vector< float > fFractVUCollect
float fInductionPed
ADC value of baseline for induction plane.
Collection of charge vs time digitized from a single readout channel.
Energy deposited on a readout channel by simulated tracks.
bool fSimCombs
switch for simulation of the combs
std::vector< float > fFractHorizGapVMiss
std::vector< float > fFractHorizGapZMiss
std::vector< uint32_t > fFirstChannelsInPlane
std::vector< float > fFractUUMiss
enum geo::_plane_proj View_t
Enumerate the possible plane projections.
std::vector< DoubleVec > GetNoiseFactVec() const override
std::vector< float > fFractUVMiss
const unsigned int onemask
std::vector< float > fFractUUCollect
std::vector< float > fFractVUMiss
Planes which measure Z direction.
unsigned int fNoiseModel
noise model>
int GapHasDeflector(double x, double y, double z)
float fInductionCalibPed
Assumed measured value for ind plane pedestal.
SigType_t SignalType(geo::PlaneID const &pid) const
Returns the type of signal on the channels of specified TPC plane.
MaybeLogger_< ELseverityLevel::ELsev_error, false > LogError
float fInductionPedRMS
ADC value of baseline RMS for induction plane.
unsigned int fNSamplesReadout
number of ADC readout samples in 1 readout frame
std::vector< float > fFractHorizGapVCollect
unsigned int Nchannels() const
Returns the number of TPC readout channels in the detector.
unsigned int fNoiseArrayPoints
number of points in randomly generated noise array
std::vector< float > fFractHorizGapUMiss
GapType_t combtest35t(double x, double y, double z)
float fCollectionPed
ADC value of baseline for collection plane.
int fNearestNeighbor
Maximum distance between hits above threshold before they are separated into different blocks...
std::vector< float > fFractVVMiss
unsigned int fNoiseOn
noise turned on or off for debugging; default is on
Signal from induction planes.
double Charge(TDC_t tdc) const
Returns the total number of ionization electrons on this channel in the specified TDC...
enum geo::_plane_sigtype SigType_t
bool fPedestalOn
switch for simulation of nonzero pedestals
double fUnderflowProbs[64]
array of probabilities of 6 LSF bits getting stuck at 111111
float fCollectionPedRMS
ADC value of baseline RMS for collection plane.
raw::Compress_t fCompression
compression type to use
std::vector< double > fChargeWork
std::vector< float > fFractZVMiss
float fCollectionCalibPed
Assumed measured value for coll plane pedestal.
ProductID put(std::unique_ptr< PROD > &&edp, std::string const &instance={})
View_t View(geo::PlaneID const &pid) const
Returns the view (wire orientation) on the channels of specified TPC plane.
unsigned int fNTimeSamples
number of ADC readout samples in all readout frames (per event)
float fCollectionCalibPedRMS
Assumed measured value for coll plane pedestal RMS.
std::vector< float > fFractVertGapVMiss
std::string fDriftEModuleLabel
module making the ionization electrons
void Convolute(detinfo::DetectorClocksData const &clockData, Channel channel, std::vector< T > &func) const
std::vector< float > fFractVertGapVCollect
std::vector< std::vector< float > > fNoiseZ
noise on each channel for each time for Z (collection) plane
std::vector< sim::IDE > TrackIDsAndEnergies(TDC_t startTDC, TDC_t endTDC) const
Return all the recorded energy deposition within a time interval.
CLHEP::HepRandomEngine & fEngine
std::vector< float > fFractVVCollect
std::vector< float > fFractVertGapUMiss
bool fSimStuckBits
switch for simulation of stuck bits
void Compress(std::vector< short > &adc, raw::Compress_t compress)
Compresses a raw data buffer.
double fOverflowProbs[64]
array of probabilities of 6 LSF bits getting stuck at 000000
std::vector< std::vector< float > > fNoiseV
noise on each channel for each time for V plane
std::size_t getView(std::string const &moduleLabel, std::string const &productInstanceName, std::string const &processName, std::vector< ELEMENT const * > &result) const
double GetASICGain(Channel channel) const override
std::vector< uint32_t > fLastChannelsInPlane
unsigned int fZeroThreshold
Zero suppression threshold.
uint32_t fFirstCollectionChannel
LArSoft geometry interface.
std::vector< float > fFractHorizGapUCollect
std::vector< float > fFractZUMiss
unsigned int fNeighboringChannels
Number of neighboring channels on either side allowed to influence zero suppression.
std::vector< float > fFractVertGapZMiss
std::vector< float > fFractVertGapUCollect
cet::coded_exception< error, detail::translate > exception
QTextStream & endl(QTextStream &s)
Signal from collection planes.
std::vector< double > DoubleVec
const float adcsaturation