Belle II Software  release-05-01-25
CDCCrudeT0Collector.cc
1 /**************************************************************************
2  * BASF2 (Belle Analysis Framework 2) *
3  * Copyright(C) 2010 - Belle II Collaboration *
4  * *
5  * Author: The Belle II Collaboration *
6  * Contributors: Makoto Uchida *
7  * *
8  * This software is provided "as is" without any warranty. *
9  **************************************************************************/
10 
11 #include "cdc/modules/cdcCrudeT0Collector/CDCCrudeT0Collector.h"
12 #include <cdc/dataobjects/WireID.h>
13 #include <framework/pcore/ProcHandler.h>
14 
15 using namespace std;
16 using namespace Belle2;
17 using namespace CDC;
18 REG_MODULE(CDCCrudeT0Collector);
19 
20 CDCCrudeT0CollectorModule::CDCCrudeT0CollectorModule() : CalibrationCollectorModule()
21 {
22  setDescription("Collector for crude t0");
24  addParam("ADCCut", m_adcMin, "threshold of ADC", m_adcMin);
25 
26 }
27 
29 {
30  describeProcess("CDCCrudeT0Collector::prepare");
31  std::string objectName = "tree";
32  TTree* tree = new TTree(objectName.c_str(), "");
33  tree->Branch<unsigned short>("lay", &m_lay);
34  tree->Branch<unsigned short>("wire", &m_wire);
35  tree->Branch<unsigned short>("tdc", &m_tdc);
36  registerObject<TTree>(objectName, tree);
37 }
38 
40 {
41  describeProcess("CDCCrudeT0Collector::startRun()");
42 }
43 
45 {
46  describeProcess("CDCCrudeT0Collector::closeRun()");
47 }
48 
50 {
51  describeProcess("CDCCrudeT0Collector::collect()");
52  auto tree = getObjectPtr<TTree>("tree");
53  for (const auto& hit : m_cdcHits) {
54  WireID wireid(hit.getID());
55  m_lay = wireid.getICLayer();
56  m_wire = wireid.getIWire();
57  m_tdc = hit.getTDCCount();
58  if (hit.getADCCount() > m_adcMin) {
59  tree->Fill();
60  }
61  }
62 }
63 
65 {
66  describeProcess("CDCCrudeT0Collector::finish()");
67 }
68 
70 {
71  B2DEBUG(100, "Running " + functionName + " function from a Process of type " + ProcHandler::getProcessName()
72  + "\nParallel Processing Used = " + to_string(ProcHandler::parallelProcessingUsed())
73  + "\nThis EvtProcID Id = " + to_string(ProcHandler::EvtProcID())
74  + "\nThe gDirectory is " + gDirectory->GetPath());
75 }
Belle2::CalibrationCollectorModule
Calibration collector module base class.
Definition: CalibrationCollectorModule.h:44
Belle2::CDC::CDCCrudeT0CollectorModule::m_lay
unsigned short m_lay
Layer ID.
Definition: CDCCrudeT0Collector.h:55
Belle2::CDC::CDCCrudeT0CollectorModule::describeProcess
void describeProcess(std::string functionName)
Describe the process.
Definition: CDCCrudeT0Collector.cc:69
Belle2::WireID
Class to identify a wire inside the CDC.
Definition: WireID.h:44
Belle2::Module::setDescription
void setDescription(const std::string &description)
Sets the description of the module.
Definition: Module.cc:216
Belle2::CDC::CDCCrudeT0CollectorModule::prepare
void prepare() override
initialization
Definition: CDCCrudeT0Collector.cc:28
Belle2::CDC::CDCCrudeT0CollectorModule::closeRun
void closeRun() override
end of run action
Definition: CDCCrudeT0Collector.cc:44
REG_MODULE
#define REG_MODULE(moduleName)
Register the given module (without 'Module' suffix) with the framework.
Definition: Module.h:652
Belle2::Module::c_ParallelProcessingCertified
@ c_ParallelProcessingCertified
This module can be run in parallel processing mode safely (All I/O must be done through the data stor...
Definition: Module.h:82
Belle2::CDC::CDCCrudeT0CollectorModule::m_tdc
unsigned short m_tdc
TDC count.
Definition: CDCCrudeT0Collector.h:57
Belle2::ProcHandler::getProcessName
static std::string getProcessName()
Get a name for this process.
Definition: ProcHandler.cc:247
Belle2::Module::setPropertyFlags
void setPropertyFlags(unsigned int propertyFlags)
Sets the flags for the module properties.
Definition: Module.cc:210
Belle2::CDC::CDCCrudeT0CollectorModule::m_wire
unsigned short m_wire
Wire ID.
Definition: CDCCrudeT0Collector.h:56
Belle2
Abstract base class for different kinds of events.
Definition: MillepedeAlgorithm.h:19
Belle2::ProcHandler::EvtProcID
static int EvtProcID()
Return ID of the current process.
Definition: ProcHandler.cc:243
Belle2::CDC::CDCCrudeT0CollectorModule::m_adcMin
unsigned short m_adcMin
ADC cut to reject noise.
Definition: CDCCrudeT0Collector.h:59
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::CDC::CDCCrudeT0CollectorModule::startRun
void startRun() override
start of run action
Definition: CDCCrudeT0Collector.cc:39
Belle2::CDC::CDCCrudeT0CollectorModule::finish
void finish() override
finalization
Definition: CDCCrudeT0Collector.cc:64
Belle2::ProcHandler::parallelProcessingUsed
static bool parallelProcessingUsed()
Returns true if multiple processes have been spawned, false in single-core mode.
Definition: ProcHandler.cc:221
Belle2::CDC::CDCCrudeT0CollectorModule::m_cdcHits
StoreArray< CDCHit > m_cdcHits
CDCHit array.
Definition: CDCCrudeT0Collector.h:58
Belle2::CDC::CDCCrudeT0CollectorModule::collect
void collect() override
collection
Definition: CDCCrudeT0Collector.cc:49