Belle II Software  release-08-01-10
ARICHRelateModule.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 // Own header.
10 #include <arich/modules/arichRelate/ARICHRelateModule.h>
11 
12 // framework - DataStore
13 #include <framework/datastore/DataStore.h>
14 
15 // framework aux
16 #include <framework/gearbox/Const.h>
17 #include <framework/logging/Logger.h>
18 
19 #include <mdst/dataobjects/Track.h>
20 #include <tracking/dataobjects/ExtHit.h>
21 #include <mdst/dataobjects/MCParticle.h>
22 #include <arich/dataobjects/ARICHAeroHit.h>
23 
24 namespace Belle2 {
30  //-----------------------------------------------------------------
32  //-----------------------------------------------------------------
33 
34  REG_MODULE(ARICHRelate);
35 
36  //-----------------------------------------------------------------
37  // Implementation
38  //-----------------------------------------------------------------
39 
41  {
42  // set module description (e.g. insert text)
43  setDescription("Creates relations between ARICHAeroHits and ExtHits. Allows to store simulation output without MCParticles");
44  // Set property flags
46 
47  }
48 
50 
51  {
52  // Dependecies check
54  m_mdstTracks.isRequired();
55  m_aeroHits.isRequired();
56  m_extHits.isRequired();
57  m_extHits.registerRelationTo(m_aeroHits);
58  }
59 
61  {
62  int nHits = m_aeroHits.getEntries();
63  B2DEBUG(50, "No. of hits " << nHits);
64 
65  for (const ARICHAeroHit& aeroHit : m_aeroHits) {
66  const MCParticle* particle = DataStore::getRelated<MCParticle>(&aeroHit);
67  if (!particle) {
68  B2DEBUG(50, "No MCParticle for AeroHit!");
69  continue;
70  }
71 
72  // Find the track produced by MCParticle
73  const Track* track = DataStore::getRelated<Track>(particle);
74  if (!track) continue;
75 
76  const TrackFitResult* fitResult = track->getTrackFitResultWithClosestMass(Const::pion);
77  if (!fitResult) continue;
78 
79  RelationVector<ExtHit> extHits = DataStore::getRelationsWithObj<ExtHit>(track);
80  const Const::EDetector arich = Const::EDetector::ARICH;
81  for (const ExtHit& extHit : extHits) {
82  if (abs(extHit.getPdgCode()) != Const::pion.getPDGCode() or
83  extHit.getDetectorID() != arich or
84  extHit.getCopyID() != 6789 or // aerogel Al support plate
85  extHit.getStatus() != EXT_EXIT) continue; // particles registered at the EXIT of the Al plate
86  extHit.addRelationTo(&aeroHit);
87  break;
88  }
89  }
90  }
91 
93 } // end Belle2 namespace
94 
Datastore class that holds information on track parameters at the entrance in aerogel.
Definition: ARICHAeroHit.h:27
StoreArray< ARICHAeroHit > m_aeroHits
Required array of input ARICHAeroHits.
StoreArray< Track > m_mdstTracks
Required array of input Tracks.
StoreArray< ExtHit > m_extHits
Required array of input ExtHits.
StoreArray< MCParticle > m_mcParticles
Required array of input MCParticles.
int getPDGCode() const
PDG code.
Definition: Const.h:464
EDetector
Enum for identifying the detector components (detector and subdetector).
Definition: Const.h:42
static const ChargedStable pion
charged pion particle
Definition: Const.h:652
Store one Ext hit as a ROOT object.
Definition: ExtHit.h:32
A Class to store the Monte Carlo particle information.
Definition: MCParticle.h:32
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
Class for type safe access to objects that are referred to in relations.
bool isRequired(const std::string &name="")
Ensure this array/object has been registered previously.
Values of the result of a track fit with a given particle hypothesis.
Class that bundles various TrackFitResults.
Definition: Track.h:25
virtual void initialize() override
Initialize the Module.
virtual void event() override
Event processor.
REG_MODULE(arichBtest)
Register the Module.
Abstract base class for different kinds of events.