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 name.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 efficiency 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 39 of file CDCCRTestModule.cc.

39 : HistoModule()
40{
41 setDescription("CDC Cosmic ray test module");
42 setPropertyFlags(c_ParallelProcessingCertified); // specify this flag if you need parallel processing
43 addParam("CorrectToF", m_ToF, "if true, time of flight will take account in t", true);
44 addParam("CorrectToP", m_ToP, "if true, time of Propagation will take account in t", true);
45 addParam("RecoTracksColName", m_recoTrackArrayName, "Name of collection hold genfit::Track", std::string(""));
46 addParam("histogramDirectoryName", m_histogramDirectoryName,
47 "Track fit results histograms will be put into this directory", std::string("trackfit"));
48 addParam("NameOfTree", m_treeName, "name of tree in output file", string("tree"));
49 addParam("fillExpertHistograms", m_fillExpertHistos, "Fill additional histograms", true);
50 addParam("noBFit", m_noBFit, "If true -> #Params ==4, #params ==5 for calculate P-Val", false);
51 addParam("plotResidual", m_plotResidual, "plot biased residual, normalized res and xtplot for all layer", false);
52 addParam("calExpectedDriftTime", m_calExpectedDriftTime, "if true module will calculate expected drift time, it take a time",
53 true);
54 addParam("hitEfficiency", m_hitEfficiency, "calculate hit efficiency(Not work now) true:yes false:No", false);
55 addParam("TriggerPos", m_TriggerPos, "Trigger position use for cut and reconstruct Trigger image", std::vector<double> { -0.6, -13.25, 17.3});
56 addParam("NormTriggerPlaneDirection", m_TriggerPlaneDirection, "Normal trigger plane direction and reconstruct Trigger image",
57 std::vector<double> { 0, 1, 0});
58 addParam("TriggerSize", m_TriggerSize, "Trigger Size, (Width x length)", std::vector<double> {100, 50});
59 addParam("IwireLow", m_low, "Lower boundary of hit dist. Histogram", std::vector<int> {0, 0, 0, 0, 0, 0, 0, 0, 0});
60 addParam("IwireUpper", m_up, "Upper boundary of hit dist. Histogram", std::vector<int> {161, 161, 193, 225, 257, 289, 321, 355, 385});
61 addParam("StoreCDCSimHitInfo", m_StoreCDCSimHitInfo, "Store simulation info related to hit, driftLeng, flight time,z_onwire",
62 false);
63 addParam("EstimateResultForUnFittedLayer", m_EstimateResultForUnFittedLayer,
64 "Calculate residual for Layer that is set unUseInFit", true);
65 addParam("SmallerOutput", m_SmallerOutput, "If true, trigghit position, residual cov,absRes, will not be stored", false);
66 addParam("StoreTrackParams", m_StoreTrackParams, "Store Track Parameter or not, it will be multicount for each hit", true);
67 addParam("StoreHitDistribution", m_MakeHitDist, "Make hit distribution or not", true);
68 addParam("EventT0Extraction", m_EventT0Extraction, "use event t0 extract t0 or not", true);
69 addParam("MinimumPt", m_MinimumPt, "Tracks with transverse momentum smaller than this will not be recorded", 0.);
70}
std::string m_recoTrackArrayName
Belle2::RecoTrack StoreArray name.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:559

◆ ~CDCCRTestModule()

~CDCCRTestModule ( )
virtual

Destructor.

Definition at line 72 of file CDCCRTestModule.cc.

73{
74 m_allHistos.clear();
75}
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 233 of file CDCCRTestModule.cc.

234{
235}

◆ 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:362
const std::string & getName() const
Returns the name of the module.
Definition: Module.h:186
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:511
LogConfig m_logConfig
The log system configuration of the module.
Definition: Module.h:513
std::vector< ModuleCondition > m_conditions
Module condition, only non-null if set.
Definition: Module.h:520
std::string m_package
Package this module is found in (may be empty).
Definition: Module.h:509
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 666 of file CDCCRTestModule.cc.

