Belle II Software  release-06-00-14
CDCDigitizerModule Class Reference

The Class for Detailed Digitization of CDC. More...

#include <CDCDigitizerModule.h>

Inheritance diagram for CDCDigitizerModule:
Collaboration diagram for CDCDigitizerModule:

Classes

struct  SignalInfo
 Structure for saving the signal information. More...
 
struct  XTalkInfo
 Structure for saving the x-talk information. More...
 

Public Types

enum  EModulePropFlags {
  c_Input = 1 ,
  c_Output = 2 ,
  c_ParallelProcessingCertified = 4 ,
  c_HistogramManager = 8 ,
  c_InternalSerializer = 16 ,
  c_TerminateInAllProcesses = 32 ,
  c_DontCollectStatistics = 64
}
 Each module can be tagged with property flags, which indicate certain features of the module. More...
 
typedef ModuleCondition::EAfterConditionPath EAfterConditionPath
 Forward the EAfterConditionPath definition from the ModuleCondition.
 

Public Member Functions

 CDCDigitizerModule ()
 Constructor.
 
void initialize () override
 Initialize variables, print info, and start CPU clock.
 
void event () override
 Actual digitization of all hits in the CDC. More...
 
void terminate () override
 Terminate func.
 
virtual std::vector< std::string > getFileNames (bool outputFiles)
 Return a list of output filenames for this modules. More...
 
virtual void beginRun ()
 Called when entering a new run. More...
 
virtual void endRun ()
 This method is called if the current run ends. More...
 
const std::string & getName () const
 Returns the name of the module. More...
 
