Belle II Software development
CDCTrackingEventLevelMdstInfoFiller.cc
1/**************************************************************************
2 * basf2 (Belle II Analysis Software Framework) *
3 * Author: The Belle II Collaboration *
4 * *
5 * See git log for contributors and copyright holders. *
6 * This file is licensed under LGPL-3.0, see LICENSE.md. *
7 **************************************************************************/
8
9#include <tracking/modules/trackFinderCDC/CDCTrackingEventLevelMdstInfoFiller.h>
10
11using namespace Belle2;
12using namespace TrackFindingCDC;
13
14
15// Register the modules to the framework
16REG_MODULE(CDCTrackingEventLevelMdstInfoFillerFromHits);
17REG_MODULE(CDCTrackingEventLevelMdstInfoFillerFromSegments);
18
19
21{
22 return "This module adds additional global event level information based on hits about CDC track finding results to the MDST object EventLevelTrackingInfo";
23}
24
26{
28 m_eventLevelTrackingInfo.isRequired();
29}
30
31void CDCTrackingEventLevelMdstInfoFillerFromHitsFindlet::apply(const std::vector<CDCWireHit>& inputWireHits)
32{
33 int nhitTotal = inputWireHits.size(); //total number of hits
34 int nTaken = 0; // bg+assigned to tracks
35 int nBg = 0; //
36 for (CDCWireHit const& hit : inputWireHits) {
37 AutomatonCell const& a_cell = hit.getAutomatonCell();
38 if (a_cell.hasTakenFlag()) nTaken += 1;
39 if (a_cell.hasBackgroundFlag()) nBg += 1;
40
41 if (! a_cell.hasTakenFlag()) {
42 // not signal and not background,
43 m_eventLevelTrackingInfo->setCDCLayer(hit.getWireID().getICLayer());
44 }
45 }
46 int nSignal = nTaken - nBg;
47
48 B2ASSERT("More background than taken CDC Wire hits", nSignal >= 0);
49
50 int nRest = nhitTotal - nSignal;
51
52 int nRestCleaned = nhitTotal - nTaken;
53
54 m_eventLevelTrackingInfo->setNCDCHitsNotAssigned(nRest);
55 m_eventLevelTrackingInfo->setNCDCHitsNotAssignedPostCleaning(nRestCleaned);
56
57 B2DEBUG(20, "Total " << nhitTotal << " taken " << nTaken << " background " << nBg << " signal " << nTaken - nBg <<
58 " Not assigned " << nRestCleaned);
59}
60
61
63{
64 return "This module adds additional global event level information based on 2D segments about CDC track finding results to the MDST object EventLevelTrackingInfo";
65}
66
68{
70 m_eventLevelTrackingInfo.isRequired();
71}
72
73void CDCTrackingEventLevelMdstInfoFillerFromSegmentsFindlet::apply(const std::vector<CDCSegment2D>& inputWireHitSegments)
74{
75 // Count 2D segments
76 int nTaken = 0;
77 int nBg = 0;
78 for (CDCSegment2D const& seg : inputWireHitSegments) {
79 AutomatonCell const& a_cell = seg.getAutomatonCell();
80 if (a_cell.hasTakenFlag()) nTaken += 1;
81 if (a_cell.hasBackgroundFlag()) nBg += 1;
82 }
83
84 m_eventLevelTrackingInfo->setNCDCSegments(inputWireHitSegments.size() - nTaken);
85 B2DEBUG(20, "Total number of segments =" << inputWireHitSegments.size() << " Taken " << nTaken << " BG " << nBg);
86}
Cell used by the cellular automata.
Definition: AutomatonCell.h:29
bool hasBackgroundFlag() const
Gets the current state of the do not use flag marker flag.
bool hasTakenFlag() const
Gets the current state of the taken marker flag.
A reconstructed sequence of two dimensional hits in one super layer.
Definition: CDCSegment2D.h:39
StoreObjPtr< EventLevelTrackingInfo > m_eventLevelTrackingInfo
Access to the EventLevelTrackingInfo object in the datastore.
void apply(const std::vector< CDCWireHit > &inputWireHits) final
Main method to make the heavy lifting.
StoreObjPtr< EventLevelTrackingInfo > m_eventLevelTrackingInfo
Access to the EventLevelTrackingInfo object in the datastore.
void apply(const std::vector< CDCSegment2D > &inputSegment2Ds) final
Main method to make the heavy lifting.
Class representing a hit wire in the central drift chamber.
Definition: CDCWireHit.h:55
void initialize() override
Receive and dispatch signal before the start of the event processing.
#define REG_MODULE(moduleName)
Register the given module (without 'Module' suffix) with the framework.
Definition: Module.h:650
Abstract base class for different kinds of events.