667{
668 // We reconstruct plane from measuedStateOnPlane from one fitted hit.
669 // because I don't want to change state of this plane so I create other state to extrapolate.
670 // first: extrapolate to wire (ideal geometry, nosag) to find z pos than get virtual wire pos due to sag,
671 // extrapolate again to found z pos and U.
673 const StateOnPlane stateOnPlane = StateOnPlane(state.getState(), state.getPlane(), state.getRep());
674 genfit::StateOnPlane st(stateOnPlane);
675
676 const B2Vector3D& Wire1PosIdeal(cdcgeoTrans->getWireBackwardPosition(m_wireID));
677 const B2Vector3D& Wire2PosIdeal(cdcgeoTrans->getWireForwardPosition(m_wireID));
678
679 // unit vector of wire direction
680 B2Vector3D WireDirectionIdeal = Wire2PosIdeal - Wire1PosIdeal;
681 WireDirectionIdeal.SetMag(1.);//normalized
682
683 // extrapolate to find z
684 const genfit::AbsTrackRep* rep = state.getRep();
685 rep->extrapolateToLine(st, Wire1PosIdeal, WireDirectionIdeal);
686 const B2Vector3D& PocaIdeal = rep->getPos(st);
687
688 double zPOCA = (Wire1PosIdeal.Z()
689 + WireDirectionIdeal.Dot(PocaIdeal - Wire1PosIdeal) * WireDirectionIdeal.Z());
690
691 // Now re-extrapolate to new wire direction, wire sag was taking account.
692 const B2Vector3D& wire1(cdcgeoTrans->getWireBackwardPosition(m_wireID, zPOCA));
693 const B2Vector3D& wire2(cdcgeoTrans->getWireForwardPosition(m_wireID, zPOCA));
694
695 // unit vector of wire direction (include sag)
696 B2Vector3D wireDirection = wire2 - wire1;
697 wireDirection.SetMag(1.);
698
699 // extrapolate to find poca
700 rep->extrapolateToLine(st, wire1, wireDirection);
701 const B2Vector3D& poca = rep->getPos(st);
702 B2Vector3D dirInPoca = rep->getMom(st);
703 dirInPoca.SetMag(1.);
704 const B2Vector3D& pocaOnWire = wire1 + wireDirection.Dot(poca - wire1) * wireDirection;
705 if (fabs(wireDirection.Angle(dirInPoca)) < 0.01) {
706 B2WARNING("cannot construct det plane, track parallel with wire");
707 }
708 // construct orthogonal (unit) vector for plane
709 const B2Vector3D& U = wireDirection.Cross(dirInPoca);
710 genfit::SharedPlanePtr pl = genfit::SharedPlanePtr(new genfit::DetPlane(pocaOnWire, U, wireDirection));
711 return pl;
712}
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 425 of file Module.h.

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

◆ 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 438 of file Module.h.

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

◆ 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 431 of file Module.h.

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

◆ 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 419 of file Module.h.