const std::string & getType () const
 Returns the type of the module (i.e. More...
 
const std::string & getPackage () const
 Returns the package this module is in.
 
const std::string & getDescription () const
 Returns the description of the module.
 
void setName (const std::string &name)
 Set the name of the module. More...
 
void setPropertyFlags (unsigned int propertyFlags)
 Sets the flags for the module properties. More...
 
LogConfiggetLogConfig ()
 Returns the log system configuration.
 
void setLogConfig (const LogConfig &logConfig)
 Set the log system configuration.
 
void setLogLevel (int logLevel)
 Configure the log level.
 
void setDebugLevel (int debugLevel)
 Configure the debug messaging level.
 
void setAbortLevel (int abortLevel)
 Configure the abort log level.
 
void setLogInfo (int logLevel, unsigned int logInfo)
 Configure the printed log information for the given level. More...
 
void if_value (const std::string &expression, const std::shared_ptr< Path > &path, EAfterConditionPath afterConditionPath=EAfterConditionPath::c_End)
 Add a condition to the module. More...
 
void if_false (const std::shared_ptr< Path > &path, EAfterConditionPath afterConditionPath=EAfterConditionPath::c_End)
 A simplified version to add a condition to the module. More...
 
void if_true (const std::shared_ptr< Path > &path, EAfterConditionPath afterConditionPath=EAfterConditionPath::c_End)
 A simplified version to set the condition of the module. More...
 
bool hasCondition () const
 Returns true if at least one condition was set for the module.
 
const ModuleConditiongetCondition () const
 Return a pointer to the first condition (or nullptr, if none was set)
 
const std::vector< ModuleCondition > & getAllConditions () const
 Return all set conditions for this module.
 
bool evalCondition () const
 If at least one condition was set, it is evaluated and true returned if at least one condition returns true. More...
 
std::shared_ptr< PathgetConditionPath () const
 Returns the path of the last true condition (if there is at least one, else reaturn a null pointer). More...
 
Module::EAfterConditionPath getAfterConditionPath () const
 What to do after the conditional path is finished. More...
 
std::vector< std::shared_ptr< Path > > getAllConditionPaths () const
 Return all condition paths currently set (no matter if the condition is true or not).
 
bool hasProperties (unsigned int propertyFlags) const
 Returns true if all specified property flags are available in this module. More...
 
bool hasUnsetForcedParams () const
 Returns true and prints error message if the module has unset parameters which the user has to set in the steering file.
 
const ModuleParamListgetParamList () const
 Return module param list.
 
template<typename T >
ModuleParam< T > & getParam (const std::string &name) const
 Returns a reference to a parameter. More...
 
bool hasReturnValue () const
 Return true if this module has a valid return value set.
 
int getReturnValue () const
 Return the return value set by this module. More...
 
std::shared_ptr< PathElementclone () const override
 Create an independent copy of this module. More...
 
std::shared_ptr< boost::python::list > getParamInfoListPython () const
 Returns a python list of all parameters. More...
 

Static Public Member Functions

static void exposePythonAPI ()
 Exposes methods of the Module class to Python.
 

Protected Member Functions

virtual void def_initialize ()
 Wrappers to make the methods without "def_" prefix callable from Python. More...
 
virtual void def_beginRun ()
 Wrapper method for the virtual function beginRun() that has the implementation to be used in a call from Python.
 
virtual void def_event ()
 Wrapper method for the virtual function event() that has the implementation to be used in a call from Python.
 
virtual void def_endRun ()
 This method can receive that the current run ends as a call from the Python side. More...
 
virtual void def_terminate ()
 Wrapper method for the virtual function terminate() that has the implementation to be used in a call from Python.
 
void setDescription (const std::string &description)
 Sets the description of the module. More...
 
void setType (const std::string &type)
 Set the module type. More...
 
template<typename T >
void addParam (const std::string &name, T &paramVariable, const std::string &description, const T &defaultValue)
 Adds a new parameter to the module. More...
 
template<typename T >
void addParam (const std::string &name, T &paramVariable, const std::string &description)
 Adds a new enforced parameter to the module. More...
 
void setReturnValue (int value)
 Sets the return value for this module as integer. More...
 
void setReturnValue (bool value)
 Sets the return value for this module as bool. More...
 
void setParamList (const ModuleParamList &params)
 Replace existing parameter list.
 

Private Member Functions

double smearDriftLength (double driftLength, double dDdt)
 Method used to smear the drift length. More...
 
double getdDdt (double driftLength)
 The method to get dD/dt. More...
 
double getDriftTime (double driftLength, bool addTof, bool addDelay)
 The method to get drift time based on drift length. More...
 
void makeSignalsAfterShapers (const WireID &wid, double edep, double dx, double costh, unsigned short &adcCount, double &convFactorForThreshold)
 Function to make signals after shapers. More...
 
double getPositiveT0 (const WireID &)
 Modify t0 for negative-t0 case.
 
void setFEElectronics ()
 Set FEE parameters (from DB)
 
double Polya (double xmax=10)
 Generate randum number according to Polya distribution. More...
 
void setSemiTotalGain ()
 Set semi-total gain (from DB)
 
double getSemiTotalGain (int clayer, int cell) const
 Return semi-total gain of the specified wire. More...
 
double getSemiTotalGain (const WireID &wireID) const
 Return semi-total gain of the specified wire. More...
 
void addXTalk ()
 Add crosstalk.
 
std::list< ModulePtrgetModules () const override
 no submodules, return empty list
 
std::string getPathString () const override
 return the module name.
 
void setParamPython (const std::string &name, const boost::python::object &pyObj)
 Implements a method for setting boost::python objects. More...
 
void setParamPythonDict (const boost::python::dict &dictionary)
 Implements a method for reading the parameter values from a boost::python dictionary. More...
 

Private Attributes

StoreArray< MCParticlem_mcParticles
 Set edep-to-ADC conversion params. More...
 
StoreArray< CDCSimHitm_simHits
 CDCSimHit array.
 
StoreArray< CDCHitm_cdcHits
 CDCHit array.
 
StoreArray< CDCHitm_cdcHits4Trg
 CDCHit4trg array.
 
std::string m_inputCDCSimHitsName
 Input array name. More...
 
std::string m_outputCDCHitsName
 Output array name.
 
std::string m_outputCDCHitsName4Trg
 Output array name for trigger.
 
std::string m_MCParticlesToSimHitsName
 Relation for origin of incoming SimHits.
 
std::string m_SimHitsTOCDCHitsName
 Relation for outgoing CDCHits.
 
bool m_useSimpleDigitization
 Use float Gaussian Smearing instead of proper digitization.
 
double m_fraction
 Fraction of the first Gaussian used to smear drift length.
 
double m_mean1
 Mean value of the first Gassian used to smear drift length.
 
double m_resolution1
 Resolution of the first Gassian used to smear drift length.
 
double m_mean2
 Mean value of the second Gassian used to smear drift length.
 
double m_resolution2
 Resolution of the second Gassian used to smear drift length.
 
double m_tdcThreshold4Outer
 TDC threshold for outer layers in unit of eV.
 
double m_tdcThreshold4Inner
 TDC threshold for inner layers in unit of eV.
 
int m_eDepInGasMode
 Mode for extracting dE(gas) from dE(gas+wire)
 
int m_adcThreshold
 Threshold for ADC in unit of count.
 
double m_tMin
 Lower edge of time window in ns.
 
double m_tMaxOuter
 Upper edge of time window in ns for the outer layers.
 
double m_tMaxInner
 Upper edge of time window in ns for the inner layers.
 
double m_trigTimeJitter
 Magnitude of trigger timing jitter (ns).
 
CDC::CDCGeometryParm_cdcgp
 Cached Pointer to CDCGeometryPar.
 
CDC::CDCGeoControlParm_gcp
 Cached pointer to CDCGeoControlPar.
 
CDCSimHitm_aCDCSimHit
 Pointer to CDCSimHit.
 
WireID m_wireID
 WireID of this hit.
 
unsigned short m_posFlag
 left or right flag of this hit
 
unsigned short m_boardID = 0
 FEE board ID.
 
TVector3 m_posWire
 wire position of this hit
 
TVector3 m_posTrack
 track position of this hit
 
TVector3 m_momentum
 3-momentum of this hit
 
double m_driftLength
 drift length of this hit
 
double m_flightTime
 flight time of this hit
 
double m_globalTime
 global time of this hit
 
double m_tdcBinWidth
 Width of a TDC bin (in ns)
 
double m_tdcBinWidthInv
 m_tdcBinWidth^-1 (in ns^-1)
 
double m_tdcResol
 TDC resolution (in ns)
 
double m_driftV
 Nominal drift velocity (in cm/ns)
 
double m_driftVInv
 m_driftV^-1 (in ns/cm)
 
double m_propSpeedInv
 Inv. More...
 
double m_tdcThresholdOffset
 Offset for TDC(digital) threshold (mV)
 
double m_analogGain
 analog gain (V/pC)
 
double m_digitalGain
 digital gain (V/pC)
 
double m_adcBinWidth
 ADC bin width (mV)
 
double m_addFudgeFactorForSigma
 additional fudge factor for space resol.
 
double m_totalFudgeFactor = 1.
 total fudge factor for space resol.
 
bool m_gasGainSmearing = false
 Swtich for gas gain smearing.
 
double m_effWForGasGainSmearing = 0.0266
 Effective energy (keV) for one electron prod. More...
 
double m_thetaOfPolya = 0.5
 theta of Polya function for gas gain smearing
 
bool m_extraADCSmearing = false
 Swtich for extra ADC smearing.
 
double m_runGain = 1.
 run gain.
 
float m_semiTotalGain [MAX_N_SLAYERS][MAX_N_SCELLS] = {{}}
 total gain per wire
 
double m_overallGainFactor = 1.
 Overall gain factor.
 
double m_degOfSPEOnThreshold = 0
 Degree of space charge effect on timing threshold.
 
bool m_doSmearing
 A switch to control drift length smearing.
 
bool m_addTimeWalk
 A switch used to control adding time-walk delay into the total drift time or not.
 
bool m_addInWirePropagationDelay
 A switch used to control adding propagation delay into the total drift time or not.
 
bool m_addTimeOfFlight
 A switch used to control adding time of flight into the total drift time or not.
 
bool m_addInWirePropagationDelay4Bg
 A switch used to control adding propagation delay into the total drift time or not for beam bg.
 
bool m_addTimeOfFlight4Bg
 A switch used to control adding time of flight into the total drift time or not for beam bg.
 
bool m_outputNegativeDriftTime
 A switch to output negative drift time to CDCHit.
 
bool m_output2ndHit
 A switch to output 2nd hit.
 
bool m_align
 A switch to control alignment.
 
bool m_correctForWireSag
 A switch to control wire sag.
 
bool m_treatNegT0WiresAsGood
 A switch for negative-t0 wires.
 
bool m_useDB4FEE
 Fetch FEE params from DB.
 
DBArray< CDCFEElectronics > * m_fEElectronicsFromDB = nullptr
 Pointer to FE electronics params. More...
 
float m_lowEdgeOfTimeWindow [nBoards] = {0}
 Lower edge of time-window.
 
float m_uprEdgeOfTimeWindow [nBoards] = {0}
 Upper edge of time-window.
 
float m_tdcThresh [nBoards] = {0}
 Threshold for timing-signal.
 
float m_adcThresh [nBoards] = {0}
 Threshold for FADC.
 
unsigned short m_widthOfTimeWindowInCount [nBoards] = {0}
 Width of time window.
 
bool m_useDB4EDepToADC
 Fetch edep-to-ADC conversion params. More...
 
bool m_useDB4RunGain
 Fetch run gain from DB.
 
bool m_spaceChargeEffect
 Space charge effect.
 
DBObjPtr< CDCDedxRunGain > * m_runGainFromDB = nullptr
 Pointer to run gain from DB.
 
DBObjPtr< CDCDedxScaleFactor > * m_gain0FromDB = nullptr
 Pointer to overall gain factor from DB.
 
DBObjPtr< CDCDedxWireGain > * m_wireGainFromDB = nullptr
 Pointer to wire gain from DB.
 
bool m_addXTalk
 Flag to switch on/off crosstalk.
 
bool m_issue2ndHitWarning
 Flag to switch on/off a warning on the 2nd TDC hit.
 
bool m_includeEarlyXTalks
 Flag to switch on/off xtalks earlier than the hit.
 
int m_debugLevel
 Debug level.
 
int m_debugLevel4XTalk
 Debug level for crosstalk.
 
DBObjPtr< CDCCrossTalkLibrary > * m_xTalkFromDB = nullptr
 Pointer to cross-talk from DB.
 
StoreObjPtr< SimClockStatem_simClockState
 generated hardware clock state
 
bool m_synchronization = true
 Flag to switch on/off timing synchronization.
 
bool m_randomization = true
 Flag to switch on/off timing randmization.
 
int m_tSimMode = 0
 Timing simulation mode.
 
int m_offsetForTriggerBin = 1
 Input to getCDCTriggerBin(offset)
 
int m_trgTimingOffsetInCount = 4
 Trigger timing offset in unit of count.
 
int m_shiftOfTimeWindowIn32Count = 153
 Shift of time window for synchronization in 32count.
 
unsigned short m_trgDelayInCount [nBoards] = {0}
 Trigger delay in frontend electronics in count.
 
std::string m_name
 The name of the module, saved as a string (user-modifiable)
 
std::string m_type
 The type of the module, saved as a string.
 
std::string m_package
 Package this module is found in (may be empty).
 
std::string m_description
 The description of the module.
 
unsigned int m_propertyFlags
 The properties of the module as bitwise or (with |) of EModulePropFlags.
 
LogConfig m_logConfig
 The log system configuration of the module.
 
ModuleParamList m_moduleParamList
 List storing and managing all parameter of the module.
 
bool m_hasReturnValue
 True, if the return value is set.
 
int m_returnValue
 The return value.
 
std::vector< ModuleConditionm_conditions
 Module condition, only non-null if set.
 

Detailed Description

The Class for Detailed Digitization of CDC.

Currently a float Gaussian with steerable parameters is used for the digitization. If there are two or more hits in one cell, only the shortest drift length is selected. The signal amplitude is the sum of all hits deposited energy in this cell.

Definition at line 53 of file CDCDigitizerModule.h.

Member Enumeration Documentation

◆ EModulePropFlags

enum EModulePropFlags
inherited

Each module can be tagged with property flags, which indicate certain features of the module.

Enumerator
c_Input 

This module is an input module (reads data).

c_Output 

This module is an output module (writes data).

c_ParallelProcessingCertified 

This module can be run in parallel processing mode safely (All I/O must be done through the data store, in particular, the module must not write any files.)

c_HistogramManager 

This module is used to manage histograms accumulated by other modules.

c_InternalSerializer 

This module is an internal serializer/deserializer for parallel processing.

c_TerminateInAllProcesses 

When using parallel processing, call this module's terminate() function in all processes().

This will also ensure that there is exactly one process (single-core if no parallel modules found) or at least one input, one main and one output process.

c_DontCollectStatistics 

No statistics is collected for this module.

Definition at line 77 of file Module.h.

Member Function Documentation

◆ beginRun()

virtual void beginRun ( void  )
inlinevirtualinherited

Called when entering a new run.

Called at the beginning of each run, the method gives you the chance to change run dependent constants like alignment parameters, etc.

This method can be implemented by subclasses.

Reimplemented in DQMHistOutputToEPICSModule, DQMHistInjectionModule, DQMHistAnalysisRooFitExampleModule, DQMHistAnalysisPXDTrackChargeModule, DQMHistAnalysisPXDReductionModule, DQMHistAnalysisPXDInjectionModule, DQMHistAnalysisPXDEffModule, DQMHistAnalysisPXDDAQModule, DQMHistAnalysisPXDCMModule, DQMHistAnalysisPXDChargeModule, vxdDigitMaskingModule, VXDDQMExpressRecoModule, PXDROIFinderAnalysisModule, PXDdigiFilterModule, PXDclusterFilterModule, SVDUnpackerDQMModule, SVDDQMInjectionModule, SVDDQMExpressRecoModule, SVDDQMDoseModule, SVDDQMClustersOnTrackModule, TTDDQMModule, PXDUnpackerNewModule, PXDPackerModule, PXDDigitizerModule, PXDTrackClusterDQMModule, PXDROIDQMModule, PXDRawDQMModule, PXDRawDQMCorrModule, PXDInjectionDQMModule, PXDGatedModeDQMModule, PXDGatedDHCDQMModule, PXDDQMExpressRecoModule, PXDDQMEfficiencySelftrackModule, PXDDQMEfficiencyModule, PXDDQMCorrModule, PXDDQMClustersModule, PXDDAQDQMModule, PXDMCBgTupleProducerModule, PXDBgTupleProducerModule, PyModule, ECLDQMInjectionModule, V0ObjectsDQMModule, DelayDQMModule, DAQMonitorModule, DQMHistComparitorModule, DQMHistAnalysisSVDDoseModule, DQMHistAnalysisPXDFitsModule, DQMHistAnalysisPXDERModule, DQMHistAnalysisIPModule, DQMHistAnalysisInputRootFileModule, DQMHistAnalysisExampleFlagsModule, DQMHistAnalysisEpicsExampleModule, VXDMisalignmentModule, TRGRAWDATAModule, TRGTOPUnpackerModule, TRGTOPDQMModule, KLMTriggerModule, TRGGRLUnpackerModule, TRGGRLDQMModule, TRGGRLProjectsModule, TRGGRLModule, TRGGRLMatchModule, TRGGDLUnpackerModule, TRGGDLSummaryModule, TRGGDLDSTModule, TRGGDLDQMModule, TRGGDLModule, TRGECLUnpackerModule, TRGECLTimingCalModule, TRGECLRawdataAnalysisModule, TRGECLQAMModule, TRGECLDQMModule, TRGECLBGTCHitModule, TRGECLModule, TRGECLFAMModule, MCMatcherTRGECLModule, CDCTriggerUnpackerModule, TRGCDCTSStreamModule, TRGCDCTSFUnpackerModule, TRGCDCTSFDQMModule, TRGCDCT3DUnpackerModule, TRGCDCT3DDQMModule, TRGCDCT3DConverterModule, TRGCDCT2DDQMModule, TRGCDCETFUnpackerModule, TRGCDCModule, CDCTriggerTSFModule, CDCTriggerNDFinderModule, CDCTriggerNeuroDQMModule, FindletModule< AFindlet >, FindletModule< TrackFinderAutomaton >, FindletModule< FacetCreator >, FindletModule< CKFToCDCFromEclFindlet >, FindletModule< AxialTrackCreatorMCTruth >, FindletModule< AxialStraightTrackFinder >, FindletModule< CKFToCDCFindlet >, FindletModule< CKFToSVDSeedFindlet >, FindletModule< SegmentLinker >, FindletModule< TrackCreatorSegmentTripleAutomaton >, FindletModule< TrackCreatorSegmentPairAutomaton >, FindletModule< SegmentOrienter >, FindletModule< SegmentCreatorFacetAutomaton >, FindletModule< TrackFinderSegmentTripleAutomaton >, FindletModule< SegmentFinderFacetAutomaton >, FindletModule< CKFToSVDFindlet >, FindletModule< TrackRejecter >, FindletModule< SegmentCreatorMCTruth >, FindletModule< TrackFinderCosmics >, FindletModule< TrackExporter >, FindletModule< SuperClusterCreator >, FindletModule< AsicBackgroundLibraryCreator >, FindletModule< HitBasedT0Extractor >, FindletModule< TrackFinderSegmentPairAutomaton >, FindletModule< ClusterPreparer >, FindletModule< AxialTrackFinderHough >, FindletModule< CosmicsTrackMergerFindlet >, FindletModule< TrackOrienter >, FindletModule< TrackLinker >, FindletModule< vxdHoughTracking::VXDHoughTracking >, FindletModule< TrackFinder >, FindletModule< SegmentPairCreator >, FindletModule< MonopoleAxialTrackFinderLegendre >, FindletModule< HitReclaimer >, FindletModule< ClusterRefiner< BridgingWireHitRelationFilter > >, FindletModule< AxialTrackFinderLegendre >, FindletModule< AxialTrackCreatorSegmentHough >, FindletModule< TrackQualityEstimator >, FindletModule< StereoHitFinder >, FindletModule< CKFToPXDFindlet >, FindletModule< WireHitPreparer >, FindletModule< TrackFlightTimeAdjuster >, FindletModule< TrackCreatorSingleSegments >, FindletModule< SegmentRejecter >, FindletModule< SegmentFitter >, FindletModule< SegmentTripleCreator >, FindletModule< SegmentTrackCombiner >, FindletModule< MCVXDCDCTrackMergerFindlet >, FindletModule< TrackCombiner >, FindletModule< MonopoleStereoHitFinder >, FindletModule< DATCONFPGAFindlet >, FindletModule< WireHitBackgroundDetector >, FindletModule< AxialSegmentPairCreator >, FindletModule< WireHitCreator >, FindletModule< TrackQualityAsserter >, FindletModule< MonopoleStereoHitFinderQuadratic >, FindletModule< ClusterBackgroundDetector >, FindletModule< CDCTrackingEventLevelMdstInfoFillerFindlet >, VXDTFTrainingDataCollectorModule, TrackFinderVXDCellOMatModule, TrackFinderVXDBasicPathFinderModule, SegmentNetworkProducerModule, SectorMapBootstrapModule, VXDQualityEstimatorMVAModule, VXDQETrainingDataCollectorModule, QualityEstimatorVXDModule, VXDSimpleClusterizerModule, TrackFinderVXDAnalizerModule, SecMapTrainerVXDTFModule, SecMapTrainerBaseModule, TrackQualityEstimatorMVAModule, TrackQETrainingDataCollectorModule, V0findingPerformanceEvaluationModule, TrackingPerformanceEvaluationModule, HitXPModule, EffPlotsModule, TrackFinderMCTruthRecoTracksModule, TrackCreatorModule, SVDROIFinderModule, SVDROIFinderAnalysisModule, SPTCvirtualIPRemoverModule, SPTCmomentumSeedRetrieverModule, PXDROIFinderModule, MuidModule, MCTrackCandClassifierModule, MCV0MatcherModule, BeamSpotMonitorModule, ExtModule, DQMHistoModuleBase, TOPXTalkChargeShareSetterModule, TOPWaveformFeatureExtractorModule, TOPUnpackerModule, TOPTimeRecalibratorModule, TOPTimeBaseCalibratorModule, TOPTBCComparatorModule, TOPRawDigitConverterModule, TOPPackerModule, TOPNtupleModule, TOPModuleT0CalibratorModule, TOPMCTrackMakerModule, TOPLaserCalibratorModule, TOPInterimFENtupleModule, TOPLaserHitSelectorModule, TOPGainEfficiencyCalculatorModule, TOPDQMModule, TOPDoublePulseGeneratorModule, TOPTriggerDigitizerModule, TOPDigitizerModule, TOPChannelT0MCModule, TOPChannelMaskerModule, TOPBunchFinderModule, TOPBackgroundModule, OpticalGunModule, SVDUnpackerModule, SVDTriggerQualityGeneratorModule, SVDEventInfoSetterModule, SVDDigitizerModule, SVD3SamplesEmulatorModule, SVDRecoDigitCreatorModule, SVDMissingAPVsClusterCreatorModule, SVDDataFormatCheckModule, SVDCoGTimeEstimatorModule, SVDClusterizerModule, SVDShaperDigitsFromTracksModule, SVDPerformanceModule, SVDOccupancyAnalysisModule, SVDMaxStripTTreeModule, SVDClusterFilterModule, SVDClusterEvaluationTrueInfoModule, SVDClusterEvaluationModule, SVDB4CommissioningPlotsModule, SVDPackerModule, svdDumpModule, SVDDQMHitTimeModule, SVDTimeCalibrationsMonitorModule, SVDPositionErrorScaleFactorImporterModule, SVDLocalCalibrationsMonitorModule, SVDLocalCalibrationsCheckModule, SVDLatencyCalibrationModule, SVDHotStripFinderModule, SVDClusterCalibrationsMonitorModule, SVDBackgroundModule, MaterialScanModule, FullSimModule, PIDNtupleModule, MdstPIDModule, KlongValidationModule, KLMExpertModule, ECLExpertModule, DataWriterModule, EventT0DQMModule, CDCDedxValidationModule, CDCDedxDQMModule, Convert2RawDetModule, PXDPerformanceModule, PXDClustersFromTracksModule, PXDRawDQMChipsModule, PXDBackgroundModule, AWESOMEBasicModule, MVAPrototypeModule, MVAMultipleExpertsModule, MVAExpertModule, MCMatcherKLMClustersModule, KLMUnpackerModule, KLMReconstructorModule, KLMPackerModule, KLMDQMModule, KLMDigitTimeShifterModule, KLMDigitizerModule, KLMClustersReconstructorModule, KLMClusterEfficiencyModule, EKLMDataCheckerModule, EKLMADCModule, BKLMTrackingModule, BKLMSimHistogrammerModule, BKLMDigitAnalyzerModule, BKLMAnaModule, StatisticsTimingHLTDQMModule, SoftwareTriggerHLTDQMModule, SoftwareTriggerModule, ExportGeometryModule, CreateFieldMapModule, KKGenInputModule, OverrideGenerationFlagsModule, EvtGenInputModule, EvtGenDecayModule, TxModule, RxModule, SeqRootOutputModule, SeqRootInputModule, StatisticsSummaryModule, HistoManagerModule, GearboxModule, RandomBarrierModule, ProgressModule, IoVDependentConditionModule, EventLimiterModule, EventInfoPrinterModule, SwitchDataStoreModule, SubEventModule, HistoModule, MCMatcherECLClustersModule, ECLWaveformFitModule, ECLUnpackerModule, ECLSplitterN2Module, ECLSplitterN1Module, ECLShowerShapeModule, ECLShowerCorrectorModule, ECLShowerCalibratorModule, ECLPackerModule, ECLLocalRunCalibratorModule, ECLLocalMaximumFinderModule, ECLHitDebugModule, ECLFinalizerModule, ECLDQMEXTENDEDModule, ECLDQMModule, EclDisplayModule, ECLDigitizerPureCsIModule, ECLDigitizerModule, ECLDigitCalibratorModule, ECLDataAnalysisModule, ECLCRFinderModule, ECLCovarianceMatrixModule, ECLClusterPSDModule, ECLChargedPIDDataAnalysisValidationModule, ECLChargedPIDDataAnalysisModule, ECLChargedPIDModule, ECLBackgroundModule, PhysicsObjectsMiraBelleModule, PhysicsObjectsMiraBelleDstModule, PhysicsObjectsMiraBelleDst2Module, PhysicsObjectsDQMModule, IPDQMExpressRecoModule, DQMHistSnapshotsModule, DQMHistDeltaHistoModule, DQMHistAnalysisTRGGDLModule, DQMHistAnalysisTOPModule, DQMHistAnalysisSVDOnMiraBelleModule, DQMHistAnalysisSVDGeneralModule, DQMHistAnalysisSVDEfficiencyModule, DQMHistAnalysisPlotOnlyModule, DQMHistAnalysisOutputRelayMsgModule, DQMHistAnalysisOutputNSMModule, DQMHistAnalysisOutputMonObjModule, DQMHistAnalysisOutputFileModule, DQMHistAnalysisOutputModule, DQMHistAnalysisMonObjModule, DQMHistAnalysisMiraBelleModule, DQMHistAnalysisKLMModule, DQMHistAnalysisInputSrvModule, DQMHistAnalysisInputPVSrvModule, DQMHistAnalysisInputModule, DQMHistAnalysisHLTMonObjModule, DQMHistAnalysisExampleModule, DQMHistAnalysisEventT0Module, DQMHistAnalysisECLModule, DQMHistAnalysisCDCMonObjModule, DQMHistAnalysisCDCDedxModule, DQMHistAnalysisARICHMonObjModule, DQMHistAnalysisARICHModule, HLTDQM2ZMQModule, CDCUnpackerModule, CDCRecoTrackFilterModule, CDCPackerModule, CDCDQMModule, cdcDQM7Module, CDCCRTestModule, CDCCosmicAnalysisModule, QcsmonitorStudyModule, QcsmonitorDigitizerModule, PlumeDigitizerModule, PindiodeStudyModule, PinDigitizerModule, TPCStudyModule, TpcDigitizerModule, MicrotpcStudyModule, He3tubeStudyModule, He3DigitizerModule, FANGSStudyModule, FANGSDigitizerModule, DosiStudyModule, DosiDigitizerModule, CsIStudyModule, CsiStudy_v2Module, CsiModule, CsIDigitizerModule, CsiDigitizer_v2Module, ClawsStudyModule, ClawsDigitizerModule, ClawStudyModule, ClawDigitizerModule, BgoStudyModule, BgoDigitizerModule, BeamDigitizerModule, BeamabortStudyModule, ReprocessorModule, NtuplePhase1_v6Module, AnalysisPhase1StudyModule, BGOverlayInputModule, BeamBkgTagSetterModule, BeamBkgMixerModule, BeamBkgHitRateMonitorModule, BeamBkgGeneratorModule, BelleMCOutputModule, B2BIIMdstInputModule, B2BIIFixMdstModule, B2BIIConvertMdstModule, B2BIIConvertBeamParamsModule, B2BIIMCParticlesMonitorModule, ARICHUnpackerModule, ARICHRelateModule, ARICHReconstructorModule, ARICHRawUnpackerModule, ARICHRateCalModule, ARICHPackerModule, ARICHNtupleModule, ARICHMCParticlesModule, ARICHFillHitsModule, ARICHDQMModule, ARICHDigitizerModule, arichBtestModule, TreeFitterModule, TagVertexModule, PhotonEfficiencySystematicsModule, ParticleVertexFitterModule, CurlTaggerModule, ChargedPidMVAMulticlassModule, ChargedPidMVAModule, EnergyBiasCorrectionModule, CosmicsAlignmentValidationModule, EventsOfDoomBusterModule, DQMHistAnalysisHLTModule, CalibrationCollectorModule, StorageSerializerModule, StorageDeserializerModule, SeqRootMergerModule, PartialSeqRootReaderModule, Ds2RawFileModule, Rbuf2RbufModule, Rbuf2DsModule, RawInputModule, Raw2DsModule, FastRbuf2DsModule, EvReductionModule, Ds2RbufModule, Ds2RawModule, CertifyParallelModule, SerializerModule, MonitorDataCOPPERModule, GenRawSendModule, DeSerializerPXDModule, ElapsedTimeModule, ReceiveEventModule, GetEventFromSocketModule, Ds2SampleModule, TrackAnaModule, MonitorDataModule, DqmHistoManagerModule, TxSocketModule, RxSocketModule, DAQPerfModule, SrsensorModule, QcsmonitorModule, PlumeModule, PindiodeModule, Ph1sustrModule, Ph1bpipeModule, MicrotpcModule, He3tubeModule, FANGSModule, DosiModule, CLAWSModule, ClawModule, CaveModule, BgoModule, BeamabortModule, and ARICHBackgroundModule.

Definition at line 147 of file Module.h.

◆ clone()

std::shared_ptr< PathElement > clone ( ) const
overridevirtualinherited

Create an independent copy of this module.

Note that parameters are shared, so changing them on a cloned module will also affect the original module.

Implements PathElement.

Definition at line 179 of file Module.cc.

◆ def_endRun()

virtual void def_endRun ( )
inlineprotectedvirtualinherited

This method can receive that the current run ends as a call from the Python side.

For regular C++-Modules that forwards the call to the regular endRun() method.

Reimplemented in PyModule.

Definition at line 439 of file Module.h.

◆ def_initialize()

virtual void def_initialize ( )
inlineprotectedvirtualinherited

Wrappers to make the methods without "def_" prefix callable from Python.

Overridden in PyModule. Wrapper method for the virtual function initialize() that has the implementation to be used in a call from Python.

Reimplemented in PyModule.

Definition at line 420 of file Module.h.

◆ endRun()

virtual void endRun ( void  )
inlinevirtualinherited

This method is called if the current run ends.

Use this method to store information, which should be aggregated over one run.

This method can be implemented by subclasses.

Reimplemented in DQMHistOutputToEPICSModule, DQMHistAnalysisRooFitExampleModule, DQMHistAnalysisPXDTrackChargeModule, DQMHistAnalysisPXDChargeModule, vxdDigitMaskingModule, TrackSetEvaluatorHopfieldNNDEVModule, SVDUnpackerDQMModule, PyModule, DQMHistComparitorModule, DQMHistAnalysisSVDDoseModule, DQMHistAnalysisPXDFitsModule, DQMHistAnalysisPXDERModule, DQMHistAnalysisInputRootFileModule, DQMHistAnalysisExampleFlagsModule, DQMHistAnalysisEpicsExampleModule, TRGRAWDATAModule, TRGTOPUnpackerModule, TRGTOPDQMModule, KLMTriggerModule, TRGGRLUnpackerModule, TRGGRLDQMModule, TRGGRLProjectsModule, TRGGRLModule, TRGGRLMatchModule, TRGGDLUnpackerModule, TRGGDLSummaryModule, TRGGDLDSTModule, TRGGDLDQMModule, TRGGDLModule, TRGECLUnpackerModule, TRGECLTimingCalModule, TRGECLRawdataAnalysisModule, TRGECLQAMModule, TRGECLDQMModule, TRGECLBGTCHitModule, TRGECLModule, TRGECLFAMModule, MCMatcherTRGECLModule, TRGCDCTSStreamModule, TRGCDCTSFUnpackerModule, TRGCDCTSFDQMModule, TRGCDCT3DUnpackerModule, TRGCDCT3DDQMModule, TRGCDCT3DConverterModule, TRGCDCT2DDQMModule, TRGCDCETFUnpackerModule, TRGCDCModule, CDCTriggerNDFinderModule, CDCTriggerNeuroDQMModule, FindletModule< AFindlet >, FindletModule< TrackFinderAutomaton >, FindletModule< FacetCreator >, FindletModule< CKFToCDCFromEclFindlet >, FindletModule< AxialTrackCreatorMCTruth >, FindletModule< AxialStraightTrackFinder >, FindletModule< CKFToCDCFindlet >, FindletModule< CKFToSVDSeedFindlet >, FindletModule< SegmentLinker >, FindletModule< TrackCreatorSegmentTripleAutomaton >, FindletModule< TrackCreatorSegmentPairAutomaton >, FindletModule< SegmentOrienter >, FindletModule< SegmentCreatorFacetAutomaton >, FindletModule< TrackFinderSegmentTripleAutomaton >, FindletModule< SegmentFinderFacetAutomaton >, FindletModule< CKFToSVDFindlet >, FindletModule< TrackRejecter >, FindletModule< SegmentCreatorMCTruth >, FindletModule< TrackFinderCosmics >, FindletModule< TrackExporter >, FindletModule< SuperClusterCreator >, FindletModule< AsicBackgroundLibraryCreator >, FindletModule< HitBasedT0Extractor >, FindletModule< TrackFinderSegmentPairAutomaton >, FindletModule< ClusterPreparer >, FindletModule< AxialTrackFinderHough >, FindletModule< CosmicsTrackMergerFindlet >, FindletModule< TrackOrienter >, FindletModule< TrackLinker >, FindletModule< vxdHoughTracking::VXDHoughTracking >, FindletModule< TrackFinder >, FindletModule< SegmentPairCreator >, FindletModule< MonopoleAxialTrackFinderLegendre >, FindletModule< HitReclaimer >, FindletModule< ClusterRefiner< BridgingWireHitRelationFilter > >, FindletModule< AxialTrackFinderLegendre >, FindletModule< AxialTrackCreatorSegmentHough >, FindletModule< TrackQualityEstimator >, FindletModule< StereoHitFinder >, FindletModule< CKFToPXDFindlet >, FindletModule< WireHitPreparer >, FindletModule< TrackFlightTimeAdjuster >, FindletModule< TrackCreatorSingleSegments >, FindletModule< SegmentRejecter >, FindletModule< SegmentFitter >, FindletModule< SegmentTripleCreator >, FindletModule< SegmentTrackCombiner >, FindletModule< MCVXDCDCTrackMergerFindlet >, FindletModule< TrackCombiner >, FindletModule< MonopoleStereoHitFinder >, FindletModule< DATCONFPGAFindlet >, FindletModule< WireHitBackgroundDetector >, FindletModule< AxialSegmentPairCreator >, FindletModule< WireHitCreator >, FindletModule< TrackQualityAsserter >, FindletModule< MonopoleStereoHitFinderQuadratic >, FindletModule< ClusterBackgroundDetector >, FindletModule< CDCTrackingEventLevelMdstInfoFillerFindlet >, VXDTFTrainingDataCollectorModule, SectorMapBootstrapModule, NoKickCutsEvalModule, VXDSimpleClusterizerModule, TrackFinderVXDAnalizerModule, SecMapTrainerVXDTFModule, SecMapTrainerBaseModule, V0findingPerformanceEvaluationModule, TrackingPerformanceEvaluationModule, HitXPModule, EffPlotsModule, TrackFinderMCTruthRecoTracksModule, SVDROIFinderModule, SVDROIFinderAnalysisModule, SVDROIDQMModule, SPTCvirtualIPRemoverModule, SPTCmomentumSeedRetrieverModule, RT2SPTCConverterModule, PXDROIFinderModule, MuidModule, MCTrackCandClassifierModule, MCV0MatcherModule, GenfitVisModule, ExtModule, TOPXTalkChargeShareSetterModule, TOPWaveformQualityPlotterModule, TOPWaveformFeatureExtractorModule, TOPUnpackerModule, TOPTimeBaseCalibratorModule, TOPTBCComparatorModule, TOPRawDigitConverterModule, TOPPackerModule, TOPNtupleModule, TOPMCTrackMakerModule, TOPLaserCalibratorModule, TOPInterimFENtupleModule, TOPLaserHitSelectorModule, TOPGainEfficiencyCalculatorModule, TOPDQMModule, TOPDoublePulseGeneratorModule, TOPTriggerDigitizerModule, TOPChannelT0MCModule, TOPBackgroundModule, OpticalGunModule, SVDUnpackerModule, SVDTriggerQualityGeneratorModule, SVD3SamplesEmulatorModule, SVDRecoDigitCreatorModule, SVDDataFormatCheckModule, SVDCoGTimeEstimatorModule, SVDClusterizerModule, SVDShaperDigitsFromTracksModule, SVDPerformanceModule, SVDOccupancyAnalysisModule, SVDClusterFilterModule, SVDClusterEvaluationTrueInfoModule, SVDClusterEvaluationModule, SVDB4CommissioningPlotsModule, SVDPackerModule, svdDumpModule, SVDTimeCalibrationsMonitorModule, SVDPositionErrorScaleFactorImporterModule, SVDLocalCalibrationsMonitorModule, SVDLatencyCalibrationModule, SVDHotStripFinderModule, SVDClusterCalibrationsMonitorModule, SVDBackgroundModule, FullSimModule, PIDNtupleModule, MdstPIDModule, KlongValidationModule, DataWriterModule, EventT0DQMModule, CDCDedxValidationModule, CDCDedxDQMModule, Root2BinaryModule, PrintEventRateModule, PrintDataModule, Convert2RawDetModule, PXDPerformanceModule, PXDClustersFromTracksModule, PXDBackgroundModule, AWESOMEBasicModule, MCMatcherKLMClustersModule, KLMUnpackerModule, KLMReconstructorModule, KLMPackerModule, KLMDQMModule, KLMDigitizerModule, KLMClustersReconstructorModule, KLMClusterEfficiencyModule, EKLMDataCheckerModule, EKLMADCModule, BKLMTrackingModule, BKLMSimHistogrammerModule, BKLMDigitAnalyzerModule, BKLMAnaModule, OverrideGenerationFlagsModule, EvtGenDecayModule, TxModule, RxModule, SeqRootOutputModule, SeqRootInputModule, StatisticsSummaryModule, HistoManagerModule, RandomBarrierModule, EventInfoPrinterModule, SwitchDataStoreModule, SubEventModule, HistoModule, MCMatcherECLClustersModule, ECLWaveformFitModule, ECLUnpackerModule, ECLSplitterN2Module, ECLSplitterN1Module, ECLShowerShapeModule, ECLShowerCorrectorModule, ECLShowerCalibratorModule, ECLPackerModule, ECLLocalRunCalibratorModule, ECLLocalMaximumFinderModule, ECLHitDebugModule, ECLFinalizerModule, ECLDQMEXTENDEDModule, ECLDQMModule, EclDisplayModule, ECLDigitizerPureCsIModule, ECLDigitizerModule, ECLDigitCalibratorModule, ECLDataAnalysisModule, ECLCRFinderModule, ECLCovarianceMatrixModule, ECLClusterPSDModule, ECLChargedPIDDataAnalysisValidationModule, ECLChargedPIDDataAnalysisModule, ECLChargedPIDModule, ECLBackgroundModule, PhysicsObjectsMiraBelleModule, PhysicsObjectsMiraBelleDstModule, PhysicsObjectsMiraBelleDst2Module, PhysicsObjectsDQMModule, IPDQMExpressRecoModule, DQMHistSnapshotsModule, DQMHistDeltaHistoModule, DQMHistAnalysisTRGGDLModule, DQMHistAnalysisTOPModule, DQMHistAnalysisSVDOnMiraBelleModule, DQMHistAnalysisSVDGeneralModule, DQMHistAnalysisSVDEfficiencyModule, DQMHistAnalysisPlotOnlyModule, DQMHistAnalysisOutputRelayMsgModule, DQMHistAnalysisOutputNSMModule, DQMHistAnalysisOutputMonObjModule, DQMHistAnalysisOutputFileModule, DQMHistAnalysisOutputModule, DQMHistAnalysisMonObjModule, DQMHistAnalysisMiraBelleModule, DQMHistAnalysisKLMModule, DQMHistAnalysisInputSrvModule, DQMHistAnalysisInputPVSrvModule, DQMHistAnalysisInputModule, DQMHistAnalysisHLTMonObjModule, DQMHistAnalysisExampleModule, DQMHistAnalysisEventT0Module, DQMHistAnalysisECLModule, DQMHistAnalysisCDCMonObjModule, DQMHistAnalysisCDCDedxModule, DQMHistAnalysisARICHMonObjModule, DQMHistAnalysisARICHModule, HLTDs2ZMQModule, HLTDQM2ZMQModule, CDCUnpackerModule, CDCRecoTrackFilterModule, CDCPackerModule, CDCDQMModule, cdcDQM7Module, CDCCRTestModule, CDCCosmicAnalysisModule, QcsmonitorStudyModule, QcsmonitorDigitizerModule, PlumeDigitizerModule, PindiodeStudyModule, PinDigitizerModule, TPCStudyModule, TpcDigitizerModule, MicrotpcStudyModule, He3tubeStudyModule, He3DigitizerModule, FANGSStudyModule, FANGSDigitizerModule, DosiStudyModule, DosiDigitizerModule, CsIStudyModule, CsiStudy_v2Module, CsiModule, CsIDigitizerModule, CsiDigitizer_v2Module, ClawsStudyModule, ClawsDigitizerModule, ClawStudyModule, ClawDigitizerModule, BgoStudyModule, BgoDigitizerModule, BeamDigitizerModule, BeamabortStudyModule, ReprocessorModule, NtuplePhase1_v6Module, AnalysisPhase1StudyModule, BGOverlayInputModule, BeamBkgTagSetterModule, BeamBkgMixerModule, BeamBkgHitRateMonitorModule, BeamBkgGeneratorModule, BelleMCOutputModule, B2BIIMdstInputModule, B2BIIConvertMdstModule, B2BIIMCParticlesMonitorModule, ARICHUnpackerModule, ARICHRelateModule, ARICHReconstructorModule, ARICHRawUnpackerModule, ARICHRateCalModule, ARICHPackerModule, ARICHNtupleModule, ARICHMCParticlesModule, ARICHFillHitsModule, ARICHDQMModule, ARICHDigitizerModule, arichBtestModule, CurlTaggerModule, CosmicsAlignmentValidationModule, AlignDQMModule, CalibrationCollectorModule, StorageSerializerModule, StorageDeserializerModule, SeqRootMergerModule, PartialSeqRootReaderModule, Ds2RawFileModule, Rbuf2RbufModule, Rbuf2DsModule, RawInputModule, Raw2DsModule, FastRbuf2DsModule, EvReductionModule, Ds2RbufModule, Ds2RawModule, CertifyParallelModule, SerializerModule, Root2RawModule, MonitorDataCOPPERModule, GenRawSendModule, DeSerializerPXDModule, ElapsedTimeModule, ReceiveEventModule, GetEventFromSocketModule, Ds2SampleModule, TrackAnaModule, MonitorDataModule, DqmHistoManagerModule, TxSocketModule, RxSocketModule, DAQPerfModule, SrsensorModule, QcsmonitorModule, PlumeModule, PindiodeModule, Ph1sustrModule, Ph1bpipeModule, MicrotpcModule, He3tubeModule, FANGSModule, DosiModule, CLAWSModule, ClawModule, CaveModule, BgoModule, BeamabortModule, and ARICHBackgroundModule.

Definition at line 166 of file Module.h.

◆ evalCondition()

bool evalCondition ( ) const
inherited

If at least one condition was set, it is evaluated and true returned if at least one condition returns true.

If no condition or result value was defined, the method returns false. Otherwise, the condition is evaluated and true returned, if at least one condition returns true. To speed up the evaluation, the condition strings were already parsed in the method if_value().

Returns
True if at least one condition and return value exists and at least one condition expression was evaluated to true.

Definition at line 96 of file Module.cc.

◆ event()

void event ( void  )
overridevirtual

Actual digitization of all hits in the CDC.

The digitized hits are written into the DataStore.

Reimplemented from Module.

Definition at line 299 of file CDCDigitizerModule.cc.

300 {
301  // Get SimHit array, MCParticle array, and relation between the two.
302  RelationArray mcParticlesToCDCSimHits(m_mcParticles, m_simHits); //RelationArray created by CDC SensitiveDetector
303 
304 
305  //--- Start Digitization --------------------------------------------------------------------------------------------
306  // Merge the hits in the same cell and save them into CDC signal map.
307 
308  // Define signal map
309  map<WireID, SignalInfo> signalMap;
310  map<WireID, SignalInfo>::iterator iterSignalMap;
311  // Define adc map
312  map<WireID, unsigned short> adcMap;
313  map<WireID, unsigned short>::iterator iterADCMap;
314  // map<WireID, double> adcMap;
315  // map<WireID, double>::iterator iterADCMap;
316 
317  // signal map for trigger
318  map<pair<WireID, unsigned>, SignalInfo> signalMapTrg;
319  map<pair<WireID, unsigned>, SignalInfo>::iterator iterSignalMapTrg;
320 
321  // Set time window per event
322  if (m_tSimMode == 0 || m_tSimMode == 1) {
323  int trigBin = 0;
324  if (m_simClockState.isValid()) {
325  trigBin = m_simClockState->getCDCTriggerBin(m_offsetForTriggerBin);
326  } else {
327  if (m_tSimMode == 0) {
328  B2DEBUG(m_debugLevel, "SimClockState unavailable so switched the mode from synchro to random.");
329  m_tSimMode = 1;
330  }
331  trigBin = gRandom->Integer(4);
332  }
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);
336 
337  //TODO: simplify the following 7 lines and setFEElectronics()
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;
344  }
345  }
346 
347  // Set trigger timing jitter for this event
348  double trigTiming = m_trigTimeJitter == 0. ? 0. : m_trigTimeJitter * (gRandom->Uniform() - 0.5);
349  // std::cout << "trigTiming= " << trigTiming << std::endl;
350  // Loop over all hits
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) {
354  // Get a hit
355  m_aCDCSimHit = m_simHits[iHits];
356 
357  // Hit geom. info
359  // B2DEBUG(29, "Encoded wire number of current CDCSimHit: " << m_wireID);
360 
363  // B2DEBUG(29, "m_boardID= " << m_boardID);
370 
371  //include alignment effects
372  //basically align flag should be always on since on/off is controlled by the input alignment.xml file itself.
373  m_align = true;
374 
375  TVector3 bwpAlign = m_cdcgp->wireBackwardPosition(m_wireID, CDCGeometryPar::c_Aligned);
376  TVector3 fwpAlign = m_cdcgp->wireForwardPosition(m_wireID, CDCGeometryPar::c_Aligned);
377 
378  TVector3 bwp = m_cdcgp->wireBackwardPosition(m_wireID);
379  TVector3 fwp = m_cdcgp->wireForwardPosition(m_wireID);
380 
381  //skip correction for wire-position alignment if unnecessary
382  if ((bwpAlign - bwp).Mag() == 0. && (fwpAlign - fwp).Mag() == 0.) m_align = false;
383  // std::cout << "a m_align= " << m_align << std::endl;
384 
385  if (m_align || m_correctForWireSag) {
386 
387  bwp = bwpAlign;
388  fwp = fwpAlign;
389 
390  if (m_correctForWireSag) {
391  double zpos = m_posWire.z();
392  double bckYSag = bwp.y();
393  double forYSag = fwp.y();
394 
395  // CDCGeometryPar::EWirePosition set = m_align ?
396  // CDCGeometryPar::c_Aligned : CDCGeometryPar::c_Base;
397  CDCGeometryPar::EWirePosition set = CDCGeometryPar::c_Aligned;
398  const int layerID = m_wireID.getICLayer();
399  const int wireID = m_wireID.getIWire();
400  m_cdcgp->getWireSagEffect(set, layerID, wireID, zpos, bckYSag, forYSag);
401  bwp.SetY(bckYSag);
402  fwp.SetY(forYSag);
403  }
404 
405  const TVector3 L = 5. * m_momentum.Unit(); //(cm) tentative
406  TVector3 posIn = m_posTrack - L;
407  TVector3 posOut = m_posTrack + L;
408  TVector3 posTrack = m_posTrack;
409  TVector3 posWire = m_posWire;
410 
411  // m_driftLength = m_cdcgp->ClosestApproach(bwp, fwp, posIn, posOut, posTrack, posWire);
412  m_driftLength = ClosestApproach(bwp, fwp, posIn, posOut, posTrack, posWire);
413  // std::cout << "base-dl, sag-dl, diff= " << m_aCDCSimHit->getDriftLength() <<" "<< m_driftLength <<" "<< m_driftLength - m_aCDCSimHit->getDriftLength() << std::endl;
414  m_posTrack = posTrack;
415  m_posWire = posWire;
416 
417  double deltaTime = 0.; //tentative (probably ok...)
418  // double deltaTime = (posTrack - m_posTrack).Mag() / speed;
419  m_flightTime += deltaTime;
420  m_globalTime += deltaTime;
422  }
423 
424  // Calculate measurement time.
425  // Smear drift length
426  double hitDriftLength = m_driftLength;
427  double dDdt = getdDdt(hitDriftLength);
428  if (m_doSmearing) {
429  hitDriftLength = smearDriftLength(hitDriftLength, dDdt);
430  }
431 
432  //set flags
433  bool addTof = m_addTimeOfFlight4Bg;
434  bool addDelay = m_addInWirePropagationDelay4Bg;
435  if (m_aCDCSimHit->getBackgroundTag() == 0) {
436  addTof = m_addTimeOfFlight;
437  addDelay = m_addInWirePropagationDelay;
438  }
439  double hitDriftTime = getDriftTime(hitDriftLength, addTof, addDelay);
440 
441  //add randamized event time for a beam bg. hit
442  if (m_aCDCSimHit->getBackgroundTag() != 0) {
443  hitDriftTime += m_globalTime - m_flightTime;
444  }
445 
446  //add trigger timing jitter
447  hitDriftTime += trigTiming;
448 
449  //apply time window cut
450  double tMin = m_tMin;
451  double tMax = m_tMaxOuter;
452  if (m_wireID.getISuperLayer() == 0) tMax = m_tMaxInner;
453  if (m_tSimMode <= 2) {
456  }
457  if (hitDriftTime < tMin || hitDriftTime > tMax) continue;
458 
459  //Sum ADC count
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) { // for non wire-by-wire mode
464  static EDepInGas& edpg = EDepInGas::getInstance();
465  hitdE = edpg.getEDepInGas(m_eDepInGasMode, m_aCDCSimHit->getPDGCode(), m_momentum.Mag(), stepLength, hitdE);
466  }
467 
468  double convFactorForThreshold = 1;
469  //TODO: modify the following function so that it can output timing signal in Volt in future
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;
473  // B2DEBUG(29, "adcTh,adcCount,convFactorForThreshold= " << adcTh <<" "<< adcCount <<" "<< convFactorForThreshold);
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));
478  // adcMap.insert(make_pair(m_wireID, hitdE));
479  } else {
480  iterADCMap->second += adcCount;
481  // iterADCMap->second += hitdE;
482  }
483 
484  //Apply energy threshold
485  // If hitdE < dEThreshold, the hit is ignored
486  // M. Uchida 2012.08.31
487  double dEThreshold = 0.;
489  dEThreshold = m_tdcThresh[m_boardID] / convFactorForThreshold * Unit::keV;
490  } else {
492  dEThreshold *= Unit::eV;
493  }
494  B2DEBUG(m_debugLevel, "hitdE,dEThreshold,driftLength " << hitdE << " " << dEThreshold << " " << hitDriftLength);
495 
496  if (hitdE < dEThreshold) {
497  B2DEBUG(m_debugLevel, "Below Ethreshold: " << hitdE << " " << dEThreshold);
498  continue;
499  }
500 
501  // add one hit per trigger time window to the trigger signal map
502  unsigned short trigWindow = floor((hitDriftTime - tMin) * m_tdcBinWidthInv / 32);
503  iterSignalMapTrg = signalMapTrg.find(make_pair(m_wireID, trigWindow));
504  if (iterSignalMapTrg == signalMapTrg.end()) {
505  // signalMapTrg.insert(make_pair(make_pair(m_wireID, trigWindow),
506  // SignalInfo(iHits, hitDriftTime, hitdE)));
507  signalMapTrg.insert(make_pair(make_pair(m_wireID, trigWindow),
508  SignalInfo(iHits, hitDriftTime, adcCount)));
509  } else {
510  if (hitDriftTime < iterSignalMapTrg->second.m_driftTime) {
511  iterSignalMapTrg->second.m_driftTime = hitDriftTime;
512  iterSignalMapTrg->second.m_simHitIndex = iHits;
513  }
514  // iterSignalMapTrg->second.m_charge += hitdE;
515  iterSignalMapTrg->second.m_charge += adcCount;
516  }
517 
518  // Reject totally-dead wire; to be replaced by isDeadWire() in future
519  // N.B. The following lines for badwire must be after the above lines for trigger becuse badwires are different between trigger and tracking.
520  // Badwires for trigger are taken into account separately in the tsim module
521  if (m_cdcgp->isBadWire(m_wireID)) {
522  // std::cout<<"badwire= " << m_wireID.getICLayer() <<" "<< m_wireID.getIWire() << std::endl;
523  continue;
524  }
525  // Reject partly-dead wire as well
526  double eff = 1.;
527  if (m_cdcgp->isDeadWire(m_wireID, eff)) {
528  // std::cout << "wid,eff= " << m_wireID << " " << eff << std::endl;
529  if (eff < gRandom->Uniform()) continue;
530  }
531 
532  // For TOT simulation, calculate drift length from In to the wire, and Out to the wire. The calculation is apprximate ignoring wire sag (this would be ok because TOT simulation is not required to be so accurate).
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;
541 
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);
547 
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);
553 
554  const double maxDriftL = std::max(driftLFromIn, driftLFromOut);
555  const double minDriftL = m_driftLength;
556  B2DEBUG(m_debugLevel, "driftLFromIn= " << driftLFromIn << " driftLFromOut= " << driftLFromOut << " minDriftL= " << minDriftL <<
557  " maxDriftL= "
558  <<
559  maxDriftL << "m_driftLength= " << m_driftLength);
560 
561  iterSignalMap = signalMap.find(m_wireID);
562 
563  if (iterSignalMap == signalMap.end()) {
564  // new entry
565  // signalMap.insert(make_pair(m_wireID, SignalInfo(iHits, hitDriftTime, hitdE)));
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);
568  } else {
569  // ... smallest drift time has to be checked, ...
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;
586  }
587  // ... total charge has to be updated.
588  // iterSignalMap->second.m_charge += hitdE;
589  iterSignalMap->second.m_charge += adcCount;
590 
591  // set max and min driftLs
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);
596  }
597 
598  } // end loop over SimHits.
599 
600  //--- Now Store the results into CDCHits and
601  // create corresponding relations between SimHits and CDCHits.
602 
603  unsigned int iCDCHits = 0;
604  RelationArray cdcSimHitsToCDCHits(m_simHits, m_cdcHits); //SimHit<->CDCHit
605  RelationArray mcParticlesToCDCHits(m_mcParticles, m_cdcHits); //MCParticle<->CDCHit
606 
607  for (iterSignalMap = signalMap.begin(); iterSignalMap != signalMap.end(); ++iterSignalMap) {
608 
609  //add time-walk (here for simplicity)
610  // unsigned short adcCount = getADCCount(iterSignalMap->second.m_charge);
611  // unsigned short adcCount = iterSignalMap->second.m_charge;
612  iterADCMap = adcMap.find(iterSignalMap->first);
613  unsigned short adcCount = iterADCMap != adcMap.end() ? iterADCMap->second : 0;
614  /*
615  unsigned short adcCount = 0;
616  if (iterADCMap != adcMap.end()) {
617  adcCount = getADCCount(iterSignalMap->first, iterADCMap->second, 1., 0.);
618  unsigned short boardID = m_cdcgp->getBoardID(iterSignalMap->first);
619  // B2DEBUG(29, "boardID= " << boardID);
620  const unsigned short adcTh = m_useDB4FEE ? m_adcThresh[boardID] : m_adcThreshold;
621  if (adcCount < adcTh) adcCount = 0;
622  }
623  */
624 
625  if (m_addTimeWalk) {
626  B2DEBUG(m_debugLevel, "timewalk= " << m_cdcgp->getTimeWalk(iterSignalMap->first, adcCount));
627  iterSignalMap->second.m_driftTime += m_cdcgp->getTimeWalk(iterSignalMap->first, adcCount);
628  }
629 
630  //remove negative drift time (TDC) upon request
632  iterSignalMap->second.m_driftTime < 0.) {
633  continue;
634  }
635 
636  //N.B. No bias (+ or -0.5 count) is introduced on average in digitization by the real TDC (info. from KEK electronics division). So round off (t0 - drifttime) below.
637  unsigned short tdcCount = static_cast<unsigned short>((getPositiveT0(iterSignalMap->first) - iterSignalMap->second.m_driftTime) *
638  m_tdcBinWidthInv + 0.5);
639 
640  //calculate tot; hard-coded currently
641  double deltaDL = iterSignalMap->second.m_maxDriftL - iterSignalMap->second.m_minDriftL;
642  if (deltaDL < 0.) {
643  B2DEBUG(m_debugLevel, "negative deltaDL= " << deltaDL);
644  deltaDL = 0.;
645  }
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]));
650  }
651 
652  CDCHit* firstHit = m_cdcHits.appendNew(tdcCount, adcCount, iterSignalMap->first, 0, tot);
653  // std::cout <<"firsthit?= " << firstHit->is2ndHit() << std::endl;
654  //set a relation: CDCSimHit -> CDCHit
655  cdcSimHitsToCDCHits.add(iterSignalMap->second.m_simHitIndex, iCDCHits);
656 
657  //set a relation: MCParticle -> CDCHit
658  RelationVector<MCParticle> rels = m_simHits[iterSignalMap->second.m_simHitIndex]->getRelationsFrom<MCParticle>();
659  if (rels.size() != 0) {
660  //assumption: only one MCParticle
661  const MCParticle* mcparticle = rels[0];
662  double weight = rels.weight(0);
663  mcparticle->addRelationTo(firstHit, weight);
664  }
665 
666  //Set 2nd-hit related things if it exists
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);
672  secondHit->set2ndHitFlag();
673  secondHit->setOtherHitIndices(firstHit);
674  // std::cout <<"2ndhit?= " << secondHit->is2ndHit() << std::endl;
675  // std::cout <<"1st-otherhitindex= " << firstHit->getOtherHitIndex() << std::endl;
676  // std::cout <<"2nd-otherhitindex= " << secondHit->getOtherHitIndex() << std::endl;
677  // secondHit->setOtherHitIndex(firstHit->getArrayIndex());
678  // firstHit->setOtherHitIndex(secondHit->getArrayIndex());
679  // std::cout <<"1st-otherhitindex= " << firstHit->getOtherHitIndex() << std::endl;
680  // std::cout <<"2nd-otherhitindex= " << secondHit->getOtherHitIndex() << std::endl;
681 
682  //set a relation: CDCSimHit -> CDCHit
683  ++iCDCHits;
684  cdcSimHitsToCDCHits.add(iterSignalMap->second.m_simHitIndex2, iCDCHits);
685  // std::cout << "settdc2 " << firstHit->getTDCCount() << " " << secondHit->getTDCCount() << std::endl;
686 
687  //set a relation: MCParticle -> CDCHit
688  rels = m_simHits[iterSignalMap->second.m_simHitIndex2]->getRelationsFrom<MCParticle>();
689  if (rels.size() != 0) {
690  //assumption: only one MCParticle
691  const MCParticle* mcparticle = rels[0];
692  double weight = rels.weight(0);
693  mcparticle->addRelationTo(secondHit, weight);
694  }
695  } else { //Check the 3rd hit when tdcCount = tdcCount2
696  // std::cout << "tdcCount1=2" << std::endl;
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);
700  // std::cout << "tdcCount3= " << tdcCount3 << " " << tdcCount << std::endl;
701  if (tdcCount3 != tdcCount) {
702  CDCHit* secondHit = m_cdcHits.appendNew(tdcCount3, adcCount, iterSignalMap->first, 0, tot);
703  secondHit->set2ndHitFlag();
704  secondHit->setOtherHitIndices(firstHit);
705  // secondHit->setOtherHitIndex(firstHit->getArrayIndex());
706  // firstHit->setOtherHitIndex(secondHit->getArrayIndex());
707  // std::cout <<"2ndhit?= " << secondHit->is2ndHit() << std::endl;
708 
709  //set a relation: CDCSimHit -> CDCHit
710  ++iCDCHits;
711  cdcSimHitsToCDCHits.add(iterSignalMap->second.m_simHitIndex3, iCDCHits);
712  // std::cout << "settdc3 " << firstHit->getTDCCount() << " " << secondHit->getTDCCount() << std::endl;
713 
714  //set a relation: MCParticle -> CDCHit
715  rels = m_simHits[iterSignalMap->second.m_simHitIndex3]->getRelationsFrom<MCParticle>();
716  if (rels.size() != 0) {
717  //assumption: only one MCParticle
718  const MCParticle* mcparticle = rels[0];
719  double weight = rels.weight(0);
720  mcparticle->addRelationTo(secondHit, weight);
721  }
722  }
723  }
724  } //end of checking tdcCount 1=2 ?
725  } //end of 2nd hit setting
726 
727  // std::cout <<"t0= " << m_cdcgp->getT0(iterSignalMap->first) << std::endl;
728  /* unsigned short tdcInCommonStop = static_cast<unsigned short>((m_tdcOffset - iterSignalMap->second.m_driftTime) * m_tdcBinWidthInv);
729  float driftTimeFromTDC = static_cast<float>(m_tdcOffset - (tdcInCommonStop + 0.5)) * m_tdcBinWidth;
730  std::cout <<"driftT bf digitization, TDC in common stop, digitized driftT = " << iterSignalMap->second.m_driftTime <<" "<< tdcInCommonStop <<" "<< driftTimeFromTDC << std::endl;
731  */
732  ++iCDCHits;
733  }
734 
735  //Add crosstalk
736  if (m_addXTalk) addXTalk();
737 
738  // Store the results with trigger time window in a separate array
739  // with corresponding relations.
740  for (iterSignalMapTrg = signalMapTrg.begin(); iterSignalMapTrg != signalMapTrg.end(); ++iterSignalMapTrg) {
741  /*
742  unsigned short adcCount = getADCCount(iterSignalMapTrg->first.first, iterSignalMapTrg->second.m_charge, 1., 0.);
743  unsigned short boardID = m_cdcgp->getBoardID(iterSignalMapTrg->first.first);
744  // B2DEBUG(29, "boardID= " << boardID);
745  const unsigned short adcTh = m_useDB4FEE ? m_adcThresh[boardID] : m_adcThreshold;
746  if (adcCount < adcTh) adcCount = 0;
747  */
748  // unsigned short adcCount = getADCCount(iterSignalMapTrg->second.m_charge);
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);
754 
755  // relations
756  m_simHits[iterSignalMapTrg->second.m_simHitIndex]->addRelationTo(cdcHit);
757  RelationVector<MCParticle> rels = m_simHits[iterSignalMapTrg->second.m_simHitIndex]->getRelationsFrom<MCParticle>();
758  if (rels.size() != 0) {
759  //assumption: only one MCParticle
760  const MCParticle* mcparticle = rels[0];
761  double weight = rels.weight(0);
762  mcparticle->addRelationTo(cdcHit, weight);
763  }
764  }
765 
766  /*
767  std::cout << " " << std::endl;
768  RelationIndex<MCParticle, CDCHit> mcp_to_hit(mcParticles, cdcHits);
769  if (!mcp_to_hit) B2FATAL("No MCParticle -> CDCHit relation founf!");
770  typedef RelationIndex<MCParticle, CDCHit>::Element RelationElement;
771  int ncdcHits = cdcHits.getEntries();
772  for (int j = 0; j < ncdcHits; ++j) {
773  for (const RelationElement& rel : mcp_to_hit.getElementsTo(cdcHits[j])) {
774  std::cout << j << " " << cdcHits[j]->is2ndHit() <<" "<< rel.from->getIndex() << " " << rel.weight << std::endl;
775  }
776  }
777  */
778 }
double m_tdcThreshold4Inner
TDC threshold for inner layers in unit of eV.
unsigned short m_boardID
FEE board ID.
int m_eDepInGasMode
Mode for extracting dE(gas) from dE(gas+wire)
double m_tMaxInner
Upper edge of time window in ns for the inner layers.
double getdDdt(double driftLength)
The method to get dD/dt.
bool m_outputNegativeDriftTime
A switch to output negative drift time to CDCHit.
TVector3 m_momentum
3-momentum of this hit
void makeSignalsAfterShapers(const WireID &wid, double edep, double dx, double costh, unsigned short &adcCount, double &convFactorForThreshold)
Function to make signals after shapers.
int m_trgTimingOffsetInCount
Trigger timing offset in unit of count.
bool m_addInWirePropagationDelay4Bg
A switch used to control adding propagation delay into the total drift time or not for beam bg.
double m_tdcBinWidthInv
m_tdcBinWidth^-1 (in ns^-1)
double m_tMin
Lower edge of time window in ns.
bool m_output2ndHit
A switch to output 2nd hit.
int m_adcThreshold
Threshold for ADC in unit of count.
bool m_addTimeOfFlight
A switch used to control adding time of flight into the total drift time or not.
TVector3 m_posTrack
track position of this hit
double m_trigTimeJitter
Magnitude of trigger timing jitter (ns).
double smearDriftLength(double driftLength, double dDdt)
Method used to smear the drift length.
float m_lowEdgeOfTimeWindow[nBoards]
Lower edge of time-window.
bool m_addInWirePropagationDelay
A switch used to control adding propagation delay into the total drift time or not.
bool m_align
A switch to control alignment.
double m_globalTime
global time of this hit
bool m_doSmearing
A switch to control drift length smearing.
bool m_addTimeOfFlight4Bg
A switch used to control adding time of flight into the total drift time or not for beam bg.
bool m_addXTalk
Flag to switch on/off crosstalk.
bool m_addTimeWalk
A switch used to control adding time-walk delay into the total drift time or not.
float m_uprEdgeOfTimeWindow[nBoards]
Upper edge of time-window.
bool m_useDB4EDepToADC
Fetch edep-to-ADC conversion params.
int m_offsetForTriggerBin
Input to getCDCTriggerBin(offset)
double m_driftLength
drift length of this hit
float m_tdcThresh[nBoards]
Threshold for timing-signal.
int m_tSimMode
Timing simulation mode.
bool m_useDB4FEE
Fetch FEE params from DB.
StoreArray< CDCSimHit > m_simHits
CDCSimHit array.
unsigned short m_widthOfTimeWindowInCount[nBoards]
Width of time window.
StoreArray< CDCHit > m_cdcHits4Trg
CDCHit4trg array.
CDCSimHit * m_aCDCSimHit
Pointer to CDCSimHit.
WireID m_wireID
WireID of this hit.
double getPositiveT0(const WireID &)
Modify t0 for negative-t0 case.
double m_tdcThreshold4Outer
TDC threshold for outer layers in unit of eV.
int m_shiftOfTimeWindowIn32Count
Shift of time window for synchronization in 32count.
unsigned short m_posFlag
left or right flag of this hit
StoreArray< CDCHit > m_cdcHits
CDCHit array.
unsigned short m_trgDelayInCount[nBoards]
Trigger delay in frontend electronics in count.
TVector3 m_posWire
wire position of this hit
double getDriftTime(double driftLength, bool addTof, bool addDelay)
The method to get drift time based on drift length.
StoreArray< MCParticle > m_mcParticles
Set edep-to-ADC conversion params.
double m_tMaxOuter
Upper edge of time window in ns for the outer layers.
float m_adcThresh[nBoards]
Threshold for FADC.
CDC::CDCGeometryPar * m_cdcgp
Cached Pointer to CDCGeometryPar.
double m_tdcBinWidth
Width of a TDC bin (in ns)
bool m_correctForWireSag
A switch to control wire sag.
StoreObjPtr< SimClockState > m_simClockState
generated hardware clock state
double m_flightTime
flight time of this hit
Class containing the result of the unpacker in raw data and the result of the digitizer in simulation...
Definition: CDCHit.h:40
void set2ndHitFlag()
Setter for 2nd hit flag.
Definition: CDCHit.h:113
void setOtherHitIndices(CDCHit *otherHit)
Setter for the other hit indices.
Definition: CDCHit.h:147
int getPDGCode() const
The method to get PDG code.
Definition: CDCSimHit.h:184
double getStepLength() const
The method to get step length.
Definition: CDCSimHit.h:196
TVector3 getPosWire() const
The method to get position on wire.
Definition: CDCSimHit.h:205
double getFlightTime() const
The method to get flight time.
Definition: CDCSimHit.h:190
float getGlobalTime() const override
The method to get global time.
Definition: CDCSimHit.h:254
WireID getWireID() const
Getter for WireID object.
Definition: CDCSimHit.h:178
double getEnergyDep() const
The method to get deposited energy.
Definition: CDCSimHit.h:193
TVector3 getMomentum() const
The method to get momentum.
Definition: CDCSimHit.h:199
double getDriftLength() const
The method to get drift length.
Definition: CDCSimHit.h:187
TVector3 getPosIn() const
The method to get position of pre-step.
Definition: CDCSimHit.h:211
int getLeftRightPassageRaw() const
The method to get new left/right info. for digitization.
Definition: CDCSimHit.h:235
TVector3 getPosTrack() const
The method to get position on the track.
Definition: CDCSimHit.h:223
TVector3 getPosOut() const
The method to get position of post-step.
Definition: CDCSimHit.h:217
double getTimeWalk(const WireID &wID, unsigned short adcCount) const
Returns time-walk.
unsigned short getBoardID(const WireID &wID) const
Returns frontend board id. corresponding to the wire id.
EWirePosition
Wire position set.
const TVector3 wireBackwardPosition(int layerId, int cellId, EWirePosition set=c_Base) const
Returns the backward position of the input sense wire.
unsigned short getNewLeftRightRaw(const TVector3 &posOnWire, const TVector3 &posOnTrack, const TVector3 &momentum) const
Returns new left/right_raw.
void getWireSagEffect(EWirePosition set, unsigned layerID, unsigned cellID, double zw, double &ywb_sag, double &ywf_sag) const
Compute effects of the sense wire sag.
const TVector3 wireForwardPosition(int layerId, int cellId, EWirePosition set=c_Base) const
Returns the forward position of the input sense wire.
bool isDeadWire(const WireID &wid, double &eff)
Inquire if the wire is dead.
bool isBadWire(const WireID &wid)
Inquire if the wire is totally-dead.
int getMaterialDefinitionMode() const
Return mode for material definition.
The Class for Energy deposit in the gas.
Definition: EDepInGas.h:20
static EDepInGas & getInstance()
Static method to get a reference to the EDepInGas instance.
Definition: EDepInGas.cc:23
double getEDepInGas(int mode, int pdg, double p, double dx, double e3) const
Return the energy deosite in the gas.
Definition: EDepInGas.cc:137
A Class to store the Monte Carlo particle information.
Definition: MCParticle.h:32
Low-level class to create/modify relations between StoreArrays.
Definition: RelationArray.h:62
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).
virtual unsigned short getBackgroundTag() const
Get background tag.
Definition: SimHitBase.h:46
static const double keV
[kiloelectronvolt]
Definition: Unit.h:113
static const double eV
[electronvolt]
Definition: Unit.h:112
static const double cm
Standard units with the value = 1.
Definition: Unit.h:47
unsigned short getICLayer() const
Getter for continuous layer numbering.
Definition: WireID.cc:24
unsigned short getIWire() const
Getter for wire within the layer.
Definition: WireID.h:145
unsigned short getISuperLayer() const
Getter for Super-Layer.
Definition: WireID.h:130
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.

