Belle II Software  release-05-01-25
TRGGDLCosmicRunModule.cc
1 #include "trg/gdl/modules/trggdl/TRGGDLCosmicRunModule.h"
2 
3 using namespace std;
4 using namespace Belle2;
5 
6 //this line registers the module with the framework and actually makes it available
7 //in steering files or the the module list (basf2 -m).
8 REG_MODULE(TRGGDLCosmicRun);
9 
10 TRGGDLCosmicRunModule::TRGGDLCosmicRunModule() : Module::Module()
11 {
13  "Module that returns true, if the trigger condition "
14  "for the 2017 cosmic runs is fulfilled.\n"
15  "trigger conditions:\n"
16  " with back-to-back: two back-to-back track segments in superlayer 2 "
17  "plus one ECL hit\n"
18  " without back-to-back: on track segment in superlayer 2 "
19  "plus one ECL hit"
20  );
21 
22  addParam("tsHitCollectionName", m_tsHitCollectionName,
23  "Name of the input StoreArray of CDCTriggerSegmentHits.",
24  string(""));
25  addParam("BackToBack", m_backToBack,
26  "Switch to turn back-to-back requirement on or off.",
27  true);
28  addParam("skipECL", m_skipECL,
29  "Switch to turn off the ECL part of the cosmic trigger.",
30  false);
31 }
32 
33 void
35 {
37  if (!m_skipECL) m_tchit.isRequired();
38 }
39 
40 void
42 {
43  bool TSinMerger[12] = {false};
44  bool TSinSL2 = false;
45  for (int its = 0; its < m_segmentHits.getEntries(); ++its) {
46  if (m_segmentHits[its]->getISuperLayer() == 2) {
47  // SegmentID in SuperLayer 2 starts at 320
48  // One merger corresponds to 16 segments
49  unsigned mergerID = (m_segmentHits[its]->getSegmentID() - 320) / 16;
50  TSinMerger[mergerID] = true;
51  TSinSL2 = true;
52  }
53  }
54  bool BackToBack = false;
55  for (unsigned i = 0; i < 6; ++i) {
56  BackToBack |= (TSinMerger[i] && TSinMerger[i + 6]);
57  }
58 
59  bool TCHit = false;
60  if (!m_skipECL) {
61  for (int itchit = 0; itchit < m_tchit.getEntries(); itchit++) {
62  if ((m_tchit[itchit] -> getNofTCHit()) > 0) {
63  TCHit = true;
64  }
65  }
66  }
67 
68  if (m_backToBack)
69  setReturnValue(BackToBack && (TCHit || m_skipECL));
70  else
71  setReturnValue(TSinSL2 && (TCHit || m_skipECL));
72 }
Belle2::TRGGDLCosmicRunModule::event
virtual void event() override
Check the trigger condition and set return value.
Definition: TRGGDLCosmicRunModule.cc:41
Belle2::Module::setDescription
void setDescription(const std::string &description)
Sets the description of the module.
Definition: Module.cc:216
Belle2::TRGGDLCosmicRunModule::m_skipECL
bool m_skipECL
switch for turning off the ECL part
Definition: TRGGDLCosmicRunModule.h:43
Belle2::TRGGDLCosmicRunModule::initialize
virtual void initialize() override
Initialize the module.
Definition: TRGGDLCosmicRunModule.cc:34
REG_MODULE
#define REG_MODULE(moduleName)
Register the given module (without 'Module' suffix) with the framework.
Definition: Module.h:652
Belle2::TRGGDLCosmicRunModule::m_tsHitCollectionName
std::string m_tsHitCollectionName
name of track segment hit list
Definition: TRGGDLCosmicRunModule.h:39
Belle2::Module
Base class for Modules.
Definition: Module.h:74
Belle2::TRGGDLCosmicRunModule::m_tchit
StoreArray< TRGECLTrg > m_tchit
list of ECL trigger hits
Definition: TRGGDLCosmicRunModule.h:48
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::Module::setReturnValue
void setReturnValue(int value)
Sets the return value for this module as integer.
Definition: Module.cc:222
Belle2::TRGGDLCosmicRunModule::m_backToBack
bool m_backToBack
switch for back-to-back condition
Definition: TRGGDLCosmicRunModule.h:41
Belle2::Module::addParam
void addParam(const std::string &name, T &paramVariable, const std::string &description, const T &defaultValue)
Adds a new parameter to the module.
Definition: Module.h:562
Belle2::TRGGDLCosmicRunModule::m_segmentHits
StoreArray< CDCTriggerSegmentHit > m_segmentHits
list of track segment hits
Definition: TRGGDLCosmicRunModule.h:46