419{ 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 444 of file Module.h.

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

◆ 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 79 of file CDCCRTestModule.cc.

80{
81 m_tree = new TTree(m_treeName.c_str(), "tree");
82 m_tree->Branch("x_mea", &x_mea, "x_mea/D");
83 m_tree->Branch("x_u", &x_u, "x_u/D");
84 m_tree->Branch("x_b", &x_b, "x_b/D");
85 m_tree->Branch("z", &z, "z/D");
86 m_tree->Branch("alpha", &alpha, "alpha/D");
87 m_tree->Branch("theta", &theta, "theta/D");
88 m_tree->Branch("t", &t, "t/D");
89 m_tree->Branch("evtT0", &evtT0, "evtT0/D");
90 m_tree->Branch("adc", &adc, "adc/s");
91 m_tree->Branch("boardID", &boardID, "boardID/I");
92 m_tree->Branch("lay", &lay, "lay/I");
93 m_tree->Branch("weight", &weight, "weight/D");
94 m_tree->Branch("IWire", &IWire, "IWire/I");
95 m_tree->Branch("Pval", &Pval, "Pval/D");
96 m_tree->Branch("ndf", &ndf, "ndf/D");
97 // m_tree->Branch("trighit", &trighit, "trighit/I");
99 m_tree->Branch("d0", &d0, "d0/D");
100 m_tree->Branch("z0", &z0, "z0/D");
101 m_tree->Branch("phi0", &phi0, "phi0/D");
102 m_tree->Branch("tanL", &tanL, "tanL/D");
103 m_tree->Branch("omega", &omega, "omega/D");
104 m_tree->Branch("Pt", &Pt, "Pt/D");
105 }
107 m_tree->Branch("z_sim", &z_sim, "z_sim/D");
108 m_tree->Branch("x_sim", &x_sim, "x_sim/D");
109 m_tree->Branch("dt_flight_sim", &dt_flight_sim, "dt_flight_sim/D");
110 }
111 if (m_calExpectedDriftTime) { // expected drift time, calculated form xfit
112 m_tree->Branch("t_fit", &t_fit, "t_fit/D");
113 }
114 if (!m_SmallerOutput) {
115 m_tree->Branch("tdc", &tdc, "tdc/I");
116 m_tree->Branch("z_prop", &z_prop, "z_prop/D");
117 m_tree->Branch("res_b", &res_b, "res_b/D");
118 m_tree->Branch("res_u", &res_u, "res_u/D");
119 m_tree->Branch("lr", &lr, "lr/I");
120 m_tree->Branch("trigHitPos_x", &trigHitPos_x, "trigHitPos_x/D");
121 m_tree->Branch("trigHitPos_z", &trigHitPos_z, "trigHitPos_z/D");
122 m_tree->Branch("numhits", &numhits, "numhits/I");
123 m_tree->Branch("res_b_err", &res_b_err, "res_b_err/D");
124 m_tree->Branch("res_u_err", &res_u_err, "res_u_err/D");
125 m_tree->Branch("absRes_u", &absRes_u, "absRes_u/D");
126 m_tree->Branch("absRes_b", &absRes_b, "absRes_b/D");
127 m_tree->Branch("dt_prop", &dt_prop, "dt_prop/D");
128 m_tree->Branch("dt_flight", &dt_flight, "dt_flight/D");
129 }
130
131 // int N =m_Nchannel;//Number of Wire per Layer used;
132 TDirectory* oldDir = gDirectory;
133 TDirectory* histDir = oldDir->mkdir(m_histogramDirectoryName.c_str());
134 histDir->cd();
135 m_hNTracks = getHist("hNTracks", "number of tracks", 3, 0, 3);
136 m_hNTracks->GetXaxis()->SetBinLabel(1, "fitted, converged");
137 m_hNTracks->GetXaxis()->SetBinLabel(2, "fitted, not converged");
138 m_hNTracks->GetXaxis()->SetBinLabel(3, "TrackCand, but no Track");
139
140 m_hNDF = getHist("hNDF", "NDF of fitted track;NDF;Tracks", 71, -1, 150);
141 m_hNHits = getHist("hNHits", "#hit of fitted track;#hit;Tracks", 61, -1, 150);
142 m_hNHits_trackcand = getHist("hNHits_trackcand", "#hit of track candidate;#hit;Tracks", 71, -1, 150);
143 m_hNTracksPerEvent = getHist("hNTracksPerEvent", "#tracks/Event;#Tracks;Event", 20, 0, 20);
144 m_hNTracksPerEventFitted = getHist("hNTracksPerEventFitted", "#tracks/Event After Fit;#Tracks;Event", 20, 0, 20);
145 m_hChi2 = getHist("hChi2", "#chi^{2} of tracks;#chi^{2};Tracks", 400, 0, 400);
146 m_hPhi0 = getHist("hPhi0", "#Phi_{0} of tracks;#phi_{0} (Degree);Tracks", 400, -190, 190);
147 m_hAlpha = getHist("hAlpha", "#alpha Dist.;#alpha (Degree);Hits", 360, -90, 90);
148 m_hTheta = getHist("hTheta", "#theta Dist.;#theta (Degree);Hits", 360, 0, 180);
149 m_hPval = getHist("hPval", "p-values of tracks;pVal;Tracks", 1000, 0, 1);
150 m_hEvtT0 = getHist("hEvtT0", "Event T0; EvtT0 (ns); #event", 200, -100, 100);
151
152 m_hTriggerHitZX = getHist("TriggerHitZX", "Hit Position on trigger counter;z(cm);x(cm)", 300, -100, 100, 120, -15, 15);
153 if (m_MakeHitDist) {
154 m_h2DHitDistInCDCHit = getHist("2DHitDistInCDCHit", " CDCHit;WireID;LayerID",
155 m_up[8] - m_low[0], m_low[0], m_up[8], 56, 0, 56);
156 m_h2DHitDistInTrCand = getHist("2DHitDistInTrCand", "Track Cand ;WireID;LayerID",
157 m_up[8] - m_low[0], m_low[0], m_up[8], 56, 0, 56);
158 m_h2DHitDistInTrack = getHist("2DHitDistInTrack", "Fitted Track ;WireID;LayerID",
159 m_up[8] - m_low[0], m_low[0], m_up[8], 56, 0, 56);
160 }
161 if (m_fillExpertHistos) {
162 m_hNDFChi2 = getHist("hNDFChi2", "#chi^{2} of tracks;NDF;#chi^{2};Tracks", 8, 0, 8, 800, 0, 200);
163 m_hNDFPval = getHist("hNDFPval", "p-values of tracks;NDF;pVal;Tracks", 8, 0, 8, 100, 0, 1);
164 }
165 int sl;
166 for (int i = 0; i < 56; ++i) {
167 if (m_hitEfficiency) {
168 m_hHitEff_soft[i] = getHistProfile(Form("hHitEff_soft_L%d", i),
169 Form("hit efficiency(soft) of Layer %d ;Drift distance;Software Efficiency", i), 200, -1, 1);
170 }
171 if (m_MakeHitDist) {
172 if (i < 8) {sl = 0;} else { sl = floor((i - 8) / 6) + 1;}
173 m_hHitDistInCDCHit[i] = getHist(Form("hHitDistInCDCHit_layer%d", i), Form("Hit Dist. ICLayer_%d;WireID;#Hits", i),
174 m_up.at(sl) - m_low.at(sl), m_low.at(sl), m_up.at(sl));
175 m_hHitDistInCDCHit[i]->SetLineColor(kGreen);
176 m_hHitDistInTrCand[i] = getHist(Form("hHitDistInTrCand_layer%d", i), Form("Hit Dist. ICLayer_%d;WireID;#Hits", i),
177 m_up.at(sl) - m_low.at(sl), m_low.at(sl), m_up.at(sl));
178 m_hHitDistInTrCand[i]->SetLineColor(kRed);
179 m_hHitDistInTrack[i] = getHist(Form("hHitDistInTrack_layer%d", i), Form("Hit Dist. ICLayer_%d;WireID;#Hits", i),
180 m_up.at(sl) - m_low.at(sl), m_low.at(sl), m_up.at(sl));
181 }
182 const double normResRange = 20;
183 const double residualRange = 0.3;
184 std::string title, name;
185 if (m_plotResidual) {
186 name = (boost::format("hist_ResidualsU%1%") % i).str();
187 title = (boost::format("unnormalized, unbiased residuals in layer %1%;cm;Tracks") % i).str();
188 m_hResidualU[i] = getHist(name, title, 500, -residualRange, residualRange);
189
190 name = (boost::format("hNormalizedResidualsU%1%") % i).str();
191 title = (boost::format("normalized, unbiased residuals in layer %1%;NDF;#sigma (cm);Tracks") % i).str();
192 m_hNormalizedResidualU[i] = getHist(name, title, 500, -normResRange, normResRange);
193
194 name = (boost::format("DxDt%1%") % i).str();
195 title = (boost::format("Drift Length vs Drift time at Layer_%1%;Drift Length (cm);Drift time (ns)") % i).str();
196 m_hDxDt[i] = getHist(name, title, 200, -1, 1, 450, -50, 400);
197 }
198 if (m_fillExpertHistos) {
199 name = (boost::format("hNDFResidualsU%1%") % i).str();
200 title = (boost::format("unnormalized, unbiased residuals along U in layer %1%;NDF;cm;Tracks") % i).str();
201 m_hNDFResidualU[i] = getHist(name, title, 8, 0, 8, 1000, -residualRange, residualRange);
202
203 name = (boost::format("hNDFNormalizedResidualsU%1%") % i).str();
204 title = (boost::format("normalized, unbiased residuals in layer %1%;NDF;#sigma (cm);Tracks") % i).str();
205 m_hNDFNormalizedResidualU[i] = getHist(name, title, 8, 0, 8, 1000, -normResRange, normResRange);
206 }
207 }
208 oldDir->cd();
209}
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 efficiency 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 345 of file CDCCRTestModule.cc.