◆ getAfterConditionPath()

Module::EAfterConditionPath getAfterConditionPath ( ) const
inherited

What to do after the conditional path is finished.

(defaults to c_End if no condition is set)

Definition at line 133 of file Module.cc.

◆ getConditionPath()

std::shared_ptr< Path > getConditionPath ( ) const
inherited

Returns the path of the last true condition (if there is at least one, else reaturn a null pointer).


Definition at line 113 of file Module.cc.

◆ getdDdt()

double getdDdt ( double  driftLength)
private

The method to get dD/dt.

In this method, X-T function will be used to calculate dD/dt (drift velocity).

Parameters
driftLengthThe value of drift length.
Returns
dDdt.

Definition at line 825 of file CDCDigitizerModule.cc.

◆ getDriftTime()

double getDriftTime ( double  driftLength,
bool  addTof,
bool  addDelay 
)
private

The method to get drift time based on drift length.

In this method, X-T function will be used to calculate drift time.

Parameters
driftLengthThe value of drift length.
addTofSwitch for adding time of flight.
addDelaySwitch for adding signal propagation delay in the wire.
Returns
Drift time.

Definition at line 871 of file CDCDigitizerModule.cc.

◆ getFileNames()

virtual std::vector<std::string> getFileNames ( bool  outputFiles)
inlinevirtualinherited

