9 #include <cdc/modules/cdcDigitizer/CDCDigitizerModule.h>
10 #include <cdc/modules/cdcDigitizer/EDepInGas.h>
11 #include <cdc/utilities/ClosestApproach.h>
13 #include <framework/datastore/RelationArray.h>
15 #include <framework/gearbox/Unit.h>
16 #include <framework/logging/Logger.h>
29 m_cdcgp(), m_gcp(), m_aCDCSimHit(), m_posFlag(0),
30 m_driftLength(0.0), m_flightTime(0.0), m_globalTime(0.0),
31 m_tdcBinWidth(1.0), m_tdcBinWidthInv(1.0),
32 m_tdcResol(0.9825), m_driftV(4.0e-3),
33 m_driftVInv(250.0), m_propSpeedInv(27.25), m_align(true)
36 setDescription(
"Creates CDCHits from CDCSimHits.");
37 setPropertyFlags(c_ParallelProcessingCertified);
41 addParam(
"InputCDCSimHitsName", m_inputCDCSimHitsName,
"Name of input array. Should consist of CDCSimHits.",
string(
""));
42 addParam(
"OutputCDCHitsName", m_outputCDCHitsName,
"Name of output array. Will consist of CDCHits.",
string(
""));
43 addParam(
"OutputCDCHitsName4Trg", m_outputCDCHitsName4Trg,
44 "Name of output array for trigger. Can contain several hits per wire, "
45 "if they correspond to different time windows of 32ns.",
46 string(
"CDCHits4Trg"));
49 addParam(
"MCParticlesToCDCSimHitsName", m_MCParticlesToSimHitsName,
50 "Name of relation between MCParticles and CDCSimHits used",
string(
""));
51 addParam(
"CDCSimHistToCDCHitsName", m_SimHitsTOCDCHitsName,
52 "Name of relation between the CDCSimHits and the CDCHits used",
string(
""));
56 addParam(
"UseSimpleDigitization", m_useSimpleDigitization,
57 "If true, a simple x-t with a constant velocity is used for the drift-length to -time conversion",
false);
60 addParam(
"Fraction", m_fraction,
"Fraction of first Gaussian used to smear drift length in cm", 1.0);
61 addParam(
"Mean1", m_mean1,
"Mean value of first Gaussian used to smear drift length in cm", 0.0000);
62 addParam(
"Resolution1", m_resolution1,
"Resolution of first Gaussian used to smear drift length in cm", 0.0130);
63 addParam(
"Mean2", m_mean2,
"Mean value of second Gaussian used to smear drift length in cm", 0.0000);
64 addParam(
"Resolution2", m_resolution2,
"Resolution of second Gaussian used to smear drift length in cm", 0.0000);
67 addParam(
"DoSmearing", m_doSmearing,
68 "If false, drift length will not be smeared.",
true);
70 addParam(
"TrigTimeJitter", m_trigTimeJitter,
71 "Magnitude (w) of trigger timing jitter (ns). The trigger timing is randuminzed uniformly in a time window of [-w/2, +w/2].",
74 addParam(
"AddTimeWalk", m_addTimeWalk,
"A switch for time-walk (pulse-heght dep. delay); true: on; false: off",
true);
75 addParam(
"AddInWirePropagationDelay", m_addInWirePropagationDelay,
76 "A switch used to control adding propagation delay in the wire into the final drift time or not; this is for signal hits.",
true);
77 addParam(
"AddInWirePropagationDelay4Bg", m_addInWirePropagationDelay4Bg,
78 "The same switch but for beam bg. hits.",
true);
79 addParam(
"AddTimeOfFlight", m_addTimeOfFlight,
80 "A switch used to control adding time of flight into the final drift time or not; this is for signal hits.",
true);
81 addParam(
"AddTimeOfFlight4Bg", m_addTimeOfFlight4Bg,
82 "The same switch but for beam bg. hits.",
true);
83 addParam(
"OutputNegativeDriftTime", m_outputNegativeDriftTime,
"Output hits with negative drift time",
true);
84 addParam(
"Output2ndHit", m_output2ndHit,
85 "Output the 2nd hit if exists in the time window. Note that it is not well-simulated at all, partly because no cross-talk betw. channels is simulated.",
88 addParam(
"CorrectForWireSag", m_correctForWireSag,
89 "A switch for sense wire sag effect; true: drift-time is calculated with the sag taken into account; false: not. Here, sag means the perturbative part which corresponds to alignment in case of wire-position. The main part (corresponding to design+displacement in wire-position) is taken into account in FullSim; you can control it via CDCJobCntlParModifier.",
92 addParam(
"TreatNegT0WiresAsGood", m_treatNegT0WiresAsGood,
"Treat wires with negative t0 (calibrated) as good wire4s.",
true);
95 addParam(
"TDCThreshold4Outer", m_tdcThreshold4Outer,
96 "TDC threshold (dE in eV) for Layers#8-56. The value corresponds to He-C2H6 gas", 250.);
97 addParam(
"TDCThreshold4Inner", m_tdcThreshold4Inner,
98 "Same as TDCThreshold4Outer but for Layers#0-7,", 150.);
99 addParam(
"EDepInGasMode", m_eDepInGasMode,
100 "Mode for extracting energy deposit in gas from energy deposit in gas+wire; =0: scaling using electron density; 1: scaling using most probab. energy deposit; 2: similar to 2 but slightly different; 3: extraction based on probability; 4: regeneration following probability",
104 addParam(
"ADCThreshold", m_adcThreshold,
105 "Threshold for ADC-count (in unit of count). ADC-count < threshold is treated as count=0.", 2);
106 addParam(
"tMin", m_tMin,
"Lower edge of time window in ns; valid only for UseDB4FEE=false", -100.);
107 addParam(
"tMaxOuter", m_tMaxOuter,
"Upper edge of time window in ns for the normal-cell layers; valid only for UseDB4FEE=false",
109 addParam(
"tMaxInner", m_tMaxInner,
"Upper edge of time window in ns for the small-cell layers; valid only for UseDB4FEE=false",
117 addParam(
"UseDB4FEE", m_useDB4FEE,
"Fetch and use FEE params. from database or not",
true);
118 addParam(
"UseDB4EDepToADC", m_useDB4EDepToADC,
"Uuse edep-to-ADC conversion params. from database or not",
true);
119 addParam(
"UseDB4RunGain", m_useDB4RunGain,
"Fetch and use run gain from database or not",
true);
120 addParam(
"OverallGainFactor", m_overallGainFactor,
"Overall gain factor for adjustment", 1.0);
123 addParam(
"Synchronization", m_synchronization,
"Synchronize timing with other sub-detectors", m_synchronization);
124 addParam(
"Randomization", m_randomization,
"Randomize timing with other sub-detectors; valid only for Synchronization=false",
126 addParam(
"OffsetForGetTriggerBin", m_offsetForTriggerBin,
"Input to getCDCTriggerBin(offset), either of 0,1,2 or 3",
127 m_offsetForTriggerBin);
128 addParam(
"TrgTimingOffsetInCount", m_trgTimingOffsetInCount,
129 "L1 trigger timing offset in count, [0,7] in a trigger bin. The defaut value is from exp14, while the value from exp12 is 2. This run dependence may be taken into account later if needed",
130 m_trgTimingOffsetInCount);
131 addParam(
"ShiftOfTimeWindowIn32Count", m_shiftOfTimeWindowIn32Count,
132 "Shift of time window in 32count for synchronization (L1 timing=0)", m_shiftOfTimeWindowIn32Count);
135 addParam(
"TDCThresholdOffset", m_tdcThresholdOffset,
"Offset for TDC (digital) threshold (mV)", 3828.);
136 addParam(
"AnalogGain", m_analogGain,
"Analog gain (V/pC)", 1.09);
137 addParam(
"DigitalGain", m_digitalGain,
"Digital gain (V/pC)", 7.);
138 addParam(
"ADCBinWidth", m_adcBinWidth,
"ADC bin width (mV)", 2.);
140 addParam(
"AddFudgeFactorForSigma", m_addFudgeFactorForSigma,
141 "Additional fudge factor for space resol. (common to all cells)", 1.);
142 addParam(
"SpaceChargeEffect", m_spaceChargeEffect,
"Switch for space charge effect",
true);
143 addParam(
"DegOfSPEOnThreshold", m_degOfSPEOnThreshold,
144 "Degree of space charge effect on timing threshold; specify the range [0,1]; =1: full effect on threshold; =0: no effect",
145 m_degOfSPEOnThreshold);
147 addParam(
"AddXTalk", m_addXTalk,
"A switch for crosstalk; true: on; false: off",
true);
148 addParam(
"Issue2ndHitWarning", m_issue2ndHitWarning,
"=true: issue a warning when a 2nd TDC hit is found.",
true);
149 addParam(
"IncludeEarlyXTalks", m_includeEarlyXTalks,
"=true: include earlier x-talks as well than the signal hit in question.",
151 addParam(
"DebugLevel", m_debugLevel,
"Debug level; 20-29 are usable.", 20);
152 addParam(
"DebugLevel4XTalk", m_debugLevel4XTalk,
"Debug level for crosstalk; 20-29 are usable.", 21);
155 addParam(
"GasGainSmearing", m_gasGainSmearing,
"Switch for gas gain smearing; true: on; false: off", m_gasGainSmearing);
156 addParam(
"EffWForGasGainSmearing", m_effWForGasGainSmearing,
157 "Effective energy (keV) needed for one electron production for gas gain smearing; average for alpha- and beta-sources.",
158 m_effWForGasGainSmearing);
159 addParam(
"ThetaOfPolyaFunction", m_thetaOfPolya,
"Theta of Polya function for gas gain smearing", m_thetaOfPolya);
160 addParam(
"ExtraADCSmearing", m_extraADCSmearing,
"Switch for extra ADC smearing; true: on; false: off", m_extraADCSmearing);
163 #if defined(CDC_DEBUG)
165 cout <<
"CDCDigitizer constructor" << endl;
169 void CDCDigitizerModule::initialize()
171 m_simHits.isRequired(m_inputCDCSimHitsName);
172 m_simClockState.isOptional();
175 m_cdcHits.registerInDataStore(m_outputCDCHitsName);
176 m_simHits.registerRelationTo(m_cdcHits);
177 m_mcParticles.registerRelationTo(m_cdcHits);
179 m_cdcHits4Trg.registerInDataStore(m_outputCDCHitsName4Trg);
180 m_simHits.registerRelationTo(m_cdcHits4Trg);
181 m_mcParticles.registerRelationTo(m_cdcHits4Trg);
183 m_cdcgp = &(CDCGeometryPar::Instance());
186 m_tdcBinWidthInv = 1. / m_tdcBinWidth;
187 m_tdcResol = m_tdcBinWidth / sqrt(12.);
189 m_driftVInv = 1. / m_driftV;
191 m_gcp = &(CDCGeoControlPar::getInstance());
192 m_totalFudgeFactor = m_cdcgp->getFudgeFactorForSigma(2);
193 m_totalFudgeFactor *= m_addFudgeFactorForSigma;
194 B2DEBUG(m_debugLevel,
"totalFugeF in Digi= " << m_totalFudgeFactor);
205 if ((*m_fEElectronicsFromDB).isValid()) {
206 (*m_fEElectronicsFromDB).
addCallback(
this, &CDCDigitizerModule::setFEElectronics);
209 B2FATAL(
"CDCDigitizer:: CDCFEElectronics not valid !");
225 if (m_useDB4RunGain) {
227 if ((*m_runGainFromDB).isValid()) {
228 (*m_runGainFromDB).
addCallback(
this, &CDCDigitizerModule::setSemiTotalGain);
230 B2FATAL(
"CDCDedxRunGain invalid!");
234 if ((*m_gain0FromDB).isValid()) {
235 (*m_gain0FromDB).
addCallback(
this, &CDCDigitizerModule::setSemiTotalGain);
237 B2FATAL(
"CDCDedxScaleFactor invalid!");
241 if ((*m_wireGainFromDB).isValid()) {
242 (*m_wireGainFromDB).
addCallback(
this, &CDCDigitizerModule::setSemiTotalGain);
245 B2FATAL(
"CDCDedxWireGain invalid!");
251 if ((*m_xTalkFromDB).isValid()) {
253 B2FATAL(
"CDCCrossTalkLibrary invalid!");
257 #if defined(CDC_DEBUG)
259 cout <<
"CDCDigitizer initialize" << endl;
261 cout <<
"m_tdcBinWidth= " << m_tdcBinWidth << endl;
262 cout <<
"m_tdcResol= " << m_tdcResol << endl;
263 cout <<
"m_driftV= " << m_driftV << endl;
264 cout <<
"m_driftVInv= " << m_driftVInv << endl;
265 cout <<
"m_propSpeedInv= " << m_propSpeedInv << endl;
275 if (m_useDB4EDepToADC) {
276 if (m_cdcgp->getEDepToADCMainFactor(0, 0) == 0.) {
277 B2FATAL(
"CDCEDepToADCConversion payloads are unavailable!");
283 if (m_synchronization) {
286 if (m_randomization) {
295 B2DEBUG(m_debugLevel,
"timing sim. mode= " << m_tSimMode);
296 if (m_tSimMode < 0 || m_tSimMode > 3) B2FATAL(
"invalid timing sim. mode= " << m_tSimMode);
299 void CDCDigitizerModule::event()
302 RelationArray mcParticlesToCDCSimHits(m_mcParticles, m_simHits);
309 map<WireID, SignalInfo> signalMap;
310 map<WireID, SignalInfo>::iterator iterSignalMap;
312 map<WireID, unsigned short> adcMap;
313 map<WireID, unsigned short>::iterator iterADCMap;
318 map<pair<WireID, unsigned>,
SignalInfo> signalMapTrg;
319 map<pair<WireID, unsigned>,
SignalInfo>::iterator iterSignalMapTrg;
322 if (m_tSimMode == 0 || m_tSimMode == 1) {
324 if (m_simClockState.isValid()) {
325 trigBin = m_simClockState->getCDCTriggerBin(m_offsetForTriggerBin);
327 if (m_tSimMode == 0) {
328 B2DEBUG(m_debugLevel,
"SimClockState unavailable so switched the mode from synchro to random.");
331 trigBin = gRandom->Integer(4);
333 if (trigBin < 0 || trigBin > 3) B2ERROR(
"Invalid trigger bin; must be an integer [0,3]!");
334 unsigned short offs = 8 * trigBin + m_trgTimingOffsetInCount;
335 B2DEBUG(m_debugLevel,
"tSimMode,trigBin,offs= " << m_tSimMode <<
" " << trigBin <<
" " << offs);
338 for (
unsigned short bd = 1; bd < nBoards; ++bd) {
339 const short tMaxInCount = 32 * (m_shiftOfTimeWindowIn32Count - m_trgDelayInCount[bd]) - offs;
340 const short tMinInCount = tMaxInCount - 32 * m_widthOfTimeWindowInCount[bd];
341 B2DEBUG(m_debugLevel, bd <<
" " << tMinInCount <<
" " << tMaxInCount);
342 m_uprEdgeOfTimeWindow[bd] = m_tdcBinWidth * tMaxInCount;
343 m_lowEdgeOfTimeWindow[bd] = m_tdcBinWidth * tMinInCount;
348 double trigTiming = m_trigTimeJitter == 0. ? 0. : m_trigTimeJitter * (gRandom->Uniform() - 0.5);
351 int nHits = m_simHits.getEntries();
352 B2DEBUG(m_debugLevel,
"Number of CDCSimHits in the current event: " << nHits);
353 for (
int iHits = 0; iHits < nHits; ++iHits) {
355 m_aCDCSimHit = m_simHits[iHits];
358 m_wireID = m_aCDCSimHit->getWireID();
361 m_posFlag = m_aCDCSimHit->getLeftRightPassageRaw();
362 m_boardID = m_cdcgp->getBoardID(m_wireID);
364 m_posWire = m_aCDCSimHit->getPosWire();
365 m_posTrack = m_aCDCSimHit->getPosTrack();
366 m_momentum = m_aCDCSimHit->getMomentum();
367 m_flightTime = m_aCDCSimHit->getFlightTime();
368 m_globalTime = m_aCDCSimHit->getGlobalTime();
369 m_driftLength = m_aCDCSimHit->getDriftLength() * Unit::cm;
375 TVector3 bwpAlign = m_cdcgp->wireBackwardPosition(m_wireID, CDCGeometryPar::c_Aligned);
376 TVector3 fwpAlign = m_cdcgp->wireForwardPosition(m_wireID, CDCGeometryPar::c_Aligned);
378 TVector3 bwp = m_cdcgp->wireBackwardPosition(m_wireID);
379 TVector3 fwp = m_cdcgp->wireForwardPosition(m_wireID);
382 if ((bwpAlign - bwp).Mag() == 0. && (fwpAlign - fwp).Mag() == 0.) m_align =
false;
385 if (m_align || m_correctForWireSag) {
390 if (m_correctForWireSag) {
391 double zpos = m_posWire.z();
392 double bckYSag = bwp.y();
393 double forYSag = fwp.y();
398 const int layerID = m_wireID.getICLayer();
399 const int wireID = m_wireID.getIWire();
400 m_cdcgp->getWireSagEffect(set, layerID, wireID, zpos, bckYSag, forYSag);
405 const TVector3 L = 5. * m_momentum.Unit();
406 TVector3 posIn = m_posTrack - L;
407 TVector3 posOut = m_posTrack + L;
408 TVector3 posTrack = m_posTrack;
409 TVector3 posWire = m_posWire;
412 m_driftLength =
ClosestApproach(bwp, fwp, posIn, posOut, posTrack, posWire);
414 m_posTrack = posTrack;
417 double deltaTime = 0.;
419 m_flightTime += deltaTime;
420 m_globalTime += deltaTime;
421 m_posFlag = m_cdcgp->getNewLeftRightRaw(m_posWire, m_posTrack, m_momentum);
426 double hitDriftLength = m_driftLength;
427 double dDdt = getdDdt(hitDriftLength);
429 hitDriftLength = smearDriftLength(hitDriftLength, dDdt);
433 bool addTof = m_addTimeOfFlight4Bg;
434 bool addDelay = m_addInWirePropagationDelay4Bg;
435 if (m_aCDCSimHit->getBackgroundTag() == 0) {
436 addTof = m_addTimeOfFlight;
437 addDelay = m_addInWirePropagationDelay;
439 double hitDriftTime = getDriftTime(hitDriftLength, addTof, addDelay);
442 if (m_aCDCSimHit->getBackgroundTag() != 0) {
443 hitDriftTime += m_globalTime - m_flightTime;
447 hitDriftTime += trigTiming;
450 double tMin = m_tMin;
451 double tMax = m_tMaxOuter;
452 if (m_wireID.getISuperLayer() == 0) tMax = m_tMaxInner;
453 if (m_tSimMode <= 2) {
454 tMin = m_lowEdgeOfTimeWindow[m_boardID];
455 tMax = m_uprEdgeOfTimeWindow[m_boardID];
457 if (hitDriftTime < tMin || hitDriftTime > tMax)
continue;
460 const double stepLength = m_aCDCSimHit->getStepLength() * Unit::cm;
461 const double costh = m_momentum.z() / m_momentum.Mag();
462 double hitdE = m_aCDCSimHit->getEnergyDep();
463 if (m_cdcgp->getMaterialDefinitionMode() != 2) {
464 static EDepInGas& edpg = EDepInGas::getInstance();
465 hitdE = edpg.
getEDepInGas(m_eDepInGasMode, m_aCDCSimHit->getPDGCode(), m_momentum.Mag(), stepLength, hitdE);
468 double convFactorForThreshold = 1;
470 unsigned short adcCount = 0;
471 makeSignalsAfterShapers(m_wireID, hitdE, stepLength, costh, adcCount, convFactorForThreshold);
472 const unsigned short adcTh = m_useDB4FEE ? m_adcThresh[m_boardID] : m_adcThreshold;
474 if (adcCount < adcTh) adcCount = 0;
475 iterADCMap = adcMap.find(m_wireID);
476 if (iterADCMap == adcMap.end()) {
477 adcMap.insert(make_pair(m_wireID, adcCount));
480 iterADCMap->second += adcCount;
487 double dEThreshold = 0.;
488 if (m_useDB4FEE && m_useDB4EDepToADC) {
489 dEThreshold = m_tdcThresh[m_boardID] / convFactorForThreshold * Unit::keV;
491 dEThreshold = (m_wireID.getISuperLayer() == 0) ? m_tdcThreshold4Inner : m_tdcThreshold4Outer;
492 dEThreshold *= Unit::eV;
494 B2DEBUG(m_debugLevel,
"hitdE,dEThreshold,driftLength " << hitdE <<
" " << dEThreshold <<
" " << hitDriftLength);
496 if (hitdE < dEThreshold) {
497 B2DEBUG(m_debugLevel,
"Below Ethreshold: " << hitdE <<
" " << dEThreshold);
502 unsigned short trigWindow = floor((hitDriftTime - tMin) * m_tdcBinWidthInv / 32);
503 iterSignalMapTrg = signalMapTrg.find(make_pair(m_wireID, trigWindow));
504 if (iterSignalMapTrg == signalMapTrg.end()) {
507 signalMapTrg.insert(make_pair(make_pair(m_wireID, trigWindow),
510 if (hitDriftTime < iterSignalMapTrg->second.m_driftTime) {
511 iterSignalMapTrg->second.m_driftTime = hitDriftTime;
512 iterSignalMapTrg->second.m_simHitIndex = iHits;
515 iterSignalMapTrg->second.m_charge += adcCount;
521 if (m_cdcgp->isBadWire(m_wireID)) {
527 if (m_cdcgp->isDeadWire(m_wireID, eff)) {
529 if (eff < gRandom->Uniform())
continue;
533 const double a = bwpAlign.X();
534 const double b = bwpAlign.Y();
535 const double c = bwpAlign.Z();
536 const TVector3 fmbAlign = fwpAlign - bwpAlign;
537 const double lmn = 1. / fmbAlign.Mag();
538 const double l = fmbAlign.X() * lmn;
539 const double m = fmbAlign.Y() * lmn;
540 const double n = fmbAlign.Z() * lmn;
542 double dx = m_aCDCSimHit->getPosIn().X() - a;
543 double dy = m_aCDCSimHit->getPosIn().Y() - b;
544 double dz = m_aCDCSimHit->getPosIn().Z() - c;
545 double sub = l * dx + m * dy + n * dz;
546 const double driftLFromIn = sqrt(dx * dx + dy * dy + dz * dz - sub * sub);
548 dx = m_aCDCSimHit->getPosOut().X() - a;
549 dy = m_aCDCSimHit->getPosOut().Y() - b;
550 dz = m_aCDCSimHit->getPosOut().Z() - c;
551 sub = l * dx + m * dy + n * dz;
552 const double driftLFromOut = sqrt(dx * dx + dy * dy + dz * dz - sub * sub);
554 const double maxDriftL = std::max(driftLFromIn, driftLFromOut);
555 const double minDriftL = m_driftLength;
556 B2DEBUG(m_debugLevel,
"driftLFromIn= " << driftLFromIn <<
" driftLFromOut= " << driftLFromOut <<
" minDriftL= " << minDriftL <<
559 maxDriftL <<
"m_driftLength= " << m_driftLength);
561 iterSignalMap = signalMap.find(m_wireID);
563 if (iterSignalMap == signalMap.end()) {
566 signalMap.insert(make_pair(m_wireID,
SignalInfo(iHits, hitDriftTime, adcCount, maxDriftL, minDriftL)));
567 B2DEBUG(m_debugLevel,
"Creating new Signal with encoded wire number: " << m_wireID);
570 if (hitDriftTime < iterSignalMap->second.m_driftTime) {
571 iterSignalMap->second.m_driftTime3 = iterSignalMap->second.m_driftTime2;
572 iterSignalMap->second.m_simHitIndex3 = iterSignalMap->second.m_simHitIndex2;
573 iterSignalMap->second.m_driftTime2 = iterSignalMap->second.m_driftTime;
574 iterSignalMap->second.m_simHitIndex2 = iterSignalMap->second.m_simHitIndex;
575 iterSignalMap->second.m_driftTime = hitDriftTime;
576 iterSignalMap->second.m_simHitIndex = iHits;
577 B2DEBUG(m_debugLevel,
"hitDriftTime of current Signal: " << hitDriftTime <<
", hitDriftLength: " << hitDriftLength);
578 }
else if (hitDriftTime < iterSignalMap->second.m_driftTime2) {
579 iterSignalMap->second.m_driftTime3 = iterSignalMap->second.m_driftTime2;
580 iterSignalMap->second.m_simHitIndex3 = iterSignalMap->second.m_simHitIndex2;
581 iterSignalMap->second.m_driftTime2 = hitDriftTime;
582 iterSignalMap->second.m_simHitIndex2 = iHits;
583 }
else if (hitDriftTime < iterSignalMap->second.m_driftTime3) {
584 iterSignalMap->second.m_driftTime3 = hitDriftTime;
585 iterSignalMap->second.m_simHitIndex3 = iHits;
589 iterSignalMap->second.m_charge += adcCount;
592 if (iterSignalMap->second.m_maxDriftL < maxDriftL) iterSignalMap->second.m_maxDriftL = maxDriftL;
593 if (iterSignalMap->second.m_minDriftL > minDriftL) iterSignalMap->second.m_minDriftL = minDriftL;
594 B2DEBUG(m_debugLevel,
"maxDriftL in struct= " << iterSignalMap->second.m_maxDriftL <<
"minDriftL in struct= " <<
595 iterSignalMap->second.m_minDriftL);
603 unsigned int iCDCHits = 0;
605 RelationArray mcParticlesToCDCHits(m_mcParticles, m_cdcHits);
607 for (iterSignalMap = signalMap.begin(); iterSignalMap != signalMap.end(); ++iterSignalMap) {
612 iterADCMap = adcMap.find(iterSignalMap->first);
613 unsigned short adcCount = iterADCMap != adcMap.end() ? iterADCMap->second : 0;
626 B2DEBUG(m_debugLevel,
"timewalk= " << m_cdcgp->getTimeWalk(iterSignalMap->first, adcCount));
627 iterSignalMap->second.m_driftTime += m_cdcgp->getTimeWalk(iterSignalMap->first, adcCount);
631 if (!m_outputNegativeDriftTime &&
632 iterSignalMap->second.m_driftTime < 0.) {
637 unsigned short tdcCount =
static_cast<unsigned short>((getPositiveT0(iterSignalMap->first) - iterSignalMap->second.m_driftTime) *
638 m_tdcBinWidthInv + 0.5);
641 double deltaDL = iterSignalMap->second.m_maxDriftL - iterSignalMap->second.m_minDriftL;
643 B2DEBUG(m_debugLevel,
"negative deltaDL= " << deltaDL);
646 const unsigned short boardID = m_cdcgp->getBoardID(iterSignalMap->first);
647 unsigned short tot = std::min(std::round(5.92749 * deltaDL + 2.59706),
static_cast<double>(m_widthOfTimeWindowInCount[boardID]));
648 if (m_adcThresh[boardID] > 0) {
649 tot = std::min(
static_cast<int>(tot),
static_cast<int>(adcCount / m_adcThresh[boardID]));
652 CDCHit* firstHit = m_cdcHits.appendNew(tdcCount, adcCount, iterSignalMap->first, 0, tot);
655 cdcSimHitsToCDCHits.
add(iterSignalMap->second.m_simHitIndex, iCDCHits);
659 if (rels.
size() != 0) {
662 double weight = rels.
weight(0);
667 if (m_output2ndHit && iterSignalMap->second.m_simHitIndex2 >= 0) {
668 unsigned short tdcCount2 =
static_cast<unsigned short>((getPositiveT0(iterSignalMap->first) - iterSignalMap->second.m_driftTime2) *
669 m_tdcBinWidthInv + 0.5);
670 if (tdcCount2 != tdcCount) {
671 CDCHit* secondHit = m_cdcHits.appendNew(tdcCount2, adcCount, iterSignalMap->first, 0, tot);
684 cdcSimHitsToCDCHits.
add(iterSignalMap->second.m_simHitIndex2, iCDCHits);
688 rels = m_simHits[iterSignalMap->second.m_simHitIndex2]->getRelationsFrom<
MCParticle>();
689 if (rels.
size() != 0) {
692 double weight = rels.
weight(0);
697 if (iterSignalMap->second.m_simHitIndex3 >= 0) {
698 unsigned short tdcCount3 =
static_cast<unsigned short>((getPositiveT0(iterSignalMap->first) - iterSignalMap->second.m_driftTime3) *
699 m_tdcBinWidthInv + 0.5);
701 if (tdcCount3 != tdcCount) {
702 CDCHit* secondHit = m_cdcHits.appendNew(tdcCount3, adcCount, iterSignalMap->first, 0, tot);
711 cdcSimHitsToCDCHits.
add(iterSignalMap->second.m_simHitIndex3, iCDCHits);
715 rels = m_simHits[iterSignalMap->second.m_simHitIndex3]->getRelationsFrom<
MCParticle>();
716 if (rels.
size() != 0) {
719 double weight = rels.
weight(0);
736 if (m_addXTalk) addXTalk();
740 for (iterSignalMapTrg = signalMapTrg.begin(); iterSignalMapTrg != signalMapTrg.end(); ++iterSignalMapTrg) {
749 unsigned short adcCount = iterSignalMapTrg->second.m_charge;
750 unsigned short tdcCount =
751 static_cast<unsigned short>((getPositiveT0(iterSignalMapTrg->first.first) -
752 iterSignalMapTrg->second.m_driftTime) * m_tdcBinWidthInv + 0.5);
753 const CDCHit* cdcHit = m_cdcHits4Trg.appendNew(tdcCount, adcCount, iterSignalMapTrg->first.first);
756 m_simHits[iterSignalMapTrg->second.m_simHitIndex]->
addRelationTo(cdcHit);
758 if (rels.
size() != 0) {
761 double weight = rels.
weight(0);
780 double CDCDigitizerModule::smearDriftLength(
const double driftLength,
const double dDdt)
785 if (m_useSimpleDigitization) {
786 if (gRandom->Uniform() <= m_fraction) {
788 resolution = m_resolution1;
791 resolution = m_resolution2;
794 const unsigned short leftRight = m_posFlag;
795 double alpha = m_cdcgp->getAlpha(m_posWire, m_momentum);
796 double theta = m_cdcgp->getTheta(m_momentum);
797 resolution = m_cdcgp->getSigma(driftLength, m_wireID.getICLayer(), leftRight, alpha, theta);
798 resolution *= m_totalFudgeFactor;
803 double diff = resolution - dDdt * m_tdcResol;
805 resolution = sqrt(diff * (resolution + dDdt * m_tdcResol));
810 #if defined(CDC_DEBUG)
812 cout <<
"CDCDigitizerModule::smearDriftLength" << endl;
813 cout <<
"tdcResol= " << m_tdcResol << endl;
814 cout <<
"dDdt,resolution= " << dDdt <<
" " << resolution << endl;
818 double newDL = gRandom->Gaus(driftLength + mean , resolution);
819 while (newDL <= 0.) newDL = gRandom->Gaus(driftLength + mean, resolution);
825 double CDCDigitizerModule::getdDdt(
const double driftL)
831 double dDdt = m_driftV;
833 if (!m_useSimpleDigitization) {
834 const unsigned short layer = m_wireID.getICLayer();
835 const unsigned short leftRight = m_posFlag;
836 double alpha = m_cdcgp->getAlpha(m_posWire, m_momentum);
837 double theta = m_cdcgp->getTheta(m_momentum);
838 double t = m_cdcgp->getDriftTime(driftL, layer, leftRight, alpha, theta);
839 dDdt = m_cdcgp->getDriftV(t, layer, leftRight, alpha, theta);
841 #if defined(CDC_DEBUG)
843 cout <<
"CDCDigitizerModule::getdDdt" << endl;
844 cout <<
"**layer= " << layer << endl;
845 cout <<
"alpha= " << 180.*alpha / M_PI << std::endl;
848 for (
int i = 0; i < 1000; ++i) {
850 double d = m_cdcgp->getDriftLength(t, layer, lr, alpha, theta);
851 cout << t <<
" " << d << endl;
857 for (
int i = 0; i < 100; ++i) {
859 double d = m_cdcgp->getDriftLength(t, layer, lr, alpha, theta);
860 cout << t <<
" " << d << endl;
871 double CDCDigitizerModule::getDriftTime(
const double driftLength,
const bool addTof,
const bool addDelay)
882 if (m_useSimpleDigitization) {
883 driftT = (driftLength / Unit::cm) * m_driftVInv;
885 #if defined(CDC_DEBUG)
887 cout <<
"CDCDigitizerModule::getDriftTime" << endl;
888 cout <<
"driftvinv= " << m_driftVInv << endl;
891 const unsigned short layer = m_wireID.getICLayer();
892 const unsigned short leftRight = m_posFlag;
893 double alpha = m_cdcgp->getAlpha(m_posWire, m_momentum);
894 double theta = m_cdcgp->getTheta(m_momentum);
895 driftT = m_cdcgp->getDriftTime(driftLength, layer, leftRight, alpha, theta);
900 driftT += m_flightTime;
906 TVector3 backWirePos = m_cdcgp->wireBackwardPosition(m_wireID, set);
908 double propLength = (m_posWire - backWirePos).Mag();
912 if (m_gcp->getSenseWireZposMode() == 1) {
913 const unsigned short layer = m_wireID.getICLayer();
914 propLength += m_cdcgp->getBwdDeltaZ(layer);
918 if (m_useSimpleDigitization) {
919 driftT += (propLength / Unit::cm) * m_propSpeedInv;
921 #if defined(CDC_DEBUG)
922 cout <<
"pseedinv= " << m_propSpeedInv << endl;
925 const unsigned short layer = m_wireID.getICLayer();
926 driftT += (propLength / Unit::cm) * m_cdcgp->getPropSpeedInv(layer);
927 #if defined(CDC_DEBUG)
928 cout <<
"layer,pseedinv= " << layer <<
" " << m_cdcgp->getPropSpeedInv(layer) << endl;
937 void CDCDigitizerModule::makeSignalsAfterShapers(
const WireID& wid,
double dEinGeV,
double dx,
double costh,
938 unsigned short& adcCount,
double& convFactorForThreshold)
940 static double conv00 = (100.0 / 3.2);
941 convFactorForThreshold = conv00;
943 if (dEinGeV <= 0. || dx <= 0.)
return;
945 const unsigned short layer = wid.
getICLayer();
946 const unsigned short cell = wid.
getIWire();
947 double dEInkeV = dEinGeV / Unit::keV;
949 double conv = conv00;
950 if (m_spaceChargeEffect) {
951 if (m_useDB4EDepToADC) {
952 conv = m_cdcgp->getEDepToADCConvFactor(layer, cell, dEInkeV, dx, costh);
953 double conv0 = m_cdcgp->getEDepToADCMainFactor(layer, cell, costh);
954 convFactorForThreshold = (conv0 + m_degOfSPEOnThreshold * (conv - conv0));
957 if (m_useDB4EDepToADC) conv = m_cdcgp->getEDepToADCMainFactor(layer, cell, costh);
958 convFactorForThreshold = conv;
961 if (convFactorForThreshold > 0.) {
962 convFactorForThreshold *= getSemiTotalGain(layer, cell);
964 convFactorForThreshold = conv00;
967 if (m_gasGainSmearing) {
969 const double nElectrons = dEInkeV / m_effWForGasGainSmearing;
971 if (nElectrons >= 1) {
972 for (
int i = 1; i <= nElectrons; ++i) {
975 relGain /= nElectrons;
982 if (m_extraADCSmearing) {
983 conv *= max(0., gRandom->Gaus(1., m_cdcgp->getEDepToADCSigma(layer, cell)));
986 conv *= getSemiTotalGain(layer, cell);
989 adcCount =
static_cast<unsigned short>(std::round(conv * dEInkeV));
994 double CDCDigitizerModule::Polya(
double xmax)
1000 static double ymax = pow(m_thetaOfPolya, m_thetaOfPolya) * exp(-m_thetaOfPolya);
1002 gRandom->RndmArray(2, urndm);
1003 x = xmax * urndm[0];
1004 double a = (1 + m_thetaOfPolya) * x;
1005 fx = pow(a, m_thetaOfPolya) * exp(-a);
1006 y = ymax * urndm[1];
1013 void CDCDigitizerModule::setFEElectronics()
1015 const double& off = m_tdcThresholdOffset;
1016 const double& gA = m_analogGain;
1017 const double& gD = m_digitalGain;
1018 const double& adcBW = m_adcBinWidth;
1019 const double convF = gA / gD / adcBW;
1020 const double el1TrgLatency = m_cdcgp->getMeanT0();
1021 B2DEBUG(m_debugLevel,
"L1TRGLatency= " << el1TrgLatency);
1022 const double c = 32. * m_tdcBinWidth;
1024 if (!m_fEElectronicsFromDB) B2FATAL(
"No FEEElectronics dbobject!");
1026 int mode = (fp.getBoardID() == -1) ? 1 : 0;
1027 int iNBoards =
static_cast<int>(nBoards);
1031 for (
int bdi = 1; bdi < iNBoards; ++bdi) {
1032 m_uprEdgeOfTimeWindow[bdi] = el1TrgLatency - c * (fp.getTrgDelay() + 1);
1033 if (m_uprEdgeOfTimeWindow[bdi] < 0.) B2FATAL(
"CDCDigitizer: Upper edge of time window < 0!");
1034 m_lowEdgeOfTimeWindow[bdi] = m_uprEdgeOfTimeWindow[bdi] - c * (fp.getWidthOfTimeWindow() + 1);
1035 if (m_lowEdgeOfTimeWindow[bdi] > 0.) B2FATAL(
"CDCDigitizer: Lower edge of time window > 0!");
1036 m_adcThresh[bdi] = fp.getADCThresh();
1037 m_tdcThresh[bdi] = convF * (off - fp.getTDCThreshInMV());
1038 m_widthOfTimeWindowInCount[bdi] = fp.getWidthOfTimeWindow() + 1;
1039 m_trgDelayInCount [bdi] = fp.getTrgDelay();
1045 for (
const auto& fpp : (*m_fEElectronicsFromDB)) {
1046 int bdi = fpp.getBoardID();
1047 if (mode == 0 && bdi == 0)
continue;
1048 if (mode == 1 && bdi == -1)
continue;
1049 if (bdi < 0 || bdi >= iNBoards) B2FATAL(
"CDCDigitizer:: Invalid no. of FEE board!");
1050 m_uprEdgeOfTimeWindow[bdi] = el1TrgLatency - c * (fpp.getTrgDelay() + 1);
1051 if (m_uprEdgeOfTimeWindow[bdi] < 0.) B2FATAL(
"CDCDigitizer: Upper edge of time window < 0!");
1052 m_lowEdgeOfTimeWindow[bdi] = m_uprEdgeOfTimeWindow[bdi] - c * (fpp.getWidthOfTimeWindow() + 1);
1053 if (m_lowEdgeOfTimeWindow[bdi] > 0.) B2FATAL(
"CDCDigitizer: Lower edge of time window > 0!");
1054 m_adcThresh[bdi] = fpp.getADCThresh();
1055 m_tdcThresh[bdi] = convF * (off - fpp.getTDCThreshInMV());
1056 m_widthOfTimeWindowInCount[bdi] = fpp.getWidthOfTimeWindow() + 1;
1057 m_trgDelayInCount [bdi] = fpp.getTrgDelay();
1061 B2DEBUG(m_debugLevel,
"mode= " << mode);
1062 for (
int bdi = 1; bdi < iNBoards; ++bdi) {
1063 B2DEBUG(m_debugLevel, bdi <<
" " << m_lowEdgeOfTimeWindow[bdi] <<
" " << m_uprEdgeOfTimeWindow[bdi] <<
" " << m_adcThresh[bdi] <<
1070 void CDCDigitizerModule::setSemiTotalGain()
1072 B2DEBUG(m_debugLevel,
" ");
1075 const int nLyrs = MAX_N_SLAYERS;
1076 B2DEBUG(m_debugLevel,
"nLyrs= " << nLyrs);
1077 int nGoodL[nLyrs] = {};
1078 float wgL[nLyrs] = {};
1079 int nGoodSL[nSuperLayers] = {};
1080 float wgSL[nSuperLayers] = {};
1084 for (
int lyr = 0; lyr < nLyrs; ++lyr) {
1085 int nWs = m_cdcgp->nWiresInLayer(lyr);
1086 for (
int w = 0; w < nWs; ++w) {
1088 float wg = (*m_wireGainFromDB)->getWireGain(iw);
1089 m_semiTotalGain[lyr][w] = wg;
1103 for (
int lyr = 0; lyr < nLyrs; ++lyr) {
1104 if (nGoodL[lyr] > 0) wgL[lyr] /= nGoodL[lyr];
1105 B2DEBUG(m_debugLevel,
"lyr,ngood,gain= " << lyr <<
" " << nGoodL[lyr] <<
" " << wgL[lyr]);
1108 for (
unsigned int sl = 0; sl < nSuperLayers; ++sl) {
1109 if (nGoodSL[sl] > 0) wgSL[sl] /= nGoodSL[sl];
1110 B2DEBUG(m_debugLevel,
"slyr,ngood,gain= " << sl <<
" " << nGoodSL[sl] <<
" " << wgSL[sl]);
1118 B2FATAL(
"No good wires !");
1120 B2DEBUG(m_debugLevel,
"ngoodAll,gain= " << nGoodAll <<
" " << wgAll);
1123 for (
int lyr = 0; lyr < nLyrs; ++lyr) {
1124 int nWs = m_cdcgp->nWiresInLayer(lyr);
1125 for (
int w = 0; w < nWs; ++w) {
1126 if (m_semiTotalGain[lyr][w] <= 0) {
1128 m_semiTotalGain[lyr][w] = wgL[lyr];
1138 for (
int lyr = 0; lyr < nLyrs; ++lyr) {
1139 int nWs = m_cdcgp->nWiresInLayer(lyr);
1140 for (
int w = 0; w < nWs; ++w) {
1141 if (m_semiTotalGain[lyr][w] <= 0) {
1142 B2WARNING(
"Gain for lyr and wire " << lyr <<
" " << w <<
"not > 0. Strange! Replace it with " << wgAll <<
".");
1143 m_semiTotalGain[lyr][w] = wgAll;
1149 m_runGain = (*m_runGainFromDB)->getRunGain();
1150 double cgain = (*m_gain0FromDB)->getScaleFactor();
1151 B2DEBUG(m_debugLevel,
"runGain, sf= " << m_runGain <<
" " << cgain);
1152 cgain *= m_runGain * m_overallGainFactor;
1153 for (
int lyr = 0; lyr < nLyrs; ++lyr) {
1154 int nWs = m_cdcgp->nWiresInLayer(lyr);
1155 for (
int w = 0; w < nWs; ++w) {
1156 m_semiTotalGain[lyr][w] *= cgain;
1157 B2DEBUG(m_debugLevel,
"lyr,wire,gain= " << lyr <<
" " << w <<
" " << m_semiTotalGain[lyr][w]);
1163 void CDCDigitizerModule::addXTalk()
1165 map<WireID, XTalkInfo> xTalkMap;
1166 map<WireID, XTalkInfo> xTalkMap1;
1167 map<WireID, XTalkInfo>::iterator iterXTalkMap1;
1170 int OriginalNoOfHits = m_cdcHits.getEntries();
1171 B2DEBUG(m_debugLevel4XTalk,
"\n \n" <<
"#CDCHits " << OriginalNoOfHits);
1172 for (
const auto& aHit : m_cdcHits) {
1173 if (m_issue2ndHitWarning && aHit.is2ndHit()) {
1174 B2WARNING(
"2nd TDC hit found, but not ready for it!");
1176 WireID wid(aHit.getID());
1178 short tdcCount = aHit.getTDCCount();
1179 short adcCount = aHit.getADCCount();
1180 short tot = aHit.getTOT();
1181 short board = m_cdcgp->getBoardID(wid);
1182 short channel = m_cdcgp->getChannelID(wid);
1183 const vector<pair<short, asicChannel>> xTalks = (*m_xTalkFromDB)->getLibraryCrossTalk(channel, tdcCount, adcCount, tot);
1185 int nXTalks = xTalks.size();
1186 for (
int i = 0; i < nXTalks; ++i) {
1187 const unsigned short tdcCount4XTalk = xTalks[i].second.TDC;
1189 B2DEBUG(m_debugLevel4XTalk,
"\n" <<
" signal: " << channel <<
" " << tdcCount <<
" " << adcCount <<
" " << tot);
1191 B2DEBUG(m_debugLevel4XTalk,
"xtalk: " << xTalks[i].first <<
" " << tdcCount4XTalk <<
" " << xTalks[i].second.ADC <<
" " <<
1192 xTalks[i].second.TOT);
1193 WireID widx = m_cdcgp->getWireID(board, xTalks[i].first);
1194 if (!m_cdcgp->isBadWire(widx)) {
1195 if (m_includeEarlyXTalks || (xTalks[i].second.TDC <= tdcCount)) {
1196 const double t0 = getPositiveT0(widx);
1197 const double ULOfTDC = (t0 - m_lowEdgeOfTimeWindow[board]) * m_tdcBinWidthInv;
1198 const double LLOfTDC = (t0 - m_uprEdgeOfTimeWindow[board]) * m_tdcBinWidthInv;
1199 if (LLOfTDC <= tdcCount4XTalk && tdcCount4XTalk <= ULOfTDC) {
1200 const unsigned short status = 0;
1201 xTalkMap.insert(make_pair(widx,
XTalkInfo(tdcCount4XTalk, xTalks[i].second.ADC, xTalks[i].second.TOT, status)));
1211 B2DEBUG(m_debugLevel4XTalk,
"#xtalk hits: " << xTalkMap.size());
1212 for (
const auto& aHit : xTalkMap) {
1215 iterXTalkMap1 = xTalkMap1.find(wid);
1216 unsigned short tdcCount = aHit.second.m_tdc;
1217 unsigned short adcCount = aHit.second.m_adc;
1218 unsigned short tot = aHit.second.m_tot;
1219 unsigned short status = aHit.second.m_status;
1221 if (iterXTalkMap1 == xTalkMap1.end()) {
1222 xTalkMap1.insert(make_pair(wid,
XTalkInfo(tdcCount, adcCount, tot, status)));
1225 if (tdcCount < iterXTalkMap1->second.m_tdc) {
1226 iterXTalkMap1->second.m_tdc = tdcCount;
1227 B2DEBUG(m_debugLevel4XTalk,
"TDC-count of current xtalk: " << tdcCount);
1229 iterXTalkMap1->second.m_adc += adcCount;
1230 iterXTalkMap1->second.m_tot += tot;
1235 B2DEBUG(m_debugLevel4XTalk,
"#xtalk1 hits: " << xTalkMap1.size());
1236 for (
const auto& aX : xTalkMap1) {
1238 const unsigned short tdc4Bg = aX.second.m_tdc;
1239 const unsigned short adc4Bg = aX.second.m_adc;
1240 const unsigned short tot4Bg = aX.second.m_tot;
1241 const unsigned short status4Bg = aX.second.m_status;
1243 for (
int iHit = 0; iHit < OriginalNoOfHits; ++iHit) {
1244 CDCHit& aH = *(m_cdcHits[iHit]);
1245 if (aH.
getID() != aX.first.getEWire()) {
1251 const unsigned short tot4Sg = aH.
getTOT();
1257 if (tdc4Sg < tdc4Bg) {
1261 for (
int i = relSimHits.size() - 1; i >= 0; --i) {
1262 relSimHits.remove(i);
1265 for (
int i = relMCParticles.size() - 1; i >= 0; --i) {
1266 relMCParticles.remove(i);
1276 unsigned short s1 = tdc4Sg;
1277 unsigned short s2 = tdc4Bg;
1278 unsigned short w1 = tot4Sg;
1279 unsigned short w2 = tot4Bg;
1280 if (tdc4Sg < tdc4Bg) {
1288 const unsigned short e1 = s1 - w1;
1289 const unsigned short e2 = s2 - w2;
1292 double pulseW = w1 + w2;
1295 }
else if (e1 <= s2) {
1299 unsigned short board = m_cdcgp->getBoardID(aX.first);
1300 aH.
setTOT(std::min(std::round(pulseW / 32.),
static_cast<double>(m_widthOfTimeWindowInCount[board])));
1309 m_cdcHits.appendNew(tdc4Bg, adc4Bg, aX.first, status4Bg, tot4Bg);
1310 B2DEBUG(m_debugLevel4XTalk,
"appended tdc,adc,tot,wid,status= " << tdc4Bg <<
" " << adc4Bg <<
" " << tot4Bg <<
" " << aX.first <<
1315 B2DEBUG(m_debugLevel4XTalk,
"original #hits, #hits= " << OriginalNoOfHits <<
" " << m_cdcHits.getEntries());
1319 double CDCDigitizerModule::getPositiveT0(
const WireID& wid)
1321 double t0 = m_cdcgp->getT0(wid);
1322 if (t0 <= 0 && m_treatNegT0WiresAsGood) t0 = m_cdcgp->getMeanT0();
The Class for Detailed Digitization of CDC.
Database object for Fron-endt electronics params.
Class containing the result of the unpacker in raw data and the result of the digitizer in simulation...
void setTDCCount(short tdcCount)
Setter for TDC count.
void set2ndHitFlag()
Setter for 2nd hit flag.
short getTDCCount() const
Getter for TDC count.
void setTOT(unsigned short tot)
Setter for TOT.
unsigned short getID() const
Getter for encoded wire number.
unsigned short getStatus() const
Getter for CDCHit status.
void setADCCount(unsigned short adcCount)
Setter for ADC count.
unsigned short getADCCount() const
Getter for integrated charge.
unsigned short getTOT() const
Getter for TOT.
void setOtherHitIndices(CDCHit *otherHit)
Setter for the other hit indices.
void setStatus(unsigned short status)
Setter for CDCHit status.
The Class for CDC Geometry Parameters.
double getNominalPropSpeed() const
Return the nominal propagation speed of the sense wire (default: 27.25 cm/nsec).
EWirePosition
Wire position set.
double getTdcBinWidth() const
Return TDC bin width (nsec).
double getNominalDriftV() const
Return the nominal drift velocity of He-ethane gas (default: 4.0x10^-3 cm/nsec).
The Class for Energy deposit in the gas.
double getEDepInGas(int mode, int pdg, double p, double dx, double e3) const
Return the energy deosite in the gas.
void addCallback(std::function< void(const std::string &)> callback, bool onDestruction=false)
Add a callback method.
Class for accessing arrays of objects in the database.
Class for accessing objects in the database.
A Class to store the Monte Carlo particle information.
Low-level class to create/modify relations between StoreArrays.
void add(index_type from, index_type to, weight_type weight=1.0)
Add a new element to the relation.
Class for type safe access to objects that are referred to in relations.
size_t size() const
Get number of relations.
float weight(int index) const
Get weight with index.
void addRelationTo(const RelationsInterface< BASE > *object, float weight=1.0, const std::string &namedRelation="") const
Add a relation from this object to another object (with caching).
RelationVector< FROM > getRelationsFrom(const std::string &name="", const std::string &namedRelation="") const
Get the relations that point from another store array to this object.
Class to identify a wire inside the CDC.
unsigned short getICLayer() const
Getter for continuous layer numbering.
unsigned short getIWire() const
Getter for wire within the layer.
unsigned short getISuperLayer() const
Getter for Super-Layer.
#define REG_MODULE(moduleName)
Register the given module (without 'Module' suffix) with the framework.
double ClosestApproach(const TVector3 &bwp, const TVector3 &fwp, const TVector3 &posIn, const TVector3 &posOut, TVector3 &hitPosition, TVector3 &wirePosition)
Returns a closest distance between a track and a wire.
Abstract base class for different kinds of events.
Structure for saving the signal information.
Structure for saving the x-talk information.