346{
347}

◆ 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:518
bool m_hasReturnValue
True, if the return value is set.
Definition: Module.h:517

◆ event()

void event ( void  )
overridevirtual

Event action (main routine).

find results in track fit results

Reimplemented from HistoModule.

Definition at line 237 of file CDCCRTestModule.cc.

238{
239 evtT0 = 0.;
241
242 /* CDCHit distribution */
243 if (m_MakeHitDist) {
244 for (int i = 0; i < m_CDCHits.getEntries(); ++i) {
245 Belle2::CDCHit* hit = m_CDCHits[i];
246 m_hHitDistInCDCHit[getICLayer(hit->getISuperLayer(), hit->getILayer())]->Fill(hit->getIWire());
247 m_h2DHitDistInCDCHit->Fill(hit->getIWire(), getICLayer(hit->getISuperLayer(), hit->getILayer()));
248 }
249 }
250 // Loop over Recotracks
251 int nTr = m_RecoTracks.getEntries();
252 m_hNTracksPerEvent->Fill(nTr);
253
254 int nfitted = 0;
255
256 for (int i = 0; i < nTr; ++i) {
257 RecoTrack* track = m_RecoTracks[i];
258 if (track->getDirtyFlag()) {B2INFO("Dirty flag was set for track: " << track->getPositionSeed().Y()); continue;}
259 m_hNHits_trackcand->Fill(track->getNumberOfCDCHits());
260 if (m_MakeHitDist) {
262 }
263 if (!track->hasTrackFitStatus()) {
264 m_hNTracks->Fill("Track not fitted", 1.0);
265 continue;
266 }
267 const genfit::FitStatus* fs = track->getTrackFitStatus();
268 if (!fs || !fs->isFitted()) {
269 m_hNTracks->Fill("Track not fitted", 1.0);
270 continue;
271 }
272 if (!fs->isFitConverged()) {//not fully convergence
273 m_hNTracks->Fill("fitted, not converged", 1.0);
274 B2DEBUG(99, "------Fitted but not converged");
275 continue;
276 }
277
278 m_hNTracks->Fill("fitted, converged", 1.0);
279 B2DEBUG(99, "-------Fitted and Converged");
280
281 nfitted = nfitted + 1;
283 const Belle2::Track* b2track = track->getRelatedFrom<Belle2::Track>();
284 if (!b2track) {B2DEBUG(99, "No relation found"); continue;}
286
287 if (!fitresult) {
288 B2WARNING("track was fitted but Relation not found");
289 continue;
290 }
291
292 if (m_noBFit) {ndf = fs->getNdf() + 1;} // in case no Magnetic field, NDF=4;
293 else {ndf = fs->getNdf();}
294 double Chi2 = fs->getChi2();
295 TrPval = std::max(0., ROOT::Math::chisquared_cdf_c(Chi2, ndf));
296 m_hPval->Fill(TrPval);
297 m_hNDF->Fill(ndf);
298 if (ndf < 15) continue;
300 // event with is fail to extract t0 will be exclude from analysis
301 if (m_eventTimeStoreObject.isValid() && m_eventTimeStoreObject->hasEventT0()) {
302 evtT0 = m_eventTimeStoreObject->getEventT0();
303 m_hEvtT0->Fill(evtT0);
304 } else { continue;}
305 }
306
307 d0 = fitresult->getD0();
308 z0 = fitresult->getZ0();
311 phi0 = fitresult->getPhi0() * 180 / M_PI;
312 Pt = fitresult->getMomentum().Rho();
313 m_hPhi0->Fill(phi0);
314 m_hChi2->Fill(Chi2);
315 if (Pt < m_MinimumPt) continue;
316 if (m_hitEfficiency && track->getNumberOfCDCHits() > 30 && TrPval > 0.001) {
317 HitEfficiency(track);
318 }
319 if (m_fillExpertHistos) {
320 m_hNDFChi2->Fill(ndf, fs->getChi2());
321 m_hNDFPval->Fill(ndf, TrPval);
322 }
323 try {
324 plotResults(track);
325 } catch (const genfit::Exception& e) {
326 // at least log that there was something going very wrong
327 B2ERROR("Exception when calling the plotResults method" << e.what());
328 }
329
331 //try {
332 // DONT IGNORE THE EXCEPTION BEING THROWN HERE
334 // plotResults(track);
335 //} catch (...) {
336 //B2ERROR (" fatal 2! ");
337
338 //}
339 }
340 }
341
342 m_hNTracksPerEventFitted->Fill(nfitted);
343}
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
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 paths */
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:224
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:229
const std::string & getDescription() const
Returns the description of the module.
Definition: Module.h:201
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:310
const std::string & getPackage() const
Returns the package this module is in.
Definition: Module.h:196
void setName(const std::string &name)
Set the name of the module.
Definition: Module.h:213
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 323 of file Module.h.