Return a list of output filenames for this modules.

This will be called when basf2 is run with "--dry-run" if the module has set either the c_Input or c_Output properties.

If the parameter outputFiles is false (for modules with c_Input) the list of input filenames should be returned (if any). If outputFiles is true (for modules with c_Output) the list of output files should be returned (if any).

If a module has sat both properties this member is called twice, once for each property.

The module should return the actual list of requested input or produced output filenames (including handling of input/output overrides) so that the grid system can handle input/output files correctly.

This function should return the same value when called multiple times. This is especially important when taking the input/output overrides from Environment as they get consumed when obtained so the finalized list of output files should be stored for subsequent calls.

Reimplemented in RootOutputModule, and RootInputModule.

Definition at line 134 of file Module.h.

◆ getName()

const std::string& getName ( ) const
inlineinherited

Returns the name of the module.

This can be changed via e.g. set_name() in the steering file to give more useful names if there is more than one module of the same type.

For identifying the type of a module, using getType() (or type() in Python) is recommended.

Definition at line 187 of file Module.h.

◆ getParamInfoListPython()

std::shared_ptr< boost::python::list > getParamInfoListPython ( ) const
inherited

Returns a python list of all parameters.

Each item in the list consists of the name of the parameter, a string describing its type, a python list of all default values and the description of the parameter.

