9 #include <svd/modules/svdPerformance/SVDPerformanceTTreeModule.h>
10 #include <framework/datastore/StoreArray.h>
11 #include <framework/gearbox/Unit.h>
12 #include <framework/core/Environment.h>
13 #include <svd/dataobjects/SVDCluster.h>
14 #include <svd/dataobjects/SVDRecoDigit.h>
15 #include <svd/dataobjects/SVDShaperDigit.h>
16 #include <svd/dataobjects/SVDTrueHit.h>
17 #include <svd/dataobjects/SVDEventInfo.h>
18 #include <vxd/dataobjects/VxdID.h>
19 #include <vxd/geometry/GeoCache.h>
20 #include <vxd/geometry/SensorInfoBase.h>
21 #include <tracking/dataobjects/RecoTrack.h>
22 #include <tracking/dataobjects/RecoHitInformation.h>
23 #include <genfit/TrackPoint.h>
25 #include <Math/Boost.h>
29 #include <mdst/dataobjects/Track.h>
30 #include <mdst/dataobjects/TrackFitResult.h>
49 setDescription(
"The module is used to create a TTree to study SVD clusters, genfit unbiased residuals and many other properties related to the track they belong to.");
51 addParam(
"outputFileName",
m_rootFileName,
"Name of output root file.", std::string(
"SVDPerformanceTTree.root"));
65 m_t_U =
new TTree(
"t_U",
"Tree for SVD u-clusters");
116 m_t_V =
new TTree(
"t_V",
"Tree for SVD v-clusters");
184 if (
m_EventT0->hasTemporaryEventT0(Const::EDetector::CDC)) {
185 const auto bestCDCEvtT0 =
m_EventT0->getBestCDCTemporaryEventT0();
193 std::string m_svdEventInfoName =
"SVDEventInfo";
195 m_svdEventInfoName =
"SVDEventInfoSim";
197 if (!eventinfo) B2ERROR(
"No SVDEventInfo!");
198 m_svdTB = eventinfo->getModeByte().getTriggerBin();
204 for (
const auto& trk : recoTracks) {
205 if (! trk.wasFitSuccessful()) {
212 if (theTK.
size() == 0) {
224 ROOT::Math::BoostZ boost(3. / 11);
225 pStar = boost(pStar);
230 const vector<SVDCluster* > svdClusters = trk.getSVDHitList();
231 B2DEBUG(40,
"FITTED TRACK: NUMBER OF SVD HITS = " << svdClusters.size());
237 for (
unsigned int i = 0; i < svdClusters.size(); i++) {
248 const auto* hitTrackPoint_1 = trk.getCreatedTrackPoint(infoSVD_1);
249 const auto* fittedResult_1 = hitTrackPoint_1->getFitterInfo();
250 if (!fittedResult_1) {
259 const TVectorD resUnBias_1 = fittedResult_1->getResidual(0,
false).getState();
261 const TVectorD& svd_predIntersect_unbiased = state_unbiased.getState();
262 const TMatrixDSym& covMatrix_unbiased = state_unbiased.getCov();
264 const TVectorD& svd_predIntersect_1 = state_1.getState();
265 const TMatrixDSym& covMatrix_1 = state_1.getCov();
269 const int strips_1 = svd_1->
getSize();
272 const ROOT::Math::XYZVector svdLocal_1(svd_1->
getPosition(), svd_predIntersect_1[4], 0.);
274 const ROOT::Math::XYZVector& svdGlobal_1 = svdSensor_1.
pointToGlobal(svdLocal_1);
275 double svdPhi_1 = atan2(svdGlobal_1.Y(), svdGlobal_1.X());
276 double svdZ_1 = svdGlobal_1.Z();
286 if (isMC && trueHit_1.
size() > 0)
323 B2ERROR(
" Inconsistency with cluster size! # recoDigits = " << theRecoDigits.
size() <<
" != " <<
m_svdSize <<
" cluster size");
327 for (
unsigned int d = 0; d <
m_svdSize; d++) {
330 array<float, 6> Samples = ShaperDigit->
getSamples();
333 std::copy(std::begin(Samples), std::end(Samples), std::back_inserter(
m_svdStrip6Samples));
335 double misalignedStripPos = svdSensor_1.
getUCellPosition(theRecoDigits[d]->getCellID());
348 const int strips_1 = svd_1->
getSize();
350 const ROOT::Math::XYZVector svdLocal_1(svd_predIntersect_1[3], svd_1->
getPosition(), 0.);
352 const ROOT::Math::XYZVector& svdGlobal_1 = svdSensor_1.
pointToGlobal(svdLocal_1);
353 double svdPhi_1 = atan2(svdGlobal_1.Y(), svdGlobal_1.X());
354 double svdZ_1 = svdGlobal_1.Z();
364 if (isMC && trueHit_1.
size() > 0)
401 B2ERROR(
" Inconsistency with cluster size! # recoDigits = " << theRecoDigits.
size() <<
" != " <<
m_svdSize <<
" cluster size");
405 for (
unsigned int d = 0; d <
m_svdSize; d++) {
407 array<float, 6> Samples = ShaperDigit->
getSamples();
409 std::copy(std::begin(Samples), std::end(Samples), std::back_inserter(
m_svdStrip6Samples));
411 double misalignedStripPos = svdSensor_1.
getVCellPosition(theRecoDigits[d]->getCellID());
425 B2INFO(
"oops...something went wrong in getting the unbiased state, skipping this cluster.");
static const ChargedStable pion
charged pion particle
bool isMC() const
Do we have generated, not real data?
static Environment & Instance()
Static method to get a reference to the Environment instance.
void setDescription(const std::string &description)
Sets the description of the module.
Class for type safe access to objects that are referred to in relations.
size_t size() const
Get number of relations.
The SVD Cluster class This class stores all information about reconstructed SVD clusters.
float getClsTime() const
Get average of waveform maximum times of cluster strip signals.
float getSNR() const
Get cluster SNR.
unsigned short getSize() const
Get cluster size.
float getCharge() const
Get collected charge.
VxdID getSensorID() const
Get the sensor ID.
bool isUCluster() const
Get the direction of strips.
float getPosition(double v=0) const
Get the coordinate of reconstructed hit.
float getClsTimeSigma() const
Get the error of the reconstructed hit time.
float getPositionSigma() const
Get the error of the reconstructed hit coordinate.
int getFirstFrame() const
Get firstFrame of the MaxSum algorithm.
The SVD ShaperDigit class.
APVFloatSamples getSamples() const
Get array of samples.
bool isOptional(const std::string &name="")
Tell the DataStore about an optional input.
Type-safe access to single objects in the data store.
bool isValid() const
Check whether the object was created.
Values of the result of a track fit with a given particle hypothesis.
ROOT::Math::PxPyPzEVector get4Momentum() const
Getter for the 4Momentum at the closest approach of the track in the r/phi projection.
double getD0() const
Getter for d0.
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.
Class to faciliate easy access to sensor information of the VXD like coordinate transformations or pi...
static GeoCache & getInstance()
Return a reference to the singleton instance.
static const SensorInfoBase & get(Belle2::VxdID id)
Return a reference to the SensorInfo of a given SensorID.
Base class to provide Sensor Information for PXD and SVD.
double getVCellPosition(int vID) const
Return the position of a specific strip/pixel in v direction.
double getUPitch(double v=0) const
Return the pitch of the sensor.
double getVSize() const
Return the length of the sensor.
double getUCellPosition(int uID, int vID=-1) const
Return the position of a specific strip/pixel in u direction.
ROOT::Math::XYZVector pointToGlobal(const ROOT::Math::XYZVector &local, bool reco=false) const
Convert a point from local to global coordinates.
double getVPitch(double v=0) const
Return the pitch of the sensor.
double getThickness() const
Return the thickness of the sensor.
double getUSize(double v=0) const
Return the width of the sensor.
Class to uniquely identify a any structure of the PXD and SVD.
baseType getSensorNumber() const
Get the sensor id.
baseType getLadderNumber() const
Get the ladder id.
baseType getLayerNumber() const
Get the layer id.
#StateOnPlane with additional covariance matrix.
REG_MODULE(arichBtest)
Register the Module.
void addParam(const std::string &name, T ¶mVariable, const std::string &description, const T &defaultValue)
Adds a new parameter to the module.
static double convertValueToUnit(double value, const std::string &unitString)
Converts a floating point value from the standard framework unit to the given unit.
double sqrt(double a)
sqrt for double
Abstract base class for different kinds of events.