#include <SimMuon/CSCDigitizer/src/CSCStripElectronicsSim.h>
Public Member Functions | |
CSCStripElectronicsSim (const edm::ParameterSet &p) | |
configurable parameters | |
void | fillDigis (CSCStripDigiCollection &digis, CSCComparatorDigiCollection &comparators) |
void | setStripConditions (CSCStripConditions *cond) |
virtual | ~CSCStripElectronicsSim () |
Private Member Functions | |
void | addCrosstalk (const CSCAnalogSignal &signal, int thisStrip, int otherStrip) |
void | addCrosstalk () |
float | calculateAmpResponse (float t) const |
std::list< int > | channelsToRead (const std::list< int > &keyStrips, int window) const |
finds what strips to read. | |
float | comparatorReading (const CSCAnalogSignal &signal, float time) const |
calculates the comparator reading, including saturation and offsets | |
void | createDigi (int istrip, float startTime, std::vector< CSCStripDigi > &result) |
void | doSaturation (CSCStripDigi &digi) |
std::list< int > | getKeyStrips (const std::vector< CSCComparatorDigi > &comparators) const |
finds the key strips from these comparators | |
std::list< int > | getKeyStripsFromMC () const |
get ths strips that have detector hits | |
void | getReadoutRange (int inputStrip, int &minStrip, int &maxStrip) |
void | initParameters () |
initialization for each layer | |
CSCAnalogSignal | makeNoiseSignal (int element) |
virtual int | readoutElement (int strip) const |
void | runComparator (std::vector< CSCComparatorDigi > &result) |
void | selfTest () const |
virtual float | signalDelay (int element, float pos) const |
how long, in ns, it takes a signal at pos to propagate to the readout edge. | |
Private Attributes | |
bool | doCrosstalk_ |
bool | doSuppression_ |
int | nScaBins_ |
int | sca_peak_bin |
float | sca_time_bin_size |
CSCStripAmpResponse | theAmpResponse |
int | theComparatorClockJump |
float | theComparatorDeadTime |
float | theComparatorNoise |
float | theComparatorRMSOffset |
float | theComparatorSaturation |
float | theComparatorThreshold |
double | theComparatorTimeBinOffset |
double | theComparatorTimeOffset |
float | theComparatorWait |
CSCCrosstalkGenerator * | theCrosstalkGenerator |
float | theDaqDeadTime |
CSCStripConditions * | theStripConditions |
float | theTimingOffset |
Definition at line 24 of file CSCStripElectronicsSim.h.
CSCStripElectronicsSim::CSCStripElectronicsSim | ( | const edm::ParameterSet & | p | ) | [explicit] |
configurable parameters
Definition at line 19 of file CSCStripElectronicsSim.cc.
References doCrosstalk_, CSCBaseElectronicsSim::fillAmpResponse(), and theCrosstalkGenerator.
00020 : CSCBaseElectronicsSim(p), 00021 theAmpResponse(theShapingTime, CSCStripAmpResponse::RADICAL), 00022 theComparatorThreshold(20.), 00023 theComparatorNoise(0.), 00024 theComparatorRMSOffset(2.), 00025 theComparatorSaturation(1057.), 00026 theComparatorWait(50.), 00027 theComparatorDeadTime(100.), 00028 theDaqDeadTime(200.), 00029 theTimingOffset(0.), 00030 nScaBins_(p.getParameter<int>("nScaBins")), 00031 doSuppression_(p.getParameter<bool>("doSuppression")), 00032 doCrosstalk_(p.getParameter<bool>("doCrosstalk")), 00033 theStripConditions(0), 00034 theCrosstalkGenerator(0), 00035 theComparatorClockJump(2), 00036 sca_time_bin_size(50.), 00037 sca_peak_bin(p.getParameter<int>("scaPeakBin")), 00038 theComparatorTimeBinOffset(p.getParameter<double>("comparatorTimeBinOffset")), 00039 theComparatorTimeOffset(p.getParameter<double>("comparatorTimeOffset")) 00040 { 00041 00042 if(doCrosstalk_) { 00043 theCrosstalkGenerator = new CSCCrosstalkGenerator(); 00044 } 00045 00046 fillAmpResponse(); 00047 }
CSCStripElectronicsSim::~CSCStripElectronicsSim | ( | ) | [virtual] |
Definition at line 50 of file CSCStripElectronicsSim.cc.
References doCrosstalk_, and theCrosstalkGenerator.
00050 { 00051 if(doCrosstalk_) { 00052 delete theCrosstalkGenerator; 00053 } 00054 }
void CSCStripElectronicsSim::addCrosstalk | ( | const CSCAnalogSignal & | signal, | |
int | thisStrip, | |||
int | otherStrip | |||
) | [private] |
Definition at line 394 of file CSCStripElectronicsSim.cc.
References CSCStripConditions::crosstalk(), CSCBaseElectronicsSim::find(), CSCCrosstalkGenerator::getCrosstalk(), CSCBaseElectronicsSim::layerId(), TrapezoidalPlaneBounds::length(), readoutElement(), CSCCrosstalkGenerator::setParameters(), CSCAnalogSignal::superimpose(), theCrosstalkGenerator, CSCBaseElectronicsSim::theLayerGeometry, and theStripConditions.
00396 { 00397 float capacitiveCrosstalk, resistiveCrosstalk; 00398 bool leftRight = (otherStrip > thisStrip); 00399 theStripConditions->crosstalk(layerId(), thisStrip, 00400 theLayerGeometry->length(), leftRight, 00401 capacitiveCrosstalk, resistiveCrosstalk); 00402 theCrosstalkGenerator->setParameters(capacitiveCrosstalk, 0., resistiveCrosstalk); 00403 CSCAnalogSignal crosstalkSignal( theCrosstalkGenerator->getCrosstalk(signal) ); 00404 find(readoutElement(otherStrip)).superimpose(crosstalkSignal); 00405 00406 // Now subtract the crosstalk signal from the original signal 00407 crosstalkSignal *= -1.; 00408 find(thisStrip).superimpose(crosstalkSignal); 00409 00410 }
void CSCStripElectronicsSim::addCrosstalk | ( | ) | [private] |
Definition at line 366 of file CSCStripElectronicsSim.cc.
References CSCBaseElectronicsSim::nElements, python::multivaluedict::sort(), SortSignalsByTotal(), and CSCBaseElectronicsSim::theSignalMap.
Referenced by fillDigis().
00366 { 00367 // this is needed so we can add a noise signal to the map 00368 // without messing up any iterators 00369 std::vector<CSCAnalogSignal> realSignals; 00370 realSignals.reserve(theSignalMap.size()); 00371 CSCSignalMap::iterator mapI = theSignalMap.begin(), mapEnd = theSignalMap.end(); 00372 for( ; mapI != mapEnd; ++mapI) { 00373 realSignals.push_back((*mapI).second); 00374 } 00375 sort(realSignals.begin(), realSignals.end(), SortSignalsByTotal); 00376 std::vector<CSCAnalogSignal>::iterator realSignalItr = realSignals.begin(), 00377 realSignalsEnd = realSignals.end(); 00378 for( ; realSignalItr != realSignalsEnd; ++realSignalItr) 00379 { 00380 int thisStrip = (*realSignalItr).getElement(); 00381 // add it to each neighbor 00382 if(thisStrip > 1) { 00383 int otherStrip = thisStrip - 1; 00384 addCrosstalk(*realSignalItr, thisStrip, otherStrip); 00385 } 00386 if(thisStrip < nElements) { 00387 int otherStrip = thisStrip + 1; 00388 addCrosstalk(*realSignalItr, thisStrip, otherStrip); 00389 } 00390 } 00391 }
float CSCStripElectronicsSim::calculateAmpResponse | ( | float | t | ) | const [private, virtual] |
Implements CSCBaseElectronicsSim.
Definition at line 84 of file CSCStripElectronicsSim.cc.
References CSCStripAmpResponse::calculateAmpResponse(), and theAmpResponse.
00085 { 00086 return theAmpResponse.calculateAmpResponse(t); 00087 }
std::list< int > CSCStripElectronicsSim::channelsToRead | ( | const std::list< int > & | keyStrips, | |
int | window | |||
) | const [private] |
finds what strips to read.
Will either take 5 strips around the keystrip, or the whole CFEB, based on doSuppression_
Definition at line 266 of file CSCStripElectronicsSim.cc.
References doSuppression_, i, CSCBaseElectronicsSim::nElements, readoutElement(), and HLT_VtxMuL3::result.
Referenced by fillDigis(), and selfTest().
00267 { 00268 std::list<int> result; 00269 std::list<int>::const_iterator keyStripItr = keyStrips.begin(); 00270 if(doSuppression_) 00271 { 00272 for( ; keyStripItr != keyStrips.end(); ++keyStripItr) 00273 { 00274 // pick the five strips around the comparator 00275 for(int istrip = (*keyStripItr)-window; istrip <= (*keyStripItr)+window; ++istrip) 00276 { 00277 if(istrip>0 && istrip<= nElements) 00278 { 00279 result.push_back(readoutElement(istrip)); 00280 } 00281 } 00282 } 00283 result.sort(); 00284 result.unique(); 00285 } 00286 else 00287 { 00288 // read the whole CFEB, 16 strips 00289 std::list<int> cfebsToRead; 00290 for( ; keyStripItr != keyStrips.end(); ++keyStripItr) 00291 { 00292 int cfeb = (readoutElement(*keyStripItr)-1)/16; 00293 cfebsToRead.push_back(cfeb); 00294 int remainder = (readoutElement(*keyStripItr)-1)%16; 00295 // if we're within 3 strips of an edge, take neighboring CFEB, too 00296 if(remainder < window && cfeb != 0) 00297 { 00298 cfebsToRead.push_back(cfeb-1); 00299 } 00300 // the 'readouElement' makes it so that ME1/1 has just one CFEB 00301 int maxCFEBs = readoutElement(nElements)/16 - 1; 00302 if(remainder >= 16-window && cfeb != maxCFEBs) 00303 { 00304 cfebsToRead.push_back(cfeb+1); 00305 } 00306 } 00307 cfebsToRead.sort(); 00308 cfebsToRead.unique(); 00309 00310 // now convert the CFEBS to strips 00311 for(std::list<int>::const_iterator cfebItr = cfebsToRead.begin(); 00312 cfebItr != cfebsToRead.end(); ++cfebItr) 00313 { 00314 for(int i = 1; i <= 16; ++i) 00315 { 00316 result.push_back((*cfebItr)*16 + i); 00317 } 00318 } 00319 } 00320 return result; 00321 }
float CSCStripElectronicsSim::comparatorReading | ( | const CSCAnalogSignal & | signal, | |
float | time | |||
) | const [private] |
calculates the comparator reading, including saturation and offsets
Definition at line 115 of file CSCStripElectronicsSim.cc.
References CSCAnalogSignal::getValue(), min, theComparatorRMSOffset, theComparatorSaturation, and CSCBaseElectronicsSim::theRandGaussQ.
Referenced by runComparator().
00116 { 00117 return std::min(signal.getValue(time), theComparatorSaturation) 00118 + theComparatorRMSOffset* theRandGaussQ->fire(); 00119 }
void CSCStripElectronicsSim::createDigi | ( | int | istrip, | |
float | startTime, | |||
std::vector< CSCStripDigi > & | result | |||
) | [private] |
Definition at line 413 of file CSCStripElectronicsSim.cc.
References CSCBaseElectronicsSim::addLinks(), CSCBaseElectronicsSim::channelIndex(), doSaturation(), CSCBaseElectronicsSim::find(), CSCAnalogSignal::getValue(), CSCBaseElectronicsSim::layerId(), LogTrace, nScaBins_, pedestal, CSCStripConditions::pedestal(), sca_time_bin_size, signal, CSCStripConditions::smearedGain(), and theStripConditions.
Referenced by fillDigis().
00414 { 00415 const CSCAnalogSignal & signal = find(channel); 00416 // fill in the sca information 00417 std::vector<int> scaCounts(nScaBins_); 00418 00419 float pedestal = theStripConditions->pedestal(layerId(), channel); 00420 float gain = theStripConditions->smearedGain(layerId(), channel); 00421 00422 for(int scaBin = 0; scaBin < nScaBins_; ++scaBin) { 00423 scaCounts[scaBin] = static_cast< int > 00424 ( pedestal + signal.getValue(startTime+scaBin*sca_time_bin_size) * gain ); 00425 } 00426 CSCStripDigi newDigi(channel, scaCounts); 00427 00428 // do saturation of 12-bit ADC 00429 doSaturation(newDigi); 00430 00431 result.push_back(newDigi); 00432 addLinks(channelIndex(channel)); 00433 LogTrace("CSCStripElectronicsSim") << newDigi; 00434 }
void CSCStripElectronicsSim::doSaturation | ( | CSCStripDigi & | digi | ) | [private] |
Definition at line 437 of file CSCStripElectronicsSim.cc.
References CSCStripDigi::getADCCounts(), min, and CSCStripDigi::setADCCounts().
Referenced by createDigi().
00438 { 00439 std::vector<int> scaCounts(digi.getADCCounts()); 00440 for(unsigned scaBin = 0; scaBin < scaCounts.size(); ++scaBin) { 00441 scaCounts[scaBin] = std::min(scaCounts[scaBin], 4095); 00442 } 00443 digi.setADCCounts(scaCounts); 00444 }
void CSCStripElectronicsSim::fillDigis | ( | CSCStripDigiCollection & | digis, | |
CSCComparatorDigiCollection & | comparators | |||
) |
Definition at line 332 of file CSCStripElectronicsSim.cc.
References addCrosstalk(), channelsToRead(), createDigi(), doCrosstalk_, getKeyStripsFromMC(), CSCBaseElectronicsSim::layerId(), range, runComparator(), sca_peak_bin, sca_time_bin_size, t, and theTimingOffset.
Referenced by CSCDigitizer::doAction().
00334 { 00335 TimeMe t("CSCStripEl:filldigi"); 00336 if(doCrosstalk_) { 00337 addCrosstalk(); 00338 } 00339 00340 std::vector<CSCComparatorDigi> comparatorOutputs; 00341 runComparator(comparatorOutputs); 00342 // copy these to the result 00343 CSCComparatorDigiCollection::Range range(comparatorOutputs.begin(), 00344 comparatorOutputs.end()); 00345 comparators.put(range, layerId()); 00346 00347 double startTime = theTimingOffset 00348 - (sca_peak_bin-1) * sca_time_bin_size; 00349 00350 //std::list<int> keyStrips = getKeyStrips(comparatorOutputs); 00351 std::list<int> keyStrips = getKeyStripsFromMC(); 00352 std::list<int> stripsToDo = channelsToRead(keyStrips, 3); 00353 std::vector<CSCStripDigi> stripDigis; 00354 stripDigis.reserve(stripsToDo.size()); 00355 for(std::list<int>::const_iterator stripItr = stripsToDo.begin(); 00356 stripItr != stripsToDo.end(); ++stripItr) 00357 { 00358 createDigi(*stripItr, startTime, stripDigis); 00359 } 00360 00361 CSCStripDigiCollection::Range stripRange(stripDigis.begin(), stripDigis.end()); 00362 digis.put(stripRange, layerId()); 00363 }
std::list< int > CSCStripElectronicsSim::getKeyStrips | ( | const std::vector< CSCComparatorDigi > & | comparators | ) | const [private] |
finds the key strips from these comparators
Definition at line 234 of file CSCStripElectronicsSim.cc.
References funct::abs(), HLT_VtxMuL3::result, and CSCBaseElectronicsSim::theOffsetOfBxZero.
00235 { 00236 std::list<int> result; 00237 for(std::vector<CSCComparatorDigi>::const_iterator compItr = comparators.begin(); 00238 compItr != comparators.end(); ++compItr) 00239 { 00240 if(std::abs(compItr->getTimeBin()-theOffsetOfBxZero) <= 2) 00241 { 00242 result.push_back(compItr->getStrip()); 00243 } 00244 } 00245 // need sort for unique to work. 00246 result.sort(); 00247 result.unique(); 00248 return result; 00249 }
std::list< int > CSCStripElectronicsSim::getKeyStripsFromMC | ( | ) | const [private] |
get ths strips that have detector hits
Definition at line 253 of file CSCStripElectronicsSim.cc.
References first, HLT_VtxMuL3::result, and CSCBaseElectronicsSim::theDetectorHitMap.
Referenced by fillDigis().
00254 { 00255 // assumes the detector hit map is filled 00256 std::list<int> result; 00257 transform(theDetectorHitMap.begin(), theDetectorHitMap.end(), 00258 back_inserter(result), boost::bind(&DetectorHitMap::value_type::first,_1)); 00259 result.sort(); 00260 result.unique(); 00261 return result; 00262 }
void CSCStripElectronicsSim::getReadoutRange | ( | int | inputStrip, | |
int & | minStrip, | |||
int & | maxStrip | |||
) | [private] |
void CSCStripElectronicsSim::initParameters | ( | ) | [private, virtual] |
initialization for each layer
Implements CSCBaseElectronicsSim.
Definition at line 56 of file CSCStripElectronicsSim.cc.
References CSCBaseElectronicsSim::averageTimeOfFlight(), CSCChamberSpecs::chamberType(), CSCLayer::geometry(), CSCBaseElectronicsSim::nElements, nScaBins_, CSCLayerGeometry::numberOfStrips(), GloballyPositioned< T >::position(), sca_peak_bin, sca_time_bin_size, GeomDet::surface(), t, CSCBaseElectronicsSim::theBunchTimingOffsets, theComparatorThreshold, CSCBaseElectronicsSim::theLayer, CSCBaseElectronicsSim::theLayerGeometry, CSCBaseElectronicsSim::theNumberOfSamples, CSCBaseElectronicsSim::theSamplingTime, CSCBaseElectronicsSim::theShapingTime, CSCBaseElectronicsSim::theSignalStartTime, CSCBaseElectronicsSim::theSignalStopTime, CSCBaseElectronicsSim::theSpecs, and theTimingOffset.
00056 { 00057 TimeMe t("CSCStripEl:init"); 00058 theLayerGeometry = theLayer->geometry(); 00059 nElements = theLayerGeometry->numberOfStrips(); 00060 theComparatorThreshold = 20.; 00061 //selfTest(); 00062 00063 //calculate the offset to the peak 00064 float averageDistance = theLayer->surface().position().mag(); 00065 float averageTimeOfFlight = averageDistance * cm / c_light; // Units of c_light: mm/ns 00066 int chamberType = theSpecs->chamberType(); 00067 00068 theTimingOffset = theShapingTime + averageTimeOfFlight 00069 + theBunchTimingOffsets[chamberType]; 00070 //TODO make sure config gets overridden 00071 theSignalStartTime = theTimingOffset 00072 - (sca_peak_bin-1) * sca_time_bin_size; 00073 theSignalStopTime = theSignalStartTime + nScaBins_*sca_time_bin_size; 00074 theNumberOfSamples = nScaBins_*static_cast<int>(sca_time_bin_size/theSamplingTime); 00075 00076 }
CSCAnalogSignal CSCStripElectronicsSim::makeNoiseSignal | ( | int | element | ) | [private, virtual] |
Reimplemented from CSCBaseElectronicsSim.
Definition at line 90 of file CSCStripElectronicsSim.cc.
References CSCBaseElectronicsSim::doNoise_, CSCAnalogSignal::getValue(), CSCBaseElectronicsSim::layerId(), CSCStripConditions::noisify(), nScaBins_, sca_time_bin_size, CSCBaseElectronicsSim::theNumberOfSamples, CSCBaseElectronicsSim::theSamplingTime, CSCBaseElectronicsSim::theSignalStartTime, and theStripConditions.
00090 { 00091 std::vector<float> noiseBins(nScaBins_); 00092 CSCAnalogSignal tmpSignal(element, sca_time_bin_size, noiseBins); 00093 if(doNoise_) { 00094 theStripConditions->noisify(layerId(), tmpSignal); 00095 } 00096 // now rebin it 00097 std::vector<float> binValues(theNumberOfSamples); 00098 for(int ibin=0; ibin < theNumberOfSamples; ++ibin) { 00099 binValues[ibin] = tmpSignal.getValue(ibin*theSamplingTime); 00100 } 00101 CSCAnalogSignal finalSignal(element, theSamplingTime, binValues, 0., theSignalStartTime); 00102 return finalSignal; 00103 }
Implements CSCBaseElectronicsSim.
Definition at line 79 of file CSCStripElectronicsSim.cc.
References CSCLayerGeometry::channel(), and CSCBaseElectronicsSim::theLayerGeometry.
Referenced by addCrosstalk(), channelsToRead(), runComparator(), and selfTest().
00079 { 00080 return theLayerGeometry->channel(strip); 00081 }
void CSCStripElectronicsSim::runComparator | ( | std::vector< CSCComparatorDigi > & | result | ) | [private] |
Definition at line 123 of file CSCStripElectronicsSim.cc.
References comparatorReading(), CSCBaseElectronicsSim::find(), CSCAnalogSignal::getValue(), CSCBaseElectronicsSim::nElements, output(), readoutElement(), python::multivaluedict::sort(), strip(), CSCBaseElectronicsSim::theBunchSpacing, theComparatorDeadTime, theComparatorThreshold, theComparatorTimeBinOffset, theComparatorTimeOffset, theComparatorWait, CSCBaseElectronicsSim::theOffsetOfBxZero, CSCBaseElectronicsSim::theSamplingTime, CSCBaseElectronicsSim::theSignalMap, CSCBaseElectronicsSim::theSignalStartTime, CSCBaseElectronicsSim::theSignalStopTime, and theTimingOffset.
Referenced by fillDigis().
00123 { 00124 // first, make a list of all the comparators we actually 00125 // need to run 00126 std::list<int> comparatorsWithSignal; 00127 CSCSignalMap::iterator signalMapItr; 00128 for(signalMapItr = theSignalMap.begin(); 00129 signalMapItr != theSignalMap.end(); ++signalMapItr) { 00130 // Elements in signal map count from 1 00131 // 1,2->0, 3,4->1, 5,6->2, ... 00132 comparatorsWithSignal.push_back( ((*signalMapItr).first-1)/2 ); 00133 } 00134 // no need to sort 00135 comparatorsWithSignal.unique(); 00136 for(std::list<int>::iterator listItr = comparatorsWithSignal.begin(); 00137 listItr != comparatorsWithSignal.end(); ++listItr) { 00138 int iComparator = *listItr; 00139 // find signal1 and signal2 00140 // iComparator counts from 0 00141 // icomp =0->1,2, =1->3,4, =2->5,6, ... 00142 const CSCAnalogSignal & signal1 = find(readoutElement(iComparator*2 + 1)); 00143 const CSCAnalogSignal & signal2 = find(readoutElement(iComparator*2 + 2)); 00144 for(float time = theSignalStartTime +theComparatorTimeOffset; 00145 time < theSignalStopTime-theComparatorWait; 00146 time += theSamplingTime) 00147 { 00148 if(comparatorReading(signal1, time) > theComparatorThreshold 00149 || comparatorReading(signal2, time) > theComparatorThreshold) { 00150 // wait a bit, so we can run the comparator at the signal peak 00151 float comparatorTime = time; 00152 time += theComparatorWait; 00153 00154 float height1 = comparatorReading(signal1, time); 00155 float height2 = comparatorReading(signal2, time); 00156 int output = 0; 00157 int strip = 0; 00158 // distrip logic; comparator output is for pairs of strips: 00159 // hit bin dec 00160 // x--- 100 4 00161 // -x-- 101 5 00162 // --x- 110 6 00163 // ---x 111 7 00164 // just to prevent a copy 00165 const CSCAnalogSignal * mainSignal = 0; 00166 // pick the higher of the two strips in the pair 00167 if(height1 > height2) { 00168 mainSignal = &signal1; 00169 float leftStrip = 0.; 00170 if(iComparator > 0) { 00171 leftStrip = comparatorReading(find(readoutElement(iComparator*2)), time); 00172 } 00173 // if this strip is higher than either of its neighbors, make a comparator digi 00174 if(leftStrip < height1 && height1 > theComparatorThreshold) { 00175 output = (leftStrip < height2); 00176 strip = iComparator*2 + 1; 00177 } 00178 } else { 00179 mainSignal = &signal2; 00180 float rightStrip = 0.; 00181 if(iComparator*2+3 <= nElements) { 00182 rightStrip = comparatorReading(find(readoutElement(iComparator*2+3)), time); 00183 } 00184 if(rightStrip < height2 && height2 > theComparatorThreshold) { 00185 output = (height1 < rightStrip); 00186 strip = iComparator*2 + 2; 00187 } 00188 } 00189 if(strip != 0) { 00190 00191 float bxFloat = (comparatorTime-theTimingOffset)/theBunchSpacing 00192 + theComparatorTimeBinOffset + theOffsetOfBxZero; 00193 00194 00195 // Comparator digi as of Nov-2006 adapted to real data: time word has 16 bits with set bit 00196 // flagging appropriate bunch crossing, and bx 0 corresponding to 9th bit i.e. 00197 00198 // 1st bit set (bit 0) <-> bx -9 00199 // 2nd 1 <-> bx -8 00200 // ... ... .... 00201 // 8th 9 <-> bx 0 00202 // 9th 10 <-> bx +1 00203 // ... ... .... 00204 // 16th 15 <-> bx +6 00205 00206 // Parameter theOffsetOfBxZero = 9 @@WARNING! This offset may be changed (hardware)! 00207 00208 int timeWord = 0; // and this will remain if too early or late 00209 if ( (bxFloat>= 0) && (bxFloat<16) ) 00210 timeWord = (1 << static_cast<int>(bxFloat) ); // set appropriate bit 00211 00212 CSCComparatorDigi newDigi(strip, output, timeWord); 00213 result.push_back(newDigi); 00214 } 00215 00216 // wait for the comparator to reset 00217 time += theComparatorDeadTime; 00218 // really should be zero, but strip signal doesn't go negative yet 00219 float resetThreshold = 1; 00220 while(time < theSignalStopTime 00221 && mainSignal->getValue(time) > resetThreshold) { 00222 time += theSamplingTime; 00223 } 00224 00225 } // if over threshold 00226 } // loop over time samples 00227 } // loop over comparators 00228 // sort by time 00229 sort(result.begin(), result.end()); 00230 }
void CSCStripElectronicsSim::selfTest | ( | ) | const [private] |
Definition at line 447 of file CSCStripElectronicsSim.cc.
References channelsToRead(), doSuppression_, CSCBaseElectronicsSim::nElements, and readoutElement().
00448 { 00449 // make sure the zero suppression algorithms work 00450 std::list<int> keyStrips, stripsRead; 00451 // 00452 bool isGanged = (readoutElement(nElements) == 16); 00453 keyStrips.push_back(readoutElement(19)); 00454 keyStrips.push_back(readoutElement(30)); 00455 keyStrips.push_back(readoutElement(32)); 00456 stripsRead = channelsToRead(keyStrips, 3); 00457 if(doSuppression_) 00458 { 00459 unsigned int expectedSize = isGanged ? 10 : 12; 00460 assert(stripsRead.size() == expectedSize); 00461 assert(stripsRead.front() == readoutElement(17)); 00462 } 00463 else 00464 { 00465 unsigned int expectedSize = isGanged ? 16 : 48; 00466 assert(stripsRead.size() == expectedSize); 00467 assert(stripsRead.front() == 1); 00468 } 00469 }
void CSCStripElectronicsSim::setStripConditions | ( | CSCStripConditions * | cond | ) | [inline] |
Definition at line 35 of file CSCStripElectronicsSim.h.
References theStripConditions.
Referenced by CSCDigitizer::setStripConditions().
00035 {theStripConditions = cond;}
float CSCStripElectronicsSim::signalDelay | ( | int | element, | |
float | pos | |||
) | const [private, virtual] |
how long, in ns, it takes a signal at pos to propagate to the readout edge.
This may be negative, since the timing may be calibrated to the center of the detector
Implements CSCBaseElectronicsSim.
Definition at line 106 of file CSCStripElectronicsSim.cc.
00106 { 00107 // readout is on top edge of chamber, signal speed is 0.8 c 00108 // zero calibrated to chamber center 00109 float distance = -1. * pos; 00110 float speed = 0.8 * c_light / cm; 00111 return distance / speed;; 00112 }
bool CSCStripElectronicsSim::doCrosstalk_ [private] |
Definition at line 98 of file CSCStripElectronicsSim.h.
Referenced by CSCStripElectronicsSim(), fillDigis(), and ~CSCStripElectronicsSim().
bool CSCStripElectronicsSim::doSuppression_ [private] |
Definition at line 97 of file CSCStripElectronicsSim.h.
Referenced by channelsToRead(), and selfTest().
int CSCStripElectronicsSim::nScaBins_ [private] |
Definition at line 96 of file CSCStripElectronicsSim.h.
Referenced by createDigi(), initParameters(), and makeNoiseSignal().
int CSCStripElectronicsSim::sca_peak_bin [private] |
Definition at line 107 of file CSCStripElectronicsSim.h.
Referenced by fillDigis(), and initParameters().
float CSCStripElectronicsSim::sca_time_bin_size [private] |
Definition at line 104 of file CSCStripElectronicsSim.h.
Referenced by createDigi(), fillDigis(), initParameters(), and makeNoiseSignal().
Reimplemented from CSCBaseElectronicsSim.
Definition at line 44 of file CSCStripElectronicsSim.h.
Referenced by calculateAmpResponse().
Definition at line 102 of file CSCStripElectronicsSim.h.
float CSCStripElectronicsSim::theComparatorDeadTime [private] |
float CSCStripElectronicsSim::theComparatorNoise [private] |
Definition at line 85 of file CSCStripElectronicsSim.h.
float CSCStripElectronicsSim::theComparatorRMSOffset [private] |
float CSCStripElectronicsSim::theComparatorSaturation [private] |
float CSCStripElectronicsSim::theComparatorThreshold [private] |
Definition at line 84 of file CSCStripElectronicsSim.h.
Referenced by initParameters(), and runComparator().
double CSCStripElectronicsSim::theComparatorTimeBinOffset [private] |
double CSCStripElectronicsSim::theComparatorTimeOffset [private] |
float CSCStripElectronicsSim::theComparatorWait [private] |
Definition at line 100 of file CSCStripElectronicsSim.h.
Referenced by addCrosstalk(), CSCStripElectronicsSim(), and ~CSCStripElectronicsSim().
float CSCStripElectronicsSim::theDaqDeadTime [private] |
Definition at line 92 of file CSCStripElectronicsSim.h.
Definition at line 99 of file CSCStripElectronicsSim.h.
Referenced by addCrosstalk(), createDigi(), makeNoiseSignal(), and setStripConditions().
float CSCStripElectronicsSim::theTimingOffset [private] |
Definition at line 94 of file CSCStripElectronicsSim.h.
Referenced by fillDigis(), initParameters(), and runComparator().