Returns
A python list containing the parameters of this parameter list.

Definition at line 279 of file Module.cc.

◆ getReturnValue()

int getReturnValue ( ) const
inlineinherited

Return the return value set by this module.

This value is only meaningful if hasReturnValue() is true

Definition at line 381 of file Module.h.

◆ getSemiTotalGain() [1/2]

double getSemiTotalGain ( const WireID wireID) const
inlineprivate

Return semi-total gain of the specified wire.

Parameters
wireIDWire id.
Returns
gain

Definition at line 161 of file CDCDigitizerModule.h.

162  {
163  return m_semiTotalGain[wireID.getICLayer()][wireID.getIWire()];
164  }
float m_semiTotalGain[MAX_N_SLAYERS][MAX_N_SCELLS]
total gain per wire

◆ getSemiTotalGain() [2/2]

double getSemiTotalGain ( int  clayer,
int  cell 
) const
inlineprivate

Return semi-total gain of the specified wire.

Parameters
clayerlayer no. (0-56)
cellcell no.
Returns
gain

Definition at line 151 of file CDCDigitizerModule.h.

◆ getType()

const std::string & getType ( ) const
inherited

Returns the type of the module (i.e.

class name minus 'Module')

Definition at line 41 of file Module.cc.

◆ hasProperties()

