9 #include <tracking/modules/svdROIFinder/SVDROIFinderAnalysisDataModule.h>
10 #include <framework/datastore/StoreArray.h>
11 #include <framework/logging/Logger.h>
13 #include <svd/dataobjects/SVDShaperDigit.h>
30 , m_recoTrackListName()
31 , m_SVDInterceptListName()
33 , m_rootFilePtr(
nullptr)
35 , m_writeToRoot(false)
39 , m_h1Track_pt(
nullptr)
40 , m_h1Track_phi(
nullptr)
41 , m_h1Track_lambda(
nullptr)
42 , m_h1Track_cosTheta(
nullptr)
43 , m_h1Track_pVal(
nullptr)
45 , m_h1ROItrack(
nullptr)
46 , m_h1ROItrack_pt(
nullptr)
47 , m_h1ROItrack_phi(
nullptr)
48 , m_h1ROItrack_lambda(
nullptr)
49 , m_h1ROItrack_cosTheta(
nullptr)
50 , m_h1ROItrack_pVal(
nullptr)
52 , m_h1GoodROItrack(
nullptr)
53 , m_h1GoodROItrack_pt(
nullptr)
54 , m_h1GoodROItrack_phi(
nullptr)
55 , m_h1GoodROItrack_lambda(
nullptr)
56 , m_h1GoodROItrack_cosTheta(
nullptr)
57 , m_h1GoodROItrack_pVal(
nullptr)
59 , m_h1FullROItrack(
nullptr)
60 , m_h1FullROItrack_pt(
nullptr)
61 , m_h1FullROItrack_phi(
nullptr)
62 , m_h1FullROItrack_lambda(
nullptr)
63 , m_h1FullROItrack_cosTheta(
nullptr)
64 , m_h1FullROItrack_pVal(
nullptr)
68 , m_h2sigmaUphi(
nullptr)
69 , m_h2sigmaVphi(
nullptr)
74 , m_h1GlobalTime(
nullptr)
76 , m_h2ROIuMinMax(
nullptr)
77 , m_h2ROIvMinMax(
nullptr)
78 , m_h2ROIcenters(
nullptr)
79 , m_h2GoodROIcenters(
nullptr)
80 , m_h2FullROIcenters(
nullptr)
81 , m_h1totROIs(
nullptr)
82 , m_h1goodROIs(
nullptr)
84 , m_h1effROIs(
nullptr)
95 setDescription(
"This module performs the analysis of the SVDROIFinder module output ON DATA");
97 addParam(
"writeToRoot", m_writeToRoot,
98 "set true if you want to save the informations in a root file named by parameter 'rootFileName'",
bool(
true));
100 addParam(
"rootFileName", m_rootFileName,
101 "fileName used for . Will be ignored if parameter 'writeToRoot' is false (standard)",
102 string(
"svdDataRedAnalysisData"));
104 addParam(
"recoTrackListName", m_recoTrackListName,
105 "name of the input collection of RecoTracks", std::string(
""));
107 addParam(
"shapers", m_shapersName,
108 "name of the input collection of SVDShaperDigits", std::string(
""));
110 addParam(
"SVDInterceptListName", m_SVDInterceptListName,
111 "name of the list of interceptions", std::string(
""));
113 addParam(
"ROIListName", m_ROIListName,
114 "name of the list of ROIs", std::string(
""));
116 addParam(
"edgeU", m_edgeU,
"fiducial region: edge U [mm]",
float(10));
117 addParam(
"edgeV", m_edgeV,
"fiducial region: edge V [mm]",
float(10));
118 addParam(
"minPVal", m_minPVal,
"fiducial region: minimum track P-Value",
float(0.001));
122 SVDROIFinderAnalysisDataModule::~SVDROIFinderAnalysisDataModule()
127 void SVDROIFinderAnalysisDataModule::initialize()
130 m_shapers.isRequired(m_shapersName);
131 m_recoTracks.isRequired(m_recoTrackListName);
132 m_tracks.isRequired();
133 m_ROIs.isRequired(m_ROIListName);
134 m_SVDIntercepts.isRequired(m_SVDInterceptListName);
142 if (m_writeToRoot ==
true) {
143 m_rootFileName +=
".root";
144 m_rootFilePtr =
new TFile(m_rootFileName.c_str(),
"RECREATE");
146 m_rootFilePtr =
nullptr;
149 m_h1GlobalTime =
new TH1F(
"hGlobalTime",
"global time for SVDShaperDigits contained in ROI", 200, -100, 100);
150 m_h1PullU =
new TH1F(
"hPullU",
"U pulls for SVDShaperDigits contained in ROI", 100, -6, 6);
151 m_h1PullV =
new TH1F(
"hPullV",
"V pulls for SVDShaperDigits contained in ROI", 100, -6, 6);
152 m_h2sigmaUphi =
new TH2F(
"hsigmaUvsPhi",
"sigmaU vs phi digits in ROI", 100, -180, 180, 100, 0, 0.35);
153 m_h2sigmaVphi =
new TH2F(
"hsigmaVvsPhi",
"sigmaU vs phi digits in ROI", 100, -180, 180, 100, 0, 0.4);
154 m_h1ResidU =
new TH1F(
"hResidU",
"U resid for SVDShaperDigits contained in ROI", 100, -0.5, 0.5);
155 m_h1ResidV =
new TH1F(
"hResidV",
"V resid for SVDShaperDigits contained in ROI", 100, -0.5, 0.5);
156 m_h1SigmaU =
new TH1F(
"hSigmaU",
"sigmaU for SVDShaperDigits contained in ROI", 100, 0, 0.35);
157 m_h1SigmaV =
new TH1F(
"hSigmaV",
"sigmaV for SVDShaperDigits contained in ROI", 100, 0, 0.35);
169 m_h1totROIs =
new TH1F(
"h1TotNROIs",
"number of all ROIs", 110, 0, 110);
170 m_h1goodROIs =
new TH1F(
"h1GoodNROIs",
"number of ROIs from Good Track", 110, 0, 110);
171 m_h1okROIs =
new TH1F(
"h1OkNROIs",
"number of Good ROIs containing a SVDShaperDigit", 110, 0, 110);
172 m_h1effROIs =
new TH1F(
"h1EffSVD",
"fraction of Good ROIs containing a SVDShaperDigit", 100, 0, 1.1);
178 m_h2ROIuMinMax =
new TH2F(
"h2ROIuMinMax",
"u Min vs Max (all ROIs)", 960, -100, 860, 960, -100, 860);
179 m_h2ROIvMinMax =
new TH2F(
"h2ROIvMinMax",
"v Min vs Max (all ROIs)", 960, -100, 860, 960, -100, 860);
180 m_h2ROIcenters =
new TH2F(
"h2ROIcenters",
"ROI Centers", 768, 0, 768, 512, 0, 512);
181 m_h2GoodROIcenters =
new TH2F(
"h2GoodROIcenters",
"Good ROI Centers", 768, 0, 768, 512, 0, 512);
182 m_h2FullROIcenters =
new TH2F(
"h2FullROIcenters",
"Full ROI Centers", 768, 0, 768, 512, 0, 512);
191 m_h1ROItrack =
new TH1F(
"hROITrack",
"track with an attached Good ROI", 2, 0, 2);
192 m_h1ROItrack_pt =
new TH1F(
"hROITrack_pT",
"Track with an attached Good ROI, Transverse Momentum", 100, 0, 8);
193 m_h1ROItrack_phi =
new TH1F(
"h1ROITrack_phi",
"Track with an attached Good ROI, Momentum Phi", 200, -TMath::Pi() - 0.01,
195 m_h1ROItrack_lambda =
new TH1F(
"h1ROITrack_lambda",
"Track with an attached Good ROI, Lambda", 100, -TMath::Pi() - 0.01,
197 m_h1ROItrack_cosTheta =
new TH1F(
"h1ROITrack_cosTheta",
"Track with an attached Good ROI, Momentum CosTheta", 100, -1 - 0.01, 1.01);
198 m_h1ROItrack_pVal =
new TH1F(
"h1ROITrack_pVal",
"Track with an attached Good ROI, P-Value", 1000, 0, 1 + 0.01);
200 m_h1FullROItrack =
new TH1F(
"hFullROITrack",
"track with an attached Full ROI", 20, 0, 20);
201 m_h1FullROItrack_pt =
new TH1F(
"hFullROITrack_pT",
"Track with an attached Full ROI, Transverse Momentum", 100, 0, 8);
202 m_h1FullROItrack_phi =
new TH1F(
"h1FullROITrack_phi",
"Track with an attached Full ROI, Momentum Phi", 200, -TMath::Pi() - 0.01,
204 m_h1FullROItrack_lambda =
new TH1F(
"h1FullROITrack_lambda",
"Track with an attached Full ROI, Lambda", 100, -TMath::Pi() - 0.01,
206 m_h1FullROItrack_cosTheta =
new TH1F(
"h1FullROITrack_cosTheta",
"Track with an attached Full ROI, Momentum CosTheta", 100,
208 m_h1FullROItrack_pVal =
new TH1F(
"h1FullROITrack_pVal",
"Track with an attached Full ROI, P-Value", 1000, 0, 1 + 0.01);
210 m_h1GoodROItrack =
new TH1F(
"hGoodROITrack",
"track with an attached Good ROI", 20, 0, 20);
211 m_h1GoodROItrack_pt =
new TH1F(
"hGoodROITrack_pT",
"Track with an attached Good ROI, Transverse Momentum", 100, 0, 8);
212 m_h1GoodROItrack_phi =
new TH1F(
"h1GoodROITrack_phi",
"Track with an attached Good ROI, Momentum Phi", 200, -TMath::Pi() - 0.01,
214 m_h1GoodROItrack_lambda =
new TH1F(
"h1GoodROITrack_lambda",
"Track with an attached Good ROI, Lambda", 100, -TMath::Pi() - 0.01,
216 m_h1GoodROItrack_cosTheta =
new TH1F(
"h1GoodROITrack_cosTheta",
"Track with an attached Good ROI, Momentum CosTheta", 100,
218 m_h1GoodROItrack_pVal =
new TH1F(
"h1GoodROITrack_pVal",
"Track with an attached Good ROI, P-Value", 1000, 0, 1 + 0.01);
220 m_h1Track =
new TH1F(
"hTrack",
"Number of Tracks per Event", 20, 0, 20);
221 m_h1Track_pt =
new TH1F(
"hTrack_pT",
"Track Transverse Momentum", 100, 0, 8);
222 m_h1Track_lambda =
new TH1F(
"h1Track_lambda",
"Track Momentum Lambda", 100, -TMath::Pi() + 0.01, TMath::Pi() + 0.01);
223 m_h1Track_phi =
new TH1F(
"h1Track_phi",
"Track momentum Phi", 200, -TMath::Pi() - 0.01, TMath::Pi() + 0.01);
224 m_h1Track_cosTheta =
new TH1F(
"h1Track_cosTheta",
"Track Momentum CosTheta", 100, -1 - 0.01, 1 + 0.01);
225 m_h1Track_pVal =
new TH1F(
"h1Track_pVal",
"Track P-Value", 1000, 0, 1 + 0.01);
230 void SVDROIFinderAnalysisDataModule::event()
233 B2DEBUG(1,
" ++++++++++++++ SVDROIFinderAnalysisDataModule");
240 for (
int i = 0; i < (int)m_tracks.getEntries(); i++) {
242 const TrackFitResult* tfr = m_tracks[i]->getTrackFitResultWithClosestMass(Const::pion);
245 m_h1Track_pt->Fill(mom.Perp());
246 m_h1Track_phi->Fill(mom.Phi());
247 m_h1Track_cosTheta->Fill(mom.CosTheta());
248 m_h1Track_lambda->Fill(TMath::Pi() / 2 - mom.Theta());
252 m_h1Track->Fill(m_tracks.getEntries());
255 for (
int i = 0; i < (int)m_ROIs.getEntries(); i++) {
257 float centerROIU = (m_ROIs[i]->getMaxUid() + m_ROIs[i]->getMinUid()) / 2;
258 float centerROIV = (m_ROIs[i]->getMaxVid() + m_ROIs[i]->getMinVid()) / 2;
260 m_h2ROIuMinMax->Fill(m_ROIs[i]->getMinUid(), m_ROIs[i]->getMaxUid());
261 m_h2ROIvMinMax->Fill(m_ROIs[i]->getMinVid(), m_ROIs[i]->getMaxVid());
262 m_h2ROIcenters->Fill(centerROIU, centerROIV);
267 if (!theRC[0]->wasFitSuccessful()) {
268 m_h1ROItrack->Fill(0);
274 const TrackFitResult* tfr = theTrack[0]->getTrackFitResultWithClosestMass(Const::pion);
277 m_h1ROItrack->Fill(0);
282 m_h1ROItrack->Fill(1);
283 m_h1ROItrack_pt->Fill(mom.Perp());
284 m_h1ROItrack_phi->Fill(mom.Phi());
285 m_h1ROItrack_cosTheta->Fill(mom.CosTheta());
286 m_h1ROItrack_lambda->Fill(TMath::Pi() / 2 - mom.Theta());
287 m_h1ROItrack_pVal->Fill(tfr->
getPValue());
290 VxdID sensorID = m_ROIs[i]->getSensorID();
292 float nStripsU = 768;
293 float nStripsV = 512;
294 float centerSensorU = nStripsU / 2;
295 float centerSensorV = nStripsV / 2;
296 float pitchU = 0.075;
297 float pitchV = 0.240;
305 float edgeStripsU = m_edgeU / pitchU;
306 float edgeStripsV = m_edgeV / pitchV;
307 B2DEBUG(10,
"good U in range " << edgeStripsU <<
", " << nStripsU - edgeStripsU);
308 B2DEBUG(10,
"good V in range " << edgeStripsV <<
", " << nStripsV - edgeStripsV);
310 B2DEBUG(10,
"U check: " << abs(centerROIU - centerSensorU) <<
" < (good) " << centerSensorU - edgeStripsU);
311 B2DEBUG(10,
"V check: " << abs(centerROIV - centerSensorV) <<
" < (good) " << centerSensorV - edgeStripsV);
313 if ((abs(centerROIU - centerSensorU) > centerSensorU - edgeStripsU)
314 || (abs(centerROIV - centerSensorV) > centerSensorV - edgeStripsV))
318 m_h2GoodROIcenters->Fill(centerROIU, centerROIV);
322 ": U side " << m_ROIs[i]->getMinUid() <<
"->" << m_ROIs[i]->getMaxUid() <<
", V side " << m_ROIs[i]->getMinVid() <<
"->" <<
323 m_ROIs[i]->getMaxVid());
325 m_h1GoodROItrack_pt->Fill(mom.Perp());
326 m_h1GoodROItrack_phi->Fill(mom.Phi());
327 m_h1GoodROItrack_cosTheta->Fill(mom.CosTheta());
328 m_h1GoodROItrack_lambda->Fill(TMath::Pi() / 2 - mom.Theta());
329 m_h1GoodROItrack_pVal->Fill(tfr->
getPValue());
331 for (
int s = 0; s < m_shapers.getEntries(); s++) {
332 if (m_ROIs[i]->Contains(*(m_shapers[s]))) {
335 m_h2FullROIcenters->Fill(centerROIU, centerROIV);
336 m_h1FullROItrack->Fill(1);
337 m_h1FullROItrack_pt->Fill(mom.Perp());
338 m_h1FullROItrack_phi->Fill(mom.Phi());
339 m_h1FullROItrack_cosTheta->Fill(mom.CosTheta());
340 m_h1FullROItrack_lambda->Fill(TMath::Pi() / 2 - mom.Theta());
341 m_h1FullROItrack_pVal->Fill(tfr->
getPValue());
343 B2RESULT(
" --> is Full");
350 m_nGoodROIs += nGoodROIs;
351 m_h1goodROIs->Fill(nGoodROIs);
352 m_nOkROIs += nOkROIs;
353 m_h1okROIs->Fill(nOkROIs);
355 m_h1totROIs->Fill(m_ROIs.getEntries());
357 m_h1effROIs->Fill((
float) nOkROIs / nGoodROIs);
358 n_rois += m_ROIs.getEntries();
361 n_tracks += m_tracks.getEntries();
364 n_intercepts += m_SVDIntercepts.getEntries();
369 B2RESULT(
" o Good ROIs = " << nGoodROIs <<
", of which Full = " << nOkROIs
370 <<
" --> efficiency = " << (
float)nOkROIs / nGoodROIs);
372 if (nGoodROIs > m_ROIs.getEntries()) B2RESULT(
" HOUSTON WE HAVE A PROBLEM!");
377 void SVDROIFinderAnalysisDataModule::terminate()
380 B2RESULT(
" ROI AnalysisData Summary ");
381 B2RESULT(
"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~");
383 B2RESULT(
" number of events = " << m_rootEvent);
384 B2RESULT(
" number of tracks = " << n_tracks);
385 B2RESULT(
" number of Intercepts = " << n_intercepts);
386 B2RESULT(
" number of ROIs = " << n_rois);
387 B2RESULT(
" number of Good ROIs = " << m_nGoodROIs);
388 if (m_nGoodROIs > 0) {
389 B2RESULT(
" number of Good ROIs with SVDShaperDigit= " << m_nOkROIs);
390 B2RESULT(
" SVD INefficiency = " << 1 - (
float)m_nOkROIs / m_nGoodROIs);
391 B2RESULT(
" average SVD INefficiency = " << 1 - m_h1effROIs->GetMean());
392 B2RESULT(
" number of EMPTY ROIs = " << m_nGoodROIs - m_nOkROIs);
397 if (m_rootFilePtr !=
nullptr) {
400 TDirectory* oldDir = gDirectory;
402 TDirectory* m_alltracks = oldDir->mkdir(
"ALLtracks");
403 TDirectory* m_roitracks = oldDir->mkdir(
"ROItracks");
404 TDirectory* m_goodroitracks = oldDir->mkdir(
"GoodROItracks");
405 TDirectory* m_fullroitracks = oldDir->mkdir(
"FullROItracks");
408 TDirectory* m_ROIDir = oldDir->mkdir(
"roi");
417 m_h1Track_pt->Write();
418 m_h1Track_phi->Write();
419 m_h1Track_lambda->Write();
420 m_h1Track_cosTheta->Write();
421 m_h1Track_pVal->Write();
424 m_h1ROItrack->Write();
425 m_h1ROItrack_pt->Write();
426 m_h1ROItrack_phi->Write();
427 m_h1ROItrack_lambda->Write();
428 m_h1ROItrack_cosTheta->Write();
430 m_goodroitracks->cd();
431 m_h1GoodROItrack->Write();
432 m_h1GoodROItrack_pt->Write();
433 m_h1GoodROItrack_phi->Write();
434 m_h1GoodROItrack_lambda->Write();
435 m_h1GoodROItrack_cosTheta->Write();
437 m_fullroitracks->cd();
438 m_h1FullROItrack->Write();
439 m_h1FullROItrack_pt->Write();
440 m_h1FullROItrack_phi->Write();
441 m_h1FullROItrack_lambda->Write();
442 m_h1FullROItrack_cosTheta->Write();
445 m_h1effROIs->Write();
446 m_h1totROIs->Write();
447 m_h1goodROIs->Write();
449 m_h2ROIuMinMax->Write();
450 m_h2ROIvMinMax->Write();
451 m_h2ROIcenters->Write();
452 m_h2GoodROIcenters->Write();
453 m_h2FullROIcenters->Write();
455 m_rootFilePtr->Close();
Class for type safe access to objects that are referred to in relations.
The Module evaluates the efficiency on SVD based on the number of empty ROIs.
Values of the result of a track fit with a given particle hypothesis.
double getPValue() const
Getter for Chi2 Probability of the track fit.
TVector3 getMomentum() const
Getter for vector of momentum at closest approach of track in r/phi projection.
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.
#define REG_MODULE(moduleName)
Register the given module (without 'Module' suffix) with the framework.
Abstract base class for different kinds of events.