Belle II Software  release-05-02-19
DATCONSVDSpacePointCreatorModule.cc
1 /**************************************************************************
2  * BASF2 (Belle Analysis Framework 2) *
3  * Copyright(C) 2013 Belle II Collaboration *
4  * *
5  * Author: The Belle II Collaboration *
6  * Contributors: Christian Wessel *
7  * *
8  **************************************************************************/
9 
10 #include <tracking/modules/DATCON/DATCONSVDSpacePointCreatorModule.h>
11 
12 #include <tracking/modules/DATCON/DATCONSpacePointHelperFunctions.h>
13 
14 using namespace std;
15 using namespace Belle2;
16 
17 
18 REG_MODULE(DATCONSVDSpacePointCreator)
19 
21  Module()
22 {
23  setDescription("Imports Clusters of the SVD detector and converts them to spacePoints.");
24  setPropertyFlags(c_ParallelProcessingCertified);
25 
26  // 1. Collections.
27  addParam("DATCONSVDCluster", m_storeDATCONSVDClustersName,
28  "DATCONSVDCluster collection name", string("DATCONSVDCluster"));
29  addParam("DATCONSVDSpacePoints", m_storeDATCONSVDSpacePointsName,
30  "DATCONSVDSpacePoints collection name", string("DATCONSVDSpacePoints"));
31  addParam("SVDTrueHits", m_storeTrueHitsName,
32  "SVDTrueHits collection name", string(""));
33  addParam("MCParticles", m_storeMCParticlesName,
34  "MCParticles collection name", string(""));
35 
36  // 2.Modification parameters:
37  addParam("OnlySingleClusterSpacePoints", m_onlySingleClusterSpacePoints,
38  "standard is false. If activated, the module will not try to find combinations of U and V clusters for the SVD any more",
39  bool(false));
40 }
41 
42 
43 void DATCONSVDSpacePointCreatorModule::initialize()
44 {
45  // prepare all store- and relationArrays:
46  storeDATCONSVDSpacePoints.registerInDataStore(m_storeDATCONSVDSpacePointsName,
47  DataStore::c_DontWriteOut | DataStore::c_ErrorIfAlreadyRegistered);
48  storeDATCONSVDClusters.isRequired(m_storeDATCONSVDClustersName);
49 
50  m_storeDATCONSVDSpacePointsName = storeDATCONSVDSpacePoints.getName();
51  m_storeDATCONSVDClustersName = storeDATCONSVDClusters.getName();
52 
53  storeTrueHits.isOptional(m_storeTrueHitsName);
54  if (storeTrueHits.isValid()) {
55  m_storeTrueHitsName = storeTrueHits.getName();
56  storeDATCONSVDSpacePoints.registerRelationTo(storeTrueHits, DataStore::c_Event, DataStore::c_DontWriteOut);
57  }
58 
59  storeMCParticles.isOptional(m_storeMCParticlesName);
60  if (storeMCParticles.isValid()) {
61  m_storeMCParticlesName = storeMCParticles.getName();
62  storeDATCONSVDSpacePoints.registerRelationTo(storeMCParticles, DataStore::c_Event, DataStore::c_DontWriteOut);
63  }
64 
65  //Relations to cluster objects only if the ancestor relations exist:
66  storeDATCONSVDSpacePoints.registerRelationTo(storeDATCONSVDClusters, DataStore::c_Event, DataStore::c_DontWriteOut);
67 
68 }
69 
70 void DATCONSVDSpacePointCreatorModule::event()
71 {
72  if (m_onlySingleClusterSpacePoints == true) {
73  provideDATCONSVDClusterSingles(storeDATCONSVDClusters,
74  storeDATCONSVDSpacePoints);
75  } else {
76  provideDATCONSVDClusterCombinations(storeDATCONSVDClusters, storeDATCONSVDSpacePoints);
77  }
78 }
REG_MODULE
#define REG_MODULE(moduleName)
Register the given module (without 'Module' suffix) with the framework.
Definition: Module.h:652
Belle2::DATCONSVDSpacePointCreatorModule
This module creates DATCONSVDSpacePoints from the DATCONSVDCluster.
Definition: DATCONSVDSpacePointCreatorModule.h:43
Belle2::Module
Base class for Modules.
Definition: Module.h:74
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::provideDATCONSVDClusterCombinations
void provideDATCONSVDClusterCombinations(const StoreArray< SVDCluster > &DATCONSVDClusters, StoreArray< DATCONSVDSpacePoint > &spacePoints)
finds all possible combinations of U and V Clusters for DATCONSVDClusters.
Definition: DATCONSpacePointHelperFunctions.h:124
Belle2::provideDATCONSVDClusterSingles
void provideDATCONSVDClusterSingles(const StoreArray< SVDCluster > &DATCONSVDClusters, StoreArray< DATCONSVDSpacePoint > &spacePoints)
simply store one spacePoint for each existing DATCONSVDCluster.
Definition: DATCONSpacePointHelperFunctions.h:79