9#include <tracking/modules/VXDTFHelperTools/VXDSimpleClusterizerModule.h>
10#include <vxd/geometry/SensorInfoBase.h>
11#include <vxd/geometry/GeoCache.h>
13#include <framework/datastore/StoreObjPtr.h>
14#include <framework/dataobjects/EventMetaData.h>
15#include <framework/logging/Logger.h>
37 setDescription(
"The VXDSimpleClusterizerModule generates PXD/SVD Clusters using TrueHits. Energy-deposit threshold and gaussian smearing can be chosen, non-primary-particles can be filtered as well. Its purpose is fast clusterizing for tracking test procedures, using standardized PXD/SVD-Cluster");
41 "particles with energy deposit in U lower than this will not create a cluster in SVD (GeV)",
double(17.4E-6));
43 "particles with energy deposit in V lower than this will not create a cluster in SVD (GeV)",
double(28.6E-6));
45 "particles with energy deposit lower than this will not create a cluster in PXD (GeV)",
double(7
E-6));
46 addParam(
"onlyPrimaries",
m_onlyPrimaries,
"if true use only primary particles from the generator no particles created by Geant4",
49 "you can define the sigma of the smearing. Standard value is the sigma of the unifom distribution for 0-1: 1/sqrt(12)",
50 double(1. /
sqrt(12.)));
52 "if positive value (in cm) is given it will be used as the sigma to smear the Clusters otherwise pitch/uniSigma will be used",
55 "PXDTrueHit collection name", std::string(
""));
57 "SVDTrueHit collection name", std::string(
""));
59 "MCParticle collection name", std::string(
""));
61 "PXDCluster collection name", std::string(
""));
63 "SVDCluster collection name", std::string(
""));
109 std::string paramValue;
111 paramValue =
"true, means that there are no secondary hits (for 1-track events this means no ghost hits guaranteed)";
113 paramValue =
"false, means that secondary hits can occur and increase the rate of ghost hits";
115 B2INFO(
"VXDSimpleClusterizer: parameter onlyPrimaries is set to " << paramValue);
125 int discardedPXDEdeposit = 0, discardedSVDEdeposit = 0, discardedPXDFake = 0, discardedSVDFake = 0;
129 B2DEBUG(5,
"******* VXDSimpleClusterizerModule processing event number: " << eventMetaDataPtr->getEvent() <<
" *******");
134 if (nMcParticles == 0) {B2DEBUG(21,
"MCTrackFinder: MCParticlesCollection is empty!");}
137 if (nPxdTrueHits == 0) {B2DEBUG(21,
"MCTrackFinder: PXDHitsCollection is empty!");}
140 if (nSvdTrueHits == 0) {B2DEBUG(21,
"MCTrackFinder: SVDHitsCollection is empty!");}
141 B2DEBUG(27,
"found " << nMcParticles <<
"/" << nPxdTrueHits <<
"/" << nSvdTrueHits <<
" mcParticles, pxdTrueHits, svdTrueHits");
149 for (
unsigned int currentTrueHit = 0; int (currentTrueHit) not_eq nPxdTrueHits; ++currentTrueHit) {
150 B2DEBUG(27,
"begin PXD current TrueHit: " << currentTrueHit <<
" of nPxdTrueHits total: " << nPxdTrueHits);
154 unsigned int particleID = std::numeric_limits<unsigned int>::max();
156 if (aMcParticle !=
nullptr) { particleID = aMcParticle->
getArrayIndex(); }
169 B2DEBUG(21,
" PXD, current TrueHit " << currentTrueHit <<
" connected to " << particleID <<
" has an energy deposit of " <<
170 energy * 1000.0 <<
"MeV ");
172 B2DEBUG(21,
" PXD, TrueHit discarded because of energy deposit too small");
174 discardedPXDEdeposit++;
180 double uTrue = aPxdTrueHit->
getU();
181 double vTrue = aPxdTrueHit->
getV();
189 B2DEBUG(27,
"sigU sigV: " << sigmaU <<
" " << sigmaV);
192 u = gRandom->Gaus(uTrue, sigmaU);
193 v = gRandom->Gaus(vTrue, sigmaV);
206 PXDCluster* newCluster =
m_pxdClusters.
appendNew(aVXDId, u, v, sigmaU, sigmaV, 0, 1, 1, 1, 1, 1, 1, 1);
210 if (particleID != std::numeric_limits<unsigned int>::max()) {
213 " relations to PXD clusters");
220 for (
unsigned int currentTrueHit = 0; int (currentTrueHit) not_eq nSvdTrueHits; ++currentTrueHit) {
221 B2DEBUG(27,
"begin SVD current TrueHit: " << currentTrueHit <<
" of nSvdTrueHits total: " << nSvdTrueHits);
225 unsigned int particleID = std::numeric_limits<unsigned int>::max();
235 if (aMcParticle !=
nullptr) { particleID = aMcParticle->
getArrayIndex(); }
238 B2DEBUG(21,
" SVD, current TrueHit " << currentTrueHit <<
" connected to " << particleID <<
" has an energy deposit of " <<
239 energy * 1000.0 <<
"MeV ");
242 discardedSVDEdeposit++;
243 B2DEBUG(21,
" SVD, TrueHit discarded because of energy deposit too small");
250 double uTrue = aSvdTrueHit->
getU();
251 double vTrue = aSvdTrueHit->
getV();
259 B2DEBUG(25,
"sigU sigV: " << sigmaU <<
" " << sigmaV);
262 u = gRandom->Gaus(uTrue, sigmaU);
263 v = gRandom->Gaus(vTrue, sigmaV);
276 double timeStamp =
m_svdTrueHits[currentTrueHit]->getGlobalTime();
287 if (particleID != std::numeric_limits<unsigned int>::max()) {
291 " relations to SVD clusters");
296 B2DEBUG(20,
"------------------------------------------------------");
298 B2DEBUG(20,
"VXDSimpleClusterizerModule: Number of PXDHits: " << nPxdTrueHits);
299 B2DEBUG(20,
"VXDSimpleClusterizerModule: Number of SVDDHits: " << nSvdTrueHits);
300 B2DEBUG(20,
"VXDSimpleClusterizerModule: total Number of MCParticles: " << nMcParticles);
303 B2DEBUG(20,
"------------------------------------------------------");
305 B2DEBUG(20,
"VXDSimpleClusterizer - event " << eventMetaDataPtr->getEvent() <<
":\n" <<
"of " << nPxdTrueHits <<
"/" << nSvdTrueHits
306 <<
" PXD-/SVDTrueHits, " << discardedPXDEdeposit <<
"/" << discardedSVDEdeposit <<
" hits were discarded bec. of low E-deposit & "
307 << discardedPXDFake <<
"/" << discardedSVDFake <<
" hits were discarded bec. of being a fake. " <<
m_pxdClusters.
getEntries() <<
"/"
315 B2INFO(
"VXDSimpleClusterizerModule::EndRun:\nSimpleClusterizerModule discarded " <<
m_weakPXDHitCtr <<
" PXDTrueHits and " <<
@ 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...
A Class to store the Monte Carlo particle information.
@ c_PrimaryParticle
bit 0: Particle is primary particle.
bool hasStatus(unsigned short int bitmask) const
Return if specific status bit is set.
int getArrayIndex() const
Get 0-based index of the particle in the corresponding MCParticle list.
void setDescription(const std::string &description)
Sets the description of the module.
void setPropertyFlags(unsigned int propertyFlags)
Sets the flags for the module properties.
@ c_ParallelProcessingCertified
This module can be run in parallel processing mode safely (All I/O must be done through the data stor...
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.
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).
FROM * getRelatedFrom(const std::string &name="", const std::string &namedRelation="") const
Get the object from 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.
const std::string & getName() const
Return name under which the object is saved in the DataStore.
bool isOptional(const std::string &name="")
Tell the DataStore about an optional input.
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.
std::string m_svdTrueHitsName
SVDTrueHit collection name.
std::string m_svdClustersName
SVDCluster collection name.
int m_fakePXDHitCtr
counts PXDHits which were not caused by a primary partice
double m_energyThreshold
set energy threshold for PXDClusters in GeV (standard is 7E-6)
double m_energyThresholdV
set energy threshold for SVDClusters in v-direction in GeV (standard is 28.6E-6)
StoreArray< SVDTrueHit > m_svdTrueHits
the storeArray for svdTrueHits as member, is faster than recreating link for each event
StoreArray< PXDTrueHit > m_pxdTrueHits
the storeArray for pxdTrueHits as member, is faster than recreating link for each event
void initialize() override
Initialize the Module.
double m_uniSigma
you can define the sigma of the smearing.
std::string m_mcParticlesName
MCParticle collection name.
StoreArray< SVDCluster > m_svdClusters
the storeArray for svdClusters as member, is faster than recreating link for each event
void event() override
This method is the core of the module.
void endRun() override
This method is called if the current run ends.
int m_weakPXDHitCtr
counts PXDHits whose energy deposit is lower than energyThreshold
int m_weakSVDHitCtr
counts SVDHits whose energy deposit is lower than energyThreshold
std::string m_pxdClustersName
PXDCluster collection name.
double m_setMeasSigma
if positive value (in cm) is given it will be used as the sigma to smear the Clusters otherwise pitch...
void beginRun() override
Called when entering a new run.
void InitializeVariables()
initialize variables to avoid nondeterministic behavior
std::string m_pxdTrueHitsName
PXDTrueHit collection name.
StoreArray< PXDCluster > m_pxdClusters
the storeArray for pxdClusters as member, is faster than recreating link for each event
StoreArray< MCParticle > m_mcParticles
the storeArray for mcParticles as member, is faster than recreating link for each event
bool m_onlyPrimaries
set True if you do not want to have hits by secondary particles
VXDSimpleClusterizerModule()
Constructor of the module.
int m_fakeSVDHitCtr
counts SVDHits which were not caused by a primary partice
double m_energyThresholdU
set energy threshold for SVDClusters in u-direction in GeV (standard is 17.4E-6)
float getV() const
Return local v coordinate of hit.
float getEnergyDep() const
Return energy deposited during traversal of sensor.
VxdID getSensorID() const
Return the Sensor ID.
float getU() const
Return local u coordinate of hit.
const SensorInfoBase & getSensorInfo(Belle2::VxdID id) const
Return a referecne to the SensorInfo of a given SensorID.
static GeoCache & getInstance()
Return a reference to the singleton instance.
Base class to provide Sensor Information for PXD and SVD.
double getUPitch(double v=0) const
Return the pitch of the sensor.
double getVPitch(double v=0) const
Return the pitch of the sensor.
Class to uniquely identify a any structure of the PXD and SVD.
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.
double sqrt(double a)
sqrt for double
Abstract base class for different kinds of events.