Belle II Software  release-05-02-19
CDCTrackingEventLevelMdstInfoFillerModule.cc
1 /**************************************************************************
2  * BASF2 (Belle Analysis Framework 2) *
3  * Copyright(C) 2018 - Belle II Collaboration *
4  * *
5  * Author: The Belle II Collaboration *
6  * Contributors: Sasha Glazov *
7  * *
8  * This software is provided "as is" without any warranty. *
9  **************************************************************************/
10 #include <tracking/modules/trackFinderCDC/CDCTrackingEventLevelMdstInfoFillerModule.h>
11 
12 using namespace Belle2;
13 using namespace TrackFindingCDC;
14 
15 // Register the CDCTrackingEventLevelMdstInfoFillerModule to the framework
16 REG_MODULE(CDCTrackingEventLevelMdstInfoFiller);
17 
18 
20 {
21  return "This module adds additional global event level information about CDC track finding results to the MDST object CDCTrackingEventLevelTrackingInfo";
22 }
23 
25 {
27  m_eventLevelTrackingInfo.isRequired();
28 }
29 
30 // Actual work
31 void CDCTrackingEventLevelMdstInfoFillerFindlet::apply(const std::vector<CDCWireHit>& inputWireHits,
32  const std::vector<CDCSegment2D>& inputWireHitSegments)
33 {
34  int nhitTotal = inputWireHits.size(); //total number of hits
35  int nTaken = 0; // bg+assigned to tracks
36  int nBg = 0; //
37  for (CDCWireHit const& hit : inputWireHits) {
38  AutomatonCell const& a_cell = hit.getAutomatonCell();
39  if (a_cell.hasTakenFlag()) nTaken += 1;
40  if (a_cell.hasBackgroundFlag()) nBg += 1;
41 
42  if (! a_cell.hasTakenFlag()) {
43  // not signal and not background,
44  m_eventLevelTrackingInfo->setCDCLayer(hit.getWireID().getICLayer());
45  }
46  }
47  int nSignal = nTaken - nBg;
48 
49  B2ASSERT("More background than taken CDC Wire hits", nSignal >= 0);
50 
51  int nRest = nhitTotal - nSignal;
52 
53  int nRestCleaned = nhitTotal - nTaken;
54 
55  m_eventLevelTrackingInfo->setNCDCHitsNotAssigned(nRest);
56  m_eventLevelTrackingInfo->setNCDCHitsNotAssignedPostCleaning(nRestCleaned);
57 
58  B2DEBUG(10, "Total " << nhitTotal << " taken " << nTaken << " background " << nBg << " signal " << nTaken - nBg <<
59  " Not assigned " << nRestCleaned);
60 
61  // Count 2D segments too:
62  nTaken = 0;
63  nBg = 0;
64  for (CDCSegment2D const& seg : inputWireHitSegments) {
65  AutomatonCell const& a_cell = seg.getAutomatonCell();
66  if (a_cell.hasTakenFlag()) nTaken += 1;
67  if (a_cell.hasBackgroundFlag()) nBg += 1;
68  }
69 
70  m_eventLevelTrackingInfo->setNCDCSegments(inputWireHitSegments.size() - nTaken);
71  B2DEBUG(10, "Total number of segments =" << inputWireHitSegments.size() << " Taken " << nTaken << " BG " << nBg);
72 }
Belle2::TrackFindingCDC::CDCTrackingEventLevelMdstInfoFillerFindlet::apply
void apply(const std::vector< CDCWireHit > &inputWireHits, const std::vector< CDCSegment2D > &inputWireHitSegments) final
Main method to make the heavy lifting.
Definition: CDCTrackingEventLevelMdstInfoFillerModule.cc:31
Belle2::TrackFindingCDC::CDCTrackingEventLevelMdstInfoFillerFindlet::m_eventLevelTrackingInfo
StoreObjPtr< EventLevelTrackingInfo > m_eventLevelTrackingInfo
Acccess to the CDCTrackingEventLevelTrackingInfo object in the datastore.
Definition: CDCTrackingEventLevelMdstInfoFillerModule.h:60
REG_MODULE
#define REG_MODULE(moduleName)
Register the given module (without 'Module' suffix) with the framework.
Definition: Module.h:652
Belle2::TrackFindingCDC::CDCTrackingEventLevelMdstInfoFillerFindlet::initialize
void initialize() final
Signal the begining of the event processing.
Definition: CDCTrackingEventLevelMdstInfoFillerModule.cc:24
Belle2::TrackFindingCDC::CompositeProcessingSignalListener::initialize
void initialize() override
Receive and dispatch signal before the start of the event processing.
Definition: CompositeProcessingSignalListener.cc:17
Belle2::TrackFindingCDC::AutomatonCell::hasBackgroundFlag
bool hasBackgroundFlag() const
Gets the current state of the do not use flag marker flag.
Definition: AutomatonCell.h:267
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::TrackFindingCDC::AutomatonCell
Cell used by the cellular automata.
Definition: AutomatonCell.h:39
Belle2::TrackFindingCDC::AutomatonCell::hasTakenFlag
bool hasTakenFlag() const
Gets the current state of the taken marker flag.
Definition: AutomatonCell.h:249
Belle2::TrackFindingCDC::CDCSegment2D
A reconstructed sequence of two dimensional hits in one super layer.
Definition: CDCSegment2D.h:40
Belle2::TrackFindingCDC::CDCTrackingEventLevelMdstInfoFillerFindlet::getDescription
std::string getDescription() final
Getter for the module description.
Definition: CDCTrackingEventLevelMdstInfoFillerModule.cc:19
Belle2::TrackFindingCDC::CDCWireHit
Class representing a hit wire in the central drift chamber.
Definition: CDCWireHit.h:65