9#include <svd/modules/svdDQM/SVDDQMEfficiencyModule.h>
10#include <hlt/softwaretrigger/core/FinalTriggerDecisionCalculator.h>
11#include <svd/dataobjects/SVDEventInfo.h>
13#include "TDirectory.h"
18using namespace SoftwareTrigger;
32 setDescription(
"Create basic histograms to compute the average sensor efficiency.");
42 std::string(
"SVDEfficiency"));
50 addParam(
"minSVDHits",
m_minSVDHits,
"Number of SVD hits required in a track to be considered.", 1u);
51 addParam(
"minCDCHits",
m_minCDCHits,
"Number of CDC hits required in a track to be considered.", 20u);
53 addParam(
"pValCut",
m_pcut,
"Set a cut on the track p-value.",
double(0));
58 addParam(
"ptCut",
m_ptCut,
"Set a cut on the track transverse momentum.",
double(1));
62 addParam(
"maxHalfResidU",
m_maxResidU,
"half window for cluster search around intercept, U direction.",
float(0.05));
63 addParam(
"maxHalfResidV",
m_maxResidV,
"half window for cluster search around intercept, V direction.",
float(0.05));
66 addParam(
"samples3",
m_3Samples,
"if True 3 samples histograms analysis is performed",
bool(
false));
88 if (!eventAccepted)
return;
92 B2INFO(
"SVDClusters array is missing, no SVD efficiencies");
96 B2INFO(
"SVDIntercepts array is missing, no SVD efficiencies");
101 B2INFO(
"RecoTracks array is missing, no SVD efficiencies");
105 std::string m_svdEventInfoName =
"SVDEventInfo";
109 if (eventinfo.isValid())
110 nSamples = eventinfo->getNSamples();
115 for (
int inter = 0 ; inter <
m_intercepts.getEntries(); inter++) {
120 B2DEBUG(10,
"this intercept is related to a good track");
126 int cellU = info.getUCellID(coorU);
127 int cellV = info.getVCellID(coorV);
153 for (
int cls = 0 ; cls <
m_svdClusters.getEntries(); cls++) {
156 if (clVxdID != theVxdID)
160 double interCoor = coorV;
161 double resid = interCoor -
m_svdClusters[cls]->getPosition();
169 if (std::abs(resid) < maxResid) {
176 if (foundU && foundV)
228 B2FATAL(
"no valid configuration found for SVD reconstruction");
230 B2DEBUG(20,
"SVDRecoConfiguration: from now on we are using " <<
m_svdPlotsConfig->get_uniqueID());
237 TDirectory* oldDir = gDirectory;
257 std::vector<VxdID> sensors =
m_geoCache.getListOfSensors();
258 for (
VxdID& avxdid : sensors) {
263 TString buff = (std::string)avxdid;
264 buff.ReplaceAll(
".",
"_");
266 int nu = info.getUCells();
267 int nv = info.getVCells();
269 m_h_track_hits[avxdid] =
new TH2D(
"track_hits_" + buff,
"tracks through sensor " + buff,
271 m_h_matched_clusterU[avxdid] =
new TH2D(
"matched_clusterU_" + buff,
"track intersections with a matched U cluster" + buff,
273 m_h_matched_clusterV[avxdid] =
new TH2D(
"matched_clusterV_" + buff,
"track intersections with a matched V cluster" + buff,
278 "track intersections with a matched U cluster for 3 samples" + buff,
281 "track intersections with a matched V cluster for 3 samples" + buff,
285 "track intersections with a matched U cluster for 6 samples" + buff,
288 "track intersections with a matched V cluster for 6 samples" + buff,
303 if (theRC.
size() == 0)
307 if (!theRC[0]->wasFitSuccessful())
return false;
309 if (theRC[0]->getNumberOfSVDHits() <
m_minSVDHits)
return false;
311 if (theRC[0]->getNumberOfCDCHits() <
m_minCDCHits)
return false;
313 const genfit::FitStatus* fitstatus = theRC[0]->getTrackFitStatus();
314 if (fitstatus->getPVal() <
m_pcut)
return false;
316 genfit::MeasuredStateOnPlane trackstate;
317 trackstate = theRC[0]->getMeasuredStateOnPlaneFromFirstHit();
318 if (trackstate.getMom().Mag() <
m_momCut)
return false;
320 if (trackstate.getMom().Perp() <
m_ptCut)
return false;
static RelationVector< T > getRelationsWithObj(const TObject *object, const std::string &name="", const std::string &namedRelation="")
Get the relations between an object and other objects in a store array.
HistoModule()
Constructor.
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...
Class for type safe access to objects that are referred to in relations.
size_t size() const
Get number of relations.
float m_fiducialV
stay away from the U border by m_fiducialU (in cm)
bool m_useParamFromDB
if true read back from DB configuration parameters
SVDDQMEfficiencyModule()
Constructor: Sets the description, the properties and the parameters of the module.
std::string m_svdClustersName
SVDClusters StoreArray name.
std::map< VxdID, TH2D * > m_h_track_hits
track hits histogram map to sensorID
void initialize() override final
initializes the need store arrays, trees and histograms
unsigned int m_minCDCHits
Required hits in CDC for tracks.
bool m_saveExpertHistos
save additional histograms id set True
std::map< VxdID, TH2D * > m_h_matched6_clusterV
matched V-hits histogram map to sensorID for 6 samples
StoreArray< SVDIntercept > m_intercepts
SVDIntercept StoreArray.
bool m_skipRejectedEvents
if true skip events rejected by HLT
SVDSummaryPlots * m_MatchedHits3Sample
matched hits summary plot for 3 samples
VXD::GeoCache & m_geoCache
BelleII Geometry.
std::map< VxdID, TH2D * > m_h_matched3_clusterV
matched V-hits histogram map to sensorID for 3 samples
unsigned int m_minSVDHits
Required hits in SVD strips for tracks.
StoreArray< SVDCluster > m_svdClusters
SVDCluster StoreArray.
double m_momCut
Cut on fitted track momentum.
int m_u_bins
number of U-bins for expert histogram
std::map< VxdID, TH2D * > m_h_matched_clusterU
matched U-hits histogram map to sensorID
std::map< VxdID, TH2D * > m_h_matched6_clusterU
matched U-hits histogram map to sensorID for 6 samples
float m_fiducialU
stay away from the U border by m_fiducialU (in cm)
void defineHisto() override final
actually defines the trees and histograms
DBObjPtr< SVDDQMPlotsConfiguration > m_svdPlotsConfig
SVD DQM plots configuration.
double m_pcut
pValue-Cut for tracks
bool isGoodIntercept(SVDIntercept *inter)
returns true if the track related to the intercept passes the selection cuts
void event() override final
main function which fills trees and histograms
std::string m_histogramDirectoryName
name of the directory where to store the histograms
float m_maxResidV
max distance cut in cm V side
bool m_3Samples
if true enable 3 samples histograms analysis
SVDSummaryPlots * m_MatchedHits6Sample
matched hits summary plot for 6 samples
std::map< VxdID, TH2D * > m_h_matched3_clusterU
matched U-hits histogram map to sensorID for 3 samples
int m_v_bins
number of V-bins for expert histogram
SVDSummaryPlots * m_MatchedHits
matched hits summary plot
SVDSummaryPlots * m_TrackHits
track hits summary plot
StoreArray< RecoTrack > m_recoTracks
RecoTrack StoreArray.
double m_ptCut
Cut on fitted track pt.
StoreObjPtr< SoftwareTriggerResult > m_resultStoreObjectPointer
Store Object for reading the trigger decision.
std::string m_interceptsName
SVDIntercepts StoreArray name.
SVDSummaryPlots * m_TrackHits3Sample
track hits summary plot for 3 samples
std::map< VxdID, TH2D * > m_h_matched_clusterV
matched V-hits histogram map to sensorID
SVDSummaryPlots * m_TrackHits6Sample
track hits summary plot for 6 samples
float m_maxResidU
max distance cut in cm U side
SVDIntercept stores the U,V coordinates and uncertainties of the intersection of a track with an SVD ...
class to summarize SVD quantities per sensor and side
static bool getFinalTriggerDecision(const SoftwareTriggerResult &result, bool forgetTotalResult=false)
Calculate the final cut decision using all "total_results" of all sub triggers in the software trigge...
Type-safe access to single objects in the data store.
Base class to provide Sensor Information for PXD and SVD.
bool inside(double u, double v, double uTolerance=DBL_EPSILON, double vTolerance=DBL_EPSILON) const
Check whether a given point is inside the active area.
Class to uniquely identify a any structure of the PXD and SVD.
unsigned short baseType
The base integer type for VxdID.
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.
Namespace to provide code needed by both Vertex Detectors, PXD and SVD, and also testbeam telescopes.
Abstract base class for different kinds of events.