11 #include <tracking/trackFindingVXD/filterMap/map/FiltersContainer.h>
12 #include <tracking/trackFindingVXD/sectorMapTools/SecMapTrainer.h>
14 #include <tracking/modules/vxdtfRedesign/VXDTFTrainingDataCollectorModule.h>
16 #include <framework/logging/Logger.h>
17 #include <framework/datastore/StoreObjPtr.h>
36 setDescription(
"This module collect the data needed to train the VXDTF sector map. The data are saved on a root file that eventually will be chained and used by the training module.");
37 setPropertyFlags(c_ParallelProcessingCertified |
38 c_TerminateInAllProcesses);
40 addParam(
"SpacePointTrackCandsName", m_PARAMSpacePointTrackCandsName,
41 "the name of the storeArray containing the SpacePointTrackCands used for extracting and collecting the training data.",
string(
""));
43 addParam(
"NameTag", m_PARAMNameTag,
"A name tag that will be attached to the name of the output file. If left empty (\"\") a "
44 "random number will be attached!", std::string(
""));
51 void VXDTFTrainingDataCollectorModule::initialize()
56 m_spacePointTrackCands.isRequired(m_PARAMSpacePointTrackCandsName);
59 auto config =
setup.second->getConfig();
61 std::string nameAppendix = m_PARAMNameTag;
63 if (nameAppendix == std::string(
"")) {
64 int randomInt = gRandom->Integer(std::numeric_limits<int>::max());
65 nameAppendix = std::to_string(randomInt);
69 newMap(
setup.first, nameAppendix);
71 m_secMapTrainers.push_back(std::move(newMap));
75 for (
auto& trainer : m_secMapTrainers) {
84 void VXDTFTrainingDataCollectorModule::event()
87 int thisExperiment = m_eventData->getExperiment();
88 int thisRun = m_eventData->getRun();
89 int thisEvent = m_eventData->getEvent();
91 for (
auto& collector : m_secMapTrainers)
92 collector.initializeEvent(thisExperiment, thisRun, thisEvent);
96 unsigned nSPTCs = m_spacePointTrackCands.getEntries();
101 for (
unsigned iTC = 0; iTC < nSPTCs; ++ iTC) {
103 for (
auto& dataCollector : m_secMapTrainers)
104 dataCollector.storeTC(*currentTC, iTC);
108 for (
auto& dataCollector : m_secMapTrainers) {
109 unsigned nTCsProcessed = dataCollector.processTracks();
112 "VXDTFTrainingDataCollectorModule, event " << thisEvent <<
113 " with mapTrainer " << dataCollector.getConfig().secMapName <<
114 ": number of TCs processed: " << nTCsProcessed <<
115 ", calculations done!");
122 void VXDTFTrainingDataCollectorModule::terminate()
124 for (
auto& dataCollector : m_secMapTrainers)
125 dataCollector.terminate();