bool hasProperties ( unsigned int  propertyFlags) const
inherited

Returns true if all specified property flags are available in this module.

Parameters
propertyFlagsOred EModulePropFlags which should be compared with the module flags.

Definition at line 160 of file Module.cc.

◆ if_false()

void if_false ( const std::shared_ptr< Path > &  path,
EAfterConditionPath  afterConditionPath = EAfterConditionPath::c_End 
)
inherited

A simplified version to add a condition to the module.

Please note that successive calls of this function will add more than one condition to the module. If more than one condition results in true, only the last of them will be used.

Please be careful: Avoid creating cyclic paths, e.g. by linking a condition to a path which is processed before the path where this module is located in.

It is equivalent to the if_value() method, using the expression "<1". This method is meant to be used together with the setReturnValue(bool value) method.

Parameters
pathShared pointer to the Path which will be executed if the return value is false.
afterConditionPathWhat to do after executing 'path'.

Definition at line 85 of file Module.cc.

◆ if_true()

void if_true ( const std::shared_ptr< Path > &  path,
EAfterConditionPath  afterConditionPath = EAfterConditionPath::c_End 
)
inherited

A simplified version to set the condition of the module.

Please note that successive calls of this function will add more than one condition to the module. If more than one condition results in true, only the last of them will be used.

