CMS 3D CMS Logo

List of all members | Public Member Functions | Private Member Functions | Private Attributes
CSCWireElectronicsSim Class Reference

#include <CSCWireElectronicsSim.h>

Inheritance diagram for CSCWireElectronicsSim:
CSCBaseElectronicsSim

Public Member Functions

 CSCWireElectronicsSim (const edm::ParameterSet &p)
 configurable parameters More...
 
void fillDigis (CSCWireDigiCollection &digis, CLHEP::HepRandomEngine *)
 
void setFraction (float newFraction)
 
- Public Member Functions inherited from CSCBaseElectronicsSim
const DigiSimLinksdigiSimLinks () const
 
void setLayerId (const CSCDetId &id)
 for standalone apps who don't calculate it from the geometry More...
 
void simulate (const CSCLayer *layer, const std::vector< CSCDetectorHit > &inputHits, CLHEP::HepRandomEngine *)
 
virtual ~CSCBaseElectronicsSim ()
 

Private Member Functions

float calculateAmpResponse (float t) const override
 
int channelIndex (int channel) const override
 we code strip indices from 1-80, and wire indices start at 100 More...
 
void initParameters () override
 initialization for each layer More...
 
int readoutElement (int element) const override
 
virtual float timeOfFlightCalibration (int wireGroup) const
 

Private Attributes

float theFraction
 
float theWireNoise
 
float theWireThreshold
 

Additional Inherited Members

- Public Types inherited from CSCBaseElectronicsSim
typedef std::map< int, CSCAnalogSignal, std::less< int > > CSCSignalMap
 
typedef edm::DetSet< StripDigiSimLinkDigiSimLinks
 
- Protected Types inherited from CSCBaseElectronicsSim
enum  { NONE, CONSERVATIVE, RADICAL }
 
typedef std::multimap< int, CSCDetectorHit, std::less< int > > DetectorHitMap
 
- Protected Member Functions inherited from CSCBaseElectronicsSim
CSCAnalogSignaladd (const CSCAnalogSignal &, CLHEP::HepRandomEngine *)
 
virtual void addLinks (int channelIndex)
 
void addNoise (CLHEP::HepRandomEngine *)
 
CSCAnalogSignal amplifySignal (const CSCDetectorHit &)
 
double averageTimeOfFlight (const DetId &detId) const
 
void combineAnalogSignals (const std::vector< CSCAnalogSignal > &)
 
 CSCBaseElectronicsSim (const edm::ParameterSet &p)
 
void fillAmpResponse ()
 
CSCAnalogSignalfind (int element, CLHEP::HepRandomEngine *)
 
CSCDetId layerId () const
 the CSCDetId corresponding to the current layer More...
 
virtual CSCAnalogSignal makeNoiseSignal (int element, CLHEP::HepRandomEngine *)
 
void setLayer (const CSCLayer *layer)
 
void setNoise (float rmsNoise, float noiseSigmaThreshold)
 
void setSignalTimeRange (double startTime, double stopTime)
 
virtual float signalDelay (int element, float pos) const
 
- Protected Attributes inherited from CSCBaseElectronicsSim
bool doNoise_
 
int nElements
 
CSCAnalogSignal theAmpResponse
 
float theBunchSpacing
 
std::vector< double > theBunchTimingOffsets
 
DetectorHitMap theDetectorHitMap
 
DigiSimLinks theDigiSimLinks
 
const CSCLayertheLayer
 
const CSCLayerGeometrytheLayerGeometry
 
CSCDetId theLayerId
 
bool theNoiseWasAdded
 
int theNumberOfSamples
 
int theOffsetOfBxZero
 
float thePeakTimeSigma
 
float theSamplingTime
 
int theShapingTime
 
CSCSignalMap theSignalMap
 
std::vector< double > theSignalPropagationSpeed
 
float theSignalStartTime
 
float theSignalStopTime
 
const CSCChamberSpecstheSpecs
 
std::vector< double > theTimingCalibrationError
 

Detailed Description

Model the readout electronics chain for EMU CSC wires

Author
Rick Wilkinson

