Belle II Software  release-05-02-19
CDCRecoTrackFilterModule.cc
1 /**************************************************************************
2  * BASF2 (Belle Analysis Framework 2) *
3  * Copyright(C) 2010 - Belle II Collaboration *
4  * *
5  * Author: The Belle II Collaboration *
6  * Contributors: Dong Van Thanh, ... *
7  * *
8  * This software is provided "as is" without any warranty. *
9  **************************************************************************/
10 
11 #include "cdc/modules/cdcRecoTrackFilter/CDCRecoTrackFilterModule.h"
12 #include <framework/datastore/StoreArray.h>
13 #include <tracking/dataobjects/RecoHitInformation.h>
14 #include <tracking/dataobjects/RecoTrack.h>
15 #include <boost/foreach.hpp>
16 
17 using namespace std;
18 using namespace Belle2;
19 using namespace CDC;
20 
21 REG_MODULE(CDCRecoTrackFilter)
22 
24 {
25  setPropertyFlags(c_ParallelProcessingCertified); // specify this flag if you need parallel processing
26  setDescription("use this module to exclude Layers in fitting, after TrackFinding");
27  addParam("RecoTracksColName", m_recoTrackArrayName, "Name of collection to hold Belle2::RecoTrack", std::string(""));
28  addParam("ExcludeSLayer", m_excludeSLayer, "Super layers (0-8) not used in the fitting", std::vector<unsigned short> {});
29  addParam("ExcludeICLayer", m_excludeICLayer, "layers (0-55) not used in the fitting", std::vector<unsigned short> {});
30 }
31 
32 CDCRecoTrackFilterModule::~CDCRecoTrackFilterModule()
33 {
34 }
35 
36 void CDCRecoTrackFilterModule::initialize()
37 {
38  StoreArray<RecoTrack> recoTracks(m_recoTrackArrayName);
39  m_recoTrackArrayName = recoTracks.getName();
40 
41 }
42 
43 void CDCRecoTrackFilterModule::beginRun()
44 {
45 }
46 
47 void CDCRecoTrackFilterModule::event()
48 {
49  const StoreArray<Belle2::RecoTrack> recoTracks(m_recoTrackArrayName);
50 
51  // Loop over Recotracks
52  int nTr = recoTracks.getEntries();
53  for (int i = 0; i < nTr; ++i) {
54  const RecoTrack* track = recoTracks[i];
55  BOOST_FOREACH(const RecoHitInformation::UsedCDCHit * cdchit, track->getCDCHitList()) {
56  WireID wireid(cdchit->getID());
57  unsigned short slay = wireid.getISuperLayer();
58  unsigned short iclay = wireid.getICLayer();
59  for (unsigned short j = 0; j < m_excludeSLayer.size(); ++j) {
60  if (slay == m_excludeSLayer.at(j)) {
61  track->getRecoHitInformation(cdchit)->setUseInFit(false);
62  }
63  }
64 
65  for (unsigned short j = 0; j < m_excludeICLayer.size(); ++j) {
66  if (iclay == m_excludeICLayer.at(j)) {
67  track->getRecoHitInformation(cdchit)->setUseInFit(false);
68  }
69  }
70 
71  }//end of track (Boost_foreach)
72  }//end RecoTrack array
73 }//End Event
74 void CDCRecoTrackFilterModule::endRun()
75 {
76 }
77 
78 void CDCRecoTrackFilterModule::terminate()
79 {
80 }
81 
Belle2::WireID
Class to identify a wire inside the CDC.
Definition: WireID.h:44
Belle2::CDCHit::getID
unsigned short getID() const
Getter for encoded wire number.
Definition: CDCHit.h:204
REG_MODULE
#define REG_MODULE(moduleName)
Register the given module (without 'Module' suffix) with the framework.
Definition: Module.h:652
Belle2::CDCHit
Class containing the result of the unpacker in raw data and the result of the digitizer in simulation...
Definition: CDCHit.h:51
Belle2::Module
Base class for Modules.
Definition: Module.h:74
Belle2::CDC::CDCRecoTrackFilterModule
The module excluding hits of specified Slayers in the RecoTracks.
Definition: CDCRecoTrackFilterModule.h:38
Belle2::RecoTrack
This is the Reconstruction Event-Data Model Track.
Definition: RecoTrack.h:78
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::StoreArray
Accessor to arrays stored in the data store.
Definition: ECLMatchingPerformanceExpertModule.h:33
Belle2::StoreArray::getEntries
int getEntries() const
Get the number of objects in the array.
Definition: StoreArray.h:226