Please be careful: Avoid creating cyclic paths, e.g. by linking a condition to a path which is processed before the path where this module is located in.

It is equivalent to the if_value() method, using the expression ">=1". This method is meant to be used together with the setReturnValue(bool value) method.

Parameters
pathShared pointer to the Path which will be executed if the return value is true.
afterConditionPathWhat to do after executing 'path'.

Definition at line 90 of file Module.cc.

◆ if_value()

void if_value ( const std::string &  expression,
const std::shared_ptr< Path > &  path,
EAfterConditionPath  afterConditionPath = EAfterConditionPath::c_End 
)
inherited

Add a condition to the module.

Please note that successive calls of this function will add more than one condition to the module. If more than one condition results in true, only the last of them will be used.

See https://confluence.desy.de/display/BI/Software+ModCondTut or ModuleCondition for a description of the syntax.

Please be careful: Avoid creating cyclic paths, e.g. by linking a condition to a path which is processed before the path where this module is located in.

Parameters
expressionThe expression of the condition.
pathShared pointer to the Path which will be executed if the condition is evaluated to true.
afterConditionPathWhat to do after executing 'path'.

Definition at line 79 of file Module.cc.

◆ makeSignalsAfterShapers()

void makeSignalsAfterShapers ( const WireID wid,
double  edep,
double  dx,
double  costh,
unsigned short &  adcCount,
double &  convFactorForThreshold 
)
private

