Belle II Software development
ObserversTest Class Reference

Test class for testing and developing new Observers. More...

Inheritance diagram for ObserversTest:

Protected Member Functions

virtual void SetUp ()
 prepare related storearrays of SpacePoints, SVD- and PXDClusters and MCParticles
 
virtual void TearDown ()
 clear datastore
 

Protected Attributes

StoreArray< SpacePointspacePointData
 some spacePoints to test RelationsInterface for observers.
 
StoreArray< PXDClusterpxdClusterData
 some pxd clusters to test RelationsInterface for observers.
 
StoreArray< SVDClustersvdClusterData
 some svd clusters to test RelationsInterface for observers.
 
StoreArray< MCParticlemcParticleData
 some mcParticles to test RelationsInterface for observers.
 

Detailed Description

Test class for testing and developing new Observers.

Definition at line 96 of file observers.cc.

Member Function Documentation

◆ SetUp()

virtual void SetUp ( )
inlineprotectedvirtual

prepare related storearrays of SpacePoints, SVD- and PXDClusters and MCParticles

Definition at line 100 of file observers.cc.

101 {
106
109
112
114
115
116 for (unsigned int i = 1; i < 3; ++i) { // prepare mcParticles, pxdClusters and spacePoints related to them
117 MCParticle* aParticle = mcParticleData.appendNew();
118
119 aParticle->setMomentum(float(i), float(i), float(i));
120
121 VxdID aVxdID = VxdID(i, i, i);
122
123 VXD::SensorInfoBase aSensorInfo = provideSensorInfo(aVxdID, (unsigned short)i, (unsigned short)i + 1., (unsigned short)i + 2.);
124
125 const PXDCluster* pxdCluster = pxdClusterData.appendNew(providePXDCluster(0., 0., aVxdID));
126 pxdCluster->addRelationTo(aParticle);
127
128 SpacePoint* newSP = spacePointData.appendNew(pxdCluster, &aSensorInfo);
129 B2DEBUG(10, " setup: new spacePoint got arrayIndex: " << newSP->getArrayIndex() << " and VxdID " << newSP->getVxdID());
130 newSP->addRelationTo(pxdCluster);
131 }
132
133 mcParticleData[0]->setPDG(Const::electron.getPDGCode());
134 mcParticleData[1]->setPDG(Const::muon.getPDGCode());
136
137
138 for (unsigned int i = 3; i < 7; ++i) { // now SVDClusters and their related spacePoints
139
140 VxdID aVxdID = VxdID(i, i, i);
141
142 VXD::SensorInfoBase aSensorInfo = provideSensorInfo(aVxdID, (unsigned short)i, (unsigned short)i + 1., (unsigned short)i + 2.);
143
144 unsigned int pID = (i - 3) / 2;
145
146 const SVDCluster* clusterU = svdClusterData.appendNew(provideSVDCluster(aVxdID, true, 0.));
147 clusterU->addRelationTo(mcParticleData[pID]);
148 const SVDCluster* clusterV = svdClusterData.appendNew(provideSVDCluster(aVxdID, false, 0.));
149 clusterV->addRelationTo(mcParticleData[pID]);
150
151 std::vector<const SVDCluster*> clusterVector = {clusterU, clusterV};
152
153 SpacePoint* newSP = spacePointData.appendNew(clusterVector, &aSensorInfo);
154 newSP->addRelationTo(clusterU);
155 newSP->addRelationTo(clusterV);
156 }
157
158 B2INFO("ObserversTest:SetUP: created " << mcParticleData.getEntries() << "/" << pxdClusterData.getEntries() << "/" <<
159 svdClusterData.getEntries() << "/" << spacePointData.getEntries() << " mcParticles/pxdClusters/svdClusters/SpacePoints");
160 }
static const ChargedStable muon
muon particle
Definition: Const.h:660
static const ChargedStable electron
electron particle
Definition: Const.h:659
static DataStore & Instance()
Instance of singleton Store.
Definition: DataStore.cc:54
void setInitializeActive(bool active)
Setter for m_initializeActive.
Definition: DataStore.cc:94
A Class to store the Monte Carlo particle information.
Definition: MCParticle.h:32
@ c_PrimaryParticle
bit 0: Particle is primary particle.
Definition: MCParticle.h:47
void setMomentum(const ROOT::Math::XYZVector &momentum)
Set particle momentum.
Definition: MCParticle.h:417
The PXD Cluster class This class stores all information about reconstructed PXD clusters The position...
Definition: PXDCluster.h:30
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).
int getArrayIndex() const
Returns this object's array index (in StoreArray), or -1 if not found.
The SVD Cluster class This class stores all information about reconstructed SVD clusters.
Definition: SVDCluster.h:29
SpacePoint typically is build from 1 PXDCluster or 1-2 SVDClusters.
Definition: SpacePoint.h:42
VxdID getVxdID() const
Return the VxdID of the sensor on which the the cluster of the SpacePoint lives.
Definition: SpacePoint.h:148
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.
Definition: StoreArray.h:246
int getEntries() const
Get the number of objects in the array.
Definition: StoreArray.h:216
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.
Definition: StoreArray.h:140
Base class to provide Sensor Information for PXD and SVD.
Class to uniquely identify a any structure of the PXD and SVD.
Definition: VxdID.h:33
StoreArray< PXDCluster > pxdClusterData
some pxd clusters to test RelationsInterface for observers.
Definition: observers.cc:171
StoreArray< SpacePoint > spacePointData
some spacePoints to test RelationsInterface for observers.
Definition: observers.cc:170
StoreArray< MCParticle > mcParticleData
some mcParticles to test RelationsInterface for observers.
Definition: observers.cc:173
StoreArray< SVDCluster > svdClusterData
some svd clusters to test RelationsInterface for observers.
Definition: observers.cc:172
SVDCluster provideSVDCluster(VxdID aVxdID, bool isU, double position, double error=0.1)
returns a svdCluster with given sensorID, uType and local position
Definition: observers.cc:76
PXDCluster providePXDCluster(double u, double v, VxdID aVxdID, double uError=0.1, double vError=0.1)
returns a pxdCluster with given sensorID and local coordinates
Definition: observers.cc:69
VXD::SensorInfoBase provideSensorInfo(VxdID aVxdID, double globalX=0., double globalY=0., double globalZ=-0.)
this is a small helper function to create a sensorInfo to be used
Definition: observers.cc:49

◆ TearDown()

virtual void TearDown ( )
inlineprotectedvirtual

clear datastore

Definition at line 165 of file observers.cc.

166 {
168 }
void reset(EDurability durability)
Frees memory occupied by data store items and removes all objects from the map.
Definition: DataStore.cc:86

Member Data Documentation

◆ mcParticleData

StoreArray<MCParticle> mcParticleData
protected

some mcParticles to test RelationsInterface for observers.

Definition at line 173 of file observers.cc.

◆ pxdClusterData

StoreArray<PXDCluster> pxdClusterData
protected

some pxd clusters to test RelationsInterface for observers.

Definition at line 171 of file observers.cc.

◆ spacePointData

StoreArray<SpacePoint> spacePointData
protected

some spacePoints to test RelationsInterface for observers.

Definition at line 170 of file observers.cc.

◆ svdClusterData

StoreArray<SVDCluster> svdClusterData
protected

some svd clusters to test RelationsInterface for observers.

Definition at line 172 of file observers.cc.


The documentation for this class was generated from the following file: