8#include <tracking/datcon/findlets/DATCONSVDClusterizer.h>
9#include <tracking/datcon/entities/DATCONSVDDigit.h>
10#include <tracking/datcon/entities/DATCONSVDClusterCandidate.h>
11#include <tracking/trackFindingCDC/utilities/StringManipulation.h>
12#include <svd/dataobjects/SVDShaperDigit.h>
13#include <svd/dataobjects/SVDCluster.h>
14#include <svd/geometry/SensorInfo.h>
15#include <vxd/dataobjects/VxdID.h>
16#include <framework/core/ModuleParamList.h>
17#include <framework/core/ModuleParamList.templateDetails.h>
20using namespace TrackFindingCDC;
40 "Cut for using default noise (noise < this value), or actual noise (noise > this value).",
43 moduleParamList->
addParameter(TrackFindingCDC::prefixed(prefix,
"requiredSNRstrip"),
46 moduleParamList->
addParameter(TrackFindingCDC::prefixed(prefix,
"requiredSNRcluster"),
49 moduleParamList->
addParameter(TrackFindingCDC::prefixed(prefix,
"isUClusterizer"),
52 moduleParamList->
addParameter(TrackFindingCDC::prefixed(prefix,
"saveClusterToDataStore"),
55 moduleParamList->
addParameter(TrackFindingCDC::prefixed(prefix,
"storeSVDClustersName"),
77 if (digits.size() == 0)
return;
82 clusterCand.
vxdID = digits.at(0).getSensorID();
84 for (
auto& digit : digits) {
92 VxdID thisSensorID = digit.getSensorID();
93 unsigned short thisCellID = digit.getCellID();
94 unsigned short thisCharge = digit.getMaxSampleCharge();
99 if (clusterCand.
strips.size() > 0) {
104 clusterCand.
strips.clear();
106 clusterCand.
vxdID = thisSensorID;
107 clusterCand.
strips.emplace_back(thisCellID);
108 clusterCand.
charges.emplace_back(thisCharge);
114 if (clusterCand.
strips.size() > 0) {
119 for (
const auto& cluster : clusters) {
130 double pitch =
m_param_isU ? info.getUPitch() : info.getVPitch();
131 unsigned short numberofStrips =
m_param_isU ? info.getUCells() : info.getVCells();
136 double clusterPositionError = pitch;
137 if (clusterCand.
strips.size() == 1) {
138 clusterPositionError = pitch /
sqrt(12.);
139 }
else if (clusterCand.
strips.size() == 2) {
140 clusterPositionError = pitch / 2.;
153 unsigned short stripID = digit.
getCellID();
164 float currentSNR = (float)sample[maxSampleIndex] / stripNoise;
174 std::set<Belle2::VxdID>::iterator itSvdLayers = svdLayers.begin();
176 std::ofstream noiseMap;
181 while (itSvdLayers != svdLayers.end()) {
183 std::set<Belle2::VxdID> svdLadders = aGeometry.
getLadders(*itSvdLayers);
184 std::set<Belle2::VxdID>::iterator itSvdLadders = svdLadders.begin();
186 while (itSvdLadders != svdLadders.end()) {
188 std::set<Belle2::VxdID> svdSensors = aGeometry.
getSensors(*itSvdLadders);
189 std::set<Belle2::VxdID>::iterator itSvdSensors = svdSensors.begin();
190 B2DEBUG(29,
" svd sensor info " << * (svdSensors.begin()));
192 while (itSvdSensors != svdSensors.end()) {
193 B2DEBUG(29,
" svd sensor info " << *itSvdSensors);
195 int layer = itSvdSensors->getLayerNumber();
196 int ladder = itSvdSensors->getLadderNumber();
197 int sensor = itSvdSensors->getSensorNumber();
202 int simpleVXDID = 131072 * (layer - 3) + 8192 * (ladder - 1) + 1024 * (sensor - 1);
206 for (
int strip = 0; strip < Ncells; strip++) {
214 m_svdNoiseMap.insert(std::make_pair(simpleVXDID + strip, noise));
216 noiseMap << 4096 * (layer - 3) + 16 * (ladder - 1) + (sensor - 1) <<
" " << strip <<
" " << noise << std::endl;
void initialize() override
Create the store arrays.
float m_param_noiseCut
Value above which u-strips are considered noisy, all other u-strips will get assigned a standard nois...
bool m_param_writeNoiseMapsToFile
Write the noise map to file m_param_noiseMapfileName for export to FPGA?
SimpleSVDNoiseMap m_svdNoiseMap
Simple noise map for u-strips*/.
SVDNoiseCalibrations m_NoiseCal
SVD Noise payload.
bool m_param_isU
Is this the finldlet for u-side or for v-side?
float m_param_requiredSNRstrip
Require a SNR for a u-strip signal to be valid.
StoreArray< SVDCluster > m_storeSVDClusters
StoreArray to save the clusters to.
std::string m_param_noiseMapfileName
File name for a file containing the noise of the strips for export to FPGA.
unsigned short m_param_maxiClusterSize
maximum cluster size
void apply(const std::vector< DATCONSVDDigit > &digits, std::vector< SVDCluster > &clusters) override
Load in the DATCONSVDDigits and create SVDClusters from them.
float calculateSNR(DATCONSVDDigit digit)
calculate the SNR of a DATCONSVDDigit (= one strip) in a simplified way
void beginRun() override
Begin Run.
void saveCluster(DATCONSVDClusterCandidate &clusterCand, std::vector< SVDCluster > &clusters)
save the current cluster candidate as a SVDCluster
void fillDATCONSVDNoiseMap()
fill the noise map to be used for SNR cuts
DATCONSVDClusterizer()
Cluster SVD strips.
const VXD::GeoCache & m_geoCache
instance of GeoCache to avoid creating it again for every cluster
float m_param_requiredSNRcluster
Require a SNR for at least one strip in the u-cluster to make the cluster valid.
bool m_param_saveClusterToDataStore
Save SVDCluster to DataStore for analysis?
std::string m_param_storeSVDClustersName
SVDClusters StoreArray name.
void exposeParameters(ModuleParamList *moduleParamList, const std::string &prefix) override
Expose the parameters of the sub findlets.
The DATCONSVDDigit class.
unsigned short getMaxSampleIndex()
Getter for the index of the biggest sample inside the cluster (0...6)
APVRawSamples getRawSamples() const
Get int-array of of 6 APV25 samples.
std::array< APVRawSampleType, c_nAPVSamples > APVRawSamples
Type for array of samples received from DAQ.
VxdID getSensorID() const
Getter for the sensor ID.
short int getCellID() const
Getter for the strip ID.
The Module parameter list class.
The SVD Cluster class This class stores all information about reconstructed SVD clusters.
float getNoise(const VxdID &sensorID, const bool &isU, const unsigned short &strip) const
This is the method for getting the noise.
bool isValid()
returns true if the m_aDBObtPtr is valid in the requested IoV
Specific implementation of SensorInfo for SVD Sensors which provides additional sensor specific infor...
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.
void initialize() override
Receive and dispatch signal before the start of the event processing.
virtual void exposeParameters(ModuleParamList *moduleParamList, const std::string &prefix)
Forward prefixed parameters of this findlet to the module parameter list.
Class to faciliate easy access to sensor information of the VXD like coordinate transformations or pi...
const std::set< Belle2::VxdID > getLayers(SensorInfoBase::SensorType sensortype=SensorInfoBase::VXD)
Return a set of all known Layers.
const SensorInfoBase & getSensorInfo(Belle2::VxdID id) const
Return a referecne to the SensorInfo of a given SensorID.
const std::set< Belle2::VxdID > & getSensors(Belle2::VxdID ladder) const
Return a set of all sensor IDs belonging to a given ladder.
static GeoCache & getInstance()
Return a reference to the singleton instance.
const std::set< Belle2::VxdID > & getLadders(Belle2::VxdID layer) const
Return a set of all ladder IDs belonging to a given layer.
Base class to provide Sensor Information for PXD and SVD.
int getVCells() const
Return number of pixel/strips in v direction.
int getUCells() const
Return number of pixel/strips in u direction.
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.
void addParameter(const std::string &name, T ¶mVariable, const std::string &description, const T &defaultValue)
Adds a new parameter to the module list.
double sqrt(double a)
sqrt for double
Abstract base class for different kinds of events.
struct containing a cluster candidate for easier handling
void finalizeCluster(const double pitch, const int stripsInSensor)
calculate cluster properties once a cluster is ready to be stored
float maxSNRinClusterCandidate
Maximum SNR of all the strips in the cluster candidate.
float clusterPosition
Position of the cluster.
std::vector< unsigned short > charges
Vector containing the charges of the corresponding strips that are added.
VxdID vxdID
VxdID of the cluster.
std::vector< unsigned short > strips
Vector containing strips (DATCONSVDDigits) that are added.
bool add(VxdID nextID, int nextCharge, unsigned short nextCellID, float nextStripSNR, unsigned short maxClusterSize)
add a new strip to the current cluster candidate if possible
int charge
Charge of the cluster.
int seedCharge
Seed Charge of the cluster.