Definition at line 20 of file CSCWireElectronicsSim.h.

Constructor & Destructor Documentation

◆ CSCWireElectronicsSim()

CSCWireElectronicsSim::CSCWireElectronicsSim ( const edm::ParameterSet p)

configurable parameters

Definition at line 15 of file CSCWireElectronicsSim.cc.

References CSCBaseElectronicsSim::fillAmpResponse().

Member Function Documentation

◆ calculateAmpResponse()

float CSCWireElectronicsSim::calculateAmpResponse ( float  t) const
overrideprivatevirtual

Implements CSCBaseElectronicsSim.

Definition at line 144 of file CSCWireElectronicsSim.cc.

144  {
145  static const float fC_by_ns = 1000000;
146  static const float resistor = 20000;
147  static const float amplifier_pole = 1 / 7.5;
148  static const float fastest_chamber_exp_risetime = 10.;
149  static const float p0 = amplifier_pole;
150  static const float p1 = 1 / fastest_chamber_exp_risetime;
151 
152  static const float dp = p0 - p1;
153 
154  // ENABLE DISC:
155 
156  static const float norm = -12 * resistor * p1 * pow(p0 / dp, 4) / fC_by_ns;
157 
158  float enable_disc_volts =
159  norm * (exp(-p0 * t) * (1 + t * dp + pow(t * dp, 2) / 2 + pow(t * dp, 3) / 6) - exp(-p1 * t));
160  static const float collectionFraction = 0.12;
161  static const float igain = 1. / 0.005; // volts per fC
162  return enable_disc_volts * igain * collectionFraction;
163 }

References Calorimetry_cff::dp, JetChargeProducer_cfi::exp, p1, funct::pow(), and submitPVValidationJobs::t.

◆ channelIndex()

int CSCWireElectronicsSim::channelIndex ( int  channel) const
inlineoverrideprivatevirtual

we code strip indices from 1-80, and wire indices start at 100

Reimplemented from CSCBaseElectronicsSim.

Definition at line 41 of file CSCWireElectronicsSim.h.

41 { return channel + 100; }

Referenced by fillDigis().

◆ fillDigis()

void CSCWireElectronicsSim::fillDigis ( CSCWireDigiCollection digis,
CLHEP::HepRandomEngine *  engine 
)

Definition at line 28 of file CSCWireElectronicsSim.cc.