324 {
325 return m_conditions;
326 }

◆ getCondition()

const ModuleCondition * getCondition ( ) const
inlineinherited

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

Definition at line 313 of file Module.h.

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

◆ 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 201 of file Module.h.

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

◆ 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 133 of file Module.h.

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

◆ 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 464 of file CDCCRTestModule.cc.

465{
466 for (const RecoHitInformation::UsedCDCHit* cdchit : track->getCDCHitList()) {
467 int iclay = getICLayer(cdchit->getISuperLayer(), cdchit->getILayer());
468 B2DEBUG(99, "In TrackCand: ICLayer: " << iclay << "IWire: " << cdchit->getIWire());
469 m_hHitDistInTrCand[iclay]->Fill(cdchit->getIWire());
470 m_h2DHitDistInTrCand->Fill(cdchit->getIWire(), iclay);
471 }
472}

◆ 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 224 of file Module.h.

224{return m_logConfig;}

◆ getModules()

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

no submodules, return empty list

Implements PathElement.

Definition at line 505 of file Module.h.

505{ 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 186 of file Module.h.

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

◆ getPackage()

const std::string & getPackage ( ) const
inlineinherited

Returns the package this module is in.

Definition at line 196 of file Module.h.

196{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:515

◆ getParamList()

const ModuleParamList & getParamList ( ) const
inlineinherited

Return module param list.

Definition at line 362 of file Module.h.

362{ 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 535 of file CDCCRTestModule.cc.

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

380{ return m_returnValue; }

◆ getTriggerHitPosition()

B2Vector3D getTriggerHitPosition ( Belle2::RecoTrack track)
private

extrapolation track to trigger counter plane (y position).

Definition at line 474 of file CDCCRTestModule.cc.

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

◆ 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:508

◆ hasCondition()

bool hasCondition ( ) const
inlineinherited

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

Definition at line 310 of file Module.h.

310{ 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 377 of file Module.h.

377{ 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 493 of file CDCCRTestModule.cc.

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

212{
213 REG_HISTOGRAM
214 m_Tracks.isRequired(m_trackArrayName);
217 m_CDCHits.isRequired(m_cdcHitArrayName);
219 //Store names to speed up creation later
220 m_relRecoTrackTrackName = relRecoTrackTrack.getName();
221
222 for (size_t i = 0; i < m_allHistos.size(); ++i) {
223 m_allHistos[i]->Reset();
224 }
225 B2ASSERT("Trigger Position (TriggerPos) must be 3 components.", m_TriggerPos.size() == 3);
226 B2ASSERT("Normal vector of Trigger Plane (NormTriggerPlaneDirection) must be 3 components.", m_TriggerPlaneDirection.size() == 3);
227 B2ASSERT("Trigger size (TriggerSize) must be 2 component width and length(z direction)", m_TriggerSize.size() == 2);
228 B2ASSERT("List of Lower boundary (IWireLow) ( for histo must be 9 components, equivalent 9 supper layers", m_low.size() == 9);
229 B2ASSERT("List of Upper boundary (IWireUp) for histo must be 9 components, equivalent 9 supper layers", m_low.size() == 9);
230 B2INFO("Trigger Position (" << m_TriggerPos.at(0) << " ," << m_TriggerPos.at(1) << " ," << m_TriggerPos.at(2) << ")");
231}
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.

◆ plotResults()

void plotResults ( Belle2::RecoTrack track)
private

Plot track parameters and related variables.

Definition at line 353 of file CDCCRTestModule.cc.

354{
359 bool hittrig = (sqrt((m_trigHitPos.X() - m_TriggerPos[0]) * (m_trigHitPos.X() - m_TriggerPos[0]) +
361 && fabs(m_trigHitPos.Z() - m_TriggerPos[2]) < m_TriggerSize[1] / 2) ? true : false;
362 if (hittrig) {trighit = 1;}
363 else {trighit = 0;}
364 static CDCGeometryPar& cdcgeo = CDCGeometryPar::Instance();
366 m_hNHits->Fill(track->getNumberOfCDCHits());
367
368 std::vector<genfit::TrackPoint*> tps = track->getHitPointsWithMeasurement();
369 numhits = tps.size();
370 for (genfit::TrackPoint* tp : tps) {
371 if (!tp->hasRawMeasurements())
372 continue;
373
374 const genfit::AbsMeasurement* raw = tp->getRawMeasurement(0);
375 const CDCRecoHit* rawCDC = dynamic_cast<const CDCRecoHit*>(raw);
376 if (rawCDC) {
377 WireID wireid = rawCDC->getWireID();
378 const genfit::KalmanFitterInfo* kfi = tp->getKalmanFitterInfo();
379 if (!kfi) {B2DEBUG(199, "No Fitter Info: Layer " << wireid.getICLayer()); continue;}
380
381 for (unsigned int iMeas = 0; iMeas < kfi->getNumMeasurements(); ++iMeas) {
382 if ((kfi->getWeights().at(iMeas)) > 0.5) {
383 const genfit::MeasurementOnPlane& residual_b = kfi->getResidual(iMeas, true);
384 const genfit::MeasurementOnPlane& residual_u = kfi->getResidual(iMeas, false);
385 lay = wireid.getICLayer();
386 IWire = wireid.getIWire();
387 if (m_MakeHitDist) {
390 }
391 boardID = cdcgeo.getBoardID(wireid);
392 Pval = TrPval;
393 tdc = rawCDC->getCDCHit()->getTDCCount();
394 adc = rawCDC->getCDCHit()->getADCCount();
395
396 const genfit::MeasuredStateOnPlane& mop = kfi->getFittedState();
397 const B2Vector3D pocaOnWire = mop.getPlane()->getO();//Local wire position
398 const B2Vector3D pocaMom = mop.getMom();
399 alpha = cdcgeo.getAlpha(pocaOnWire, pocaMom) ;
400 theta = cdcgeo.getTheta(pocaMom);
401 //Convert to outgoing
402 x_mea = kfi->getMeasurementOnPlane(iMeas)->getState()(0);
403 x_b = kfi->getFittedState(true).getState()(3);// x fit biased
404 res_b = residual_b.getState()(0);
405 x_u = kfi->getFittedState(false).getState()(3);//x fit unbiased
406 res_u = residual_u.getState()(0);
407 if (x_u > 0) lr = 1;
408 else lr = 0;
409 if (fabs(alpha) > M_PI / 2) {
410 x_b *= -1;
411 res_b *= -1;
412 x_u *= -1;
413 res_u *= -1;
414 }
415 x_mea = copysign(x_mea, x_u);
416 lr = cdcgeo.getOutgoingLR(lr, alpha);
418 alpha = cdcgeo.getOutgoingAlpha(alpha);
419 B2DEBUG(199, "x_unbiased " << x_u << " |left_right " << lr);
420 if (m_calExpectedDriftTime) { t_fit = cdcgeo.getDriftTime(std::abs(x_u), lay, lr, alpha, theta);}
421 alpha *= 180 / M_PI;
422 theta *= 180 / M_PI;
423 m_hAlpha->Fill(alpha);
424 m_hTheta->Fill(theta);
425
426 //B2INFO("resi V " <<residual.getState()(1));
427 // weight_res = residual.getWeight();
428 absRes_b = std::abs(x_b + res_b) - std::abs(x_b);
429 absRes_u = std::abs(x_u + res_u) - std::abs(x_u);
430 weight = residual_u.getWeight();
431 res_b_err = std::sqrt(residual_b.getCov()(0, 0));
432 res_u_err = std::sqrt(residual_u.getCov()(0, 0));
433
434 t = tdcTrans->getDriftTime(tdc, wireid, mop.getTime(), pocaOnWire.Z(), adc);
435 z = pocaOnWire.Z();
436
437 // t = getCorrectedDriftTime(wireid, tdc, adc, z, z0);
439 CDCSimHit* simhit = rawCDC->getCDCHit()->getRelated<Belle2::CDCSimHit>();
440 if (simhit) {
441 x_sim = simhit->getDriftLength();
442 z_sim = simhit->getPosWire().Z();
443 dt_flight_sim = simhit->getFlightTime();
444 }
445 }
446 m_tree->Fill();
447 if (m_plotResidual) {
448 m_hDxDt[lay]->Fill(x_u, t);
449 m_hResidualU[lay]->Fill(res_b, weight);
450 m_hNormalizedResidualU[lay]->Fill(res_b / sqrt(residual_b.getCov()(0, 0)), weight);
451 }
452 if (m_fillExpertHistos) {
454 m_hNDFResidualU[lay]->Fill(ndf, res_b);
455 m_hNDFNormalizedResidualU[lay]->Fill(ndf, res_b / std::sqrt(residual_b.getCov()(0, 0)), weight);
456 }
457 } //NDF
458 // }//end of if isU
459 }//end of for
460 }//end of rawCDC
461 }//end of for tp
462}//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 229 of file Module.h.

229{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 213 of file Module.h.

213{ m_name = name; };

◆ setParamList()

void setParamList ( const ModuleParamList params)
inlineprotectedinherited

Replace existing parameter list.

Definition at line 500 of file Module.h.

500{ 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:28
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 349 of file CDCCRTestModule.cc.

350{
351}

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 520 of file Module.h.

◆ m_description

std::string m_description
privateinherited

The description of the module.

Definition at line 510 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 517 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 efficiency 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 513 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 515 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 507 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 509 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 511 of file Module.h.

◆ m_recoTrackArrayName

std::string m_recoTrackArrayName
private

Belle2::RecoTrack StoreArray name.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 518 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 508 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: