9#include <tracking/modules/spacePointCreator/CurlingTrackCandSplitterModule.h>
12#include <framework/dataobjects/EventMetaData.h>
13#include <framework/datastore/StoreObjPtr.h>
16#include <pxd/dataobjects/PXDCluster.h>
17#include <pxd/dataobjects/PXDTrueHit.h>
18#include <svd/dataobjects/SVDCluster.h>
19#include <svd/dataobjects/SVDTrueHit.h>
22#include <tracking/spacePointCreation/SpacePoint.h>
23#include <tracking/spacePointCreation/SpacePointTrackCand.h>
25#include <boost/format.hpp>
37 setDescription(
"Module for checking SpacePointTrackCands for curling behaviour and (if wanted) splitting them into SpacePointTrackCands that no longer show curling behaviour. WARNING: MODULE IS DEPRECATED use SPTCReferee instead!");
40 "Split curling SpacePointTrackCands into non-curling SpacePointTrackCands and store them",
true);
42 "Maximum number of SpacePointTrackCand Stubs to be created from a curling SpacePointTrackCand. Set to 0 if you want all possible TrackCand Stubs",
45 addParam(
"SpacePointTCName",
m_PARAMsptcName,
"Collection name of the SpacePointTrackCands to be analyzed for curling behaviour",
48 "Collection name under which the first outgoing part of a curling TrackCand will be stored in the StoreArray. The first part of a curling Track has its origin at the interaction point.",
51 "Collection name under which all ingoing parts of a curling TrackCand will be stored in the StoreArray", std::string(
""));
53 "Collection name under which all but the first outgoing parts of a curling TrackCand will be stored in the StoreArray",
56 "Collection name under which all parts of a curling TrackCand will be stored in the StoreArray together. NOTE: only if this parameter is set to a non-empty string a complete (but split) curling TrackCand will be stored!",
60 std::vector<double> defaultOrigin = { 0., 0., 0. };
62 "WARNING: still need to find out the units that are used internally! Reset origin to given point. Used for determining the direction of flight of a particle for a given hit. Needs to be reset for e.g. testbeam, where origin is not at (0,0,0)",
66 "Set to true to investigate the positions of SpacePoints and TrueHits and write them to a ROOT file",
false);
68 std::vector<std::string> defaultRootFName;
69 defaultRootFName.push_back(
"PositionResiduals");
70 defaultRootFName.push_back(
"RECREATE");
73 "Filename and write-mode ('RECREATE' or 'UPDATE'). If given more than 2 strings this module will cause termination",
78 "Switch for using SpacePoints in position Analysis that are related to more than one TrueHit",
false);
92 B2INFO(
"CurlingTrackCandSplitter ----------------------------- initialize() -------------------------------------");
93 B2WARNING(
"CurlingTrackCandSplitter is deprecated and will be removed from framework in the near future! use SPTCReferee instead!");
104 B2WARNING(
"CurlingTrackCandSplitter::initialize: More than one of your input strings for the collection names is empty. This can lead to undeterministic behaviour since two or more collections will be stored under the same name!");
124 " as collection name for complete curling TrackCands. Complete curling TrackCands will hence be stored.");
127 "You did not put in any under which complete curling TrackCands should be stored, hence curling TrackCands will only be stored in parts.");
133 B2WARNING(
"CurlingTrackCandSplitter::initialize> Value of nTrackStubs is below 0: nTrackStubs = " <<
m_PARAMnTrackStubs <<
134 ". Resetting this value to 0 now! This means that all parts of curling TrackCands will be stored.");
141 B2WARNING(
"CurlingTrackCandSplitter::initialize: Provided origin is not a 3D point! Please provide 3 values (x,y,z). Rejecting user input and setting origin to (0,0,0) for now!");
153 B2FATAL(
"CurlingTrackCandSplitter::initialize() : rootFileName is set wrong: entries are: " << output);
158 m_treePtr =
new TTree(
"m_treePtr",
"aTree");
161 for (
int layer = 0; layer < c_nPlanes; ++layer) {
162 std::string layerString = (boost::format(
"%1%") % (layer +
165 std::string name =
"SpacePointXGlobal_" + layerString;
167 name =
"SpacePointYGlobal_" + layerString;
169 name =
"SpacePointZGlobal_" + layerString;
172 name =
"SpacePointULocal_" + layerString;
174 name =
"SpacePointVlocal_" + layerString;
177 name =
"TrueHitXGlobal_" + layerString;
179 name =
"TrueHitYGlobal_" + layerString;
181 name =
"TrueHitZGlobal_" + layerString;
184 name =
"TrueHitULocal_" + layerString;
186 name =
"TrueHitVLocal_" + layerString;
189 name =
"PosResidualsXGlobal_" + layerString;
191 name =
"PosResidualsYGlobal_" + layerString;
193 name =
"PosResidualsZGlobal_" + layerString;
196 name =
"PosResidualsULocal_" + layerString;
198 name =
"PosResidualsVLocal_" + layerString;
202 name =
"LocalPositionResiduals_" + layerString;
204 name =
"GlobalPositionResiduals_" + layerString;
207 name =
"MisMatchPosDistance_" + layerString;
209 name =
"MisMatchPosX_" + layerString;
211 name =
"MisMatchPosY_" + layerString;
213 name =
"MisMatchPosZ_" + layerString;
216 name =
"MisMatchPosU_" + layerString;
218 name =
"MisMatchPosV_" + layerString;
221 name =
"MisMatchMomX_" + layerString;
223 name =
"MisMatchMomY_" + layerString;
225 name =
"MisMatchMomZ_" + layerString;
238 const int eventCounter = eventMetaDataPtr->getEvent();
239 B2DEBUG(21,
"CurlingTrackCandSplitter::event(). -------------- Processing event " << eventCounter <<
" ----------------");
244 B2DEBUG(21,
"Found " << nTCs <<
" SpacePointTrackCands in StoreArray " <<
m_spacePointTCs.
getName() <<
" for this event");
248 for (
int iTC = 0; iTC < nTCs; ++iTC) {
252 B2DEBUG(21,
"=========================== Processing SpacePointTrackCand " << iTC <<
" ===============================");
256 if (splittingIndices.empty()) {
257 B2DEBUG(21,
"This SpacePointTrackCand shows no curling behaviour and will be added to collection: " <<
m_PARAMcurlingOutFirstName);
264 B2DEBUG(21,
"This SpacePointTrackCand shows curling behaviour");
266 B2DEBUG(21,
"This SpacePointTrackCand could be split into " << splittingIndices.size() + 1 <<
267 " but will not, because splitCurlers is set to false");
282 if (!trackStub.isOutgoing()) {
287 if (trackStub.getTrackStubIndex() > 1) {
299 }
catch (FoundNoTrueHit& anE) {
300 B2WARNING(
"Caught an exception during checking for curling behaviour: " << anE.what() <<
301 " This TrackCandidate cannot be checked for curling behaviour");
303 }
catch (FoundNoCluster& anE) {
304 B2WARNING(
"Caught an exception during checking for curling behaviour: " << anE.what() <<
305 " This TrackCandidate cannot be checked for curling behaviour");
307 }
catch (TrueHitsNotMatching& anE) {
308 B2WARNING(
"Caught an exception during checking for curling behaviour: " << anE.what() <<
309 " This TrackCandidate cannot be checked for curling behaviour");
311 }
catch (SpacePointTrackCand::UnsupportedDetType& anE) {
312 B2WARNING(
"Caught an exception during checking for curling behaviour: " << anE.what() <<
313 " This TrackCandidate cannot be checked for curling behaviour");
324 B2INFO(
"CurlingTrackCandSplitter::terminate(): checked " <<
m_spacePointTCCtr <<
" SpacePointTrackCands for curling behaviour. " <<
328 " SpacePoints that were related to more than one TrueHit");
341 const std::vector<const Belle2::SpacePoint*>& tcSpacePoints = SPTrackCand.
getHits();
342 unsigned int nHits = SPTrackCand.
getNHits();
344 B2DEBUG(21,
"SpacePointTrackCand contains " << nHits <<
" SpacePoints");
346 std::vector<int> returnVector;
348 std::pair<bool, bool>
353 for (
unsigned int iHit = 0; iHit < nHits; ++iHit) {
354 const SpacePoint* spacePoint = tcSpacePoints[iHit];
355 auto detType = spacePoint->
getType();
357 B2DEBUG(21,
"Now checking SpacePoint " << iHit <<
" in SPTC. This SpacePoint has Index " << spacePoint->
getArrayIndex() <<
361 std::pair<B2Vector3D, B2Vector3D > hitGlobalPosMom;
371 if (pxdTrueHit ==
nullptr) {
372 B2DEBUG(21,
"Found no PXDTrueHit for PXDCluster " << pxdCluster->
getArrayIndex() <<
" from Array " << pxdCluster->
getArrayName() <<
373 ". This PXDCluster is related with SpacePoint " << spacePoint->
getArrayIndex() <<
" from Array " << spacePoint->
getArrayName());
374 throw FoundNoTrueHit();
377 B2DEBUG(21,
"Found PXDCluster " << pxdCluster->
getArrayIndex() <<
" and " <<
" PXDTrueHit " << pxdTrueHit->getArrayIndex() <<
378 " from StoreArray " << pxdTrueHit->getArrayName() <<
" related to this SpacePoint");
380 B2DEBUG(21,
"Now getting global position and momentum for PXDCluster " << pxdCluster->
getArrayIndex() <<
" from Array " <<
391 if (svdClusters.
size() == 0) {
392 B2WARNING(
"Found no related clusters for SpacePoint " << spacePoint->
getArrayIndex() <<
" from Array " << spacePoint->
getArrayName()
393 <<
". With no Cluster no information if a track is curling or not can be obtained");
394 throw FoundNoCluster();
399 std::vector<const SVDTrueHit*> svdTrueHits;
400 for (
const SVDCluster& aCluster : svdClusters) {
404 if (relTrueHits.
size() == 0) {
405 B2DEBUG(21,
"Found no SVDTrueHit for SVDCluster " << aCluster.getArrayIndex() <<
" from Array " << aCluster.getArrayName() <<
406 ". This SVDCluster is related with SpacePoint " << spacePoint->
getArrayIndex() <<
" from Array " << spacePoint->
getArrayName());
407 throw FoundNoTrueHit();
410 B2DEBUG(21,
"Found " << relTrueHits.
size() <<
" TrueHits for SVDCluster " << aCluster.getArrayIndex() <<
" from Array " <<
411 aCluster.getArrayName());
412 for (
unsigned int i = 0; i < relTrueHits.
size(); ++i) { svdTrueHits.push_back(relTrueHits[i]); }
427 if (svdTrueHits.size() >= 1) {
428 B2DEBUG(21,
"Found " << svdTrueHits.size() <<
" SVDTrueHits related to Clusters related to SpacePoint " <<
432 std::sort(svdTrueHits.begin(), svdTrueHits.end());
433 unsigned int oldSize = svdTrueHits.size();
434 auto newEnd = std::unique(svdTrueHits.begin(), svdTrueHits.end());
435 svdTrueHits.resize(std::distance(svdTrueHits.begin(), newEnd));
438 if (svdTrueHits.size() == oldSize) {
439 std::stringstream trueHitInds;
440 for (
const SVDTrueHit* trueHit : svdTrueHits) { trueHitInds << trueHit->getArrayIndex() <<
", "; }
441 B2DEBUG(21,
"There is no overlapping TrueHit for SpacePoint " << spacePoint->
getArrayIndex() <<
" from Array " <<
442 spacePoint->
getArrayName() <<
". The Indices of the TrueHits are: " << trueHitInds.str());
446 std::vector<B2Vector3D > globalPositions;
447 std::vector<B2Vector3D > globalMomenta;
449 for (
unsigned int i = 0; i < svdTrueHits.size(); ++i) {
451 globalPositions.push_back(posMom.first);
452 globalMomenta.push_back(posMom.second);
455 int layer = svdTrueHits[0]->getSensorID().getLayerNumber() - 1;
457 for (
unsigned int i = 1; i < globalPositions.size(); ++i) {
458 rootVariables.
MisMatchPosResiduals.at(layer).push_back((globalPositions[i] - globalPositions[i - 1]).Mag());
460 rootVariables.
MisMatchPosX.at(layer).push_back((globalPositions[i] - globalPositions[i - 1]).X());
461 rootVariables.
MisMatchPosY.at(layer).push_back((globalPositions[i] - globalPositions[i - 1]).Y());
462 rootVariables.
MisMatchPosZ.at(layer).push_back((globalPositions[i] - globalPositions[i - 1]).Z());
464 rootVariables.
MisMatchPosU.at(layer).push_back((svdTrueHits[i]->getU() - svdTrueHits[i - 1]->getU()));
465 rootVariables.
MisMatchPosV.at(layer).push_back((svdTrueHits[i]->getV() - svdTrueHits[i - 1]->getV()));
467 B2Vector3D momDiff = globalMomenta[i] - globalMomenta[i - 1];
474 if (svdClusters.size() > 1) { TrueHitsNotMatching(); }
479 if (svdTrueHits.size() > 1) {
484 B2DEBUG(21,
"Now getting global position and momentum for SVDCluster " << svdClusters[0]->getArrayIndex() <<
" from Array " <<
485 svdClusters[0]->getArrayName() <<
" via SVDTrueHit " << svdTrueHits[0]->getArrayIndex() <<
" from StoreArray " <<
486 svdTrueHits[0]->getArrayName());
495 throw SpacePointTrackCand::UnsupportedDetType();
502 if (directions.first != directions.second) {
503 B2DEBUG(21,
"The direction of flight has changed for SpacePoint " << iHit <<
504 " in SpacePointTrackCand. The StoreArray index of this SpacePoint is " << spacePoint->
getArrayIndex() <<
" in " <<
506 returnVector.push_back(iHit);
509 directions.first = directions.second;
517template<
class TrueHit>
518std::pair<const Belle2::B2Vector3D, const Belle2::B2Vector3D >
522 VxdID aVxdId = aTrueHit->getSensorID();
524 B2DEBUG(21,
"Getting global position and momentum vectors for TrueHit " << aTrueHit->getArrayIndex() <<
" from Array " <<
525 aTrueHit->getArrayName() <<
". This hit has VxdID " << aVxdId);
534 B2DEBUG(21,
"Local position of hit is (" << hitLocal.
X() <<
"," << hitLocal.
Y() <<
"," << hitLocal.
Z() <<
535 "), Global position of hit is (" << hitGlobal.
X() <<
"," << hitGlobal.
Y() <<
"," << hitGlobal.
Z() <<
")");
539 B2DEBUG(21,
"Global momentum of hit is (" << pGlobal.
X() <<
"," << pGlobal.
Y() <<
"," << pGlobal.
Z() <<
")");
541 return std::make_pair(hitGlobal, pGlobal);
546 std::pair<const B2Vector3D, const B2Vector3D>& hitPosAndMom,
549 B2Vector3D originToHit = hitPosAndMom.first - origin;
550 B2Vector3D momentumAtHit = hitPosAndMom.second + originToHit;
553 B2DEBUG(21,
"Position of hit relative to origin is (" << originToHit.
X() <<
"," << originToHit.
Y() <<
"," << originToHit.
Z() <<
554 "). Momentum relative to hit (relative to origin) (" << momentumAtHit.
X() <<
"," << momentumAtHit.
Y() <<
"," << momentumAtHit.
Z() <<
559 double hitRadComp = originToHit.
Perp();
560 double hitMomRadComp =
561 momentumAtHit.
Perp();
563 B2DEBUG(21,
" radial component of hit coordinates: " << hitRadComp <<
564 ", radial component of tip of momentum vector with its origin set to hit position: " << hitMomRadComp);
566 if (hitMomRadComp < hitRadComp) {
567 B2DEBUG(21,
"Direction of flight is inwards for this hit");
570 B2DEBUG(21,
"Direction of flight is outwards for this hit");
576const std::vector<Belle2::SpacePointTrackCand>
578 const std::vector<int>& splitIndices)
580 std::vector<SpacePointTrackCand> spacePointTCs;
582 std::vector<std::pair<int, int> >
586 for (
int index : splitIndices) {
587 rangeIndices.push_back({firstIndex, index});
588 firstIndex = index + 1;
590 rangeIndices.push_back({firstIndex, SPTrackCand.
getNHits() - 1});
594 bool outgoing = splitIndices[0] != 0;
598 if (NTracklets < 1) { NTracklets = rangeIndices.size(); }
599 for (
unsigned iTr = 0; iTr < rangeIndices.size() && iTr < uint(NTracklets); ++iTr) {
601 int lastInd = rangeIndices[iTr].second;
602 int firstInd = rangeIndices[iTr].first;
604 B2DEBUG(21,
"Creating Track Stub " << iTr <<
" of " << splitIndices.size() <<
605 " possible Track Stub for this SpacePointTrackCand. The indices for this Tracklet are (first,last): (" << firstInd <<
"," << lastInd
606 <<
"). This SpacePointTrackCand contains " << SPTrackCand.
getNHits() <<
" SpacePoints in total.");
610 const std::vector<const SpacePoint*> trackletSpacePoints = SPTrackCand.
getHitsInRange(firstInd, lastInd);
625 outgoing = !outgoing;
630 spacePointTCs.push_back(newSPTrackCand);
631 }
catch (SpacePointTrackCand::SPTCIndexOutOfBounds& anE) {
632 B2WARNING(
"Caught an exception while trying to split SpacePointTrackCands: " << anE.what() <<
633 " This SPTC will be skipped from splitting!");
637 return spacePointTCs;
641template <
class TrueHit>
645 B2DEBUG(21,
"Getting positions (for ROOT output) of SpacePoint " << spacePoint->
getArrayIndex() <<
" from Array " <<
646 spacePoint->
getArrayName() <<
" and TrueHit " << trueHit->getArrayIndex() <<
" from Array " << trueHit->getArrayName());
650 VxdID trueHitVxdId = trueHit->getSensorID();
673 if (spLayer != thLayer) {
674 B2FATAL(
"Layer numbers of TrueHit and SpacePoint do not match!");
678 bool singleCluster =
true;
679 if (spacePointUV.
m_setU) {
681 rootVariables.
TrueHitULocal.at(thLayer).push_back(trueHit->getU());
682 rootVariables.
PosResidueULocal.at(spLayer).push_back((spacePointUV.
m_U - trueHit->getU()));
684 if (spacePointUV.
m_setV) {
686 rootVariables.
TrueHitVLocal.at(thLayer).push_back(trueHit->getV());
687 rootVariables.
PosResidueVLocal.at(spLayer).push_back((spacePointUV.
m_V - trueHit->getV()));
698 rootVariables.
PosResidueXGlobal.at(spLayer).push_back((spacePointGlobal - trueHitGlobal).X());
699 rootVariables.
PosResidueYGlobal.at(spLayer).push_back((spacePointGlobal - trueHitGlobal).Y());
700 rootVariables.
PosResidueZGlobal.at(spLayer).push_back((spacePointGlobal - trueHitGlobal).Z());
702 rootVariables.
PosResiduesGlobal.at(spLayer).push_back((spacePointGlobal - trueHitGlobal).Mag());
703 rootVariables.
PosResiduesLocal.at(spLayer).push_back((spacePointLocal - trueHitLocal).Mag());
705 singleCluster =
false;
708 B2DEBUG(21,
"Global (x,y,z)/Local (U,V) positions of SpacePoint: (" << spacePointGlobal.
X() <<
"," << spacePointGlobal.
Y() <<
","
709 << spacePointGlobal.
Z() <<
")/(" << spacePointLocal.
X() <<
"," << spacePointLocal.
Y() <<
"). This was a singleCluster SpacePoint: "
712 B2DEBUG(21,
"Global (x,y,z)/Local (U,V) positions of TrueHit: (" << trueHitGlobal.
X() <<
"," << trueHitGlobal.
Y() <<
"," <<
713 trueHitGlobal.
Z() <<
")/(" << trueHitLocal.
X() <<
"," << trueHitLocal.
Y() <<
")");
715 B2DEBUG(21,
"This leads to position differences global/local: " << (spacePointGlobal - trueHitGlobal).Mag() <<
"/" <<
716 (spacePointLocal - trueHitLocal).Mag());
777 returnVals.
m_setU = setCoords.first;
778 returnVals.
m_setV = setCoords.second;
779 returnVals.
m_U = localUV.first;
780 returnVals.
m_V = localUV.second;
DataType Z() const
access variable Z (= .at(2) without boundary check)
DataType X() const
access variable X (= .at(0) without boundary check)
DataType Y() const
access variable Y (= .at(1) without boundary check)
DataType Perp() const
The transverse component (R in cylindrical coordinate system).
void SetXYZ(DataType x, DataType y, DataType z)
set all coordinates using data type
std::array< std::vector< double >, c_nPlanes > m_rootMisMatchPosX
Difference of X-positions (global) for mismatched TrueHits (layerwise)
std::array< std::vector< double >, c_nPlanes > m_rootMisMatchPosV
Difference of V-positions (local) for mismatched TrueHits (layerwise)
int m_NoCurlingTCsCtr
Counter for SPTCs that were not curling and hence were added to the StoreArray of first out parts.
StoreArray< SpacePointTrackCand > m_spacePointTCs
SpacePointTrackCand StoreArray.
std::string m_PARAMcurlingOutRestName
collection name of all but the first outgoing parts of a curling TrackCand
TTree * m_treePtr
Pointer to ROOT tree.
std::array< std::vector< double >, c_nPlanes > m_rootPosResidueYGlobal
Y-position (global) difference between TrueHit and SpacePoint (layerwise)
std::array< std::vector< double >, c_nPlanes > m_rootSpacePointZGlobals
Global Z-Positions of SpacePoints (layerwise)
std::array< std::vector< double >, c_nPlanes > m_rootMisMatchPosU
Difference of U-positions (local) for mismatched TrueHits (layerwise)
std::array< std::vector< double >, c_nPlanes > m_rootMisMatchMomX
Difference of Momentum in X-Direction for TrueHits that do not match but are related from one SpacePo...
StoreArray< SpacePointTrackCand > m_curlingAllIns
Curling SpacePointTrackCand StoreArray.
StoreArray< SpacePointTrackCand > m_curlingFirstOuts
Curling SpacePointTrackCand StoreArray.
bool m_saveCompleteCurler
set to true if all parts of a curling TrackCand should be stored in a separate StoreArray (no paramet...
void initialize() override
initialize: initialize counters, register stuff in DataStore, check if all necessary StoreArrays are ...
std::array< std::vector< double >, c_nPlanes > m_rootSpacePointYGlobals
Global Y-Positions of SpacePoints (layerwise)
std::vector< double > m_PARAMsetOrigin
set the origin to a specific point.
B2Vector3D m_origin
origin used internally (set from user set value)
void event() override
event: check SpacePointTrackCand for curling behaviour, split if needed (and wanted by user)
std::array< std::vector< double >, c_nPlanes > m_rootGlobalPosResiduals
Global Position Residuals between TrueHits and SpacePoints (layerwise)
int m_PARAMnTrackStubs
maximum number of TrackCand Stubs to be stored for a curling TrackCand
std::string m_PARAMcurlingAllInName
collection name of all ingoing parts of a curling TrackCand
std::array< std::vector< double >, c_nPlanes > m_rootTrueHitXGlobals
Global U-Positions of TrueHits (layerwise)
void terminate() override
terminate: print some summary on the modules work
std::array< std::vector< double >, c_nPlanes > m_rootMisMatchPosDistance
Distance of TrueHits that do not match but are related from one SpacePoint (layerwise)
std::pair< const B2Vector3D, const B2Vector3D > getGlobalPositionAndMomentum(TrueHit *aTrueHit)
Get the global position and momentum for a given TrueHit (PXD or SVD at the moment).
std::string m_PARAMcompleteCurlerName
collection name of all parts of a curling TrackCand
std::string m_PARAMsptcName
collection name of the SpacePointTrackCands to be analyzed
int m_NoSingleTrueHitCtr
Counter for SpacePoints that relate to more than one TrueHit.
int m_createdTrackStubsCtr
Counter for created TrackCand Stubs by splitting a SpacePointTrackCand.
std::array< std::vector< double >, c_nPlanes > m_rootPosResidueXGlobal
X-position (global) difference between TrueHit and SpacePoint (layerwise)
std::array< std::vector< double >, c_nPlanes > m_rootMisMatchMomZ
Difference of Momentum in Z-Direction for TrueHits that do not match but are related from one SpacePo...
std::array< std::vector< double >, c_nPlanes > m_rootSpacePointXGlobals
Global X-Positions of SpacePoints (layerwise)
bool getDirectionOfFlight(std::pair< const B2Vector3D, const B2Vector3D > const &hitPosAndMom, const B2Vector3D &origin)
determine the direction of flight of a particle for a given hit and the origin (assumed interaction p...
CurlingTrackCandSplitterModule()
Constructor.
std::array< std::vector< double >, c_nPlanes > m_rootSpacePointULocals
Local U-Positions of SpacePoints (layerwise)
std::vector< std::string > m_PARAMrootFileName
two entries accepted.
const std::vector< int > checkTrackCandForCurling(const Belle2::SpacePointTrackCand &, RootVariables &rootVariables)
Check if the track candidate is curling.
std::array< std::vector< double >, c_nPlanes > m_rootMisMatchMomY
Difference of Momentum in Y-Direction for TrueHits that do not match but are related from one SpacePo...
void getValuesForRoot(const SpacePoint *spacePoint, const TrueHit *trueHit, RootVariables &rootVariables)
Get The Values that are later written to a ROOT file.
std::array< std::vector< double >, c_nPlanes > m_rootMisMatchPosZ
Difference of Z-positions (global) for mismatched TrueHits (layerwise)
TaggedUVPos getUV(const SpacePoint *spacePoint)
get U&V for a SpacePoint (via its relation to Clusters) (SpacePoint can only return normalized U&V co...
StoreArray< SpacePointTrackCand > m_curlingCompletes
Curling SpacePointTrackCand StoreArray.
void writeToRoot(const RootVariables &rootVariables)
Write previously collected values to ROOT file.
std::array< std::vector< double >, c_nPlanes > m_rootSpacePointVLocals
Local V-Positions of SpacePoints (layerwise)
std::array< std::vector< double >, c_nPlanes > m_rootPosResidueZGlobal
Z-position (global) difference between TrueHit and SpacePoint (layerwise)
int m_noDecisionPossibleCtr
Counter for TrackCands where a decision if curling or not is not possible.
std::array< std::vector< double >, c_nPlanes > m_rootLocalPosResiduals
Local Position Residuals between TrueHits and SpacePoints (layerwise)
std::array< std::vector< double >, c_nPlanes > m_rootTrueHitYGlobals
Global V-Positions of TrueHits (layerwise)
bool m_PARAMuseNonSingleTHinPA
Switch for using SpacePoints in position Analysis that are related to more than one TrueHit.
std::string m_PARAMcurlingOutFirstName
collection name of the first outgoing (i.e.
const std::vector< Belle2::SpacePointTrackCand > splitCurlingTrackCand(const Belle2::SpacePointTrackCand &SPTrackCand, int NTracklets, const std::vector< int > &splitIndices)
Split a culring track candidate into (up to NTracklets) tracklets.
std::array< std::vector< double >, c_nPlanes > m_rootTrueHitVLocals
Local Y-Positions of TrueHits (layerwise)
int m_curlingTCCtr
Counter for TrackCands that show curling behaviour.
int m_spacePointTCCtr
Counter for presented SpacePointTrackCands.
void initializeCounters()
initialize all counters to 0 for avoiding undeterministic behaviour.
TFile * m_rootFilePtr
Pointer to ROOT file.
std::array< std::vector< double >, c_nPlanes > m_rootMisMatchPosY
Difference of Y-positions (global) for mismatched TrueHits (layerwise)
std::array< std::vector< double >, c_nPlanes > m_rootTrueHitULocals
Local X-Positions of TrueHits (layerwise)
std::array< std::vector< double >, c_nPlanes > m_rootTrueHitZGlobals
Global Z-Positions of TrueHits (layerwise)
std::array< std::vector< double >, c_nPlanes > m_rootPosResidueVLocal
V-position (local) difference between TrueHit and SpacePoint (layerwise)
bool m_PARAMpositionAnalysis
Set to true if output to ROOT file is desired with the positions and position differences of SpacePoi...
StoreArray< SpacePointTrackCand > m_curlingRestOuts
Curling SpacePointTrackCand StoreArray.
bool m_PARAMsplitCurlers
indicating if the SpacePointTrackCands should only be analyzed for curling behaviour,...
std::array< std::vector< double >, c_nPlanes > m_rootPosResidueULocal
U-position (local) difference between TrueHit and SpacePoint (layerwise)
@ c_ErrorIfAlreadyRegistered
If the object/array was already registered, produce an error (aborting initialisation).
@ c_Event
Different object in each event, all objects/arrays are invalidated after event() function has been ca...
void setDescription(const std::string &description)
Sets the description of the module.
The PXD Cluster class This class stores all information about reconstructed PXD clusters The position...
Class PXDTrueHit - Records of tracks that either enter or leave the sensitive volume.
Class for type safe access to objects that are referred to in relations.
size_t size() const
Get number of relations.
void addRelationTo(const RelationsInterface< BASE > *object, float weight=1.0, const std::string &namedRelation="") const
Add a relation from this object to another object (with caching).
std::string getArrayName() const
Get name of array this object is stored in, or "" if not found.
int getArrayIndex() const
Returns this object's array index (in StoreArray), or -1 if not found.
TO * getRelatedTo(const std::string &name="", const std::string &namedRelation="") const
Get the object to which this object has a relation.
RelationVector< TO > getRelationsTo(const std::string &name="", const std::string &namedRelation="") const
Get the relations that point from this object to another store array.
The SVD Cluster class This class stores all information about reconstructed SVD clusters.
Class SVDTrueHit - Records of tracks that either enter or leave the sensitive volume.
Storage for (VXD) SpacePoint-based track candidates.
void setSortingParameters(const std::vector< double > &sortParams)
set the sorting parameters
void set6DSeed(const TVectorD &state6D)
set the 6D state seed
unsigned int getNHits() const
get the number of hits (space points) in the track candidate
int getPdgCode() const
get pdg code
const TMatrixDSym & getCovSeed() const
get the covariance matrix seed (6D).
const std::vector< const Belle2::SpacePoint * > & getHits() const
get hits (space points) of track candidate
void setCovSeed(const TMatrixDSym &cov)
set the covariance matrix seed
int getMcTrackID() const
get the MC Track ID
void setTrackStubIndex(int trackStubInd)
set TrackStub index
const std::vector< const Belle2::SpacePoint * > getHitsInRange(int firstInd, int lastInd) const
get hits (SpacePoints) in range (indices of SpacePoint inside SpacePointTrackCand) including first in...
const std::vector< double > getSortingParametersInRange(int firstIndex, int lastIndex) const
get the sorting parameters in range (indices of SpacePoints inside SpacePointTrackCand) including fir...
double getChargeSeed() const
get charge
const TVectorD & getStateSeed() const
get state seed as 6D vector
void setFlightDirection(bool direction)
set the direction of flight (true is outgoing, false is ingoing).
SpacePoint typically is build from 1 PXDCluster or 1-2 SVDClusters.
double getNormalizedLocalV() const
Return normalized local coordinates of the cluster in v (0 <= posV <= 1).
std::pair< bool, bool > getIfClustersAssigned() const
Returns, if u(v)-coordinate is based on cluster information.
VxdID getVxdID() const
Return the VxdID of the sensor on which the the cluster of the SpacePoint lives.
Belle2::VXD::SensorInfoBase::SensorType getType() const
Return SensorType (PXD, SVD, ...) on which the SpacePoint lives.
static std::pair< double, double > convertNormalizedToLocalCoordinates(const std::pair< double, double > &hitNormalized, Belle2::VxdID vxdID, const Belle2::VXD::SensorInfoBase *aSensorInfo=nullptr)
converts a hit in sensor-independent relative coordinates into local coordinate of given sensor.
const B2Vector3D & getPosition() const
return the position vector in global coordinates
double Z() const
return the z-value of the global position of the SpacePoint
double X() const
return the x-value of the global position of the SpacePoint
double getNormalizedLocalU() const
Return normalized local coordinates of the cluster in u (0 <= posU <= 1).
double Y() const
return the y-value of the global position of the SpacePoint
const std::string & getName() const
Return name under which the object is saved in the DataStore.
bool isRequired(const std::string &name="")
Ensure this array/object has been registered previously.
bool registerInDataStore(DataStore::EStoreFlags storeFlags=DataStore::c_WriteOut)
Register the object/array in the DataStore.
T * appendNew()
Construct a new T object at the end of the array.
int getEntries() const
Get the number of objects in the array.
bool registerRelationTo(const StoreArray< TO > &toArray, DataStore::EDurability durability=DataStore::c_Event, DataStore::EStoreFlags storeFlags=DataStore::c_WriteOut, const std::string &namedRelation="") const
Register a relation to the given StoreArray.
Type-safe access to single objects in the data store.
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.
Base class to provide Sensor Information for PXD and SVD.
ROOT::Math::XYZVector pointToGlobal(const ROOT::Math::XYZVector &local, bool reco=false) const
Convert a point from local to global coordinates.
ROOT::Math::XYZVector vectorToGlobal(const ROOT::Math::XYZVector &local, bool reco=false) const
Convert a vector from local to global coordinates.
Class to uniquely identify a any structure of the PXD and SVD.
baseType getLayerNumber() const
Get the layer id.
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
Abstract base class for different kinds of events.
Internal DataStore for ROOT output variables.
std::array< std::vector< double >, c_nPlanes > PosResidueVLocal
V-position (local) difference between TrueHit and SpacePoint (layerwise)
std::array< std::vector< double >, c_nPlanes > MisMatchMomZ
Difference of Momentum in Z-Direction for TrueHits that do not match but are related from one SpacePo...
std::array< std::vector< double >, c_nPlanes > MisMatchPosZ
Difference of Z-positions (global) for mismatched TrueHits (layerwise)
std::array< std::vector< double >, c_nPlanes > MisMatchPosU
Difference of U-positions (local) for mismatched TrueHits (layerwise)
std::array< std::vector< double >, c_nPlanes > PosResidueZGlobal
Z-position (global) difference between TrueHit and SpacePoint (layerwise)
std::array< std::vector< double >, c_nPlanes > MisMatchMomX
Difference of Momentum in X-Direction for TrueHits that do not match but are related from one SpacePo...
std::array< std::vector< double >, c_nPlanes > MisMatchPosV
Difference of V-positions (local) for mismatched TrueHits (layerwise)
std::array< std::vector< double >, c_nPlanes > MisMatchPosResiduals
Distance between TrueHits that do not match but are related from one SpacePoint (layerwise)
std::array< std::vector< double >, c_nPlanes > MisMatchPosY
Difference of Y-positions (global) for mismatched TrueHits (layerwise)
std::array< std::vector< double >, c_nPlanes > SpacePointYGlobal
global y-positions of SpacePoints (layerwise)
std::array< std::vector< double >, c_nPlanes > MisMatchPosX
Difference of X-positions (global) for mismatched TrueHits (layerwise)
std::array< std::vector< double >, c_nPlanes > SpacePointVLocal
local v-positions of SpacePoints (layerwise)
std::array< std::vector< double >, c_nPlanes > TrueHitULocal
local u-positions of TrueHits (layerwise)
std::array< std::vector< double >, c_nPlanes > SpacePointZGlobal
global z-positions of SpacePoints (layerwise)
std::array< std::vector< double >, c_nPlanes > PosResidueULocal
U-position (local) difference between TrueHit and SpacePoint (layerwise)
std::array< std::vector< double >, c_nPlanes > TrueHitXGlobal
global x-positions of TrueHits (layerwise)
std::array< std::vector< double >, c_nPlanes > PosResiduesGlobal
position differences in global coordinates (layerwise)
std::array< std::vector< double >, c_nPlanes > SpacePointULocal
local u-positions of SpacePoints (layerwise)
std::array< std::vector< double >, c_nPlanes > TrueHitVLocal
local v-positions of TrueHits (layerwise)
std::array< std::vector< double >, c_nPlanes > MisMatchMomY
Difference of Momentum in Y-Direction for TrueHits that do not match but are related from one SpacePo...
std::array< std::vector< double >, c_nPlanes > PosResidueYGlobal
Y-position (global) difference between TrueHit and SpacePoint (layerwise)
std::array< std::vector< double >, c_nPlanes > SpacePointXGlobal
global x-positions of SpacePoints (layerwise)
std::array< std::vector< double >, c_nPlanes > PosResiduesLocal
position differences in local coordinates (layerwise)
std::array< std::vector< double >, c_nPlanes > PosResidueXGlobal
X-position (global) difference between TrueHit and SpacePoint (layerwise)
std::array< std::vector< double >, c_nPlanes > TrueHitZGlobal
global z-positions of TrueHits (layerwise)
std::array< std::vector< double >, c_nPlanes > TrueHitYGlobal
global y-positions of TrueHits (layerwise)
struct for easier handling of getting U- & V-position of SpacePoints and some difficulties that arise...
bool m_setV
indicator if V is set
bool m_setU
indicator if U is set