28  {
29  if (theSignalMap.empty()) {
30  return;
31  }
32 
33  // Loop over analog signals, run the fractional discriminator on each one,
34  // and save the DIGI in the layer.
35  for (CSCSignalMap::iterator mapI = theSignalMap.begin(), lastSignal = theSignalMap.end(); mapI != lastSignal;
36  ++mapI) {
37  int wireGroup = (*mapI).first;
38  const CSCAnalogSignal &signal = (*mapI).second;
39  LogTrace("CSCWireElectronicsSim") << "CSCWireElectronicsSim: dump of wire signal follows... " << signal;
40  int signalSize = signal.getSize();
41 
42  int timeWord = 0; // and this will remain if too early or late (<bx-6 or >bx+9)
43 
44  // the way we handle noise in this chamber is by randomly varying
45  // the threshold
47  if (doNoise_) {
48  threshold += CLHEP::RandGaussQ::shoot(engine) * theWireNoise;
49  }
50  for (int ibin = 0; ibin < signalSize; ++ibin) {
51  if (signal.getBinValue(ibin) > threshold) {
52  // jackpot. Now define this signal as everything up until
53  // the signal goes below zero.
54  int lastbin = signalSize;
55  int i;
56  for (i = ibin; i < signalSize; ++i) {
57  if (signal.getBinValue(i) < 0.) {
58  lastbin = i;
59  break;
60  }
61  }
62 
63  float qMax = 0.0;
64  // in this loop, find the max charge and the 'fifth' electron arrival
65  for (i = ibin; i < lastbin; ++i) {
66  float next_charge = signal.getBinValue(i);
67  if (next_charge > qMax) {
68  qMax = next_charge;
69  }
70  }
71 
72  int bin_firing_FD = 0;
73  for (i = ibin; i < lastbin; ++i) {
74  if (signal.getBinValue(i) >= qMax * theFraction) {
75  bin_firing_FD = i;
76  //@@ Long-standing but unlikely minor bug, I (Tim) think - following
77  //'break' was missing...
78  //@@ ... So if both ibins 0 and 1 could fire FD, we'd flag the
79  // firing bin as 1 not 0
80  //@@ (since the above test was restricted to bin_firing_FD==0 too).
81  break;
82  }
83  }
84 
85  float tofOffset = timeOfFlightCalibration(wireGroup);
86  int chamberType = theSpecs->chamberType();
87 
88  // Note that CSCAnalogSignal::superimpose does not reset theTimeOffset
89  // to the earliest of the two signal's time offsets. If it did then we
90  // could handle signals from any time range e.g. form pileup events many
91  // bx's from the signal bx (bx=0). But then we would be wastefully
92  // storing signals over times which we can never see in the real
93  // detector, because only hits within a few bx's of bx=0 are read out.
94  // Instead, the working time range for wire hits is always started from
95  // theSignalStartTime, set as a parameter in the config file.
96  // On the other hand, if any of the overlapped CSCAnalogSignals happens
97  // to have a timeOffset earlier than theSignalStartTime (which is
98  // currently set to -100 ns) then we're in trouble. For pileup events
99  // this would mean events from collisions earlier than 4 bx before the
100  // signal bx.
101 
102  float fdTime = theSignalStartTime + theSamplingTime * bin_firing_FD;
103  if (doNoise_) {
104  fdTime += theTimingCalibrationError[chamberType] * CLHEP::RandGaussQ::shoot(engine);
105  }
106 
107  float bxFloat = (fdTime - tofOffset - theBunchTimingOffsets[chamberType]) / theBunchSpacing + theOffsetOfBxZero;
108  int bxInt = static_cast<int>(bxFloat);
109  if (bxFloat >= 0 && bxFloat < 16) {
110  timeWord |= (1 << bxInt);
111  // discriminator stays high for 35 ns
112  if (bxFloat - bxInt > 0.6) {
113  timeWord |= (1 << (bxInt + 1));
114  }
115  }
116 
117  // Wire digi as of Oct-2006 adapted to real data: time word has 16 bits
118  // with set bit flagging appropriate bunch crossing, and bx 0
119  // corresponding to the 7th bit, 'bit 6':
120 
121  // 1st bit set (bit 0) <-> bx -6
122  // 2nd 1 <-> bx -5
123  // ... ... ....
124  // 7th 6 <-> bx 0
125  // 8th 7 <-> bx +1
126  // ... ... ....
127  // 16th 15 <-> bx +9
128 
129  // skip over all the time bins used for this digi
130  ibin = lastbin;
131  } // if over threshold
132  } // loop over time bins in signal
133 
134  // Only create a wire digi if there is a wire hit within [-6 bx, +9 bx]
135  if (timeWord != 0) {
136  CSCWireDigi newDigi(wireGroup, timeWord);
137  LogTrace("CSCWireElectronicsSim") << "CSCWireElectronicsSim: " << newDigi;
138  digis.insertDigi(layerId(), newDigi);
139  addLinks(channelIndex(wireGroup));
140  }
141  } // loop over wire signals
142 }

References CSCBaseElectronicsSim::addLinks(), CSCChamberSpecs::chamberType(), channelIndex(), CSCBaseElectronicsSim::doNoise_, CSCAnalogSignal::getBinValue(), CSCAnalogSignal::getSize(), mps_fire::i, CSCBaseElectronicsSim::layerId(), LogTrace, CSCBaseElectronicsSim::theBunchSpacing, CSCBaseElectronicsSim::theBunchTimingOffsets, theFraction, CSCBaseElectronicsSim::theOffsetOfBxZero, CSCBaseElectronicsSim::theSamplingTime, CSCBaseElectronicsSim::theSignalMap, CSCBaseElectronicsSim::theSignalStartTime, CSCBaseElectronicsSim::theSpecs, CSCBaseElectronicsSim::theTimingCalibrationError, theWireNoise, theWireThreshold, remoteMonitoring_LED_IterMethod_cfg::threshold, and timeOfFlightCalibration().

