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 auto evtT0List_CDC =
m_EventT0->getTemporaryEventT0s(Const::EDetector::CDC) ;
194 std::string m_svdEventInfoName =
"SVDEventInfo";
196 m_svdEventInfoName =
"SVDEventInfoSim";
198 if (!eventinfo) B2ERROR(
"No SVDEventInfo!");
199 m_svdTB = eventinfo->getModeByte().getTriggerBin();
205 for (
const auto& trk : recoTracks) {
206 if (! trk.wasFitSuccessful()) {
213 if (theTK.
size() == 0) {
225 ROOT::Math::BoostZ boost(3. / 11);
226 pStar = boost(pStar);
231 const vector<SVDCluster* > svdClusters = trk.getSVDHitList();
232 B2DEBUG(40,
"FITTED TRACK: NUMBER OF SVD HITS = " << svdClusters.size());
238 for (
unsigned int i = 0; i < svdClusters.size(); i++) {
249 const auto* hitTrackPoint_1 = trk.getCreatedTrackPoint(infoSVD_1);
250 const auto* fittedResult_1 = hitTrackPoint_1->getFitterInfo();
251 if (!fittedResult_1) {
260 const TVectorD resUnBias_1 = fittedResult_1->getResidual(0,
false).getState();
262 const TVectorD& svd_predIntersect_unbiased = state_unbiased.getState();
263 const TMatrixDSym& covMatrix_unbiased = state_unbiased.getCov();
265 const TVectorD& svd_predIntersect_1 = state_1.getState();
266 const TMatrixDSym& covMatrix_1 = state_1.getCov();
270 const int strips_1 = svd_1->
getSize();
273 const ROOT::Math::XYZVector svdLocal_1(svd_1->
getPosition(), svd_predIntersect_1[4], 0.);
275 const ROOT::Math::XYZVector& svdGlobal_1 = svdSensor_1.
pointToGlobal(svdLocal_1);
276 double svdPhi_1 = atan2(svdGlobal_1.Y(), svdGlobal_1.X());
277 double svdZ_1 = svdGlobal_1.Z();
287 if (isMC && trueHit_1.
size() > 0)
324 B2ERROR(
" Inconsistency with cluster size! # recoDigits = " << theRecoDigits.
size() <<
" != " <<
m_svdSize <<
" cluster size");
328 for (
unsigned int d = 0; d <
m_svdSize; d++) {
331 array<float, 6> Samples = ShaperDigit->
getSamples();
334 std::copy(std::begin(Samples), std::end(Samples), std::back_inserter(
m_svdStrip6Samples));
336 double misalignedStripPos = svdSensor_1.
getUCellPosition(theRecoDigits[d]->getCellID());
349 const int strips_1 = svd_1->
getSize();
351 const ROOT::Math::XYZVector svdLocal_1(svd_predIntersect_1[3], svd_1->
getPosition(), 0.);
353 const ROOT::Math::XYZVector& svdGlobal_1 = svdSensor_1.
pointToGlobal(svdLocal_1);
354 double svdPhi_1 = atan2(svdGlobal_1.Y(), svdGlobal_1.X());
355 double svdZ_1 = svdGlobal_1.Z();
365 if (isMC && trueHit_1.
size() > 0)
402 B2ERROR(
" Inconsistency with cluster size! # recoDigits = " << theRecoDigits.
size() <<
" != " <<
m_svdSize <<
" cluster size");
406 for (
unsigned int d = 0; d <
m_svdSize; d++) {
408 array<float, 6> Samples = ShaperDigit->
getSamples();
410 std::copy(std::begin(Samples), std::end(Samples), std::back_inserter(
m_svdStrip6Samples));
412 double misalignedStripPos = svdSensor_1.
getVCellPosition(theRecoDigits[d]->getCellID());
426 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.