Belle II Software development
CDCCRTestModule Class Reference

CDC Cosmic test calibration module. More...

#include <CDCCRTestModule.h>

Inheritance diagram for CDCCRTestModule:
HistoModule Module PathElement

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

 CDCCRTestModule ()
 Constructor.
 
virtual ~CDCCRTestModule ()
 Destructor.
 
void initialize () override
 Initializes the Module.
 
void beginRun () override
 Begin run action.
 
void event () override
 Event action (main routine).
 
void endRun () override
 End run action.
 
void terminate () override
 Termination action.
 
void defineHisto () override
 Histogram definitions such as TH1(), TH2(), TNtuple(), TTree()....
 
virtual std::vector< std::string > getFileNames (bool outputFiles)
 Return a list of output filenames for this modules.
 
const std::string & getName () const
 Returns the name of the module.
 
const std::string & getType () const
 Returns the type of the module (i.e.
 
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.
 
void setPropertyFlags (unsigned int propertyFlags)
 Sets the flags for the module properties.
 
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.
 
void if_value (const std::string &expression, const std::shared_ptr< Path > &path, EAfterConditionPath afterConditionPath=EAfterConditionPath::c_End)
 Add a condition to the module.
 
void if_false (const std::shared_ptr< Path > &path, EAfterConditionPath afterConditionPath=EAfterConditionPath::c_End)
 A simplified version to add a condition to the module.
 
void if_true (const std::shared_ptr< Path > &path, EAfterConditionPath afterConditionPath=EAfterConditionPath::c_End)
 A simplified version to set the condition of the module.
 
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.
 
std::shared_ptr< PathgetConditionPath () const
 Returns the path of the last true condition (if there is at least one, else reaturn a null pointer).
 
Module::EAfterConditionPath getAfterConditionPath () const
 What to do after the conditional path is finished.
 
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.
 
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.
 
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.
 
std::shared_ptr< PathElementclone () const override
 Create an independent copy of this module.
 
std::shared_ptr< boost::python::list > getParamInfoListPython () const
 Returns a python list of all parameters.
 

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.
 
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.
 
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.
 
void setType (const std::string &type)
 Set the module type.
 
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.
 
template<typename T >
void addParam (const std::string &name, T &paramVariable, const std::string &description)
 Adds a new enforced parameter to the module.
 
void setReturnValue (int value)
 Sets the return value for this module as integer.
 
void setReturnValue (bool value)
 Sets the return value for this module as bool.
 
void setParamList (const ModuleParamList &params)
 Replace existing parameter list.
 

Private Member Functions

TH1 * getHist (const char *name, const char *title, int nBins, double x0, double x1)
 Create 1D histogram.
 
TProfile * getHistProfile (const char *name, const char *title, int nBins, double x0, double x1)
 Create profile plot.
 
TH2 * getHist (const char *name, const char *title, int nBinsX, double x0, double x1, int nBinsY, double y0, double y1)
 Create 2d-histogram.
 
TH1 * getHist (const std::string &name, const std::string &title, int nBins, double x0, double x1)
 Create 1d-histogram.
 
TProfile * getHistProfile (const std::string &name, const std::string &title, int nBins, double x0, double x1)
 Create profile plot.
 
TH2 * getHist (const std::string &name, const std::string &title, int nBinsX, double x0, double x1, int nBinsY, double y0, double y1)
 Create 2d-histogram.
 
const genfit::SharedPlanePtr constructPlane (const genfit::MeasuredStateOnPlane &state, WireID m_wireID)
 Construct a plane for the hit.
 
void getResidualOfUnFittedLayer (Belle2::RecoTrack *track)
 Calculate residual for Layers which didn't use int fitting.
 
void plotResults (Belle2::RecoTrack *track)
 Plot track parameters and related variables.
 
void getHitDistInTrackCand (const RecoTrack *track)
 Make hit distribution from track candidate.
 
B2Vector3D getTriggerHitPosition (Belle2::RecoTrack *track)
 extrapolation track to trigger counter plane (y position).
 
void HitEfficiency (const Belle2::RecoTrack *track)
 Cal Hit eff.
 
int getICLayer (int slayer, int ilayer)
 Convert slayer and ilayer to iclayer.
 
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.
 
void setParamPythonDict (const boost::python::dict &dictionary)
 Implements a method for reading the parameter values from a boost::python dictionary.
 

Private Attributes

const Belle2::TrackFitResultfitresult
 Track fit result.
 
StoreObjPtr< EventT0m_eventTimeStoreObject
 Event timing.
 
StoreArray< Trackm_Tracks
 Tracks.
 
StoreArray< RecoTrackm_RecoTracks
 Tracks.
 
StoreArray< TrackFitResultm_TrackFitResults
 Track fit results.
 
StoreArray< CDCHitm_CDCHits
 CDC hits.
 
std::string m_trackArrayName
 Belle2::Track StoreArray name.
 
std::string m_cdcHitArrayName
 Belle2::CDCHit StoreArray name.
 
std::string m_recoTrackArrayName
 Belle2::RecoTrack StoreArray nam.e.
 
std::string m_trackFitResultArrayName
 Belle2::TrackFitResult StoreArray name.
 
std::string m_relRecoTrackTrackName
 Relation between RecoTrack and Belle2:Track.
 
std::string m_histogramDirectoryName
 subdir where to place the histograms.
 
std::vector< TH1 * > m_allHistos
 A list of 1d histograms.
 
std::string m_treeName
 Name of tree for the output file.
 
TTree * m_tree
 Output tree recording the information of each hit.
 
TH1 * m_hNTracks
 Number of track fitted, Convergence, not conv, not fit.
 
TH1 * m_hNTracksPerEvent
 Number of TrackCand per Event.
 
TH1 * m_hNTracksPerEventFitted
 Number of TrackCand per Event.
 
TH1 * m_hNDF
 Number of Degree Freedom.
 
TH1 * m_hNHits
 Number of Hits per track.
 
TH1 * m_hNHits_trackcand
 Number of Hits per trackCand.
 
TH1 * m_hChi2
 Chi2 histo.
 
TH1 * m_hPval
 Fit Probability histo.
 
TH2 * m_hNDFChi2
 Chi2 vs degree-of-freedom histo.
 
TH2 * m_hNDFPval
 Degree-of-freedom vs Probability histo.
 
TH1 * m_hAlpha
 Alpha of each Hit.
 
TH1 * m_hPhi0
 Phi0 of ttrack, see Helix.
 
TH1 * m_hTheta
 Theta of each Hit.
 
TH1 * m_hHitDistInCDCHit [56]
 Hit Dist.
 
TH1 * m_hHitDistInTrCand [56]
 Hit Dist.
 
TH1 * m_hHitDistInTrack [56]
 Hit Dist.
 
TH1 * m_hResidualU [56]
 Residual distribution (in cm)

 
TH1 * m_hEvtT0
 Event T0.
 
TH2 * m_hNDFResidualU [56]
 Residual vs.
 
TH1 * m_hNormalizedResidualU [56]
 Residual distribution normalized with tracking error.
 
TH2 * m_hNDFNormalizedResidualU [56]
 Normalized residual vs.
 
TH2 * m_hDxDt [56]
 Unbiased x_fit vs.
 
TProfile * m_hHitEff_soft [56]
 Hit efficience of each layer, software.
 
TH2 * m_h2DHitDistInCDCHit
 2D Hit Dist.
 
TH2 * m_h2DHitDistInTrCand
 2D Hit Dist.
 
TH2 * m_h2DHitDistInTrack
 2D Hit Dist..(ICLay vs IWire) have weight>0.5 after fit with DAF
 
TH2 * m_hTriggerHitZX
 Trigger hit image.
 
double res_b
 Biased residual.
 
double res_u
 Unbiased residual.
 
double res_b_err
 Biased residual error.
 
double res_u_err
 Unbiased residual error.
 
double weight
 Weight of hit.
 
double absRes_b
 absolute value of biased residual.
 
double absRes_u
 absolute value of unbiased residual.
 
double alpha
 Entrance Azimuthal angle of hit (degree).
 
double theta
 Entrance Polar angle of hit (degree).
 
unsigned short adc
 adc value.
 
short tdc
 tdc value.
 
double t
 Measurement Drift time.
 
double t_fit
 Drift time calculated from x_fit.
 
double dt_flight
 Time of flight.
 
double dt_flight_sim
 Time of flight (Simulation).
 
double dt_prop
 Time of propagation.
 
double evtT0
 Event time.
 
double Pt
 Transverse momentum.
 
double x_mea
 measure drift length (signed by left right).
 
double x_u
 X_fit for unbiased track fit.
 
double x_b
 X_fit for biased track fit.
 
double x_sim
 Simulation DriftLength .
 
double z
 Z of hit on wire.
 
double z_sim
 Z of hit on wire (simulation).
 
double z_prop
 Propagation Length along the sense wire.
 
int lay
 Layer ID.
 
int IWire
 Wire ID.
 
int lr
 Left or right.
 
int numhits
 Number of hits.
 
int boardID
 Electrical Board ID.
 
double Pval
 P-value of fitted track.
 
double TrPval
 P-value of fitted track.
 
double ndf
 degree of freedom.
 
double d0
 Track Parameter, d0.
 
double z0
 Track Parameter, z0.
 
double phi0
 Track Parameter, phi0.
 
double tanL
 Track Parameter, tanL.
 
double omega
 Track Parameter, omega.
 
double m_MinimumPt
 Minimum Transverse momentum of tracks.
 
B2Vector3D m_trigHitPos
 Trigger position.
 
std::vector< double > m_TriggerPos
 Nominal center position of trigger counter.
 
std::vector< double > m_TriggerPlaneDirection
 Nominal center position of trigger counter.
 
std::vector< double > m_TriggerSize
 Size of trigger counter (Width x length).
 
std::vector< int > m_up
 upper channel list for each board.
 
std::vector< int > m_low
 lower channel list for each board.
 
double trigHitPos_x
 X-position of track at trigger counter.
 
double trigHitPos_z
 Z-position of track at trigger counter.
 
int trighit
 Trigger hit information.
 
bool m_fillExpertHistos
 Fill some histogram for monitoring fit quality.
 
bool m_plotResidual
 Process track to get the hit information of fitted track.
 
bool m_hitEfficiency
 calculate hit eff or not, Haven't finished.
 
bool m_calExpectedDriftTime
 Calculate expected drift time from x_fit or not.
 
bool m_noBFit
 fit incase no magnetic Field of not, if true, NDF=4 in cal P-value
 
bool m_ToP
 Enable to correct ToP if true.
 
bool m_ToF
 Enable to correct ToF if true.
 
bool m_StoreCDCSimHitInfo
 Store CDCSimHit Information.
 
bool m_EstimateResultForUnFittedLayer
 Calculate residual for layer that we do not use in track fitting.
 
bool m_SmallerOutput
 make output smaller by ignore some variable.
 
bool m_StoreTrackParams
 Store Track parameter or not.
 
bool m_MakeHitDist
 Switch to make histograms of hit distribution.
 
bool m_EventT0Extraction
 use Event T0 extract t0 or not.
 
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

CDC Cosmic test calibration module.

Definition at line 39 of file CDCCRTestModule.h.

Member Typedef Documentation

◆ EAfterConditionPath

Forward the EAfterConditionPath definition from the ModuleCondition.

Definition at line 88 of file Module.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.

77 {
78 c_Input = 1,
79 c_Output = 2,
85 };
@ c_HistogramManager
This module is used to manage histograms accumulated by other modules.
Definition: Module.h:81
@ c_Input
This module is an input module (reads data).
Definition: Module.h:78
@ c_DontCollectStatistics
No statistics is collected for this module.
Definition: Module.h:84
@ c_ParallelProcessingCertified
This module can be run in parallel processing mode safely (All I/O must be done through the data stor...
Definition: Module.h:80
@ c_InternalSerializer
This module is an internal serializer/deserializer for parallel processing.
Definition: Module.h:82
@ c_Output
This module is an output module (writes data).
Definition: Module.h:79
@ c_TerminateInAllProcesses
When using parallel processing, call this module's terminate() function in all processes().
Definition: Module.h:83

Constructor & Destructor Documentation

◆ CDCCRTestModule()

Constructor.

Definition at line 40 of file CDCCRTestModule.cc.

40 : HistoModule()
41{
42 setDescription("CDC Cosmic ray test module");
43 setPropertyFlags(c_ParallelProcessingCertified); // specify this flag if you need parallel processing
44 addParam("CorrectToF", m_ToF, "if true, time of flight will take account in t", true);
45 addParam("CorrectToP", m_ToP, "if true, time of Propagation will take account in t", true);
46 addParam("RecoTracksColName", m_recoTrackArrayName, "Name of collection hold genfit::Track", std::string(""));
47 addParam("histogramDirectoryName", m_histogramDirectoryName,
48 "Track fit results histograms will be put into this directory", std::string("trackfit"));
49 addParam("NameOfTree", m_treeName, "name of tree in output file", string("tree"));
50 addParam("fillExpertHistograms", m_fillExpertHistos, "Fill additional histograms", true);
51 addParam("noBFit", m_noBFit, "If true -> #Params ==4, #params ==5 for calculate P-Val", false);
52 addParam("plotResidual", m_plotResidual, "plot biased residual, normalized res and xtplot for all layer", false);
53 addParam("calExpectedDriftTime", m_calExpectedDriftTime, "if true module will calculate expected drift time, it take a time",
54 true);
55 addParam("hitEfficiency", m_hitEfficiency, "calculate hit efficiency(Not work now) true:yes false:No", false);
56 addParam("TriggerPos", m_TriggerPos, "Trigger position use for cut and reconstruct Trigger image", std::vector<double> { -0.6, -13.25, 17.3});
57 addParam("NormTriggerPlaneDirection", m_TriggerPlaneDirection, "Normal trigger plane direction and reconstruct Trigger image",
58 std::vector<double> { 0, 1, 0});
59 addParam("TriggerSize", m_TriggerSize, "Trigger Size, (Width x length)", std::vector<double> {100, 50});
60 addParam("IwireLow", m_low, "Lower boundary of hit dist. Histogram", std::vector<int> {0, 0, 0, 0, 0, 0, 0, 0, 0});
61 addParam("IwireUpper", m_up, "Upper boundary of hit dist. Histogram", std::vector<int> {161, 161, 193, 225, 257, 289, 321, 355, 385});
62 addParam("StoreCDCSimHitInfo", m_StoreCDCSimHitInfo, "Store simulation info related to hit, driftLeng, flight time,z_onwire",
63 false);
64 addParam("EstimateResultForUnFittedLayer", m_EstimateResultForUnFittedLayer,
65 "Calculate residual for Layer that is set unUseInFit", true);
66 addParam("SmallerOutput", m_SmallerOutput, "If true, trigghit position, residual cov,absRes, will not be stored", false);
67 addParam("StoreTrackParams", m_StoreTrackParams, "Store Track Parameter or not, it will be multicount for each hit", true);
68 addParam("StoreHitDistribution", m_MakeHitDist, "Make hit distribution or not", true);
69 addParam("EventT0Extraction", m_EventT0Extraction, "use event t0 extract t0 or not", true);
70 addParam("MinimumPt", m_MinimumPt, "Tracks with transverse momentum smaller than this will not be recorded", 0.);
71}
std::string m_recoTrackArrayName
Belle2::RecoTrack StoreArray nam.e.
double m_MinimumPt
Minimum Transverse momentum of tracks.
bool m_calExpectedDriftTime
Calculate expected drift time from x_fit or not.
bool m_plotResidual
Process track to get the hit information of fitted track.
bool m_StoreTrackParams
Store Track parameter or not.
bool m_SmallerOutput
make output smaller by ignore some variable.
bool m_hitEfficiency
calculate hit eff or not, Haven't finished.
std::vector< int > m_low
lower channel list for each board.
std::string m_histogramDirectoryName
subdir where to place the histograms.
bool m_fillExpertHistos
Fill some histogram for monitoring fit quality.
bool m_MakeHitDist
Switch to make histograms of hit distribution.
bool m_noBFit
fit incase no magnetic Field of not, if true, NDF=4 in cal P-value
bool m_EstimateResultForUnFittedLayer
Calculate residual for layer that we do not use in track fitting.
bool m_ToP
Enable to correct ToP if true.
std::vector< int > m_up
upper channel list for each board.
bool m_ToF
Enable to correct ToF if true.
std::string m_treeName
Name of tree for the output file.
std::vector< double > m_TriggerPlaneDirection
Nominal center position of trigger counter.
bool m_StoreCDCSimHitInfo
Store CDCSimHit Information.
std::vector< double > m_TriggerPos
Nominal center position of trigger counter.
bool m_EventT0Extraction
use Event T0 extract t0 or not.
std::vector< double > m_TriggerSize
Size of trigger counter (Width x length).
HistoModule()
Constructor.
Definition: HistoModule.h:32
void setDescription(const std::string &description)
Sets the description of the module.
Definition: Module.cc:214
void setPropertyFlags(unsigned int propertyFlags)
Sets the flags for the module properties.
Definition: Module.cc:208
void addParam(const std::string &name, T &paramVariable, const std::string &description, const T &defaultValue)
Adds a new parameter to the module.
Definition: Module.h:560

◆ ~CDCCRTestModule()

~CDCCRTestModule ( )
virtual

Destructor.

Definition at line 73 of file CDCCRTestModule.cc.

74{
75 m_allHistos.clear();
76}
std::vector< TH1 * > m_allHistos
A list of 1d histograms.

Member Function Documentation

◆ beginRun()

void beginRun ( void  )
overridevirtual

Begin run action.

Reimplemented from HistoModule.

Definition at line 234 of file CDCCRTestModule.cc.

235{
236}

◆ 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.

180{
182 newModule->m_moduleParamList.setParameters(getParamList());
183 newModule->setName(getName());
184 newModule->m_package = m_package;
185 newModule->m_propertyFlags = m_propertyFlags;
186 newModule->m_logConfig = m_logConfig;
187 newModule->m_conditions = m_conditions;
188
189 return newModule;
190}
std::shared_ptr< Module > registerModule(const std::string &moduleName, std::string sharedLibPath="") noexcept(false)
Creates an instance of a module and registers it to the ModuleManager.
static ModuleManager & Instance()
Exception is thrown if the requested module could not be created by the ModuleManager.
const ModuleParamList & getParamList() const
Return module param list.
Definition: Module.h:363
const std::string & getName() const
Returns the name of the module.
Definition: Module.h:187
const std::string & getType() const
Returns the type of the module (i.e.
Definition: Module.cc:41
unsigned int m_propertyFlags
The properties of the module as bitwise or (with |) of EModulePropFlags.
Definition: Module.h:512
LogConfig m_logConfig
The log system configuration of the module.
Definition: Module.h:514
std::vector< ModuleCondition > m_conditions
Module condition, only non-null if set.
Definition: Module.h:521
std::string m_package
Package this module is found in (may be empty).
Definition: Module.h:510
std::shared_ptr< Module > ModulePtr
Defines a pointer to a module object as a boost shared pointer.
Definition: Module.h:43

◆ constructPlane()

const genfit::SharedPlanePtr constructPlane ( const genfit::MeasuredStateOnPlane &  state,
WireID  m_wireID 
)
private

Construct a plane for the hit.

Definition at line 667 of file CDCCRTestModule.cc.

668{
669 // We reconstruct plane from measuedStateOnPlane from one fitted hit.
670 // because I don't want to change state of this plane so I create other state to extrapolate.
671 // first: extrapolate to wire (ideal geometry, nosag) to find z pos than get virtual wire pos due to sag,
672 // extrapolate again to found z pos and U.
674 const StateOnPlane stateOnPlane = StateOnPlane(state.getState(), state.getPlane(), state.getRep());
675 genfit::StateOnPlane st(stateOnPlane);
676
677 const B2Vector3D& Wire1PosIdeal(cdcgeoTrans->getWireBackwardPosition(m_wireID));
678 const B2Vector3D& Wire2PosIdeal(cdcgeoTrans->getWireForwardPosition(m_wireID));
679
680 // unit vector of wire direction
681 B2Vector3D WireDirectionIdeal = Wire2PosIdeal - Wire1PosIdeal;
682 WireDirectionIdeal.SetMag(1.);//normalized
683
684 // extrapolate to find z
685 const genfit::AbsTrackRep* rep = state.getRep();
686 rep->extrapolateToLine(st, Wire1PosIdeal, WireDirectionIdeal);
687 const B2Vector3D& PocaIdeal = rep->getPos(st);
688
689 double zPOCA = (Wire1PosIdeal.Z()
690 + WireDirectionIdeal.Dot(PocaIdeal - Wire1PosIdeal) * WireDirectionIdeal.Z());
691
692 // Now re-extrapolate to new wire direction, wire sag was taking account.
693 const B2Vector3D& wire1(cdcgeoTrans->getWireBackwardPosition(m_wireID, zPOCA));
694 const B2Vector3D& wire2(cdcgeoTrans->getWireForwardPosition(m_wireID, zPOCA));
695
696 // unit vector of wire direction (include sag)
697 B2Vector3D wireDirection = wire2 - wire1;
698 wireDirection.SetMag(1.);
699
700 // extrapolate to find poca
701 rep->extrapolateToLine(st, wire1, wireDirection);
702 const B2Vector3D& poca = rep->getPos(st);
703 B2Vector3D dirInPoca = rep->getMom(st);
704 dirInPoca.SetMag(1.);
705 const B2Vector3D& pocaOnWire = wire1 + wireDirection.Dot(poca - wire1) * wireDirection;
706 if (fabs(wireDirection.Angle(dirInPoca)) < 0.01) {
707 B2WARNING("cannot construct det plane, track parallel with wire");
708 }
709 // construct orthogonal (unit) vector for plane
710 const B2Vector3D& U = wireDirection.Cross(dirInPoca);
711 genfit::SharedPlanePtr pl = genfit::SharedPlanePtr(new genfit::DetPlane(pocaOnWire, U, wireDirection));
712 return pl;
713}
void SetMag(DataType mag)
Set magnitude keeping theta and phi constant.
Definition: B2Vector3.h:182
DataType Z() const
access variable Z (= .at(2) without boundary check)
Definition: B2Vector3.h:435
B2Vector3< DataType > Cross(const B2Vector3< DataType > &p) const
Cross product.
Definition: B2Vector3.h:296
DataType Dot(const B2Vector3< DataType > &p) const
Scalar product.
Definition: B2Vector3.h:290
DataType Angle(const B2Vector3< DataType > &q) const
The angle w.r.t.
Definition: B2Vector3.h:302
This class uses the realistic detector geometry (the one after alignment procedure) for the translati...
const B2Vector3D getWireBackwardPosition(const WireID &wireID) override
Get wire position at backward end.
const B2Vector3D getWireForwardPosition(const WireID &wireID) override
Get wire position at forward end.
ROOT::Math::XYZVector poca(ROOT::Math::XYZVector const &trackPos, ROOT::Math::XYZVector const &trackP, ROOT::Math::XYZVector const &vtxPos)
Returns the Point Of Closest Approach of a track to a vertex.

◆ def_beginRun()

virtual void def_beginRun ( )
inlineprotectedvirtualinherited

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

Reimplemented in PyModule.

Definition at line 426 of file Module.h.

426{ beginRun(); }
virtual void beginRun()
Called when entering a new run.
Definition: Module.h:147

◆ 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.

439{ endRun(); }
virtual void endRun()
This method is called if the current run ends.
Definition: Module.h:166

◆ def_event()

virtual void def_event ( )
inlineprotectedvirtualinherited

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

Reimplemented in PyModule.

Definition at line 432 of file Module.h.

432{ event(); }
virtual void event()
This method is the core of the module.
Definition: Module.h:157

◆ 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.

420{ initialize(); }
virtual void initialize()
Initialize the Module.
Definition: Module.h:109

◆ def_terminate()

virtual void def_terminate ( )
inlineprotectedvirtualinherited

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

Reimplemented in PyModule.

Definition at line 445 of file Module.h.

445{ terminate(); }
virtual void terminate()
This method is called at the end of the event processing.
Definition: Module.h:176

◆ defineHisto()

void defineHisto ( )
overridevirtual

Histogram definitions such as TH1(), TH2(), TNtuple(), TTree()....

are supposed to be placed in this function.

Reimplemented from HistoModule.

Definition at line 80 of file CDCCRTestModule.cc.

81{
82 m_tree = new TTree(m_treeName.c_str(), "tree");
83 m_tree->Branch("x_mea", &x_mea, "x_mea/D");
84 m_tree->Branch("x_u", &x_u, "x_u/D");
85 m_tree->Branch("x_b", &x_b, "x_b/D");
86 m_tree->Branch("z", &z, "z/D");
87 m_tree->Branch("alpha", &alpha, "alpha/D");
88 m_tree->Branch("theta", &theta, "theta/D");
89 m_tree->Branch("t", &t, "t/D");
90 m_tree->Branch("evtT0", &evtT0, "evtT0/D");
91 m_tree->Branch("adc", &adc, "adc/s");
92 m_tree->Branch("boardID", &boardID, "boardID/I");
93 m_tree->Branch("lay", &lay, "lay/I");
94 m_tree->Branch("weight", &weight, "weight/D");
95 m_tree->Branch("IWire", &IWire, "IWire/I");
96 m_tree->Branch("Pval", &Pval, "Pval/D");
97 m_tree->Branch("ndf", &ndf, "ndf/D");
98 // m_tree->Branch("trighit", &trighit, "trighit/I");
100 m_tree->Branch("d0", &d0, "d0/D");
101 m_tree->Branch("z0", &z0, "z0/D");
102 m_tree->Branch("phi0", &phi0, "phi0/D");
103 m_tree->Branch("tanL", &tanL, "tanL/D");
104 m_tree->Branch("omega", &omega, "omega/D");
105 m_tree->Branch("Pt", &Pt, "Pt/D");
106 }
108 m_tree->Branch("z_sim", &z_sim, "z_sim/D");
109 m_tree->Branch("x_sim", &x_sim, "x_sim/D");
110 m_tree->Branch("dt_flight_sim", &dt_flight_sim, "dt_flight_sim/D");
111 }
112 if (m_calExpectedDriftTime) { // expected drift time, calculated form xfit
113 m_tree->Branch("t_fit", &t_fit, "t_fit/D");
114 }
115 if (!m_SmallerOutput) {
116 m_tree->Branch("tdc", &tdc, "tdc/I");
117 m_tree->Branch("z_prop", &z_prop, "z_prop/D");
118 m_tree->Branch("res_b", &res_b, "res_b/D");
119 m_tree->Branch("res_u", &res_u, "res_u/D");
120 m_tree->Branch("lr", &lr, "lr/I");
121 m_tree->Branch("trigHitPos_x", &trigHitPos_x, "trigHitPos_x/D");
122 m_tree->Branch("trigHitPos_z", &trigHitPos_z, "trigHitPos_z/D");
123 m_tree->Branch("numhits", &numhits, "numhits/I");
124 m_tree->Branch("res_b_err", &res_b_err, "res_b_err/D");
125 m_tree->Branch("res_u_err", &res_u_err, "res_u_err/D");
126 m_tree->Branch("absRes_u", &absRes_u, "absRes_u/D");
127 m_tree->Branch("absRes_b", &absRes_b, "absRes_b/D");
128 m_tree->Branch("dt_prop", &dt_prop, "dt_prop/D");
129 m_tree->Branch("dt_flight", &dt_flight, "dt_flight/D");
130 }
131
132 // int N =m_Nchannel;//Number of Wire per Layer used;
133 TDirectory* oldDir = gDirectory;
134 TDirectory* histDir = oldDir->mkdir(m_histogramDirectoryName.c_str());
135 histDir->cd();
136 m_hNTracks = getHist("hNTracks", "number of tracks", 3, 0, 3);
137 m_hNTracks->GetXaxis()->SetBinLabel(1, "fitted, converged");
138 m_hNTracks->GetXaxis()->SetBinLabel(2, "fitted, not converged");
139 m_hNTracks->GetXaxis()->SetBinLabel(3, "TrackCand, but no Track");
140
141 m_hNDF = getHist("hNDF", "NDF of fitted track;NDF;Tracks", 71, -1, 150);
142 m_hNHits = getHist("hNHits", "#hit of fitted track;#hit;Tracks", 61, -1, 150);
143 m_hNHits_trackcand = getHist("hNHits_trackcand", "#hit of track candidate;#hit;Tracks", 71, -1, 150);
144 m_hNTracksPerEvent = getHist("hNTracksPerEvent", "#tracks/Event;#Tracks;Event", 20, 0, 20);
145 m_hNTracksPerEventFitted = getHist("hNTracksPerEventFitted", "#tracks/Event After Fit;#Tracks;Event", 20, 0, 20);
146 m_hChi2 = getHist("hChi2", "#chi^{2} of tracks;#chi^{2};Tracks", 400, 0, 400);
147 m_hPhi0 = getHist("hPhi0", "#Phi_{0} of tracks;#phi_{0} (Degree);Tracks", 400, -190, 190);
148 m_hAlpha = getHist("hAlpha", "#alpha Dist.;#alpha (Degree);Hits", 360, -90, 90);
149 m_hTheta = getHist("hTheta", "#theta Dist.;#theta (Degree);Hits", 360, 0, 180);
150 m_hPval = getHist("hPval", "p-values of tracks;pVal;Tracks", 1000, 0, 1);
151 m_hEvtT0 = getHist("hEvtT0", "Event T0; EvtT0 (ns); #event", 200, -100, 100);
152
153 m_hTriggerHitZX = getHist("TriggerHitZX", "Hit Position on trigger counter;z(cm);x(cm)", 300, -100, 100, 120, -15, 15);
154 if (m_MakeHitDist) {
155 m_h2DHitDistInCDCHit = getHist("2DHitDistInCDCHit", " CDCHit;WireID;LayerID",
156 m_up[8] - m_low[0], m_low[0], m_up[8], 56, 0, 56);
157 m_h2DHitDistInTrCand = getHist("2DHitDistInTrCand", "Track Cand ;WireID;LayerID",
158 m_up[8] - m_low[0], m_low[0], m_up[8], 56, 0, 56);
159 m_h2DHitDistInTrack = getHist("2DHitDistInTrack", "Fitted Track ;WireID;LayerID",
160 m_up[8] - m_low[0], m_low[0], m_up[8], 56, 0, 56);
161 }
162 if (m_fillExpertHistos) {
163 m_hNDFChi2 = getHist("hNDFChi2", "#chi^{2} of tracks;NDF;#chi^{2};Tracks", 8, 0, 8, 800, 0, 200);
164 m_hNDFPval = getHist("hNDFPval", "p-values of tracks;NDF;pVal;Tracks", 8, 0, 8, 100, 0, 1);
165 }
166 int sl;
167 for (int i = 0; i < 56; ++i) {
168 if (m_hitEfficiency) {
169 m_hHitEff_soft[i] = getHistProfile(Form("hHitEff_soft_L%d", i),
170 Form("hit efficiency(soft) of Layer %d ;Drift distance;Software Efficiency", i), 200, -1, 1);
171 }
172 if (m_MakeHitDist) {
173 if (i < 8) {sl = 0;} else { sl = floor((i - 8) / 6) + 1;}
174 m_hHitDistInCDCHit[i] = getHist(Form("hHitDistInCDCHit_layer%d", i), Form("Hit Dist. ICLayer_%d;WireID;#Hits", i),
175 m_up.at(sl) - m_low.at(sl), m_low.at(sl), m_up.at(sl));
176 m_hHitDistInCDCHit[i]->SetLineColor(kGreen);
177 m_hHitDistInTrCand[i] = getHist(Form("hHitDistInTrCand_layer%d", i), Form("Hit Dist. ICLayer_%d;WireID;#Hits", i),
178 m_up.at(sl) - m_low.at(sl), m_low.at(sl), m_up.at(sl));
179 m_hHitDistInTrCand[i]->SetLineColor(kRed);
180 m_hHitDistInTrack[i] = getHist(Form("hHitDistInTrack_layer%d", i), Form("Hit Dist. ICLayer_%d;WireID;#Hits", i),
181 m_up.at(sl) - m_low.at(sl), m_low.at(sl), m_up.at(sl));
182 }
183 const double normResRange = 20;
184 const double residualRange = 0.3;
185 std::string title, name;
186 if (m_plotResidual) {
187 name = (boost::format("hist_ResidualsU%1%") % i).str();
188 title = (boost::format("unnormalized, unbiased residuals in layer %1%;cm;Tracks") % i).str();
189 m_hResidualU[i] = getHist(name, title, 500, -residualRange, residualRange);
190
191 name = (boost::format("hNormalizedResidualsU%1%") % i).str();
192 title = (boost::format("normalized, unbiased residuals in layer %1%;NDF;#sigma (cm);Tracks") % i).str();
193 m_hNormalizedResidualU[i] = getHist(name, title, 500, -normResRange, normResRange);
194
195 name = (boost::format("DxDt%1%") % i).str();
196 title = (boost::format("Drift Length vs Drift time at Layer_%1%;Drift Length (cm);Drift time (ns)") % i).str();
197 m_hDxDt[i] = getHist(name, title, 200, -1, 1, 450, -50, 400);
198 }
199 if (m_fillExpertHistos) {
200 name = (boost::format("hNDFResidualsU%1%") % i).str();
201 title = (boost::format("unnormalized, unbiased residuals along U in layer %1%;NDF;cm;Tracks") % i).str();
202 m_hNDFResidualU[i] = getHist(name, title, 8, 0, 8, 1000, -residualRange, residualRange);
203
204 name = (boost::format("hNDFNormalizedResidualsU%1%") % i).str();
205 title = (boost::format("normalized, unbiased residuals in layer %1%;NDF;#sigma (cm);Tracks") % i).str();
206 m_hNDFNormalizedResidualU[i] = getHist(name, title, 8, 0, 8, 1000, -normResRange, normResRange);
207 }
208 }
209 oldDir->cd();
210}
TProfile * getHistProfile(const char *name, const char *title, int nBins, double x0, double x1)
Create profile plot.
double x_sim
Simulation DriftLength .
TTree * m_tree
Output tree recording the information of each hit.
double res_b
Biased residual.
double alpha
Entrance Azimuthal angle of hit (degree).
TH1 * m_hNHits
Number of Hits per track.
double res_u_err
Unbiased residual error.
TH1 * m_hNHits_trackcand
Number of Hits per trackCand.
double absRes_b
absolute value of biased residual.
double dt_flight
Time of flight.
TH1 * m_hHitDistInTrack[56]
Hit Dist.
double res_u
Unbiased residual.
TH1 * m_hPhi0
Phi0 of ttrack, see Helix.
TH1 * m_hNormalizedResidualU[56]
Residual distribution normalized with tracking error.
TH1 * m_hNTracks
Number of track fitted, Convergence, not conv, not fit.
TH1 * m_hHitDistInCDCHit[56]
Hit Dist.
double z0
Track Parameter, z0.
TH2 * m_hNDFNormalizedResidualU[56]
Normalized residual vs.
double Pval
P-value of fitted track.
double z_prop
Propagation Length along the sense wire.
double res_b_err
Biased residual error.
double t
Measurement Drift time.
TH2 * m_hNDFPval
Degree-of-freedom vs Probability histo.
TH1 * m_hTheta
Theta of each Hit.
TH1 * m_hNTracksPerEvent
Number of TrackCand per Event.
double omega
Track Parameter, omega.
double weight
Weight of hit.
double Pt
Transverse momentum.
double x_b
X_fit for biased track fit.
double t_fit
Drift time calculated from x_fit.
TH1 * m_hAlpha
Alpha of each Hit.
double z_sim
Z of hit on wire (simulation).
TH2 * m_hNDFChi2
Chi2 vs degree-of-freedom histo.
int boardID
Electrical Board ID.
double z
Z of hit on wire.
TProfile * m_hHitEff_soft[56]
Hit efficience of each layer, software.
TH2 * m_h2DHitDistInTrack
2D Hit Dist..(ICLay vs IWire) have weight>0.5 after fit with DAF
double trigHitPos_x
X-position of track at trigger counter.
double dt_prop
Time of propagation.
double x_u
X_fit for unbiased track fit.
double theta
Entrance Polar angle of hit (degree).
TH1 * m_hNTracksPerEventFitted
Number of TrackCand per Event.
TH1 * m_hPval
Fit Probability histo.
double d0
Track Parameter, d0.
TH1 * m_hHitDistInTrCand[56]
Hit Dist.
TH2 * m_h2DHitDistInTrCand
2D Hit Dist.
TH2 * m_hDxDt[56]
Unbiased x_fit vs.
TH2 * m_hNDFResidualU[56]
Residual vs.
double tanL
Track Parameter, tanL.
unsigned short adc
adc value.
double phi0
Track Parameter, phi0.
double trigHitPos_z
Z-position of track at trigger counter.
double ndf
degree of freedom.
double absRes_u
absolute value of unbiased residual.
TH1 * m_hNDF
Number of Degree Freedom.
TH1 * m_hResidualU[56]
Residual distribution (in cm)
TH2 * m_hTriggerHitZX
Trigger hit image.
TH2 * m_h2DHitDistInCDCHit
2D Hit Dist.
TH1 * getHist(const char *name, const char *title, int nBins, double x0, double x1)
Create 1D histogram.
double dt_flight_sim
Time of flight (Simulation).
double x_mea
measure drift length (signed by left right).

◆ endRun()

void endRun ( void  )
overridevirtual

End run action.

Reimplemented from HistoModule.

Definition at line 346 of file CDCCRTestModule.cc.

347{
348}

◆ 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.

97{
98 if (m_conditions.empty()) return false;
99
100 //okay, a condition was set for this Module...
101 if (!m_hasReturnValue) {
102 B2FATAL("A condition was set for '" << getName() << "', but the module did not set a return value!");
103 }
104
105 for (const auto& condition : m_conditions) {
106 if (condition.evaluate(m_returnValue)) {
107 return true;
108 }
109 }
110 return false;
111}
int m_returnValue
The return value.
Definition: Module.h:519
bool m_hasReturnValue
True, if the return value is set.
Definition: Module.h:518

◆ event()

void event ( void  )
overridevirtual

Event action (main routine).

find results in track fit results

Reimplemented from HistoModule.

Definition at line 238 of file CDCCRTestModule.cc.

239{
240 evtT0 = 0.;
242
243 /* CDCHit distribution */
244 if (m_MakeHitDist) {
245 for (int i = 0; i < m_CDCHits.getEntries(); ++i) {
246 Belle2::CDCHit* hit = m_CDCHits[i];
247 m_hHitDistInCDCHit[getICLayer(hit->getISuperLayer(), hit->getILayer())]->Fill(hit->getIWire());
248 m_h2DHitDistInCDCHit->Fill(hit->getIWire(), getICLayer(hit->getISuperLayer(), hit->getILayer()));
249 }
250 }
251 // Loop over Recotracks
252 int nTr = m_RecoTracks.getEntries();
253 m_hNTracksPerEvent->Fill(nTr);
254
255 int nfitted = 0;
256
257 for (int i = 0; i < nTr; ++i) {
258 RecoTrack* track = m_RecoTracks[i];
259 if (track->getDirtyFlag()) {B2INFO("Dirty flag was set for track: " << track->getPositionSeed().Y()); continue;}
260 m_hNHits_trackcand->Fill(track->getNumberOfCDCHits());
261 if (m_MakeHitDist) {
263 }
264 if (!track->hasTrackFitStatus()) {
265 m_hNTracks->Fill("Track not fitted", 1.0);
266 continue;
267 }
268 const genfit::FitStatus* fs = track->getTrackFitStatus();
269 if (!fs || !fs->isFitted()) {
270 m_hNTracks->Fill("Track not fitted", 1.0);
271 continue;
272 }
273 if (!fs->isFitConverged()) {//not fully convergence
274 m_hNTracks->Fill("fitted, not converged", 1.0);
275 B2DEBUG(99, "------Fitted but not converged");
276 continue;
277 }
278
279 m_hNTracks->Fill("fitted, converged", 1.0);
280 B2DEBUG(99, "-------Fitted and Converged");
281
282 nfitted = nfitted + 1;
284 const Belle2::Track* b2track = track->getRelatedFrom<Belle2::Track>();
285 if (!b2track) {B2DEBUG(99, "No relation found"); continue;}
287
288 if (!fitresult) {
289 B2WARNING("track was fitted but Relation not found");
290 continue;
291 }
292
293 if (m_noBFit) {ndf = fs->getNdf() + 1;} // in case no Magnetic field, NDF=4;
294 else {ndf = fs->getNdf();}
295 double Chi2 = fs->getChi2();
296 TrPval = std::max(0., ROOT::Math::chisquared_cdf_c(Chi2, ndf));
297 m_hPval->Fill(TrPval);
298 m_hNDF->Fill(ndf);
299 if (ndf < 15) continue;
301 // event with is fail to extract t0 will be exclude from analysis
302 if (m_eventTimeStoreObject.isValid() && m_eventTimeStoreObject->hasEventT0()) {
303 evtT0 = m_eventTimeStoreObject->getEventT0();
304 m_hEvtT0->Fill(evtT0);
305 } else { continue;}
306 }
307
308 d0 = fitresult->getD0();
309 z0 = fitresult->getZ0();
312 phi0 = fitresult->getPhi0() * 180 / M_PI;
313 Pt = fitresult->getMomentum().Rho();
314 m_hPhi0->Fill(phi0);
315 m_hChi2->Fill(Chi2);
316 if (Pt < m_MinimumPt) continue;
317 if (m_hitEfficiency && track->getNumberOfCDCHits() > 30 && TrPval > 0.001) {
318 HitEfficiency(track);
319 }
320 if (m_fillExpertHistos) {
321 m_hNDFChi2->Fill(ndf, fs->getChi2());
322 m_hNDFPval->Fill(ndf, TrPval);
323 }
324 try {
325 plotResults(track);
326 } catch (const genfit::Exception& e) {
327 // at least log that there was something going very wrong
328 B2ERROR("Exception when calling the plotResults method" << e.what());
329 }
330
332 //try {
333 // DONT IGNORE THE EXCEPTION BEING THROWN HERE
335 // plotResults(track);
336 //} catch (...) {
337 //B2ERROR (" fatal 2! ");
338
339 //}
340 }
341 }
342
343 m_hNTracksPerEventFitted->Fill(nfitted);
344}
Class containing the result of the unpacker in raw data and the result of the digitizer in simulation...
Definition: CDCHit.h:40
StoreObjPtr< EventT0 > m_eventTimeStoreObject
Event timing.
void getHitDistInTrackCand(const RecoTrack *track)
Make hit distribution from track candidate.
int getICLayer(int slayer, int ilayer)
Convert slayer and ilayer to iclayer.
void HitEfficiency(const Belle2::RecoTrack *track)
Cal Hit eff.
std::string m_relRecoTrackTrackName
Relation between RecoTrack and Belle2:Track.
void plotResults(Belle2::RecoTrack *track)
Plot track parameters and related variables.
void getResidualOfUnFittedLayer(Belle2::RecoTrack *track)
Calculate residual for Layers which didn't use int fitting.
const Belle2::TrackFitResult * fitresult
Track fit result.
double TrPval
P-value of fitted track.
StoreArray< RecoTrack > m_RecoTracks
Tracks.
StoreArray< Track > m_Tracks
Tracks.
StoreArray< CDCHit > m_CDCHits
CDC hits.
static const ChargedStable muon
muon particle
Definition: Const.h:660
This is the Reconstruction Event-Data Model Track.
Definition: RecoTrack.h:79
Low-level class to create/modify relations between StoreArrays.
Definition: RelationArray.h:62
int getEntries() const
Get the number of objects in the array.
Definition: StoreArray.h:216
double getOmega() const
Getter for omega.
double getD0() const
Getter for d0.
double getTanLambda() const
Getter for tanLambda.
double getZ0() const
Getter for z0.
ROOT::Math::XYZVector getMomentum() const
Getter for vector of momentum at closest approach of track in r/phi projection.
double getPhi0() const
Getter for phi0.
Class that bundles various TrackFitResults.
Definition: Track.h:25
const TrackFitResult * getTrackFitResult(const Const::ChargedStable &chargedStable) const
Default Access to TrackFitResults.
Definition: Track.cc:30