Referenced by CSCDigitizer::doAction().

◆ initParameters()

void CSCWireElectronicsSim::initParameters ( )
overrideprivatevirtual

◆ readoutElement()

int CSCWireElectronicsSim::readoutElement ( int  element) const
overrideprivatevirtual

◆ setFraction()

void CSCWireElectronicsSim::setFraction ( float  newFraction)
inline

Definition at line 25 of file CSCWireElectronicsSim.h.

25 { theFraction = newFraction; };

References theFraction.

◆ timeOfFlightCalibration()

float CSCWireElectronicsSim::timeOfFlightCalibration ( int  wireGroup) const
privatevirtual

Definition at line 165 of file CSCWireElectronicsSim.cc.

165  {
166  // calibration is done for groups of 8 wire groups, facetiously
167  // called wireGroupGroups
168  int middleWireGroup = wireGroup - wireGroup % 8 + 4;
169  int numberOfWireGroups = theLayerGeometry->numberOfWireGroups();
170  if (middleWireGroup > numberOfWireGroups)
171  middleWireGroup = numberOfWireGroups;
172 
173  GlobalPoint centerOfGroupGroup = theLayer->centerOfWireGroup(middleWireGroup);
174  float averageDist = centerOfGroupGroup.mag();
175  float averageTOF = averageDist * cm / c_light; // Units of c_light: mm/ns
176 
177  LogTrace("CSCWireElectronicsSim") << "CSCWireElectronicsSim: TofCalib wg = " << wireGroup
178  << " mid wg = " << middleWireGroup << " av dist = " << averageDist
179  << " av tof = " << averageTOF;
180 
181  return averageTOF;
182 }

References CSCLayer::centerOfWireGroup(), LogTrace, PV3DBase< T, PVType, FrameType >::mag(), CSCLayerGeometry::numberOfWireGroups(), CSCBaseElectronicsSim::theLayer, and CSCBaseElectronicsSim::theLayerGeometry.

Referenced by fillDigis().

Member Data Documentation

◆ theFraction

float CSCWireElectronicsSim::theFraction
private

Definition at line 46 of file CSCWireElectronicsSim.h.

Referenced by fillDigis(), and setFraction().

◆ theWireNoise

float CSCWireElectronicsSim::theWireNoise
private

Definition at line 47 of file CSCWireElectronicsSim.h.

Referenced by fillDigis(), and initParameters().

◆ theWireThreshold

float CSCWireElectronicsSim::theWireThreshold
private

Definition at line 48 of file CSCWireElectronicsSim.h.

Referenced by fillDigis(), and initParameters().

