8#include <cdc/modules/cdcCalibrationCollector/CDCBadWireCollector.h>
9#include <cdc/translators/RealisticTDCCountTranslator.h>
10#include <framework/datastore/RelationArray.h>
11#include <tracking/trackFindingCDC/eventdata/hits/CDCWireHit.h>
12#include <tracking/trackFindingCDC/topology/CDCWireTopology.h>
13#include <cdc/dataobjects/WireID.h>
19using namespace TrackFindingCDC;
29 addParam(
"minimumPt",
m_minimumPt,
"Tracks with tranverse momentum smaller than this value will not used", 1.0);
30 addParam(
"minimumNDF",
m_minimumNDF,
"Discard tracks whose degree-of-freedom below this value", 5.);
44 auto m_efftree =
new TTree(
m_effTreeName.c_str(),
"tree for wire efficiency");
45 m_efftree->Branch<
unsigned short>(
"layerID", &
layerID);
46 m_efftree->Branch<
unsigned short>(
"wireID", &
wireID);
47 m_efftree->Branch<
float>(
"z", &
z);
48 m_efftree->Branch<
bool>(
"isFound", &
isFound);
51 auto m_hNDF =
new TH1F(
"hNDF",
"NDF of fitted track;NDF;Tracks", 71, -1, 70);
52 auto m_hPval =
new TH1F(
"hPval",
"p-values of tracks;pVal;Tracks", 1000, 0, 1);
62 std::vector<unsigned short> wiresInCDCTrack;
66 unsigned short eWireID = cdcHit.getWire().getEWire();
67 wiresInCDCTrack.push_back(eWireID);
71 const int nTr =
m_Tracks.getEntries();
72 for (
int i = 0; i < nTr; ++i) {
76 B2WARNING(
"No track fit result found.");
80 double ndf = fitresult->
getNDF();
83 double d0 = fitresult->
getD0();
84 double z0 = fitresult->
getZ0();
93 if (d0 > 2 || z0 > 5)
continue;
102 const Helix& helixFit)
const
108 const CDCWire& oneWire = layer.getWire(1);
110 double arcLength = helixFit.getArcLength2DAtCylindricalR(newR);
114 const CDCWire& wire = layer.getClosestWire(crosspoint);
122 const double radiusofLayer = wireLayer.getRefCylindricalR();
124 const double arcLength = helixFit.getArcLength2DAtCylindricalR(radiusofLayer);
126 if (!xyz.
X())
continue;
128 unsigned short crossedWire = wireIntersected.
getEWire();
129 unsigned short crossedCWire = wireIntersected.
getNeighborCW()->getEWire();
130 unsigned short crossedCCWire = wireIntersected.
getNeighborCCW()->getEWire();
132 if (find(wireHits.begin(), wireHits.end(), crossedWire) != wireHits.end()
133 || find(wireHits.begin(), wireHits.end(), crossedCWire) != wireHits.end()
134 || find(wireHits.begin(), wireHits.end(), crossedCCWire) != wireHits.end())
DataType Z() const
access variable Z (= .at(2) without boundary check)
DataType X() const
access variable X (= .at(0) without boundary check)
double m_minimumNDF
minimum NDF required for track
std::string m_effTreeName
Name of efficiency tree for the output file.
CDCBadWireCollectorModule()
Constructor.
std::string m_cdcTrackVectorName
Belle2::CDCTrack vectorpointer name.
TrackFindingCDC::StoreWrappedObjPtr< std::vector< TrackFindingCDC::CDCTrack > > m_CDCTracks
CDC tracks.
StoreArray< TrackFitResult > m_TrackFitResults
Track fit results.
std::string m_cdcHitArrayName
Belle2::CDCHit StoreArray name.
unsigned short wireID
wireID for hit-level wire monitoring
void collect() override
Event action, collect information for calibration.
const TrackFindingCDC::CDCWire & getIntersectingWire(const B2Vector3D &xyz, const TrackFindingCDC::CDCWireLayer &layer, const Helix &helixFit) const
extrapolates the helix fit to a given layer and finds the wire which it would be hitting
void buildEfficiencies(std::vector< unsigned short > wireHits, const Helix helixFit)
Build efficiency.
std::string m_trackArrayName
Belle2::Track StoreArray name.
void prepare() override
Initializes the Module.
void finish() override
Termination action.
std::string m_trackFitResultArrayName
Belle2::TrackFitResult StoreArray name.
unsigned short layerID
layerID for hit-level wire monitoring
StoreArray< Track > m_Tracks
Tracks.
double m_minimumPt
minimum pt required for track
float z
z of hit fot hit-level wire monitoring
virtual ~CDCBadWireCollectorModule()
Destructor.
bool isFound
flag for a hit that has been found near a track as expected by extrapolation
StoreArray< CDCHit > m_CDCHits
CDC hits.
void registerObject(std::string name, T *obj)
Register object with a name, takes ownership, do not access the pointer beyond prepare()
CalibrationCollectorModule()
Constructor. Sets the default prefix for calibration dataobjects.
T * getObjectPtr(std::string name)
Calls the CalibObjManager to get the requested stored collector data.
static const ChargedStable muon
muon particle
void setDescription(const std::string &description)
Sets the description of the module.
void setPropertyFlags(unsigned int propertyFlags)
Sets the flags for the module properties.
@ c_ParallelProcessingCertified
This module can be run in parallel processing mode safely (All I/O must be done through the data stor...
Class representing a three dimensional reconstructed hit.
Class representing a sequence of three dimensional reconstructed hits.
Class representing a sense wire layer in the central drift chamber.
Class representing the sense wire arrangement in the whole of the central drift chamber.
const std::vector< Belle2::TrackFindingCDC::CDCWireLayer > & getWireLayers() const
Getter for the underlying storing layer vector.
static CDCWireTopology & getInstance()
Getter for the singleton instance of the wire topology.
Class representing a sense wire in the central drift chamber.
Vector2D getWirePos2DAtZ(const double z) const
Gives the xy projected position of the wire at the given z coordinate.
MayBePtr< const CDCWire > getNeighborCCW() const
Gives the closest neighbor in the counterclockwise direction - always exists.
IWire getIWire() const
Getter for the wire id within its layer.
unsigned short getEWire() const
Getter for the encoded wire number.
ILayer getICLayer() const
Getter for the continuous layer id ranging from 0 - 55.
MayBePtr< const CDCWire > getNeighborCW() const
Gives the closest neighbor in the clockwise direction - always exists.
double norm() const
Calculates the length of the vector.
Values of the result of a track fit with a given particle hypothesis.
Helix getHelix() const
Conversion to framework Helix (without covariance).
float getNDF() const
Getter for number of degrees of freedom of the track fit.
double getPValue() const
Getter for Chi2 Probability of the track fit.
double getD0() const
Getter for d0.
double getTransverseMomentum() const
Getter for the absolute value of the transverse momentum at the perigee.
double getZ0() const
Getter for z0.
Class that bundles various TrackFitResults.
const TrackFitResult * getTrackFitResultWithClosestMass(const Const::ChargedStable &requestedType) const
Return the track fit for the fit hypothesis with the closest mass.
void addParam(const std::string &name, T ¶mVariable, const std::string &description, const T &defaultValue)
Adds a new parameter to the module.
#define REG_MODULE(moduleName)
Register the given module (without 'Module' suffix) with the framework.
B2Vector3< double > B2Vector3D
typedef for common usage with double
HepGeom::Vector3D< double > Vector3D
3D Vector
Abstract base class for different kinds of events.