◆ exposePythonAPI()

void exposePythonAPI ( )
staticinherited

Exposes methods of the Module class to Python.

Definition at line 325 of file Module.cc.

326{
327 // to avoid confusion between std::arg and boost::python::arg we want a shorthand namespace as well
328 namespace bp = boost::python;
329
330 docstring_options options(true, true, false); //userdef, py sigs, c++ sigs
331
332 void (Module::*setReturnValueInt)(int) = &Module::setReturnValue;
333
334 enum_<Module::EAfterConditionPath>("AfterConditionPath",
335 R"(Determines execution behaviour after a conditional path has been executed:
336
337.. attribute:: END
338
339 End processing of this path after the conditional path. (this is the default for if_value() etc.)
340
341.. attribute:: CONTINUE
342
343 After the conditional path, resume execution after this module.)")
344 .value("END", Module::EAfterConditionPath::c_End)
345 .value("CONTINUE", Module::EAfterConditionPath::c_Continue)
346 ;
347
348 /* Do not change the names of >, <, ... we use them to serialize conditional pathes */
349 enum_<Belle2::ModuleCondition::EConditionOperators>("ConditionOperator")
356 ;
357
358 enum_<Module::EModulePropFlags>("ModulePropFlags",
359 R"(Flags to indicate certain low-level features of modules, see :func:`Module.set_property_flags()`, :func:`Module.has_properties()`. Most useful flags are:
360
361.. attribute:: PARALLELPROCESSINGCERTIFIED
362
363 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.)
364
365.. attribute:: HISTOGRAMMANAGER
366
367 This module is used to manage histograms accumulated by other modules
368
369.. attribute:: TERMINATEINALLPROCESSES
370
371 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.
372)")
373 .value("INPUT", Module::EModulePropFlags::c_Input)
374 .value("OUTPUT", Module::EModulePropFlags::c_Output)
375 .value("PARALLELPROCESSINGCERTIFIED", Module::EModulePropFlags::c_ParallelProcessingCertified)
376 .value("HISTOGRAMMANAGER", Module::EModulePropFlags::c_HistogramManager)
377 .value("INTERNALSERIALIZER", Module::EModulePropFlags::c_InternalSerializer)
378 .value("TERMINATEINALLPROCESSES", Module::EModulePropFlags::c_TerminateInAllProcesses)
379 ;
380
381 //Python class definition
382 class_<Module, PyModule> module("Module", R"(
383Base class for Modules.
384
385A module is the smallest building block of the framework.
386A typical event processing chain consists of a Path containing
387modules. By inheriting from this base class, various types of
388modules can be created. To use a module, please refer to
389:func:`Path.add_module()`. A list of modules is available by running
390``basf2 -m`` or ``basf2 -m package``, detailed information on parameters is
391given by e.g. ``basf2 -m RootInput``.
392
393The 'Module Development' section in the manual provides detailed information
394on how to create modules, setting parameters, or using return values/conditions:
395https://xwiki.desy.de/xwiki/rest/p/f4fa4/#HModuleDevelopment
396
397)");
398 module
399 .def("__str__", &Module::getPathString)
400 .def("name", &Module::getName, return_value_policy<copy_const_reference>(),
401 "Returns the name of the module. Can be changed via :func:`set_name() <Module.set_name()>`, use :func:`type() <Module.type()>` for identifying a particular module class.")
402 .def("type", &Module::getType, return_value_policy<copy_const_reference>(),
403 "Returns the type of the module (i.e. class name minus 'Module')")
404 .def("set_name", &Module::setName, args("name"), R"(
405Set custom name, e.g. to distinguish multiple modules of the same type.
406
407>>> path.add_module('EventInfoSetter')
408>>> ro = path.add_module('RootOutput', branchNames=['EventMetaData'])
409>>> ro.set_name('RootOutput_metadata_only')
410>>> print(path)
411[EventInfoSetter -> RootOutput_metadata_only]
412
413)")
414 .def("description", &Module::getDescription, return_value_policy<copy_const_reference>(),
415 "Returns the description of this module.")
416 .def("package", &Module::getPackage, return_value_policy<copy_const_reference>(),
417 "Returns the package this module belongs to.")
418 .def("available_params", &_getParamInfoListPython,
419 "Return list of all module parameters as `ModuleParamInfo` instances")
420 .def("has_properties", &Module::hasProperties, (bp::arg("properties")),
421 R"DOCSTRING(Allows to check if the module has the given properties out of `ModulePropFlags` set.
422
423>>> if module.has_properties(ModulePropFlags.PARALLELPROCESSINGCERTIFIED):
424>>> ...
425
426Parameters:
427 properties (int): bitmask of `ModulePropFlags` to check for.
428)DOCSTRING")
429 .def("set_property_flags", &Module::setPropertyFlags, args("property_mask"),
430 "Set module properties in the form of an OR combination of `ModulePropFlags`.");
431 {
432 // python signature is too crowded, make ourselves
433 docstring_options subOptions(true, false, false); //userdef, py sigs, c++ sigs
434 module
435 .def("if_value", &Module::if_value,
436 (bp::arg("expression"), bp::arg("condition_path"), bp::arg("after_condition_path")= Module::EAfterConditionPath::c_End),
437 R"DOCSTRING(if_value(expression, condition_path, after_condition_path=AfterConditionPath.END)
438
439Sets a conditional sub path which will be executed after this
440module if the return value set in the module passes the given ``expression``.
441
442Modules can define a return value (int or bool) using ``setReturnValue()``,
443which can be used in the steering file to split the Path based on this value, for example
444
445>>> module_with_condition.if_value("<1", another_path)
446
447In case the return value of the ``module_with_condition`` for a given event is
448less than 1, the execution will be diverted into ``another_path`` for this event.
449
450You could for example set a special return value if an error occurs, and divert
451the execution into a path containing :b2:mod:`RootOutput` if it is found;
452saving only the data producing/produced by the error.
453
454After a conditional path has executed, basf2 will by default stop processing
455the path for this event. This behaviour can be changed by setting the
456``after_condition_path`` argument.
457
458Parameters:
459 expression (str): Expression to determine if the conditional path should be executed.
460 This should be one of the comparison operators ``<``, ``>``, ``<=``,
461 ``>=``, ``==``, or ``!=`` followed by a numerical value for the return value
462 condition_path (Path): path to execute in case the expression is fulfilled
463 after_condition_path (AfterConditionPath): What to do once the ``condition_path`` has been executed.
464)DOCSTRING")
465 .def("if_false", &Module::if_false,
466 (bp::arg("condition_path"), bp::arg("after_condition_path")= Module::EAfterConditionPath::c_End),
467 R"DOC(if_false(condition_path, after_condition_path=AfterConditionPath.END)
468
469Sets a conditional sub path which will be executed after this module if
470the return value of the module evaluates to False. This is equivalent to
471calling `if_value` with ``expression=\"<1\"``)DOC")
472 .def("if_true", &Module::if_true,
473 (bp::arg("condition_path"), bp::arg("after_condition_path")= Module::EAfterConditionPath::c_End),
474 R"DOC(if_true(condition_path, after_condition_path=AfterConditionPath.END)
475
476Sets a conditional sub path which will be executed after this module if
477the return value of the module evaluates to True. It is equivalent to
478calling `if_value` with ``expression=\">=1\"``)DOC");
479 }
480 module
481 .def("has_condition", &Module::hasCondition,
482 "Return true if a conditional path has been set for this module "
483 "using `if_value`, `if_true` or `if_false`")
484 .def("get_all_condition_paths", &_getAllConditionPathsPython,
485 "Return a list of all conditional paths set for this module using "
486 "`if_value`, `if_true` or `if_false`")
487 .def("get_all_conditions", &_getAllConditionsPython,
488 "Return a list of all conditional path expressions set for this module using "
489 "`if_value`, `if_true` or `if_false`")
490 .add_property("logging", make_function(&Module::getLogConfig, return_value_policy<reference_existing_object>()),
@ c_GE
Greater or equal than: ">=".
@ c_SE
Smaller or equal than: "<=".
@ c_GT
Greater than: ">"
@ c_NE
Not equal: "!=".
@ c_EQ
Equal: "=" or "=="
@ c_ST
Smaller than: "<"
Base class for Modules.
Definition: Module.h:72
LogConfig & getLogConfig()
Returns the log system configuration.
Definition: Module.h:225
void if_value(const std::string &expression, const std::shared_ptr< Path > &path, EAfterConditionPath afterConditionPath=EAfterConditionPath::c_End)
Add a condition to the module.
Definition: Module.cc:79
void if_true(const std::shared_ptr< Path > &path, EAfterConditionPath afterConditionPath=EAfterConditionPath::c_End)
A simplified version to set the condition of the module.
Definition: Module.cc:90
void setReturnValue(int value)
Sets the return value for this module as integer.
Definition: Module.cc:220
void setLogConfig(const LogConfig &logConfig)
Set the log system configuration.
Definition: Module.h:230
const std::string & getDescription() const
Returns the description of the module.
Definition: Module.h:202
void if_false(const std::shared_ptr< Path > &path, EAfterConditionPath afterConditionPath=EAfterConditionPath::c_End)
A simplified version to add a condition to the module.
Definition: Module.cc:85
bool hasCondition() const
Returns true if at least one condition was set for the module.
Definition: Module.h:311
const std::string & getPackage() const
Returns the package this module is in.
Definition: Module.h:197
void setName(const std::string &name)
Set the name of the module.
Definition: Module.h:214
bool hasProperties(unsigned int propertyFlags) const
Returns true if all specified property flags are available in this module.
Definition: Module.cc:160
std::string getPathString() const override
return the module name.
Definition: Module.cc:192

◆ 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.

134{
135 if (m_conditions.empty()) return EAfterConditionPath::c_End;
136
137 //okay, a condition was set for this Module...
138 if (!m_hasReturnValue) {
139 B2FATAL("A condition was set for '" << getName() << "', but the module did not set a return value!");
140 }
141
142 for (const auto& condition : m_conditions) {
143 if (condition.evaluate(m_returnValue)) {
144 return condition.getAfterConditionPath();
145 }
146 }
147
148 return EAfterConditionPath::c_End;
149}

◆ getAllConditionPaths()

std::vector< std::shared_ptr< Path > > getAllConditionPaths ( ) const
inherited

Return all condition paths currently set (no matter if the condition is true or not).

Definition at line 150 of file Module.cc.

151{
152 std::vector<std::shared_ptr<Path>> allConditionPaths;
153 for (const auto& condition : m_conditions) {
154 allConditionPaths.push_back(condition.getPath());
155 }
156
157 return allConditionPaths;
158}

◆ getAllConditions()

const std::vector< ModuleCondition > & getAllConditions ( ) const
inlineinherited

Return all set conditions for this module.

Definition at line 324 of file Module.h.

325 {
326 return m_conditions;
327 }

◆ getCondition()

const ModuleCondition * getCondition ( ) const
inlineinherited

Return a pointer to the first condition (or nullptr, if none was set)

Definition at line 314 of file Module.h.

315 {
316 if (m_conditions.empty()) {
317 return nullptr;
318 } else {
319 return &m_conditions.front();
320 }
321 }

◆ 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.

114{
115 PathPtr p;
116 if (m_conditions.empty()) return p;
117
118 //okay, a condition was set for this Module...
119 if (!m_hasReturnValue) {
120 B2FATAL("A condition was set for '" << getName() << "', but the module did not set a return value!");
121 }
122
123 for (const auto& condition : m_conditions) {
124 if (condition.evaluate(m_returnValue)) {
125 return condition.getPath();
126 }
127 }
128
129 // if none of the conditions were true, return a null pointer.
130 return p;
131}
std::shared_ptr< Path > PathPtr
Defines a pointer to a path object as a boost shared pointer.
Definition: Path.h:35

◆ getDescription()

const std::string & getDescription ( ) const
inlineinherited

Returns the description of the module.

Definition at line 202 of file Module.h.

202{return m_description;}
std::string m_description
The description of the module.
Definition: Module.h:511

◆ 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 RootInputModule, StorageRootOutputModule, and RootOutputModule.

Definition at line 134 of file Module.h.

135 {
136 return std::vector<std::string>();
137 }

◆ getHist() [1/4]

TH1 * getHist ( const char *  name,
const char *  title,
int  nBins,
double  x0,
double  x1 
)
inlineprivate

Create 1D histogram.

Definition at line 90 of file CDCCRTestModule.h.

92 {
93 TH1* h = new TH1D(name, title, nBins, x0, x1);
94 m_allHistos.push_back(h);
95 return h;
96 }

◆ getHist() [2/4]

TH2 * getHist ( const char *  name,
const char *  title,
int  nBinsX,
double  x0,
double  x1,
int  nBinsY,
double  y0,
double  y1 
)
inlineprivate

Create 2d-histogram.

Definition at line 112 of file CDCCRTestModule.h.

115 {
116 TH2* h = new TH2D(name, title, nBinsX, x0, x1, nBinsY, y0, y1);
117 m_allHistos.push_back(h);
118 return h;
119 }

◆ getHist() [3/4]

TH1 * getHist ( const std::string &  name,
const std::string &  title,
int  nBins,
double  x0,
double  x1 
)
inlineprivate

Create 1d-histogram.

Definition at line 124 of file CDCCRTestModule.h.

126 {
127 return getHist(name.c_str(), title.c_str(), nBins, x0, x1);
128 }

◆ getHist() [4/4]

TH2 * getHist ( const std::string &  name,
const std::string &  title,
int  nBinsX,
double  x0,
double  x1,
int  nBinsY,
double  y0,
double  y1 
)
inlineprivate

Create 2d-histogram.

Definition at line 142 of file CDCCRTestModule.h.

145 {
146 return getHist(name.c_str(), title.c_str(), nBinsX, x0, x1, nBinsY, y0, y1);
147 }

◆ getHistProfile() [1/2]

TProfile * getHistProfile ( const char *  name,
const char *  title,
int  nBins,
double  x0,
double  x1 
)
inlineprivate

Create profile plot.

Definition at line 101 of file CDCCRTestModule.h.

103 {
104 TProfile* h = new TProfile(name, title, nBins, x0, x1);
105 m_allHistos.push_back(h);
106 return h;
107 }

◆ getHistProfile() [2/2]

TProfile * getHistProfile ( const std::string &  name,
const std::string &  title,
int  nBins,
double  x0,
double  x1 
)
inlineprivate

Create profile plot.

Definition at line 133 of file CDCCRTestModule.h.

135 {
136 return getHistProfile(name.c_str(), title.c_str(), nBins, x0, x1);
137 }

◆ getHitDistInTrackCand()

void getHitDistInTrackCand ( const RecoTrack track)
private

Make hit distribution from track candidate.

Definition at line 465 of file CDCCRTestModule.cc.

466{
467 BOOST_FOREACH(const RecoHitInformation::UsedCDCHit * cdchit, track->getCDCHitList()) {
468 int iclay = getICLayer(cdchit->getISuperLayer(), cdchit->getILayer());
469 B2DEBUG(99, "In TrackCand: ICLayer: " << iclay << "IWire: " << cdchit->getIWire());
470 m_hHitDistInTrCand[iclay]->Fill(cdchit->getIWire());
471 m_h2DHitDistInTrCand->Fill(cdchit->getIWire(), iclay);
472 }
473}
unsigned short getIWire() const
Getter for iWire.
Definition: CDCHit.h:166
unsigned short getISuperLayer() const
Getter for iSuperLayer.
Definition: CDCHit.h:184
unsigned short getILayer() const
Getter for iLayer.
Definition: CDCHit.h:172

◆ getICLayer()

int getICLayer ( int  slayer,
int  ilayer 
)
inlineprivate

Convert slayer and ilayer to iclayer.

Definition at line 183 of file CDCCRTestModule.h.

184 {
185 if (slayer == 0) {return ilayer;}
186 else {return 8 + (slayer - 1) * 6 + ilayer;}
187 }

◆ getLogConfig()

LogConfig & getLogConfig ( )
inlineinherited

Returns the log system configuration.

Definition at line 225 of file Module.h.

225{return m_logConfig;}

◆ getModules()

std::list< ModulePtr > getModules ( ) const
inlineoverrideprivatevirtualinherited

no submodules, return empty list

Implements PathElement.

Definition at line 506 of file Module.h.

506{ return std::list<ModulePtr>(); }

◆ 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.

187{return m_name;}
std::string m_name
The name of the module, saved as a string (user-modifiable)
Definition: Module.h:508

◆ getPackage()

const std::string & getPackage ( ) const
inlineinherited

Returns the package this module is in.

Definition at line 197 of file Module.h.

197{return m_package;}

◆ 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.

280{
282}
std::shared_ptr< boost::python::list > getParamInfoListPython() const
Returns a python list of all parameters.
ModuleParamList m_moduleParamList
List storing and managing all parameter of the module.
Definition: Module.h:516

◆ getParamList()

const ModuleParamList & getParamList ( ) const
inlineinherited

Return module param list.

Definition at line 363 of file Module.h.

363{ return m_moduleParamList; }

◆ getPathString()

std::string getPathString ( ) const
overrideprivatevirtualinherited

return the module name.

Implements PathElement.

Definition at line 192 of file Module.cc.

193{
194
195 std::string output = getName();
196
197 for (const auto& condition : m_conditions) {
198 output += condition.getString();
199 }
200
201 return output;
202}

◆ getResidualOfUnFittedLayer()

void getResidualOfUnFittedLayer ( Belle2::RecoTrack track)
private

Calculate residual for Layers which didn't use int fitting.

Definition at line 536 of file CDCCRTestModule.cc.

537{
538 B2INFO("Start estimate residual for un-fitted layer");
539 B2INFO("position seed" << track->getPositionSeed().Y());
540 static CDCGeometryPar& cdcgeo = CDCGeometryPar::Instance();
542 const genfit::AbsTrackRep* trackRepresentation = track->getCardinalRepresentation();
543 x_b = 0; res_b = 0; res_b_err = 0;
544 x_u = 0; res_u = 0; res_u_err = 0;
545 z = 0; dt_flight_sim = 0; z_prop = 0; t = 0;
546 dt_prop = 0; dt_flight = 0; alpha = 0; theta = 0;
547 tdc = 0; adc = 0; lay = 0; IWire = 0;
548 // ndf =0; Pval=0; numhits=0; trigHitPos_x= 0; trigHitPos_z=0;
549 // trighit=1; lr=-1;
550 B2INFO("number of cdchit" << track->getCDCHitList().size());
551 B2INFO("number of point use int fit" << ndf + 4);
552
553 typedef std::pair<double, const RecoHitInformation*> SortingRecoHitPair;
554
555 for (const RecoHitInformation::UsedCDCHit* cdchit : track->getCDCHitList()) {
556 // RecoHitInformation* recoHitInfo = track->getRecoHitInformation(cdchit);
557 if (track->getRecoHitInformation(cdchit)->useInFit()) continue;
558 // yeah is true, but better to check for the above
559 //if ((recoHitInfo->getCreatedTrackPoint())) continue;
560 // This was wrong: the sorting parameter is not the hitID
561 int hitSortingParameter = track->getRecoHitInformation(cdchit)->getSortingParameter();
562
563 SortingRecoHitPair frontSideHit = std::make_pair(0, nullptr);;
564 SortingRecoHitPair backsideSideHit = std::make_pair(0, nullptr);;
565 SortingRecoHitPair hit4extraction; // = std::make_pair(0, nullptr); avoid cppcheck warning.
566
567 //find closest hit to hit which do not fit
568 // if (hitID < track->getNumberOfCDCHits() / 2) { //case for first part of track, searching forward, stop at first choice
569 for (const RecoHitInformation::UsedCDCHit* hit : track->getCDCHitList()) {
570 RecoHitInformation const* recoHitInfo_fw = track->getRecoHitInformation(hit);
571 if (recoHitInfo_fw->useInFit()) { //may be should check fit status of that hit, do it later.
572 frontSideHit = std::make_pair(recoHitInfo_fw->getSortingParameter(), recoHitInfo_fw);
573 break;
574 }
575 }
576 //}
577 // if (hitID > track->getNumberOfCDCHits() / 2) { //case for last part of track, searching backward, and stop at the first choice
578 auto hitListReverse = track->getCDCHitList();
579 std::reverse(hitListReverse.begin(), hitListReverse.end());
580 for (const RecoHitInformation::UsedCDCHit* hit : hitListReverse) {
581 RecoHitInformation const* recoHitInfo_bkw = track->getRecoHitInformation(hit);
582 if (recoHitInfo_bkw->useInFit()) {
583 // also get proper id here
584 backsideSideHit = std::make_pair(recoHitInfo_bkw->getSortingParameter(), recoHitInfo_bkw);
585 break;
586 }
587 }
588 B2DEBUG(99, "forward sorting parameter: " << frontSideHit.first << " |backward sorting parameter = " << backsideSideHit.first);
589 if (std::fabs(frontSideHit.first - hitSortingParameter) < std::fabs(backsideSideHit.first - hitSortingParameter)) {
590 hit4extraction = frontSideHit;
591 } else {
592 hit4extraction = backsideSideHit;
593 }
594
595 // no proper neighbouring hit found
596 if (hit4extraction.second == nullptr)
597 continue;
598
599 auto closestHitTrackPoint = track->getCreatedTrackPoint(hit4extraction.second);
600 // now we need to find the hit behind this sorting param !
601 // but easy: we have already the TrackPoint via the RecoHitInformation
602 genfit::MeasuredStateOnPlane meaOnPlane = closestHitTrackPoint->getFitterInfo(trackRepresentation)->getFittedState(
603 true /* biased version */);
604
605 //start to extrapolation
606 WireID wireid = WireID(cdchit->getID());
607 // double flightTime1 = meaOnPlane.getTime();
608 //Now reconstruct plane for hit
609 genfit::SharedPlanePtr plane = nullptr;
610 try {
611 plane = constructPlane(meaOnPlane, wireid);
612 } catch (const genfit::Exception& e) {
613 B2WARNING("Error happen, can not reconstruct plan for extrapolating" << e.what());
614 continue;
615 }
616 double segmentLength;
617 try {
618 segmentLength = meaOnPlane.extrapolateToPlane(plane);
619 } catch (const genfit::Exception& e) {
620 B2WARNING("Could not extrapolate the fit" << e.what());
621 continue;
622 }
623 IWire = wireid.getIWire();
624 lay = wireid.getICLayer();
625 const B2Vector3D pocaOnWire = meaOnPlane.getPlane()->getO();//Local wire position
626 const B2Vector3D pocaMom = meaOnPlane.getMom();
627 x_u = meaOnPlane.getState()(3);
628 alpha = cdcgeo.getAlpha(pocaOnWire, pocaMom) ;
629 theta = cdcgeo.getTheta(pocaMom);
630 z = pocaOnWire.Z();
631 z_prop = z - cdcgeo.wireBackwardPosition(wireid, CDCGeometryPar::c_Aligned).Z();
632 dt_prop = z_prop / 27.25;
633 //Convert to outgoing
634 if (x_u > 0) lr = 1;
635 else lr = 0;
636 if (fabs(alpha) > M_PI / 2) {
637 x_u *= -1;
638 }
639 lr = cdcgeo.getOutgoingLR(lr, alpha);
641 alpha = cdcgeo.getOutgoingAlpha(alpha);
642 dt_flight = meaOnPlane.getTime();
643 x_mea = tdcTrans->getDriftLength(cdchit->getTDCCount(), wireid, dt_flight, lr, pocaOnWire.Z(), alpha, theta, cdchit->getADCCount());
644 x_mea = std::copysign(x_mea, x_u);
645 res_u = x_mea - x_u;
646 absRes_u = fabs(x_mea) - fabs(x_u);
647 alpha *= 180 / M_PI;
648 theta *= 180 / M_PI;
649 m_hAlpha->Fill(alpha);
650 m_hTheta->Fill(theta);
652 CDCSimHit* simhit = cdchit->getRelated<Belle2::CDCSimHit>();
653 if (simhit) {
654 x_sim = simhit->getDriftLength();
655 z_sim = simhit->getPosWire().Z();
656 dt_flight_sim = simhit->getFlightTime();
657 }
658 }
659 B2DEBUG(199, "we calculate residua for lay - IWire: " << lay << " - " << IWire);
660 B2DEBUG(199, "distance between two hit" << segmentLength);
661 B2DEBUG(199, "Flight Time (extra | sim)" << dt_flight << " - " << dt_flight_sim);
662 B2DEBUG(199, "DriftLength (cal | sim)" << x_mea << " - " << x_sim);
663 m_tree->Fill();
664 }
665}
Example Detector.
Definition: CDCSimHit.h:21
double getFlightTime() const
The method to get flight time.
Definition: CDCSimHit.h:184
B2Vector3D getPosWire() const
The method to get position on wire.
Definition: CDCSimHit.h:199
double getDriftLength() const
The method to get drift length.
Definition: CDCSimHit.h:181
const genfit::SharedPlanePtr constructPlane(const genfit::MeasuredStateOnPlane &state, WireID m_wireID)
Construct a plane for the hit.
The Class for CDC Geometry Parameters.
double getTheta(const B2Vector3D &momentum) const
Returns track incident angle (theta in rad.).
double getAlpha(const B2Vector3D &posOnWire, const B2Vector3D &momentum) const
Returns track incident angle in rphi plane (alpha in rad.).
const B2Vector3D wireBackwardPosition(uint layerId, int cellId, EWirePosition set=c_Base) const
Returns the backward position of the input sense wire.
double getOutgoingAlpha(const double alpha) const
Converts incoming- to outgoing-alpha.
unsigned short getOutgoingLR(const unsigned short lr, const double alpha) const
Converts incoming-lr to outgoing-lr.
double getOutgoingTheta(const double alpha, const double theta) const
Converts incoming- to outgoing-theta.
static CDCGeometryPar & Instance(const CDCGeometry *=nullptr)
Static method to get a reference to the CDCGeometryPar instance.
Translator mirroring the realistic Digitization.
double getDriftLength(unsigned short tdcCount, const WireID &wireID=WireID(), double timeOfFlightEstimator=0, bool leftRight=false, double z=0, double alpha=0, double theta=static_cast< double >(TMath::Pi()/2.), unsigned short adcCount=0) override
Get Drift length.
This class stores additional information to every CDC/SVD/PXD hit stored in a RecoTrack.
bool useInFit() const
Get the flag, whether this his should be used in a fit or not.
unsigned int getSortingParameter() const
Get the sorting parameter.
T * getRelated(const std::string &name="", const std::string &namedRelation="") const
Get the object to or from which this object has a relation.
Class to identify a wire inside the CDC.
Definition: WireID.h:34