Function to make signals after shapers.

Parameters
widwire id.
edepenergy deposit (GeV).
dxstep length (cm).
costhcos(theta) of particle.
adcCountADC-count.
convFactorForThresholdconversin factor needed for threshold setting.
Returns
ADC-count and conversion factor for threshold.

Definition at line 937 of file CDCDigitizerModule.cc.

◆ Polya()

double Polya ( double  xmax = 10)
private

Generate randum number according to Polya distribution.

Parameters
xmaxmax of no. generated
Returns
randum no.

Definition at line 994 of file CDCDigitizerModule.cc.

◆ setDescription()

void setDescription ( const std::string &  description)
protectedinherited

Sets the description of the module.

Parameters
descriptionA description of the module.

Definition at line 214 of file Module.cc.

◆ setLogInfo()

void setLogInfo ( int  logLevel,
unsigned int  logInfo 
)
inherited

Configure the printed log information for the given level.

Parameters
logLevelThe log level (one of LogConfig::ELogLevel)
logInfoWhat kind of info should be printed? ORed combination of LogConfig::ELogInfo flags.

Definition at line 73 of file Module.cc.

◆ setName()

void setName ( const std::string &  name)
inlineinherited

Set the name of the module.

Note
The module name is set when using the REG_MODULE macro, but the module can be renamed before calling process() using the set_name() function in your steering file.
Parameters
nameThe name of the module

Definition at line 214 of file Module.h.

◆ setParamPython()

void setParamPython ( const std::string &  name,
const boost::python::object &  pyObj 
)
privateinherited

Implements a method for setting boost::python objects.

The method supports the following types: list, dict, int, double, string, bool The conversion of the python object to the C++ type and the final storage of the parameter value is done in the ModuleParam class.

Parameters
nameThe unique name of the parameter.
pyObjThe object which should be converted and stored as the parameter value.

Definition at line 234 of file Module.cc.

◆ setParamPythonDict()

void setParamPythonDict ( const boost::python::dict &  dictionary)
privateinherited

Implements a method for reading the parameter values from a boost::python dictionary.

The key of the dictionary has to be the name of the parameter and the value has to be of one of the supported parameter types.

Parameters
dictionaryThe python dictionary from which the parameter values are read.

Definition at line 249 of file Module.cc.

◆ setPropertyFlags()

void setPropertyFlags ( unsigned int  propertyFlags)
inherited

Sets the flags for the module properties.

Parameters
propertyFlagsbitwise OR of EModulePropFlags

Definition at line 208 of file Module.cc.

◆ setReturnValue() [1/2]

void setReturnValue ( bool  value)
protectedinherited

Sets the return value for this module as bool.

The bool value is saved as an integer with the convention 1 meaning true and 0 meaning false. The value can be used in the steering file to divide the analysis chain into several paths.

Parameters
valueThe value of the return value.

Definition at line 227 of file Module.cc.

◆ setReturnValue() [2/2]

void setReturnValue ( int  value)
protectedinherited

Sets the return value for this module as integer.

The value can be used in the steering file to divide the analysis chain into several paths.

Parameters
valueThe value of the return value.

Definition at line 220 of file Module.cc.

◆ setType()

void setType ( const std::string &  type)
protectedinherited

Set the module type.

Only for use by internal modules (which don't use the normal REG_MODULE mechanism).

Definition at line 48 of file Module.cc.

◆ smearDriftLength()

double smearDriftLength ( double  driftLength,
double  dDdt 
)
private

Method used to smear the drift length.

Parameters
driftLengthThe value of drift length.
dDdtdD/dt (drift velocity).
Returns
Drift length after smearing.

Definition at line 780 of file CDCDigitizerModule.cc.

Member Data Documentation

◆ m_effWForGasGainSmearing

double m_effWForGasGainSmearing = 0.0266
private

Effective energy (keV) for one electron prod.

for gas gain smearing

Definition at line 230 of file CDCDigitizerModule.h.

◆ m_fEElectronicsFromDB

DBArray<CDCFEElectronics>* m_fEElectronicsFromDB = nullptr
private

Pointer to FE electronics params.

from DB.

Definition at line 253 of file CDCDigitizerModule.h.

◆ m_inputCDCSimHitsName

std::string m_inputCDCSimHitsName
private

Input array name.


Definition at line 177 of file CDCDigitizerModule.h.

◆ m_mcParticles

StoreArray<MCParticle> m_mcParticles
private

Set edep-to-ADC conversion params.

(from DB) MCParticle array

Definition at line 172 of file CDCDigitizerModule.h.

◆ m_propSpeedInv

double m_propSpeedInv
private

Inv.

of nominal signal propagation speed in a wire (in ns/cm)

Definition at line 219 of file CDCDigitizerModule.h.

◆ m_useDB4EDepToADC

bool m_useDB4EDepToADC
private

Fetch edep-to-ADC conversion params.

from DB

Definition at line 260 of file CDCDigitizerModule.h.


The documentation for this class was generated from the following files: