Belle II Software  release-08-01-10
CDCTrackingEventLevelMdstInfoFillerModule.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 #include <tracking/modules/trackFinderCDC/CDCTrackingEventLevelMdstInfoFillerModule.h>
9 
10 using namespace Belle2;
11 using namespace TrackFindingCDC;
12 
13 // Register the CDCTrackingEventLevelMdstInfoFillerModule to the framework
14 REG_MODULE(CDCTrackingEventLevelMdstInfoFiller);
15 
16 
18 {
19  return "This module adds additional global event level information about CDC track finding results to the MDST object CDCTrackingEventLevelTrackingInfo";
20 }
21 
23 {
25  m_eventLevelTrackingInfo.isRequired();
26 }
27 
28 // Actual work
29 void CDCTrackingEventLevelMdstInfoFillerFindlet::apply(const std::vector<CDCWireHit>& inputWireHits,
30  const std::vector<CDCSegment2D>& inputWireHitSegments)
31 {
32  int nhitTotal = inputWireHits.size(); //total number of hits
33  int nTaken = 0; // bg+assigned to tracks
34  int nBg = 0; //
35  for (CDCWireHit const& hit : inputWireHits) {
36  AutomatonCell const& a_cell = hit.getAutomatonCell();
37  if (a_cell.hasTakenFlag()) nTaken += 1;
38  if (a_cell.hasBackgroundFlag()) nBg += 1;
39 
40  if (! a_cell.hasTakenFlag()) {
41  // not signal and not background,
42  m_eventLevelTrackingInfo->setCDCLayer(hit.getWireID().getICLayer());
43  }
44  }
45  int nSignal = nTaken - nBg;
46 
47  B2ASSERT("More background than taken CDC Wire hits", nSignal >= 0);
48 
49  int nRest = nhitTotal - nSignal;
50 
51  int nRestCleaned = nhitTotal - nTaken;
52 
53  m_eventLevelTrackingInfo->setNCDCHitsNotAssigned(nRest);
54  m_eventLevelTrackingInfo->setNCDCHitsNotAssignedPostCleaning(nRestCleaned);
55 
56  B2DEBUG(10, "Total " << nhitTotal << " taken " << nTaken << " background " << nBg << " signal " << nTaken - nBg <<
57  " Not assigned " << nRestCleaned);
58 
59  // Count 2D segments too:
60  nTaken = 0;
61  nBg = 0;
62  for (CDCSegment2D const& seg : inputWireHitSegments) {
63  AutomatonCell const& a_cell = seg.getAutomatonCell();
64  if (a_cell.hasTakenFlag()) nTaken += 1;
65  if (a_cell.hasBackgroundFlag()) nBg += 1;
66  }
67 
68  m_eventLevelTrackingInfo->setNCDCSegments(inputWireHitSegments.size() - nTaken);
69  B2DEBUG(10, "Total number of segments =" << inputWireHitSegments.size() << " Taken " << nTaken << " BG " << nBg);
70 }
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
void apply(const std::vector< CDCWireHit > &inputWireHits, const std::vector< CDCSegment2D > &inputWireHitSegments) final
Main method to make the heavy lifting.
StoreObjPtr< EventLevelTrackingInfo > m_eventLevelTrackingInfo
Acccess to the CDCTrackingEventLevelTrackingInfo object in the datastore.
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.
REG_MODULE(arichBtest)
Register the Module.
Abstract base class for different kinds of events.