◆ 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.

381{ return m_returnValue; }

◆ getTriggerHitPosition()

B2Vector3D getTriggerHitPosition ( Belle2::RecoTrack track)
private

extrapolation track to trigger counter plane (y position).

Definition at line 475 of file CDCCRTestModule.cc.

476{
477 B2Vector3D trigpos(m_TriggerPos.at(0), m_TriggerPos.at(1), m_TriggerPos.at(2));
479 const genfit::AbsTrackRep* trackRepresentation = track->getCardinalRepresentation();
480 B2Vector3D pos(-200, 200, 200);
481 try {
482 genfit::MeasuredStateOnPlane mop = track->getMeasuredStateOnPlaneClosestTo(ROOT::Math::XYZVector(trigpos), trackRepresentation);
483 double l = mop.extrapolateToPlane(genfit::SharedPlanePtr(new genfit::DetPlane(trigpos, trigDir)));
484 if (fabs(l) < 1000) pos = mop.getPos();
485 } catch (const genfit::Exception& er) {
486 B2WARNING("extrapolate to Trigger counter failure" << er.what());
487 } catch (const std::runtime_error& er) {
488 B2WARNING("Runtime error encountered: " << er.what());
489 } catch (...) {
490 B2WARNING("Undefined exception encountered.");
491 }
492 return pos;
493}

