 |
Belle II Software
release-05-02-19
|
11 #include <ecl/modules/eclMatchingPerformance/ECLMatchingPerformanceExpertModule.h>
13 #include <ecl/geometry/ECLGeometryPar.h>
14 #include <framework/datastore/StoreArray.h>
15 #include <framework/datastore/StoreObjPtr.h>
16 #include <framework/dataobjects/EventMetaData.h>
17 #include <framework/datastore/RelationVector.h>
19 #include <root/TFile.h>
20 #include <root/TTree.h>
29 ECLMatchingPerformanceExpertModule::ECLMatchingPerformanceExpertModule() :
30 Module(), m_trackProperties()
32 setDescription(
"Module to test the matching efficiency between tracks and ECLClusters. Additionally, information about the tracks are written into a ROOT file.");
36 std::string(
"ECLMatchingPerformanceOutput.root"));
37 addParam(
"minimalCalDigitEnergy",
m_minCalDigitEnergy,
"minimal energy deposition in crystal to distinguish true signal from noise",
58 TDirectory* oldDir = gDirectory;
69 m_iEvent = eventMetaData->getEvent();
70 m_iRun = eventMetaData->getRun();
75 TVector3 pos_enter, pos_exit, pos_center;
83 B2ASSERT(
"Related Belle2 Track has no related track fit result!", fitResult);
109 for (
auto& eclCluster : track.getRelationsTo<
ECLCluster>()) {
111 if (!(eclCluster.isTrack()))
continue;
117 bool found_first_enter =
false;
118 std::set<int> uniqueECLCalDigits;
121 for (
const auto& extHit : track.getRelationsTo<
ExtHit>()) {
122 int copyid = extHit.getCopyID();
123 if (copyid == -1)
continue;
124 if (extHit.getDetectorID() != Const::EDetector::ECL)
continue;
126 if (eclClusterNear) {
132 const int cell = copyid + 1;
133 if (extHit.getStatus() == EXT_ENTER) {
135 inserted = (uniqueECLCalDigits.insert(cell)).second;
138 if (eclCalDigit.getCellId() == cell) {
146 if (!found_first_enter) {
147 pos_enter = extHit.getPosition();
150 found_first_enter =
true;
163 geometry->Mapping(cell - 1);
164 thetaID = geometry->GetThetaID();
166 phiID = geometry->GetPhiID();
167 const short int phiInc = (((phiID + 1) > (crystalsPerRing - 1)) ? phiID + 1 - crystalsPerRing : phiID + 1);
168 const double fractionalPhiInc =
static_cast < double >(phiInc) / crystalsPerRing;
169 const short int phiDec = ((phiID - 1 < 0) ? crystalsPerRing + phiID - 1 : phiID - 1);
170 const double fractionalPhiDec =
static_cast < double >(phiDec) / crystalsPerRing;
184 const short int thisPhiInc = std::lround(fractionalPhiInc * crystalsPerRing);
188 short int thisPhiDec = std::lround(fractionalPhiDec * crystalsPerRing);
189 if (thisPhiDec == crystalsPerRing) thisPhiDec = 0;
201 short int thisPhiDec = std::lround(fractionalPhiDec * crystalsPerRing);
202 if (thisPhiDec == crystalsPerRing) thisPhiDec = 0;
206 const short int thisPhiInc = std::lround(fractionalPhiInc * crystalsPerRing);
221 }
else if (extHit.getStatus() == EXT_EXIT) {
223 pos_exit = extHit.getPosition();
229 int cellid = eclCalDigit.getCellId();
230 TVector3 cvec = geometry->GetCrystalPos(cellid - 1);
231 distance = (cvec - 0.5 * (pos_enter + pos_exit)).Mag();
253 B2FATAL(
"Data tree was not created.");
323 TDirectory* oldDir = gDirectory;
382 std::stringstream leaf;
383 leaf << varName <<
"/D";
384 m_dataTree->Branch(varName.c_str(), &varReference, leaf.str().c_str());
389 std::stringstream leaf;
390 leaf << varName <<
"/I";
391 m_dataTree->Branch(varName.c_str(), &varReference, leaf.str().c_str());
395 int& matchedToNeighbours,
const int& cell)
397 auto& vec_of_neighbouring_cells = eclneighbours->
getNeighbours(cell);
398 for (
const auto& neighbouringcell : vec_of_neighbouring_cells) {
400 [&](
const ECLCalDigit & d) { return (d.getCellId() == neighbouringcell && d.getEnergy() > m_minCalDigitEnergy); }
404 matchedToNeighbours = 1;
413 [&](
const ECLCalDigit & d) { return (d.getCellId() == cell && d.getEnergy() > m_minCalDigitEnergy); }
unsigned int getNumberOfPXDHits() const
Return the number of pxd hits.
TVector3 getClusterPosition() const
Return TVector3 on cluster position (x,y,z)
const genfit::FitStatus * getTrackFitStatus(const genfit::AbsTrackRep *representation=nullptr) const
Return the track fit status for the given representation or for the cardinal one. You are not allowed...
void setDescription(const std::string &description)
Sets the description of the module.
Class to store calibrated ECLDigits: ECLCalDigits.
TVector3 getMomentum() const
Getter for vector of momentum at closest approach of track in r/phi projection.
double py
measured momentum in y direction
double px
measured momentum in x direction
#define REG_MODULE(moduleName)
Register the given module (without 'Module' suffix) with the framework.
@ c_ParallelProcessingCertified
This module can be run in parallel processing mode safely (All I/O must be done through the data stor...
unsigned int getNumberOfSVDHits() const
Return the number of svd hits.
double getPValue() const
Getter for Chi2 Probability of the track fit.
@ c_nPhotons
CR is split into n photons (N1)
Values of the result of a track fit with a given particle hypothesis.
TVector3 getPosition() const
Getter for vector of position at closest approach of track in r/phi projection.
double getZ0() const
Getter for z0.
static ECLGeometryPar * Instance()
Static method to get a reference to the ECLGeometryPar instance.
double pt
measured transverse momentum
int nSVDhits
Number of SVD hits in reconstructed track
void setPropertyFlags(unsigned int propertyFlags)
Sets the flags for the module properties.
This is the Reconstruction Event-Data Model Track.
Store one Ext hit as a ROOT object.
Class to get the neighbours for a given cell id.
double cosTheta
polar angle of measured momentum vector
Abstract base class for different kinds of events.
Type-safe access to single objects in the data store.
double y
measured y value of position
int nCDChits
Number of CDC hits in reconstructed track
double getNdf() const
Get the degrees of freedom of the fit.
int nPXDhits
Number of PXD hits in reconstructed track
unsigned int getNumberOfCDCHits() const
Return the number of cdc hits.
void addParam(const std::string &name, T ¶mVariable, const std::string &description, const T &defaultValue)
Adds a new parameter to the module.
double phi
azimuthal angle of measured momentum vector
The Class for ECL Geometry Parameters.
static const ChargedStable muon
muon particle
Class that bundles various TrackFitResults.
const std::vector< short int > & getNeighbours(short int cid) const
Return the neighbours for a given cell ID.
@ c_Event
Different object in each event, all objects/arrays are invalidated after event() function has been ca...
short int getCrystalsPerRing(const short int thetaid) const
return number of crystals in a given theta ring
double x
measured x value of position
double ptot
measured total momentum
double pz
measured momentum in z direction
short getChargeSign() const
Return track charge (1 or -1).
double z
measured z value of position
FROM * getRelatedFrom(const std::string &name="", const std::string &namedRelation="") const
Get the object from which this object has a relation.
double getD0() const
Getter for d0.