Newer
Older
TB_Chris / TbAlgorithms / src / .svn / text-base / TbClusterPlots.cpp.svn-base
  1. #include <cmath>
  2.  
  3. // AIDA
  4. // #include "AIDA/IAxis.h"
  5.  
  6. // Gaudi
  7. #include "GaudiKernel/PhysicalConstants.h"
  8. #include "GaudiUtils/Aida2ROOT.h"
  9. #include "GaudiUtils/HistoLabels.h"
  10.  
  11. // Tb/TbEvent
  12. #include "Event/TbHit.h"
  13.  
  14. // Tb/TbKernel
  15. #include "TbKernel/TbModule.h"
  16.  
  17. // Local
  18. #include "TbClusterPlots.h"
  19.  
  20. using namespace Gaudi::Utils::Histos;
  21.  
  22. DECLARE_ALGORITHM_FACTORY(TbClusterPlots)
  23.  
  24. //=============================================================================
  25. // Standard constructor.
  26. //=============================================================================
  27. TbClusterPlots::TbClusterPlots(const std::string& name,
  28. ISvcLocator* pSvcLocator)
  29. : TbAlgorithm(name, pSvcLocator),
  30. m_parToT("", 0.5, 1024.5, 1024),
  31. m_parCharge("", 0., 60000., 200),
  32. m_parXY("", -25., 25., 200),
  33. m_parTime("", 0., 300000., 1000),
  34. m_parDifferenceXY("", -2., 2., 200),
  35. m_parDifferenceRot("", -0.1, 0.1, 200),
  36. m_parDifferenceT("", -1000., 1000., 1000),
  37. m_parSamples(0, 100000, 1),
  38. m_clusterFinder(nullptr),
  39. m_event(0) {
  40.  
  41. declareProperty("ClusterLocation",
  42. m_clusterLocation = LHCb::TbClusterLocation::Default);
  43. declareProperty("ReferencePlane", m_referencePlane = 0);
  44. declareProperty("TimeWindow", m_twindow = 250. * Gaudi::Units::ns);
  45.  
  46. declareProperty("ParametersToT", m_parToT);
  47. declareProperty("ParametersCharge", m_parCharge);
  48. declareProperty("ParametersXY", m_parXY);
  49. declareProperty("ParametersTime", m_parTime);
  50. declareProperty("ParametersDifferenceXY", m_parDifferenceXY);
  51. declareProperty("ParametersDifferenceRot", m_parDifferenceRot);
  52. declareProperty("ParametersDifferenceT", m_parDifferenceT);
  53.  
  54. declareProperty("FillSamples", m_fillSamples = false);
  55. declareProperty("FillComparisonPlots", m_fillComparisonPlots = false);
  56. declareProperty("FillTrackingEfficiency", m_fillTrackingEfficiency = false);
  57. declareProperty("ParametersSamples", m_parSamples);
  58. declareProperty("ChargeCutLow", m_chargeCutLow = 0);
  59. }
  60.  
  61. //=============================================================================
  62. // Destructor
  63. //=============================================================================
  64. TbClusterPlots::~TbClusterPlots() {}
  65.  
  66. //=============================================================================
  67. // Initialization.
  68. //=============================================================================
  69. StatusCode TbClusterPlots::initialize() {
  70.  
  71. // Initialise the base class.
  72. StatusCode sc = TbAlgorithm::initialize();
  73. if (sc.isFailure()) return sc;
  74. // Initialise the plots.
  75. setupPlots();
  76. // Setup the cluster finder.
  77. m_clusterFinder =
  78. tool<ITbClusterFinder>("TbClusterFinder", "ClusterFinder", this);
  79. if (!m_clusterFinder) {
  80. return Error("Cannot retrieve cluster finder tool.");
  81. }
  82. m_clusterFinder->setSearchAlgorithm("adap_seq");
  83. return StatusCode::SUCCESS;
  84. }
  85.  
  86. //=============================================================================
  87. // Finalization.
  88. //=============================================================================
  89. StatusCode TbClusterPlots::finalize() {
  90. for (unsigned int i = 0; i < m_nPlanes; ++i) {
  91. double num = m_nTrackedClusters_vs_telHitOccupancy->binHeight(
  92. m_nTrackedClusters_vs_telHitOccupancy->coordToIndex(i));
  93. double denom = m_nClusters_vs_telHitOccupancy->binHeight(
  94. m_nClusters_vs_telHitOccupancy->coordToIndex(i));
  95. double frac = num / denom;
  96. if (denom > 0) m_fractionTrackedClusters_vs_telHitOccupancy->fill(i, frac);
  97.  
  98. num = m_nTrackedClusters_vs_telCharge->binHeight(
  99. m_nTrackedClusters_vs_telCharge->coordToIndex(i));
  100. denom = m_nClusters_vs_telCharge->binHeight(
  101. m_nClusters_vs_telCharge->coordToIndex(i));
  102. frac = num / denom;
  103. if (denom > 0) m_fractionTrackedClusters_vs_telCharge->fill(i, frac);
  104. }
  105.  
  106. return TbAlgorithm::finalize();
  107. }
  108.  
  109. //=============================================================================
  110. // Main execution.
  111. //=============================================================================
  112. StatusCode TbClusterPlots::execute() {
  113.  
  114. for (unsigned int i = 0; i < m_nPlanes; ++i) {
  115. // Skip masked planes.
  116. if (masked(i)) continue;
  117. // Get the clusters for this plane.
  118. const std::string clusterLocation = m_clusterLocation + std::to_string(i);
  119. LHCb::TbClusters* clusters = getIfExists<LHCb::TbClusters>(clusterLocation);
  120. if (!clusters) return Error("No clusters in " + clusterLocation);
  121. // Fill the plots depending on just these clusters.
  122. fillPerChipPlots(clusters);
  123. fillClusterVisuals(clusters);
  124. // Store the iterators in the cluster finder.
  125. m_clusterFinder->setClusters(clusters, i);
  126. }
  127.  
  128. if (m_fillTrackingEfficiency) fillTrackingEfficiency();
  129.  
  130. if (m_fillComparisonPlots) fillComparisonPlots();
  131. m_event++;
  132. return StatusCode::SUCCESS;
  133. }
  134.  
  135. //=============================================================================
  136. // Fill "event displays".
  137. //=============================================================================
  138. void TbClusterPlots::fillClusterVisuals(const LHCb::TbClusters* clusters) {
  139.  
  140. for (const LHCb::TbCluster* cluster : *clusters) {
  141. if (cluster->htime() > m_parSamples.highEdge()) break;
  142. if (cluster->htime() < m_parSamples.lowEdge()) continue;
  143. if (cluster->associated()) continue;
  144. const unsigned int plane = cluster->plane();
  145. for (auto hit : cluster->hits()) {
  146. double xLocal = 0.;
  147. double yLocal = 0.;
  148. geomSvc()->pixelToPoint(hit->scol(), hit->row(), plane, xLocal, yLocal);
  149. Gaudi::XYZPoint pLocal(xLocal, yLocal, 0.);
  150. Gaudi::XYZPoint pGlobal = geomSvc()->localToGlobal(pLocal, plane);
  151. m_clusterVisuals[plane]->fill(pGlobal.x(), pGlobal.y());
  152. }
  153. }
  154. }
  155.  
  156. //=============================================================================
  157. // Fill plots.
  158. //=============================================================================
  159. void TbClusterPlots::fillPerChipPlots(const LHCb::TbClusters* clusters) {
  160.  
  161. double tprev = 0.;
  162. bool first = true;
  163. for (const LHCb::TbCluster* cluster : *clusters) {
  164. const unsigned int plane = cluster->plane();
  165. const unsigned int tot = cluster->ToT();
  166. const double charge = cluster->charge();
  167. m_hToT[plane]->fill(tot);
  168. m_hCharge[plane]->fill(charge);
  169. const unsigned int size = cluster->size();
  170. if (size == 1) {
  171. m_hToTOnePixel[plane]->fill(tot);
  172. m_hChargeOnePixel[plane]->fill(charge);
  173. } else if (size == 2) {
  174. m_hToTTwoPixel[plane]->fill(tot);
  175. m_hChargeTwoPixel[plane]->fill(charge);
  176. } else if (size == 3) {
  177. m_hToTThreePixel[plane]->fill(tot);
  178. m_hChargeThreePixel[plane]->fill(charge);
  179. } else if (size == 4) {
  180. m_hToTFourPixel[plane]->fill(tot);
  181. m_hChargeFourPixel[plane]->fill(charge);
  182. }
  183. m_hSize[plane]->fill(size);
  184.  
  185. // Hitmap.
  186. m_hHitMap[plane]->fill(cluster->x(), cluster->y());
  187.  
  188. counter("effFractionAssociated" + std::to_string(plane)) +=
  189. cluster->associated();
  190. if (cluster->charge() > 50) {
  191. counter("effFractionAssociatedAbove50TOT" + std::to_string(plane)) +=
  192. cluster->associated();
  193. }
  194. const double t = cluster->htime();
  195. m_hTime[plane]->fill(t);
  196. if (!first) m_hTimeBetweenClusters[plane]->fill(t - tprev);
  197. first = false;
  198. tprev = t;
  199.  
  200. if (cluster->associated()) {
  201. m_hHitMapAssociated[plane]->fill(cluster->x(), cluster->y());
  202. m_hSizeAssociated[plane]->fill(size);
  203. m_hToTAssociated[plane]->fill(tot);
  204. m_hChargeAssociated[plane]->fill(charge);
  205. m_hTimeAssociated[plane]->fill(t);
  206. } else {
  207. m_hHitMapNonAssociated[plane]->fill(cluster->x(), cluster->y());
  208. m_hSizeNonAssociated[plane]->fill(size);
  209. m_hToTNonAssociated[plane]->fill(tot);
  210. m_hChargeNonAssociated[plane]->fill(charge);
  211. m_hTimeNonAssociated[plane]->fill(t);
  212. }
  213. m_hWidthCol[plane]->fill(cluster->cols());
  214. m_hWidthRow[plane]->fill(cluster->rows());
  215. m_hGlobalXvsZ->fill(cluster->z(), cluster->x());
  216. m_hGlobalYvsZ->fill(cluster->z(), cluster->y());
  217.  
  218. // Loop over the hits in the cluster.
  219. auto hits = cluster->hits();
  220. bool firstHit = true;
  221. double tSeed = 0.;
  222. for (const LHCb::TbHit* hit : hits) {
  223. if (firstHit) {
  224. tSeed = hit->htime();
  225. firstHit = false;
  226. } else {
  227. m_hTimeSeedMinusHit[plane]->fill(hit->htime() - tSeed);
  228. }
  229. }
  230. }
  231.  
  232. if (m_fillSamples) fillSamples(clusters);
  233. }
  234.  
  235. //=============================================================================
  236. // Comparison windows (via scrolling window).
  237. //=============================================================================
  238. void TbClusterPlots::fillComparisonPlots() {
  239.  
  240. // Make sure there are clusters on the reference plane.
  241. if (m_clusterFinder->empty(m_referencePlane)) return;
  242. // Scroll over clusters on the reference plane, then draw comparisons
  243. // between this cluster and those inside a time window on the other planes.
  244. const auto refBegin = m_clusterFinder->first(m_referencePlane);
  245. const auto refEnd = m_clusterFinder->end(m_referencePlane);
  246. for (auto itRef = refBegin; itRef != refEnd; ++itRef) {
  247. // Calculate the time window for this cluster.
  248. const auto tRef = (*itRef)->htime();
  249. const auto tMin = tRef - m_twindow;
  250. const auto tMax = tRef + m_twindow;
  251.  
  252. const double xRef = (*itRef)->x();
  253. const double yRef = (*itRef)->y();
  254.  
  255. // Loop over other the other planes.
  256. for (unsigned int i = 0; i < m_nPlanes; ++i) {
  257. // Skip empty planes.
  258. if (m_clusterFinder->empty(i)) continue;
  259. // Get the first cluster within the time range.
  260. const auto begin = m_clusterFinder->getIterator(tMin, i);
  261. const auto end = m_clusterFinder->end(i);
  262. // Loop over the clusters within the range.
  263. for (auto ic = begin; ic != end; ++ic) {
  264. // Stop when too far ahead.
  265. if ((*ic)->htime() >= tMax) break;
  266. // (Re)-check if inside the window.
  267. if ((*ic)->htime() >= tMin) {
  268. // Fill correlation plots.
  269. m_gx_correls[i]->fill((*ic)->x(), xRef);
  270. m_gy_correls[i]->fill((*ic)->y(), yRef);
  271. m_gt_correls[i]->fill((*ic)->htime(), tRef);
  272. // Fill difference plots.
  273. m_gx_diffs[i]->fill((*ic)->x() - xRef);
  274. m_gy_diffs[i]->fill((*ic)->y() - yRef);
  275. m_gt_diffs[i]->fill((*ic)->htime() - tRef);
  276. }
  277. }
  278. }
  279. }
  280. }
  281.  
  282. //=============================================================================
  283. // Plot a set of clusters.
  284. //=============================================================================
  285. void TbClusterPlots::fillSamples(const LHCb::TbClusters* clusters) {
  286.  
  287. // Takes a set number of clusters and plots their hits on a TH2, with
  288. // the bins weighted by ToT values. Clusters are spaced equally. A dot at
  289. // their reconstructed positions would be cool.
  290.  
  291. const unsigned int nSamplesRoot = 6;
  292. const unsigned int nSamples = nSamplesRoot * nSamplesRoot;
  293. const unsigned int sampleSpacing = 6;
  294. const unsigned int n = nSamplesRoot * sampleSpacing;
  295. LHCb::TbClusters::const_iterator ic = clusters->begin();
  296. for (unsigned int i = 0; i < nSamples && i < clusters->size(); ++i) {
  297. // Modify later to not always visualize first few clusters.
  298. // Position of cluster seed on TH2.
  299. // Sequentially left to right, then down to up.
  300. const int c_col = (i % nSamplesRoot) * sampleSpacing;
  301. const int c_row = (i / nSamplesRoot) * sampleSpacing;
  302. const auto& hits = (*ic)->hits();
  303. const int seed_col = hits.front()->col();
  304. const int seed_row = hits.front()->row();
  305. for (auto it = hits.cbegin(), end = hits.cend(); it != end; ++it) {
  306. // Center the cluster on the seed hit, then shift to posn on TH2.
  307. const int col = ((*it)->col() - seed_col) + c_col;
  308. const int row = ((*it)->row() - seed_row) + c_row;
  309. plot2D(col, row, "ClusterSamples", "Cluster samples", 0, n, 0, n, n, n,
  310. (*it)->ToT());
  311. }
  312. ++ic;
  313. }
  314.  
  315. // Switch off filling the samples plot after the first call.
  316. m_fillSamples = false;
  317. }
  318.  
  319. //=============================================================================
  320.  
  321. void TbClusterPlots::fillTrackingEfficiency() {
  322. std::string clusterLocation = m_clusterLocation + "0";
  323. LHCb::TbClusters* clusters_zero =
  324. getIfExists<LHCb::TbClusters>(clusterLocation);
  325.  
  326. // Loop over clusters on plane 0.
  327. LHCb::TbClusters::const_iterator begin = clusters_zero->begin();
  328. LHCb::TbClusters::const_iterator end = clusters_zero->end();
  329. for (LHCb::TbClusters::const_iterator iSeed = begin; iSeed != end; ++iSeed) {
  330. double timeSeed = (*iSeed)->htime();
  331. double tWindow = 10;
  332.  
  333. unsigned int nClusters = 0;
  334. unsigned int nTrackedClusters = 0;
  335. unsigned int nTelHits = 0;
  336. unsigned int nTelHits_tracked = 0;
  337. double telCharge = 0;
  338.  
  339. for (unsigned int i = 1; i < m_nPlanes; ++i) {
  340. if (i == 4) continue;
  341. // Get the clusters for this plane.
  342. clusterLocation = m_clusterLocation + std::to_string(i);
  343. LHCb::TbClusters* clusters =
  344. getIfExists<LHCb::TbClusters>(clusterLocation);
  345.  
  346. LHCb::TbClusters::const_iterator begin = clusters->begin();
  347. LHCb::TbClusters::const_iterator end = clusters->end();
  348. for (LHCb::TbClusters::const_iterator it = begin; it != end; ++it) {
  349. double delT = timeSeed - (*it)->htime();
  350. if (fabs(delT) < tWindow) {
  351. nTelHits += (*it)->size();
  352. telCharge += (*it)->charge();
  353. if ((*it)->charge() > m_chargeCutLow) {
  354. nClusters++;
  355. if ((*it)->associated()) {
  356. nTrackedClusters++;
  357. nTelHits_tracked += (*it)->size();
  358. }
  359. }
  360. }
  361. }
  362. }
  363. // if (nClustersPerPlane > 4 && m_event == 1050)
  364. //std::cout<<nClustersPerPlane<<"\t"<<m_event<<"\t"<<(*iSeed)->htime()<<std::endl;
  365. m_telHitOccupancy->fill(nTelHits);
  366. m_telHitOccupancy_tracked->fill(nTelHits_tracked);
  367. m_nClusters_vs_telHitOccupancy->fill(nTelHits, nClusters);
  368. m_nTrackedClusters_vs_telHitOccupancy->fill(nTelHits, nTrackedClusters);
  369.  
  370. m_telCharge->fill(telCharge);
  371. m_nClusters_vs_telCharge->fill(telCharge, nClusters);
  372. m_nTrackedClusters_vs_telCharge->fill(telCharge, nTrackedClusters);
  373.  
  374. m_telClusterOccupancy->fill(nClusters);
  375. m_telClusterOccupancy_tracked->fill(nTrackedClusters);
  376. m_nClusters_vs_telClusterOccupancy->fill(nClusters, nClusters);
  377. m_nTrackedClusters_vs_telClusterOccupancy->fill(nClusters,
  378. nTrackedClusters);
  379.  
  380. // if (nClusters == 15 && m_event == 1050)
  381. // std::cout<<(*iSeed)->htime()<<"\t"<<nTelHits<<std::endl;
  382. }
  383. }
  384.  
  385. //=============================================================================
  386. // Initialization of plot objects
  387. //=============================================================================
  388. void TbClusterPlots::setupPlots() {
  389. unsigned int nBins = 60;
  390. m_nTrackedClusters_vs_telHitOccupancy =
  391. book1D("TrackingEfficiency/nTrackedClusters_vs_telHitOccupancy",
  392. "nTrackedClusters_vs_telHitOccupancy", 0, 250, nBins);
  393. m_fractionTrackedClusters_vs_telHitOccupancy =
  394. book1D("TrackingEfficiency/fractionTrackedClusters_telHitOccupancy",
  395. "ffractionTrackedClusters_telHitOccupancy", 0, 250, nBins);
  396. m_nClusters_vs_telHitOccupancy =
  397. book1D("TrackingEfficiency/nClusters_vs_telHitOccupancy",
  398. "nClusters_vs_telHitOccupancy", 0, 250, nBins);
  399. m_telHitOccupancy = book1D("TrackingEfficiency/telHitOccupancy",
  400. "telHitOccupancy", 0, 250, nBins);
  401. m_telHitOccupancy_tracked =
  402. book1D("TrackingEfficiency/telHitOccupancy_tracked",
  403. "telHitOccupancy_tracked", 0, 250, nBins);
  404.  
  405. m_nTrackedClusters_vs_telCharge =
  406. book1D("TrackingEfficiency/nTrackedClusters_vs_telCharge",
  407. "nTrackedClusters_vs_telCharge", 0, 8000, nBins);
  408. m_fractionTrackedClusters_vs_telCharge =
  409. book1D("TrackingEfficiency/fractionTrackedClusters_telCharge",
  410. "ffractionTrackedClusters_telCharge", 0, 8000, nBins);
  411. m_nClusters_vs_telCharge = book1D("TrackingEfficiency/nClusters_vs_telCharge",
  412. "nClusters_vs_telCharge", 0, 8000, nBins);
  413. m_telCharge =
  414. book1D("TrackingEfficiency/telCharge", "telCharge", 0, 8000, nBins);
  415.  
  416. m_nTrackedClusters_vs_telClusterOccupancy =
  417. book1D("TrackingEfficiency/nTrackedClusters_vs_telClusterOccupancy",
  418. "nTrackedClusters_vs_telClusterOccupancy", 0, 60, nBins);
  419. m_fractionTrackedClusters_vs_telClusterOccupancy =
  420. book1D("TrackingEfficiency/fractionTrackedClusters_telClusterOccupancy",
  421. "ffractionTrackedClusters_telClusterOccupancy", 0, 60, nBins);
  422. m_nClusters_vs_telClusterOccupancy =
  423. book1D("TrackingEfficiency/nClusters_vs_telClusterOccupancy",
  424. "nClusters_vs_telClusterOccupancy", 0, 60, nBins);
  425. m_telClusterOccupancy = book1D("TrackingEfficiency/telClusterOccupancy",
  426. "telClusterOccupancy", 0, 60, nBins);
  427. m_telClusterOccupancy_tracked =
  428. book1D("TrackingEfficiency/telClusterOccupancy_tracked",
  429. "telClusterOccupancy_tracked", 0, 60, nBins);
  430.  
  431. const double zMin = geomSvc()->modules().front()->z() - 50.;
  432. const double zMax = geomSvc()->modules().back()->z() + 50.;
  433. unsigned int bins = m_parXY.bins();
  434. double low = m_parXY.lowEdge();
  435. double high = m_parXY.highEdge();
  436. m_hGlobalXvsZ =
  437. book2D("GlobalXvsZ", "GlobalXvsZ", zMin, zMax, 5000, low, high, bins);
  438. m_hGlobalYvsZ =
  439. book2D("GlobalYvsZ", "GlobalYvsZ", zMin, zMax, 5000, low, high, bins);
  440. setAxisLabels(m_hGlobalXvsZ, "global #it{z} [mm]", "global #it{x} [mm]");
  441. setAxisLabels(m_hGlobalYvsZ, "global #it{z} [mm]", "global #it{y} [mm]");
  442. for (unsigned int i = 0; i < m_nPlanes; ++i) {
  443. const std::string plane = std::to_string(i);
  444. const std::string title = geomSvc()->modules().at(i)->id();
  445.  
  446. // ToT distributions
  447. bins = m_parToT.bins();
  448. low = m_parToT.lowEdge();
  449. high = m_parToT.highEdge();
  450. std::string name = "ToT/All/Plane" + plane;
  451. m_hToT.push_back(book1D(name, title, low, high, bins));
  452. name = "ToT/OnePixel/Plane" + plane;
  453. m_hToTOnePixel.push_back(book1D(name, title, low, high, bins));
  454. name = "ToT/TwoPixel/Plane" + plane;
  455. m_hToTTwoPixel.push_back(book1D(name, title, low, high, bins));
  456. name = "ToT/ThreePixel/Plane" + plane;
  457. m_hToTThreePixel.push_back(book1D(name, title, low, high, bins));
  458. name = "ToT/FourPixel/Plane" + plane;
  459. m_hToTFourPixel.push_back(book1D(name, title, low, high, bins));
  460. name = "ToT/Associated/Plane" + plane;
  461. m_hToTAssociated.push_back(book1D(name, title, low, high, bins));
  462. name = "ToT/NonAssociated/Plane" + plane;
  463. m_hToTNonAssociated.push_back(book1D(name, title, low, high, bins));
  464. setAxisLabels(m_hToT[i], "ToT", "entries");
  465. setAxisLabels(m_hToTOnePixel[i], "ToT", "entries");
  466. setAxisLabels(m_hToTTwoPixel[i], "ToT", "entries");
  467. setAxisLabels(m_hToTThreePixel[i], "ToT", "entries");
  468. setAxisLabels(m_hToTFourPixel[i], "ToT", "entries");
  469. setAxisLabels(m_hToTAssociated[i], "ToT", "entries");
  470. setAxisLabels(m_hToTNonAssociated[i], "ToT", "entries");
  471.  
  472. // Charge distributions
  473. bins = m_parCharge.bins();
  474. low = m_parCharge.lowEdge();
  475. high = m_parCharge.highEdge();
  476. name = "Charge/All/Plane" + plane;
  477. m_hCharge.push_back(book1D(name, title, low, high, bins));
  478. name = "Charge/OnePixel/Plane" + plane;
  479. m_hChargeOnePixel.push_back(book1D(name, title, low, high, bins));
  480. name = "Charge/TwoPixel/Plane" + plane;
  481. m_hChargeTwoPixel.push_back(book1D(name, title, low, high, bins));
  482. name = "Charge/ThreePixel/Plane" + plane;
  483. m_hChargeThreePixel.push_back(book1D(name, title, low, high, bins));
  484. name = "Charge/FourPixel/Plane" + plane;
  485. m_hChargeFourPixel.push_back(book1D(name, title, low, high, bins));
  486. name = "Charge/Associated/Plane" + plane;
  487. m_hChargeAssociated.push_back(book1D(name, title, low, high, bins));
  488. name = "Charge/NonAssociated/Plane" + plane;
  489. m_hChargeNonAssociated.push_back(book1D(name, title, low, high, bins));
  490. setAxisLabels(m_hCharge[i], "charge [electrons]", "entries");
  491. setAxisLabels(m_hChargeOnePixel[i], "charge [electrons]", "entries");
  492. setAxisLabels(m_hChargeTwoPixel[i], "charge [electrons]", "entries");
  493. setAxisLabels(m_hChargeThreePixel[i], "charge [electrons]", "entries");
  494. setAxisLabels(m_hChargeFourPixel[i], "charge [electrons]", "entries");
  495. setAxisLabels(m_hChargeAssociated[i], "charge [electrons]", "entries");
  496. setAxisLabels(m_hChargeNonAssociated[i], "charge [electrons]", "entries");
  497.  
  498. // Cluster size distributions
  499. name = "Size/Plane" + plane;
  500. m_hSize.push_back(book1D(name, title, 0.5, 10.5, 10));
  501. name = "SizeAssociated/Plane" + plane;
  502. m_hSizeAssociated.push_back(book1D(name, title, 0.5, 10.5, 10));
  503. name = "SizeNonAssociated/Plane" + plane;
  504. m_hSizeNonAssociated.push_back(book1D(name, title, 0.5, 10.5, 10));
  505. setAxisLabels(m_hSize[i], "cluster size", "entries");
  506. setAxisLabels(m_hSizeAssociated[i], "cluster size", "entries");
  507. setAxisLabels(m_hSizeNonAssociated[i], "cluster size", "entries");
  508.  
  509. // Cluster width along column and row directions
  510. name = "Width/col/Plane" + plane;
  511. m_hWidthCol.push_back(book1D(name, title, 0.5, 10.5, 10));
  512. name = "Width/row/Plane" + plane;
  513. m_hWidthRow.push_back(book1D(name, title, 0.5, 10.5, 10));
  514. setAxisLabels(m_hWidthCol[i], "columns", "entries");
  515. setAxisLabels(m_hWidthRow[i], "rows", "entries");
  516.  
  517. // Cluster position hit maps
  518. bins = m_parXY.bins();
  519. low = m_parXY.lowEdge();
  520. high = m_parXY.highEdge();
  521. name = "Positions/Plane" + plane;
  522. m_hHitMap.push_back(book2D(name, title, low, high, bins, low, high, bins));
  523. name = "PositionsAssociated/Plane" + plane;
  524. m_hHitMapAssociated.push_back(
  525. book2D(name, title, low, high, bins, low, high, bins));
  526. name = "PositionsNonAssociated/Plane" + plane;
  527. m_hHitMapNonAssociated.push_back(
  528. book2D(name, title, low, high, bins, low, high, bins));
  529. setAxisLabels(m_hHitMap[i], "global #it{x} [mm]", "global #it{y} [mm]");
  530. setAxisLabels(m_hHitMapAssociated[i], "global #it{x} [mm]",
  531. "global #it{y} [mm]");
  532. setAxisLabels(m_hHitMapNonAssociated[i], "global #it{x} [mm]",
  533. "global #it{y} [mm]");
  534.  
  535. // Global x/y correlations
  536. name = "Correlations/x/Plane" + plane;
  537. m_gx_correls.push_back(
  538. book2D(name, title, low, high, bins, low, high, bins));
  539. name = "Correlations/y/Plane" + plane;
  540. m_gy_correls.push_back(
  541. book2D(name, title, low, high, bins, low, high, bins));
  542. setAxisLabels(m_gx_correls[i], "#it{x} [mm]", "#it{x}_{ref} [mm]");
  543. setAxisLabels(m_gy_correls[i], "#it{y} [mm]", "#it{y}_{ref} [mm]");
  544.  
  545. // Time distributions
  546. bins = m_parTime.bins();
  547. low = m_parTime.lowEdge();
  548. high = m_parTime.highEdge();
  549. name = "Time/Plane" + plane;
  550. m_hTime.push_back(book1D(name, title, low, high, bins));
  551. name = "TimeAssociated/Plane" + plane;
  552. m_hTimeAssociated.push_back(book1D(name, title, low, high, bins));
  553. name = "TimeNonAssociated/Plane" + plane;
  554. m_hTimeNonAssociated.push_back(book1D(name, title, low, high, bins));
  555. setAxisLabels(m_hTime[i], "time [ns]", "entries");
  556. setAxisLabels(m_hTimeAssociated[i], "time [ns]", "entries");
  557. setAxisLabels(m_hTimeNonAssociated[i], "time [ns]", "entries");
  558. // Time spread of hits within a cluster.
  559. name = "TimeHitMinusSeed/Plane" + plane;
  560. m_hTimeSeedMinusHit.push_back(book1D(name, title, 0., 500., 200));
  561. setAxisLabels(m_hTimeSeedMinusHit[i], "#it{t}_{hit} - #it{t}_{seed} [ns]",
  562. "entries");
  563. // Time correlations
  564. name = "Correlations/t/Plane" + plane;
  565. m_gt_correls.push_back(
  566. book2D(name, title, low, high, bins, low, high, bins));
  567. setAxisLabels(m_gt_correls[i], "#it{t}", "#it{t}_{ref}");
  568.  
  569. // Global x/y differences
  570. bins = m_parDifferenceXY.bins();
  571. low = m_parDifferenceXY.lowEdge();
  572. high = m_parDifferenceXY.highEdge();
  573. name = "Differences/x/Plane" + plane;
  574. m_gx_diffs.push_back(book1D(name, title, low, high, bins));
  575. name = "Differences/y/Plane" + plane;
  576. m_gy_diffs.push_back(book1D(name, title, low, high, bins));
  577. bins = m_parDifferenceRot.bins();
  578. low = m_parDifferenceRot.lowEdge();
  579. high = m_parDifferenceRot.highEdge();
  580. setAxisLabels(m_gx_diffs[i], "#it{x} - #it{x}_{ref} [mm]", "entries");
  581. setAxisLabels(m_gy_diffs[i], "#it{y} - #it{y}_{ref} [mm]", "entries");
  582. // Time differences
  583. bins = m_parDifferenceT.bins();
  584. low = m_parDifferenceT.lowEdge();
  585. high = m_parDifferenceT.highEdge();
  586. name = "Differences/t/Plane" + plane;
  587. m_gt_diffs.push_back(book1D(name, title, low, high, bins));
  588. setAxisLabels(m_gt_diffs[i], "#it{t} - #it{t}_{ref}", "entries");
  589.  
  590. // Time between clusters
  591. name = "TimeBetweenClusters/Plane" + plane,
  592. m_hTimeBetweenClusters.push_back(book1D(name, title, 0., 1000., 50));
  593. setAxisLabels(m_hTimeBetweenClusters[i], "#Deltat [ns]", "entries");
  594. }
  595.  
  596. for (unsigned int i = 0; i < m_nPlanes; i++) {
  597. std::string name = "ClusterVisuals/Sample" + std::to_string(i);
  598. m_clusterVisuals.push_back(
  599. book2D(name, name, 0, 14.08, 256, 0, 14.08, 256));
  600. }
  601. }