◆ 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.

42{
43 if (m_type.empty())
44 B2FATAL("Module type not set for " << getName());
45 return m_type;
46}
std::string m_type
The type of the module, saved as a string.
Definition: Module.h:509

◆ hasCondition()

bool hasCondition ( ) const
inlineinherited

Returns true if at least one condition was set for the module.

Definition at line 311 of file Module.h.

311{ return not m_conditions.empty(); };

◆ 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.

161{
162 return (propertyFlags & m_propertyFlags) == propertyFlags;
163}

◆ hasReturnValue()

bool hasReturnValue ( ) const
inlineinherited

Return true if this module has a valid return value set.

Definition at line 378 of file Module.h.

378{ return m_hasReturnValue; }

◆ hasUnsetForcedParams()

bool hasUnsetForcedParams ( ) const
inherited

Returns true and prints error message if the module has unset parameters which the user has to set in the steering file.

Definition at line 166 of file Module.cc.

167{
169 std::string allMissing = "";
170 for (const auto& s : missing)
171 allMissing += s + " ";
172 if (!missing.empty())
173 B2ERROR("The following required parameters of Module '" << getName() << "' were not specified: " << allMissing <<
174 "\nPlease add them to your steering file.");
175 return !missing.empty();
176}
std::vector< std::string > getUnsetForcedParams() const
Returns list of unset parameters (if they are required to have a value.

◆ HitEfficiency()

void HitEfficiency ( const Belle2::RecoTrack track)
private

Cal Hit eff.

Definition at line 494 of file CDCCRTestModule.cc.

495{
496 /* static CDCGeometryPar& cdcgeo = CDCGeometryPar::Instance();
497 for (int i = 0; i < 56; ++i) {
498 double rcell = (rinnerlayer[i] + routerlayer[i]) / 2;
499 double arcL = h.getArcLength2DAtCylindricalR(rcell);
500 const B2Vector3D hitpos = h.getPositionAtArcLength2D(arcL);
501 int cellID = cdcgeo.cellId(i, hitpos);
502 B2INFO("Hit at LayerID - CellID: " << i << "-" << cellID);
503 }
504 */
506 BOOST_FOREACH(const RecoHitInformation::UsedCDCHit * cdchit, track->getCDCHitList()) {
507 WireID Wid = WireID(cdchit->getID());
508 const genfit::TrackPoint* tp = track->getCreatedTrackPoint(track->getRecoHitInformation(cdchit));
509 //some hit didn't take account in fitting, so I use left/right info from track finding results.
510 int RLInfo = 0;
511 RecoHitInformation::RightLeftInformation rightLeftHitInformation = track->getRecoHitInformation(cdchit)->getRightLeftInformation();
512 if (rightLeftHitInformation == RecoHitInformation::RightLeftInformation::c_left) {
513 RLInfo = -1;
514 } else if (rightLeftHitInformation == RecoHitInformation::RightLeftInformation::c_right) {
515 RLInfo = 1;
516 } else continue;
517
518 if (!tp->hasRawMeasurements())
519 continue;
520 const genfit::KalmanFitterInfo* kfi = tp->getKalmanFitterInfo();
521 if (!kfi) continue;
522
523 // double max = std::max_element(kfi->getWeights(),kfi->getNumMeasurements());
524 double max = 0.;
525 unsigned short imea = 0;
526 for (unsigned int iMeas = 0; iMeas < kfi->getNumMeasurements(); ++iMeas) {
527 double ww = kfi->getWeights().at(iMeas);
528 if (ww > max) {max = ww; imea = iMeas;}
529 }
530 double xx = kfi->getMeasurementOnPlane(imea)->getState()(0);
531 m_hHitEff_soft[Wid.getICLayer()]->Fill(std::copysign(xx, RLInfo), max);
532 }
534}
unsigned short getID() const
Getter for encoded wire number.
Definition: CDCHit.h:193
RightLeftInformation
The RightLeft information of the hit which is only valid for CDC hits.
unsigned short getICLayer() const
Getter for continuous layer numbering.
Definition: WireID.cc:24

◆ 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.

86{
87 if_value("<1", path, afterConditionPath);
88}

◆ 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.

91{
92 if_value(">=1", path, afterConditionPath);
93}

◆ 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://xwiki.desy.de/xwiki/rest/p/a94f2 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.

80{
81 m_conditions.emplace_back(expression, path, afterConditionPath);
82}

◆ initialize()

void initialize ( void  )
overridevirtual

Initializes the Module.

Reimplemented from HistoModule.

Definition at line 212 of file CDCCRTestModule.cc.

213{
214 REG_HISTOGRAM
215 m_Tracks.isRequired(m_trackArrayName);
218 m_CDCHits.isRequired(m_cdcHitArrayName);
220 //Store names to speed up creation later
221 m_relRecoTrackTrackName = relRecoTrackTrack.getName();
222
223 for (size_t i = 0; i < m_allHistos.size(); ++i) {
224 m_allHistos[i]->Reset();
225 }
226 B2ASSERT("Trigger Position (TriggerPos) must be 3 components.", m_TriggerPos.size() == 3);
227 B2ASSERT("Normal vector of Trigger Plane (NormTriggerPlaneDirection) must be 3 components.", m_TriggerPlaneDirection.size() == 3);
228 B2ASSERT("Trigger size (TriggerSize) must be 2 component width and length(z direction)", m_TriggerSize.size() == 2);
229 B2ASSERT("List of Lower boundary (IWireLow) ( for histo must be 9 components, equivalent 9 supper layers", m_low.size() == 9);
230 B2ASSERT("List of Upper boundary (IWireUp) for histo must be 9 components, equivalent 9 supper layers", m_low.size() == 9);
231 B2INFO("Trigger Position (" << m_TriggerPos.at(0) << " ," << m_TriggerPos.at(1) << " ," << m_TriggerPos.at(2) << ")");
232}
StoreArray< TrackFitResult > m_TrackFitResults
Track fit results.
std::string m_cdcHitArrayName
Belle2::CDCHit StoreArray name.
std::string m_trackArrayName
Belle2::Track StoreArray name.
std::string m_trackFitResultArrayName
Belle2::TrackFitResult StoreArray name.
bool isRequired(const std::string &name="")
Ensure this array/object has been registered previously.

◆ plotResults()

void plotResults ( Belle2::RecoTrack track)
private

Plot track parameters and related variables.

Definition at line 354 of file CDCCRTestModule.cc.

355{
360 bool hittrig = (sqrt((m_trigHitPos.X() - m_TriggerPos[0]) * (m_trigHitPos.X() - m_TriggerPos[0]) +
362 && fabs(m_trigHitPos.Z() - m_TriggerPos[2]) < m_TriggerSize[1] / 2) ? true : false;
363 if (hittrig) {trighit = 1;}
364 else {trighit = 0;}
365 static CDCGeometryPar& cdcgeo = CDCGeometryPar::Instance();
367 m_hNHits->Fill(track->getNumberOfCDCHits());
368
369 std::vector<genfit::TrackPoint*> tps = track->getHitPointsWithMeasurement();
370 numhits = tps.size();
371 BOOST_FOREACH(genfit::TrackPoint * tp, tps) {
372 if (!tp->hasRawMeasurements())
373 continue;
374
375 const genfit::AbsMeasurement* raw = tp->getRawMeasurement(0);
376 const CDCRecoHit* rawCDC = dynamic_cast<const CDCRecoHit*>(raw);
377 if (rawCDC) {
378 WireID wireid = rawCDC->getWireID();
379 const genfit::KalmanFitterInfo* kfi = tp->getKalmanFitterInfo();
380 if (!kfi) {B2DEBUG(199, "No Fitter Info: Layer " << wireid.getICLayer()); continue;}
381
382 for (unsigned int iMeas = 0; iMeas < kfi->getNumMeasurements(); ++iMeas) {
383 if ((kfi->getWeights().at(iMeas)) > 0.5) {
384 const genfit::MeasurementOnPlane& residual_b = kfi->getResidual(iMeas, true);
385 const genfit::MeasurementOnPlane& residual_u = kfi->getResidual(iMeas, false);
386 lay = wireid.getICLayer();
387 IWire = wireid.getIWire();
388 if (m_MakeHitDist) {
391 }
392 boardID = cdcgeo.getBoardID(wireid);
393 Pval = TrPval;
394 tdc = rawCDC->getCDCHit()->getTDCCount();
395 adc = rawCDC->getCDCHit()->getADCCount();
396
397 const genfit::MeasuredStateOnPlane& mop = kfi->getFittedState();
398 const B2Vector3D pocaOnWire = mop.getPlane()->getO();//Local wire position
399 const B2Vector3D pocaMom = mop.getMom();
400 alpha = cdcgeo.getAlpha(pocaOnWire, pocaMom) ;
401 theta = cdcgeo.getTheta(pocaMom);
402 //Convert to outgoing
403 x_mea = kfi->getMeasurementOnPlane(iMeas)->getState()(0);
404 x_b = kfi->getFittedState(true).getState()(3);// x fit biased
405 res_b = residual_b.getState()(0);
406 x_u = kfi->getFittedState(false).getState()(3);//x fit unbiased
407 res_u = residual_u.getState()(0);
408 if (x_u > 0) lr = 1;
409 else lr = 0;
410 if (fabs(alpha) > M_PI / 2) {
411 x_b *= -1;
412 res_b *= -1;
413 x_u *= -1;
414 res_u *= -1;
415 }
416 x_mea = copysign(x_mea, x_u);
417 lr = cdcgeo.getOutgoingLR(lr, alpha);
419 alpha = cdcgeo.getOutgoingAlpha(alpha);
420 B2DEBUG(199, "x_unbiased " << x_u << " |left_right " << lr);
421 if (m_calExpectedDriftTime) { t_fit = cdcgeo.getDriftTime(std::abs(x_u), lay, lr, alpha, theta);}
422 alpha *= 180 / M_PI;
423 theta *= 180 / M_PI;
424 m_hAlpha->Fill(alpha);
425 m_hTheta->Fill(theta);
426
427 //B2INFO("resi V " <<residual.getState()(1));
428 // weight_res = residual.getWeight();
429 absRes_b = std::abs(x_b + res_b) - std::abs(x_b);
430 absRes_u = std::abs(x_u + res_u) - std::abs(x_u);
431 weight = residual_u.getWeight();
432 res_b_err = std::sqrt(residual_b.getCov()(0, 0));
433 res_u_err = std::sqrt(residual_u.getCov()(0, 0));
434
435 t = tdcTrans->getDriftTime(tdc, wireid, mop.getTime(), pocaOnWire.Z(), adc);
436 z = pocaOnWire.Z();
437
438 // t = getCorrectedDriftTime(wireid, tdc, adc, z, z0);
440 CDCSimHit* simhit = rawCDC->getCDCHit()->getRelated<Belle2::CDCSimHit>();
441 if (simhit) {
442 x_sim = simhit->getDriftLength();
443 z_sim = simhit->getPosWire().Z();
444 dt_flight_sim = simhit->getFlightTime();
445 }
446 }
447 m_tree->Fill();
448 if (m_plotResidual) {
449 m_hDxDt[lay]->Fill(x_u, t);
450 m_hResidualU[lay]->Fill(res_b, weight);
451 m_hNormalizedResidualU[lay]->Fill(res_b / sqrt(residual_b.getCov()(0, 0)), weight);
452 }
453 if (m_fillExpertHistos) {
455 m_hNDFResidualU[lay]->Fill(ndf, res_b);
456 m_hNDFNormalizedResidualU[lay]->Fill(ndf, res_b / std::sqrt(residual_b.getCov()(0, 0)), weight);
457 }
458 } //NDF
459 // }//end of if isU
460 }//end of for
461 }//end of rawCDC
462 }//end of for tp
463}//end of func
DataType X() const
access variable X (= .at(0) without boundary check)
Definition: B2Vector3.h:431
DataType Y() const
access variable Y (= .at(1) without boundary check)
Definition: B2Vector3.h:433
short getTDCCount() const
Getter for TDC count.
Definition: CDCHit.h:219
unsigned short getADCCount() const
Getter for integrated charge.
Definition: CDCHit.h:230
This class is used to transfer CDC information to the track fit.
Definition: CDCRecoHit.h:32
WireID getWireID() const
Getter for WireID object.
Definition: CDCRecoHit.h:49
const CDCHit * getCDCHit() const
get the pointer to the CDCHit object that was used to create this CDCRecoHit object.
Definition: CDCRecoHit.h:112
int trighit
Trigger hit information.
B2Vector3D m_trigHitPos
Trigger position.
B2Vector3D getTriggerHitPosition(Belle2::RecoTrack *track)
extrapolation track to trigger counter plane (y position).
unsigned short getBoardID(const WireID &wID) const
Returns frontend board id. corresponding to the wire id.
double getDriftTime(double dist, unsigned short layer, unsigned short lr, double alpha, double theta) const
Return the drift time to the sense wire.
double getDriftTime(unsigned short tdcCount, const WireID &wireID, double timeOfFlightEstimator, double z, unsigned short adcCount) override
Get Drift time.
double sqrt(double a)
sqrt for double
Definition: beamHelpers.h:28

◆ setAbortLevel()

void setAbortLevel ( int  abortLevel)
inherited

Configure the abort log level.

Definition at line 67 of file Module.cc.

68{
69 m_logConfig.setAbortLevel(static_cast<LogConfig::ELogLevel>(abortLevel));
70}
ELogLevel
Definition of the supported log levels.
Definition: LogConfig.h:26
void setAbortLevel(ELogLevel abortLevel)
Configure the abort level.
Definition: LogConfig.h:112

◆ setDebugLevel()

void setDebugLevel ( int  debugLevel)
inherited

Configure the debug messaging level.

Definition at line 61 of file Module.cc.

62{
63 m_logConfig.setDebugLevel(debugLevel);
64}
void setDebugLevel(int debugLevel)
Configure the debug messaging level.
Definition: LogConfig.h:98

◆ 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.

215{
216 m_description = description;
217}

◆ setLogConfig()

void setLogConfig ( const LogConfig logConfig)
inlineinherited

Set the log system configuration.

Definition at line 230 of file Module.h.

230{m_logConfig = logConfig;}

◆ 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.

74{
75 m_logConfig.setLogInfo(static_cast<LogConfig::ELogLevel>(logLevel), logInfo);
76}
void setLogInfo(ELogLevel logLevel, unsigned int logInfo)
Configure the printed log information for the given level.
Definition: LogConfig.h:127

◆ setLogLevel()

void setLogLevel ( int  logLevel)
inherited

Configure the log level.

Definition at line 55 of file Module.cc.

56{
57 m_logConfig.setLogLevel(static_cast<LogConfig::ELogLevel>(logLevel));
58}
void setLogLevel(ELogLevel logLevel)
Configure the log level.
Definition: LogConfig.cc:25

◆ 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.

214{ m_name = name; };

◆ setParamList()

void setParamList ( const ModuleParamList params)
inlineprotectedinherited

Replace existing parameter list.

Definition at line 501 of file Module.h.

501{ m_moduleParamList = params; }

◆ 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.

235{
236 LogSystem& logSystem = LogSystem::Instance();
237 logSystem.updateModule(&(getLogConfig()), getName());
238 try {
240 } catch (std::runtime_error& e) {
241 throw std::runtime_error("Cannot set parameter '" + name + "' for module '"
242 + m_name + "': " + e.what());
243 }
244
245 logSystem.updateModule(nullptr);
246}
Class for logging debug, info and error messages.
Definition: LogSystem.h:46
void updateModule(const LogConfig *moduleLogConfig=nullptr, const std::string &moduleName="")
Sets the log configuration to the given module log configuration and sets the module name This method...
Definition: LogSystem.h:191
static LogSystem & Instance()
Static method to get a reference to the LogSystem instance.
Definition: LogSystem.cc:31
void setParamPython(const std::string &name, const PythonObject &pyObj)
Implements a method for setting boost::python objects.

◆ 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.

250{
251
252 LogSystem& logSystem = LogSystem::Instance();
253 logSystem.updateModule(&(getLogConfig()), getName());
254
255 boost::python::list dictKeys = dictionary.keys();
256 int nKey = boost::python::len(dictKeys);
257
258 //Loop over all keys in the dictionary
259 for (int iKey = 0; iKey < nKey; ++iKey) {
260 boost::python::object currKey = dictKeys[iKey];
261 boost::python::extract<std::string> keyProxy(currKey);
262
263 if (keyProxy.check()) {
264 const boost::python::object& currValue = dictionary[currKey];
265 setParamPython(keyProxy, currValue);
266 } else {
267 B2ERROR("Setting the module parameters from a python dictionary: invalid key in dictionary!");
268 }
269 }
270
271 logSystem.updateModule(nullptr);
272}
void setParamPython(const std::string &name, const boost::python::object &pyObj)
Implements a method for setting boost::python objects.
Definition: Module.cc:234

◆ 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.

209{
210 m_propertyFlags = propertyFlags;
211}

◆ 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.

228{
229 m_hasReturnValue = true;
230 m_returnValue = value;
231}

◆ 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.

221{
222 m_hasReturnValue = true;
223 m_returnValue = value;
224}

◆ 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.

49{
50 if (!m_type.empty())
51 B2FATAL("Trying to change module type from " << m_type << " is not allowed, the value is assumed to be fixed.");
52 m_type = type;
53}

◆ terminate()

void terminate ( void  )
overridevirtual

Termination action.

Reimplemented from HistoModule.

Definition at line 350 of file CDCCRTestModule.cc.

351{
352}

Member Data Documentation

◆ absRes_b

double absRes_b
private

absolute value of biased residual.

Definition at line 252 of file CDCCRTestModule.h.

◆ absRes_u

double absRes_u
private

absolute value of unbiased residual.

Definition at line 253 of file CDCCRTestModule.h.

◆ adc

unsigned short adc
private

adc value.

Definition at line 256 of file CDCCRTestModule.h.

◆ alpha

double alpha
private

Entrance Azimuthal angle of hit (degree).

Definition at line 254 of file CDCCRTestModule.h.

◆ boardID

int boardID
private

Electrical Board ID.

Definition at line 277 of file CDCCRTestModule.h.

◆ d0

double d0
private

Track Parameter, d0.

Definition at line 281 of file CDCCRTestModule.h.

◆ dt_flight

double dt_flight
private

Time of flight.

Definition at line 260 of file CDCCRTestModule.h.

◆ dt_flight_sim

double dt_flight_sim
private

Time of flight (Simulation).

Definition at line 261 of file CDCCRTestModule.h.

◆ dt_prop

double dt_prop
private

Time of propagation.

Definition at line 262 of file CDCCRTestModule.h.

◆ evtT0

double evtT0
private

Event time.

Definition at line 263 of file CDCCRTestModule.h.

◆ fitresult

const Belle2::TrackFitResult* fitresult
private

Track fit result.

Definition at line 189 of file CDCCRTestModule.h.

◆ IWire

int IWire
private

Wire ID.

Definition at line 274 of file CDCCRTestModule.h.

◆ lay

int lay
private

Layer ID.

Definition at line 273 of file CDCCRTestModule.h.

◆ lr

int lr
private

Left or right.

Definition at line 275 of file CDCCRTestModule.h.

◆ m_allHistos

std::vector<TH1*> m_allHistos
private

A list of 1d histograms.

Definition at line 214 of file CDCCRTestModule.h.

◆ m_calExpectedDriftTime

bool m_calExpectedDriftTime
private

Calculate expected drift time from x_fit or not.

Definition at line 301 of file CDCCRTestModule.h.

◆ m_cdcHitArrayName

std::string m_cdcHitArrayName
private

Belle2::CDCHit StoreArray name.

Definition at line 209 of file CDCCRTestModule.h.

◆ m_CDCHits

StoreArray<CDCHit> m_CDCHits
private

CDC hits.

Definition at line 206 of file CDCCRTestModule.h.

◆ m_conditions

std::vector<ModuleCondition> m_conditions
privateinherited

Module condition, only non-null if set.

Definition at line 521 of file Module.h.

◆ m_description

std::string m_description
privateinherited

The description of the module.

Definition at line 511 of file Module.h.

◆ m_EstimateResultForUnFittedLayer

bool m_EstimateResultForUnFittedLayer
private

Calculate residual for layer that we do not use in track fitting.

Definition at line 306 of file CDCCRTestModule.h.

◆ m_EventT0Extraction

bool m_EventT0Extraction
private

use Event T0 extract t0 or not.

Definition at line 310 of file CDCCRTestModule.h.

◆ m_eventTimeStoreObject

StoreObjPtr<EventT0> m_eventTimeStoreObject
private

Event timing.

The event time is fetched from the data store using this pointer.

Definition at line 194 of file CDCCRTestModule.h.

◆ m_fillExpertHistos

bool m_fillExpertHistos
private

Fill some histogram for monitoring fit quality.

Definition at line 298 of file CDCCRTestModule.h.

◆ m_h2DHitDistInCDCHit

TH2* m_h2DHitDistInCDCHit
private

2D Hit Dist.

(ICLay vs IWire) from CDCHit.

Definition at line 241 of file CDCCRTestModule.h.

◆ m_h2DHitDistInTrack

TH2* m_h2DHitDistInTrack
private

2D Hit Dist..(ICLay vs IWire) have weight>0.5 after fit with DAF

Definition at line 243 of file CDCCRTestModule.h.

◆ m_h2DHitDistInTrCand

TH2* m_h2DHitDistInTrCand
private

2D Hit Dist.

(ICLay vs IWire) of Track candidates.

Definition at line 242 of file CDCCRTestModule.h.

◆ m_hAlpha

TH1* m_hAlpha
private

Alpha of each Hit.

Definition at line 228 of file CDCCRTestModule.h.

◆ m_hasReturnValue

bool m_hasReturnValue
privateinherited

True, if the return value is set.

Definition at line 518 of file Module.h.

◆ m_hChi2

TH1* m_hChi2
private

Chi2 histo.

Definition at line 224 of file CDCCRTestModule.h.

◆ m_hDxDt

TH2* m_hDxDt[56]
private

Unbiased x_fit vs.

drift time.

Definition at line 239 of file CDCCRTestModule.h.

◆ m_hEvtT0

TH1* m_hEvtT0
private

Event T0.

Definition at line 235 of file CDCCRTestModule.h.

◆ m_hHitDistInCDCHit

TH1* m_hHitDistInCDCHit[56]
private

Hit Dist.

from CDCHit.

Definition at line 231 of file CDCCRTestModule.h.

◆ m_hHitDistInTrack

TH1* m_hHitDistInTrack[56]
private

Hit Dist.

after fit (Weight of Hit >0.5).

Definition at line 233 of file CDCCRTestModule.h.

◆ m_hHitDistInTrCand

TH1* m_hHitDistInTrCand[56]
private

Hit Dist.

Before Fit.

Definition at line 232 of file CDCCRTestModule.h.

◆ m_hHitEff_soft

TProfile* m_hHitEff_soft[56]
private

Hit efficience of each layer, software.

Definition at line 240 of file CDCCRTestModule.h.

◆ m_histogramDirectoryName

std::string m_histogramDirectoryName
private

subdir where to place the histograms.

Definition at line 213 of file CDCCRTestModule.h.

◆ m_hitEfficiency

bool m_hitEfficiency
private

calculate hit eff or not, Haven't finished.

Definition at line 300 of file CDCCRTestModule.h.

◆ m_hNDF

TH1* m_hNDF
private

Number of Degree Freedom.

Definition at line 221 of file CDCCRTestModule.h.

◆ m_hNDFChi2

TH2* m_hNDFChi2
private

Chi2 vs degree-of-freedom histo.

Definition at line 226 of file CDCCRTestModule.h.

◆ m_hNDFNormalizedResidualU

TH2* m_hNDFNormalizedResidualU[56]
private

Normalized residual vs.

ndf.

Definition at line 238 of file CDCCRTestModule.h.

◆ m_hNDFPval

TH2* m_hNDFPval
private

Degree-of-freedom vs Probability histo.

Definition at line 227 of file CDCCRTestModule.h.

◆ m_hNDFResidualU

TH2* m_hNDFResidualU[56]
private

Residual vs.

ndf.

Definition at line 236 of file CDCCRTestModule.h.

◆ m_hNHits

TH1* m_hNHits
private

Number of Hits per track.

Definition at line 222 of file CDCCRTestModule.h.

◆ m_hNHits_trackcand

TH1* m_hNHits_trackcand
private

Number of Hits per trackCand.

Definition at line 223 of file CDCCRTestModule.h.

◆ m_hNormalizedResidualU

TH1* m_hNormalizedResidualU[56]
private

Residual distribution normalized with tracking error.


Definition at line 237 of file CDCCRTestModule.h.

◆ m_hNTracks

TH1* m_hNTracks
private

Number of track fitted, Convergence, not conv, not fit.

Definition at line 218 of file CDCCRTestModule.h.

◆ m_hNTracksPerEvent

TH1* m_hNTracksPerEvent
private

Number of TrackCand per Event.

Definition at line 219 of file CDCCRTestModule.h.

◆ m_hNTracksPerEventFitted

TH1* m_hNTracksPerEventFitted
private

Number of TrackCand per Event.

Definition at line 220 of file CDCCRTestModule.h.

◆ m_hPhi0

TH1* m_hPhi0
private

Phi0 of ttrack, see Helix.

Definition at line 229 of file CDCCRTestModule.h.

◆ m_hPval

TH1* m_hPval
private

Fit Probability histo.

Definition at line 225 of file CDCCRTestModule.h.

◆ m_hResidualU

TH1* m_hResidualU[56]
private

Residual distribution (in cm)

Definition at line 234 of file CDCCRTestModule.h.

◆ m_hTheta

TH1* m_hTheta
private

Theta of each Hit.

Definition at line 230 of file CDCCRTestModule.h.

◆ m_hTriggerHitZX

TH2* m_hTriggerHitZX
private

Trigger hit image.

Definition at line 244 of file CDCCRTestModule.h.

◆ m_logConfig

LogConfig m_logConfig
privateinherited

The log system configuration of the module.

Definition at line 514 of file Module.h.

◆ m_low

std::vector<int> m_low
private

lower channel list for each board.

Definition at line 293 of file CDCCRTestModule.h.

◆ m_MakeHitDist

bool m_MakeHitDist
private

Switch to make histograms of hit distribution.

Definition at line 309 of file CDCCRTestModule.h.

◆ m_MinimumPt

double m_MinimumPt
private

Minimum Transverse momentum of tracks.

Definition at line 286 of file CDCCRTestModule.h.

◆ m_moduleParamList

ModuleParamList m_moduleParamList
privateinherited

List storing and managing all parameter of the module.

Definition at line 516 of file Module.h.

◆ m_name

std::string m_name
privateinherited

The name of the module, saved as a string (user-modifiable)

Definition at line 508 of file Module.h.

◆ m_noBFit

bool m_noBFit
private

fit incase no magnetic Field of not, if true, NDF=4 in cal P-value

Definition at line 302 of file CDCCRTestModule.h.

◆ m_package

std::string m_package
privateinherited

Package this module is found in (may be empty).

Definition at line 510 of file Module.h.

◆ m_plotResidual

bool m_plotResidual
private

Process track to get the hit information of fitted track.

Definition at line 299 of file CDCCRTestModule.h.

◆ m_propertyFlags

unsigned int m_propertyFlags
privateinherited

The properties of the module as bitwise or (with |) of EModulePropFlags.

Definition at line 512 of file Module.h.

◆ m_recoTrackArrayName

std::string m_recoTrackArrayName
private

Belle2::RecoTrack StoreArray nam.e.

Definition at line 210 of file CDCCRTestModule.h.

◆ m_RecoTracks

StoreArray<RecoTrack> m_RecoTracks
private

Tracks.

Definition at line 200 of file CDCCRTestModule.h.

◆ m_relRecoTrackTrackName

std::string m_relRecoTrackTrackName
private

Relation between RecoTrack and Belle2:Track.

Definition at line 212 of file CDCCRTestModule.h.

◆ m_returnValue

int m_returnValue
privateinherited

The return value.

Definition at line 519 of file Module.h.

◆ m_SmallerOutput

bool m_SmallerOutput
private

make output smaller by ignore some variable.

Definition at line 307 of file CDCCRTestModule.h.

◆ m_StoreCDCSimHitInfo

bool m_StoreCDCSimHitInfo
private

Store CDCSimHit Information.

Definition at line 305 of file CDCCRTestModule.h.

◆ m_StoreTrackParams

bool m_StoreTrackParams
private

Store Track parameter or not.

Definition at line 308 of file CDCCRTestModule.h.

◆ m_ToF

bool m_ToF
private

Enable to correct ToF if true.

Definition at line 304 of file CDCCRTestModule.h.

◆ m_ToP

bool m_ToP
private

Enable to correct ToP if true.

Definition at line 303 of file CDCCRTestModule.h.

◆ m_trackArrayName

std::string m_trackArrayName
private

Belle2::Track StoreArray name.

Definition at line 208 of file CDCCRTestModule.h.

◆ m_trackFitResultArrayName

std::string m_trackFitResultArrayName
private

Belle2::TrackFitResult StoreArray name.

Definition at line 211 of file CDCCRTestModule.h.

◆ m_TrackFitResults

StoreArray<TrackFitResult> m_TrackFitResults
private

Track fit results.

Definition at line 203 of file CDCCRTestModule.h.

◆ m_Tracks

StoreArray<Track> m_Tracks
private

Tracks.

Definition at line 197 of file CDCCRTestModule.h.

◆ m_tree

TTree* m_tree
private

Output tree recording the information of each hit.

Definition at line 217 of file CDCCRTestModule.h.

◆ m_treeName

std::string m_treeName
private

Name of tree for the output file.

Definition at line 215 of file CDCCRTestModule.h.

◆ m_TriggerPlaneDirection

std::vector<double> m_TriggerPlaneDirection
private

Nominal center position of trigger counter.

Definition at line 290 of file CDCCRTestModule.h.

◆ m_TriggerPos

std::vector<double> m_TriggerPos
private

Nominal center position of trigger counter.

Definition at line 289 of file CDCCRTestModule.h.

◆ m_TriggerSize

std::vector<double> m_TriggerSize
private

Size of trigger counter (Width x length).

Definition at line 291 of file CDCCRTestModule.h.

◆ m_trigHitPos

B2Vector3D m_trigHitPos
private

Trigger position.

Definition at line 288 of file CDCCRTestModule.h.

◆ m_type

std::string m_type
privateinherited

The type of the module, saved as a string.

Definition at line 509 of file Module.h.

◆ m_up

std::vector<int> m_up
private

upper channel list for each board.

Definition at line 292 of file CDCCRTestModule.h.

◆ ndf

double ndf
private

degree of freedom.

Definition at line 280 of file CDCCRTestModule.h.

◆ numhits

int numhits
private

Number of hits.

Definition at line 276 of file CDCCRTestModule.h.

◆ omega

double omega
private

Track Parameter, omega.

Definition at line 285 of file CDCCRTestModule.h.

◆ phi0

double phi0
private

Track Parameter, phi0.

Definition at line 283 of file CDCCRTestModule.h.

◆ Pt

double Pt
private

Transverse momentum.

Definition at line 264 of file CDCCRTestModule.h.

◆ Pval

double Pval
private

P-value of fitted track.


Definition at line 278 of file CDCCRTestModule.h.

◆ res_b

double res_b
private

Biased residual.

Definition at line 247 of file CDCCRTestModule.h.

◆ res_b_err

double res_b_err
private

Biased residual error.

Definition at line 249 of file CDCCRTestModule.h.

◆ res_u

double res_u
private

Unbiased residual.

Definition at line 248 of file CDCCRTestModule.h.

◆ res_u_err

double res_u_err
private

Unbiased residual error.

Definition at line 250 of file CDCCRTestModule.h.

◆ t

double t
private

Measurement Drift time.

Definition at line 258 of file CDCCRTestModule.h.

◆ t_fit

double t_fit
private

Drift time calculated from x_fit.

Definition at line 259 of file CDCCRTestModule.h.

◆ tanL

double tanL
private

Track Parameter, tanL.

Definition at line 284 of file CDCCRTestModule.h.

◆ tdc

short tdc
private

tdc value.

Definition at line 257 of file CDCCRTestModule.h.

◆ theta

double theta
private

Entrance Polar angle of hit (degree).

Definition at line 255 of file CDCCRTestModule.h.

◆ trighit

int trighit
private

Trigger hit information.

1 if track hits trigger counter, otherwise 0.

Definition at line 296 of file CDCCRTestModule.h.

◆ trigHitPos_x

double trigHitPos_x
private

X-position of track at trigger counter.

Definition at line 294 of file CDCCRTestModule.h.

◆ trigHitPos_z

double trigHitPos_z
private

Z-position of track at trigger counter.

Definition at line 295 of file CDCCRTestModule.h.

◆ TrPval

double TrPval
private

P-value of fitted track.


Definition at line 279 of file CDCCRTestModule.h.

◆ weight

double weight
private

Weight of hit.

Definition at line 251 of file CDCCRTestModule.h.

◆ x_b

double x_b
private

X_fit for biased track fit.

Definition at line 268 of file CDCCRTestModule.h.

◆ x_mea

double x_mea
private

measure drift length (signed by left right).

Definition at line 266 of file CDCCRTestModule.h.

◆ x_sim

double x_sim
private

Simulation DriftLength .

Definition at line 269 of file CDCCRTestModule.h.

◆ x_u

double x_u
private

X_fit for unbiased track fit.

Definition at line 267 of file CDCCRTestModule.h.

◆ z

double z
private

Z of hit on wire.

Definition at line 270 of file CDCCRTestModule.h.

◆ z0

double z0
private

Track Parameter, z0.

Definition at line 282 of file CDCCRTestModule.h.

◆ z_prop

double z_prop
private

Propagation Length along the sense wire.

Definition at line 272 of file CDCCRTestModule.h.

◆ z_sim

double z_sim
private

Z of hit on wire (simulation).

Definition at line 271 of file CDCCRTestModule.h.


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