PandaRoot
BSEmcMergePreclusters.h
Go to the documentation of this file.
1 //****************************************************************************
2 //* This file is part of PandaRoot. *
3 //* *
4 //* PandaRoot is distributed under the terms of the *
5 //* GNU General Public License (GPL) version 3, *
6 //* copied verbatim in the file "LICENSE". *
7 //* *
8 //* Copyright (C) 2006 - 2024 FAIR GmbH and copyright holders of PandaRoot *
9 //* The copyright holders are listed in the file "COPYRIGHTHOLDERS". *
10 //* The authors are listed in the file "AUTHORS". *
11 //****************************************************************************
12 
13 //-----------------------------------------------------------------------
14 // File and Version Information:
15 // $Id: $
16 //
17 //---------------------------------------------------------------------
18 //#pragma once
19 #ifndef BSEMCMERGEPRECLUSTERS_HH
20 #define BSEMCMERGEPRECLUSTERS_HH
21 
22 #include <memory>
23 #include <string>
24 #include <vector>
25 
26 #include "Rtypes.h"
27 #include "RtypesCore.h"
28 
29 #include "PndContainerI.h"
30 #include "PndProcess.h"
31 
32 #include "BSEmcCluster.h"
33 
34 #include "BSEmcDigi.h"
36 #include "BSEmcPositionAlgo.h"
37 #include "BSEmcPrecluster.h"
38 
39 class BSEmcCluster;
41 class BSEmcDigi;
43 class BSEmcPrecluster;
45 class TBuffer;
46 class TClass;
47 class TMemberInspector;
48 struct BSEmcClusteringData;
49 template <class T>
50 class PndContainerI;
51 template <class T>
53 
64  public:
66 
67  virtual ~BSEmcMergePreclusters();
68 
69  virtual void SetDetectorName(const std::string &t_detectorName) /*override*/;
70  virtual void RequestDataContainer(PndContainerRegister *t_register) /*override*/;
71  virtual void GetDataContainer(PndContainerRegister *t_register) /*override*/;
72  virtual void SetupParameters(const PndParameterRegister *t_paramRegister) /*override*/;
73  virtual void Process() /*override*/;
74  std::vector<BSEmcCluster *> MergePreclusters(const std::vector<const BSEmcDigi *> &t_digiCont, const std::vector<BSEmcPrecluster *> &t_preclusterCont);
75 
76  void SetPositionMethod(Int_t method)
77  {
78  fPosMethod = method;
79  }
86  void SetNeighbourMethod(Int_t nbmethod)
87  {
88  fNbMethod = nbmethod;
89  }
96  void SetClusteringParName(const std::string &t_parName) { fClusteringParName = t_parName; }
97  void SetClusterPropertiesParName(const std::string &t_parName) { fClusterPropertiesParName = t_parName; }
98  void SetPositionParName(const std::string &t_parName) { fPositionParName = t_parName; }
99  void SetNeighbouringRelationParName(const std::string &t_parName) { fNeighbouringRelationParName = t_parName; }
100 
101  void SetDigiBranchName(const TString &t_branchname) { fDigiBranchname = t_branchname; }
102  void SetPreclusterBranchName(const TString &t_branchname) { fPreclusterBranchname = t_branchname; }
103  void SetClusterBranchName(const TString &t_branchname) { fClusterBranchname = t_branchname; }
104 
105  protected:
106  std::vector<Int_t> FindNeighbouringPrecluster(const std::vector<BSEmcPrecluster *> &t_preclusterCont);
107  std::vector<Int_t> ClusterNeigbours(const std::vector<Int_t> &t_neighbours, const std::vector<BSEmcPrecluster *> &t_preclusterCont);
108 
109  std::vector<BSEmcCluster *> MergePreclustersIntoCluster(const std::vector<Int_t> &t_clusterNrForPrecluster, const std::vector<BSEmcPrecluster *> &t_preclusterCont);
110 
111  virtual void FinishClusters(const std::vector<const BSEmcDigi *> &t_digiCont, const std::vector<BSEmcCluster *> &t_clusterCont);
112  void FinishCluster(const std::vector<const BSEmcDigi *> &t_digiCont, BSEmcCluster *tmpcluster);
113 
114  private:
115  TString fDigiBranchname{""};
116  TString fPreclusterBranchname{""};
117  TString fClusterBranchname{""};
118 
119  PndContainerI<BSEmcDigi> *fDigiArray{nullptr};
120  PndMutableContainerI<BSEmcPrecluster> *fPreclusterArray{nullptr};
121  PndMutableContainerI<BSEmcCluster> *fClusterArray{nullptr};
122  std::string fClusteringParName{""};
123  std::string fClusterPropertiesParName{""};
124  std::string fPositionParName{""};
125  std::string fNeighbouringRelationParName{""};
126  BSEmcGeoNeighbouringRelationPar *fNeighbouringRelationPar{nullptr};
127 
128  BSEmcCrystalPositionPar *fPositionPar{nullptr};
129  std::unique_ptr<BSEmcPositionAlgo> fPositionProcess{new BSEmcPositionAlgo};
130  Int_t fPosMethod;
131  Int_t fNbMethod;
132  Int_t evtCounter;
133  Int_t precCounter;
134  Int_t fNrOfPres;
135  Int_t nMrgProg;
136  Int_t nTotClusters;
137  Int_t fRemovedClusters;
138  Int_t nTotDigis;
139  Int_t wrongConnection;
140  Double_t CNtotRtime;
141  Double_t CNtotCtime;
142 
143  Int_t fClusterNr{0};
144  ClassDef(BSEmcMergePreclusters, 2)
145 };
146 #endif /*BSEMCMERGEPRECLUSTERS_HH*/
Base Process class.
Definition: PndProcess.h:36
Process to merge preclusters into Clusters.
virtual void SetDetectorName(const std::string &t_detectorName)
Set the Detector name. Important, as most EmcParameter need to know for which detector they need to b...
std::vector< BSEmcCluster * > MergePreclusters(const std::vector< const BSEmcDigi *> &t_digiCont, const std::vector< BSEmcPrecluster *> &t_preclusterCont)
std::vector< Int_t > FindNeighbouringPrecluster(const std::vector< BSEmcPrecluster *> &t_preclusterCont)
void SetDigiBranchName(const TString &t_branchname)
void SetNeighbouringRelationParName(const std::string &t_parName)
represents an emc precluster, formed in the (virtual) data concentrators
void SetNeighbourMethod(Int_t nbmethod)
void FinishCluster(const std::vector< const BSEmcDigi *> &t_digiCont, BSEmcCluster *tmpcluster)
Helper class to calculate the cluster position.
void SetPreclusterBranchName(const TString &t_branchname)
void SetClusteringParName(const std::string &t_parName)
virtual void GetDataContainer(PndContainerRegister *t_register)
Pass the container register to the process, and set the processes container requirements.
void SetClusterPropertiesParName(const std::string &t_parName)
void SetPositionParName(const std::string &t_parName)
a cluster (group of neighboring crystals) of hit emc crystals
Definition: BSEmcCluster.h:66
virtual void RequestDataContainer(PndContainerRegister *t_register)
Pass the container register to the process, and get the processes container requirements.
Parameter for crystal positions.
void SetPositionMethod(Int_t method)
virtual void Process()
The actual data transformation (digitizing, clustering, etc.) should be defined here.
represents the reconstructed hit of one emc crystal
Definition: BSEmcDigi.h:59
virtual ~BSEmcMergePreclusters()
std::vector< BSEmcCluster * > MergePreclustersIntoCluster(const std::vector< Int_t > &t_clusterNrForPrecluster, const std::vector< BSEmcPrecluster *> &t_preclusterCont)
Interface to a datacontainer to be used in PandaROOT.
virtual void FinishClusters(const std::vector< const BSEmcDigi *> &t_digiCont, const std::vector< BSEmcCluster *> &t_clusterCont)
Helper class to indirect the Parameter fetching via the FairRuntimeDb.
Neigbouring Relations based on a list of detectorIds.
void SetClusterBranchName(const TString &t_branchname)
std::vector< Int_t > ClusterNeigbours(const std::vector< Int_t > &t_neighbours, const std::vector< BSEmcPrecluster *> &t_preclusterCont)
virtual void SetupParameters(const PndParameterRegister *t_paramRegister)
Fetch all parameters from the PndParameterRegister.