Belle II Software  release-06-00-14
V0ObjectsDQMModule.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 // File : V0ObjectsDQMModule.cc
10 // Description : Module to monitor displaced vertices on HLT
11 //-
12 
13 #include <dqm/modules/V0ObjectsDQM/V0ObjectsDQMModule.h>
14 #include <framework/datastore/StoreObjPtr.h>
15 #include <analysis/dataobjects/ParticleList.h>
16 #include <TDirectory.h>
17 
18 using namespace Belle2;
19 
20 //-----------------------------------------------------------------
21 // Register the Module
22 //-----------------------------------------------------------------
23 REG_MODULE(V0ObjectsDQM)
24 
25 //-----------------------------------------------------------------
26 // Implementation
27 //-----------------------------------------------------------------
28 
29 V0ObjectsDQMModule::V0ObjectsDQMModule() : HistoModule()
30 {
31  //Set module properties
32 
33  setDescription("Monitor displaced vertices");
34  setPropertyFlags(c_ParallelProcessingCertified);
35 
36  addParam("V0PListName", m_V0PListName, "Name of the vertexed particle list", std::string("K_S0:V0DQM"));
37 }
38 
39 void V0ObjectsDQMModule::defineHisto()
40 {
41  TDirectory* oldDir = gDirectory;
42  oldDir->mkdir("V0Objects");
43  oldDir->cd("V0Objects");
44 
45  for (int j = 0; j < 32; j++) {
46  m_h_xvsy[j] = new TH2F(Form("xvsy[%i]", j), Form("xvsy[%i]", j), 200, -10, 10, 200, -10, 10);
47  m_h_xvsy[j]->SetXTitle("x [cm]");
48  m_h_xvsy[j]->SetYTitle("y [cm]");
49  m_h_xvsy[j]->SetStats(kFALSE);
50  }
51  m_h_xvsz = new TH2F("xvsz", "xvsz", 1500, -75, 75, 400, -10, 10);
52  m_h_xvsz->SetXTitle("z [cm]");
53  m_h_xvsz->SetYTitle("x [cm]");
54  m_h_xvsz->SetStats(kFALSE);
55 
56  oldDir->cd();
57 }
58 
59 
61 {
62  REG_HISTOGRAM
63 
64 }
65 
66 
68 {
69  for (int j = 0; j < 32; j++) {
70  m_h_xvsy[j]->Reset();
71  }
72  m_h_xvsz->Reset();
73 }
74 
75 
77 {
78 
80 
81  if (V0Particles.isValid()) {
82  for (unsigned int i = 0; i < V0Particles->getListSize(); i++) {
83  Particle* V0 = V0Particles->getParticle(i);
84  //Get the vertex position, fill accordingly
85  float vtxx = V0->getX();
86  float vtxy = V0->getY();
87  float vtxz = V0->getZ();
88  if (fabs(vtxz) < 75 && fabs(vtxx) < 10 && fabs(vtxy) < 10) {
89  m_h_xvsy[int(floor((vtxz + 75) / 5))]->Fill(vtxx, vtxy);
90  if (vtxz <= -5. || vtxz >= 8.) m_h_xvsz->Fill(vtxz, vtxx);
91  }
92  }
93  }
94 
95 }
HistoModule.h is supposed to be used instead of Module.h for the modules with histogram definitions t...
Definition: HistoModule.h:29
Class to store reconstructed particles.
Definition: Particle.h:74
Type-safe access to single objects in the data store.
Definition: StoreObjPtr.h:95
bool isValid() const
Check whether the object was created.
Definition: StoreObjPtr.h:110
void initialize() override final
Function for dynamic initialization of module.
void event() override final
Function to process event record.
void beginRun() override final
Function to process begin_run record.
std::string m_V0PListName
Name of the V0 particle list.
Object holding information for V0s.
Definition: V0.h:30
#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.