CSCBaseElectronicsSim::theSpecs
const CSCChamberSpecs * theSpecs
Definition: CSCBaseElectronicsSim.h:113
e_SI
#define e_SI
Definition: HitDigitizerFP420.cc:24
mps_fire.i
i
Definition: mps_fire.py:428
CSCChamberSpecs::chamberType
int chamberType() const
Definition: CSCChamberSpecs.cc:154
CSCAnalogSignal::getBinValue
float getBinValue(int i) const
Definition: CSCAnalogSignal.h:48
CSCBaseElectronicsSim::theSignalMap
CSCSignalMap theSignalMap
Definition: CSCBaseElectronicsSim.h:118
CSCBaseElectronicsSim::theTimingCalibrationError
std::vector< double > theTimingCalibrationError
Definition: CSCBaseElectronicsSim.h:154
CSCBaseElectronicsSim::CSCBaseElectronicsSim
CSCBaseElectronicsSim(const edm::ParameterSet &p)
Definition: CSCBaseElectronicsSim.cc:15
CSCLayerGeometry::wireGroup
int wireGroup(int wire) const
Definition: CSCLayerGeometry.h:106
CSCBaseElectronicsSim::doNoise_
bool doNoise_
Definition: CSCBaseElectronicsSim.h:155
CSCWireElectronicsSim::theWireNoise
float theWireNoise
Definition: CSCWireElectronicsSim.h:47
Calorimetry_cff.dp
dp
Definition: Calorimetry_cff.py:158
CSCLayer::centerOfWireGroup
GlobalPoint centerOfWireGroup(int wireGroup) const
Definition: CSCLayer.cc:10
CSCBaseElectronicsSim::addLinks
virtual void addLinks(int channelIndex)
Definition: CSCBaseElectronicsSim.cc:167
CSCBaseElectronicsSim::theOffsetOfBxZero
int theOffsetOfBxZero
Definition: CSCBaseElectronicsSim.h:150
CSCChamberSpecs::wireNoise
float wireNoise(float timeInterval) const
Definition: CSCChamberSpecs.h:182
CSCBaseElectronicsSim::theSignalStartTime
float theSignalStartTime
Definition: CSCBaseElectronicsSim.h:140
CSCBaseElectronicsSim::theBunchTimingOffsets
std::vector< double > theBunchTimingOffsets
Definition: CSCBaseElectronicsSim.h:137
Point3DBase< float, GlobalTag >
CSCBaseElectronicsSim::theLayer
const CSCLayer * theLayer
Definition: CSCBaseElectronicsSim.h:115
CSCBaseElectronicsSim::nElements
int nElements
Definition: CSCBaseElectronicsSim.h:130
CSCWireElectronicsSim::theFraction
float theFraction
Definition: CSCWireElectronicsSim.h:46
CSCBaseElectronicsSim::theLayerGeometry
const CSCLayerGeometry * theLayerGeometry
Definition: CSCBaseElectronicsSim.h:114
AlCaHLTBitMon_ParallelJobs.p
def p
Definition: AlCaHLTBitMon_ParallelJobs.py:153
CSCWireDigi
Definition: CSCWireDigi.h:14
CSCBaseElectronicsSim::theSamplingTime
float theSamplingTime
Definition: CSCBaseElectronicsSim.h:144
CSCBaseElectronicsSim::theShapingTime
int theShapingTime
Definition: CSCBaseElectronicsSim.h:133
p1
double p1[4]
Definition: TauolaWrapper.h:89
CSCAnalogSignal::getSize
int getSize() const
Definition: CSCAnalogSignal.h:69
CSCWireElectronicsSim::timeOfFlightCalibration
virtual float timeOfFlightCalibration(int wireGroup) const
Definition: CSCWireElectronicsSim.cc:165
PV3DBase::mag
T mag() const
Definition: PV3DBase.h:64
CSCWireElectronicsSim::theWireThreshold
float theWireThreshold
Definition: CSCWireElectronicsSim.h:48
CSCAnalogSignal
Definition: CSCAnalogSignal.h:32
CSCBaseElectronicsSim::layerId
CSCDetId layerId() const
the CSCDetId corresponding to the current layer
Definition: CSCBaseElectronicsSim.h:104
funct::pow
Power< A, B >::type pow(const A &a, const B &b)
Definition: Power.h:29
LogTrace
#define LogTrace(id)
Definition: MessageLogger.h:234
CSCBaseElectronicsSim::theBunchSpacing
float theBunchSpacing
Definition: CSCBaseElectronicsSim.h:122
JetChargeProducer_cfi.exp
exp
Definition: JetChargeProducer_cfi.py:6
remoteMonitoring_LED_IterMethod_cfg.threshold
threshold
Definition: remoteMonitoring_LED_IterMethod_cfg.py:430
submitPVValidationJobs.t
string t
Definition: submitPVValidationJobs.py:644
CSCLayerGeometry::numberOfWireGroups
int numberOfWireGroups() const
Definition: CSCLayerGeometry.h:76
CSCBaseElectronicsSim::fillAmpResponse
void fillAmpResponse()
Definition: CSCBaseElectronicsSim.cc:83
CSCWireElectronicsSim::channelIndex
int channelIndex(int channel) const override
we code strip indices from 1-80, and wire indices start at 100
Definition: CSCWireElectronicsSim.h:41