9#include <svd/modules/svdClusterQualityEstimator/ClusterQualityHelperFunctions.h>
10#include <svd/modules/svdClusterQualityEstimator/SVDClusterQualityEstimatorCalibrationModule.h>
21REG_MODULE(SVDClusterQualityEstimatorCalibration);
27 setDescription(
"Generate PDFs used in assigning quality to clusterss.");
32 "SVDCluster collection name",
string(
""));
35 "RecoTracks collection name",
string(
""));
39 "allows the user to set an identifier for this module. Usefull if one wants to use several instances of that module",
string(
""));
50 "Name of output file containing pdfs", std::string(
"clusterQICalibration.root"));
53 "Use old PDF name convention?",
bool(
true));
69 for (
auto& sensors : geo.
getSensors(ladders)) {
71 for (
int side = 0; side <= 1; side++) {
73 std::string sensorName;
74 std::string errorNameString;
79 std::string signalHistName = sensorName +
"signal";
80 std::string backgroundHistName = sensorName +
"background";
104 if (track.wasFitSuccessful() == 1) {
105 if (track.hasSVDHits() == 1) {
106 for (
auto& svdHit : track.getSVDHitList()) {
108 std::string errorNameString;
113 sigHist->Fill(svdHit->getClsTime(), svdHit->getCharge());
124 std::string errorNameString;
129 bkgHist->Fill(cluster.getClsTime(), cluster.getCharge());
141 std::vector<std::string> usedSensors;
145 for (
auto& ladders : geo.
getLadders(layers)) {
146 for (
auto& sensors : geo.
getSensors(ladders)) {
147 for (
int side = 0; side <= 1; side++) {
149 std::string sensorName;
150 std::string errorName;
154 if (std::find(usedSensors.begin(), usedSensors.end(), sensorName.c_str()) == usedSensors.end()) {
155 usedSensors.push_back(sensorName);
175 signal->Divide(background);
176 probability->Add(signal);
181 int imax = signal->GetXaxis()->GetNbins();
182 int jmax = signal->GetYaxis()->GetNbins();
183 for (
int i = 1; i <= imax; i++) {
184 for (
int j = 1; j <= jmax; j++) {
185 int bkg = background->GetBinContent(i, j);
186 int sig = signal->GetBinContent(i, j);
187 double var = ((sig + 1) * (sig + 2)) / ((bkg + 2) * (bkg + 3)) -
188 ((sig + 1) * (sig + 1)) / ((bkg + 2) * (bkg + 2));
189 double err =
sqrt(var);
190 error->SetBinContent(i, j, err);
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...
std::string m_svdClustersName
SVDCluster collection name.
std::string m_nameOfInstance
allows the user to set an identifier for this module.
virtual void initialize() override
Init the module.
StoreArray< SVDCluster > m_svdClusters
the storeArray for svdClusters
virtual void event() override
eventWise jobs
int m_binSizeTime
Number of bins in time dimension.
virtual void terminate() override
final output
void calculateError(TH2F *signal, TH2F *background, TH2F *error)
compute error
std::map< std::string, TH2F * > backgroundHistMap
map to store background histograms
bool m_useLegacyNaming
Choice between PDF naming conventions.
std::string m_recoTracksName
RecoTrack collection name.
std::map< std::string, TH2F * > signalHistMap
map to store signal histograms
int m_maxClusterSize
Maximum cluster size the PDFs will be distributed over.
StoreArray< RecoTrack > m_recoTracks
StoreArray for recoTracks.
SVDClusterQualityEstimatorCalibrationModule()
Constructor.
void calculateProb(TH2F *signal, TH2F *background, TH2F *probability)
compute probvability
int m_binSizeCharge
Number of bins in charge dimension.
std::string m_outputFileName
output filename
bool isRequired(const std::string &name="")
Ensure this array/object has been registered previously.
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 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.
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
void clusterPDFName(const VxdID &sensor, int size, int side, int maxClusterSize, std::string &PDFName, std::string &errorPDFName, bool useLegacyNaming)
Function to set name of PDF for cluster quality estimation.
Abstract base class for different kinds of events.