Belle II Software  release-08-01-10
CDCCrudeT0Collector.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 
9 #include "cdc/modules/cdcCrudeT0Collector/CDCCrudeT0Collector.h"
10 #include <cdc/dataobjects/WireID.h>
11 #include <framework/pcore/ProcHandler.h>
12 
13 using namespace std;
14 using namespace Belle2;
15 using namespace CDC;
16 REG_MODULE(CDCCrudeT0Collector);
17 
18 CDCCrudeT0CollectorModule::CDCCrudeT0CollectorModule() : CalibrationCollectorModule()
19 {
20  setDescription("Collector for crude t0");
22  addParam("ADCCut", m_adcMin, "threshold of ADC", m_adcMin);
23 
24 }
25 
27 {
28  describeProcess("CDCCrudeT0Collector::prepare");
29  std::string objectName = "tree";
30  TTree* tree = new TTree(objectName.c_str(), "");
31  tree->Branch<unsigned short>("lay", &m_lay);
32  tree->Branch<unsigned short>("wire", &m_wire);
33  tree->Branch<unsigned short>("tdc", &m_tdc);
34  registerObject<TTree>(objectName, tree);
35 }
36 
38 {
39  describeProcess("CDCCrudeT0Collector::startRun()");
40 }
41 
43 {
44  describeProcess("CDCCrudeT0Collector::closeRun()");
45 }
46 
48 {
49  describeProcess("CDCCrudeT0Collector::collect()");
50  auto tree = getObjectPtr<TTree>("tree");
51  for (const auto& hit : m_cdcHits) {
52  WireID wireid(hit.getID());
53  m_lay = wireid.getICLayer();
54  m_wire = wireid.getIWire();
55  m_tdc = hit.getTDCCount();
56  if (hit.getADCCount() > m_adcMin) {
57  tree->Fill();
58  }
59  }
60 }
61 
63 {
64  describeProcess("CDCCrudeT0Collector::finish()");
65 }
66 
68 {
69  B2DEBUG(100, "Running " + functionName + " function from a Process of type " + ProcHandler::getProcessName()
70  + "\nParallel Processing Used = " + to_string(ProcHandler::parallelProcessingUsed())
71  + "\nThis EvtProcID Id = " + to_string(ProcHandler::EvtProcID())
72  + "\nThe gDirectory is " + gDirectory->GetPath());
73 }
void startRun() override
start of run action
unsigned short m_adcMin
ADC cut to reject noise.
void closeRun() override
end of run action
void prepare() override
initialization
StoreArray< CDCHit > m_cdcHits
CDCHit array.
void describeProcess(std::string functionName)
Describe the process.
Calibration collector module base class.
void setDescription(const std::string &description)
Sets the description of the module.
Definition: Module.cc:214
void setPropertyFlags(unsigned int propertyFlags)
Sets the flags for the module properties.
Definition: Module.cc:208
@ 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:80
static int EvtProcID()
Return ID of the current process.
Definition: ProcHandler.cc:248
static bool parallelProcessingUsed()
Returns true if multiple processes have been spawned, false in single-core mode.
Definition: ProcHandler.cc:226
static std::string getProcessName()
Get a name for this process.
Definition: ProcHandler.cc:252
Class to identify a wire inside the CDC.
Definition: WireID.h:34
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:560
#define REG_MODULE(moduleName)
Register the given module (without 'Module' suffix) with the framework.
Definition: Module.h:650
Abstract base class for different kinds of events.