PandaRoot
BSEmcFlagSplitOffs.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 #ifndef BSEMCFLAGSPLITOFFS_HH
14 #define BSEMCFLAGSPLITOFFS_HH
15 
16 #include "BSEmcCluster.h"
17 
20 #include "BSEmcSplitOffPar.h"
21 #include "PndContainerI.h"
22 #include "PndMutableContainerI.h"
23 #include "PndParameterRegister.h"
24 #include "PndProcess.h"
25 #include "TF1.h"
26 #include <vector>
27 
28 class FairParGenericSet;
29 
30 class BSEmcDigi;
31 class BSEmcCluster;
32 class BSEmcSubCluster;
33 class BSEmcRecoHit;
34 
36  public:
38  virtual ~BSEmcFlagSplitOffs();
39  virtual void SetDetectorName(const std::string &t_detectorName);
40  virtual void SetupParameters(const PndParameterRegister *t_parameterRegister);
41  virtual void RequestDataContainer(PndContainerRegister *t_register) /*override*/;
42  virtual void GetDataContainer(PndContainerRegister *t_register) /*override*/;
43  virtual void Process() /*override*/;
44 
45  void SetDigiBranchName(const TString &t_branchname) { fDigiBranchname = t_branchname; }
46  void SetClusterBranchName(const TString &t_branchname) { fClusterBranchname = t_branchname; }
47  void SetSubClusterBranchName(const TString &t_branchname) { fSubClusterBranchname = t_branchname; }
48  void SetRecoHitBranchName(const TString &t_branchname) { fRecoHitBranchname = t_branchname; }
49  struct Cluster_Info {
50  const std::vector<const BSEmcDigi *> &DigiArray;
51  const std::vector<const BSEmcCluster *> &ClusterArray;
53  const std::vector<const BSEmcSubCluster *> &SubclusterArray;
54 
55  Cluster_Info(const std::vector<const BSEmcDigi *> &digis, const std::vector<const BSEmcCluster *> &clusters, const BSEmcCluster *current_cluster,
56  const std::vector<const BSEmcSubCluster *> &subclusters)
57  : DigiArray(digis), ClusterArray(clusters), cluster(current_cluster), SubclusterArray(subclusters)
58  {
59  }
60  };
61 
67  std::map<int, std::vector<const BSEmcSubCluster *>> CreateClusterMap();
68 
77  const BSEmcSubCluster *FindSubCluster(const BSEmcDigiInfo_t &max, std::vector<const BSEmcSubCluster *> subcluster_array);
78 
86  std::vector<BSEmcDigiInfo_t> FindSecondaryMaxima(const BSEmcDigiInfo_t &centralmax, const std::vector<BSEmcDigiInfo_t> &maxima);
87 
97  double CalculateShowerMass(const std::vector<const BSEmcDigi *> &DigiArray, const BSEmcCluster *cluster);
98 
110  bool ShowerMassCut(const std::vector<const BSEmcDigi *> &DigiArray, const BSEmcCluster *cluster);
111 
122  double CalculateHighPEDShowerMass(const std::vector<const BSEmcDigi *> &DigiArray, const BSEmcSubCluster *subcluster1, const BSEmcSubCluster *subcluster2);
123 
136  bool HighPEDCut(const std::vector<const BSEmcDigi *> &DigiArray, const BSEmcSubCluster *subcluster1, const BSEmcSubCluster *subcluster2);
137 
147  double CalculateDistance(const std::vector<const BSEmcDigi *> &DigiArray, const BSEmcDigiInfo_t &firstmax, const BSEmcDigiInfo_t &secondmax);
148 
158  double FindSmallestDistance(const std::vector<const BSEmcCluster *> &ClusterArray, const std::vector<const BSEmcDigi *> &DigiArray, const BSEmcDigiInfo_t &max);
159 
169  double FindEnergyClosestCluster(const std::vector<const BSEmcCluster *> &ClusterArray, const std::vector<const BSEmcDigi *> &DigiArray, const BSEmcDigiInfo_t &max);
170 
183  bool RatioCut(const double ratio, const double distance);
184 
195  void FlagHighPED(Cluster_Info &ClusterInfo, std::vector<int> &SplitOffSubclusterIds);
196 
207  void Flag2PED(Cluster_Info &ClusterInfo, std::vector<int> &SplitOffSubclusterIds);
208 
220  void Flag1PED(Cluster_Info &ClusterInfo, std::vector<int> &SplitOffSubclusterIds);
221 
222  private:
223  std::string fPositionParName{""};
224  std::string fNeighbouringRelationParName{""};
225  std::string fSplitOffParName{""};
226  BSEmcGeoNeighbouringRelationPar *fNeighbouringRelationPar{nullptr};
227  const BSEmcCrystalPositionPar *fPositionPar;
228  BSEmcSplitOffPar *fSplitOffPar{nullptr};
229 
230  TString fDigiBranchname{""};
231  TString fClusterBranchname{""};
232  TString fSubClusterBranchname{""};
233  TString fRecoHitBranchname{""};
234 
235  PndContainerI<BSEmcDigi> *fDigiArray{nullptr};
236  PndContainerI<BSEmcCluster> *fClusterArray{nullptr};
237  PndContainerI<BSEmcSubCluster> *fSubClusterArray{nullptr};
238  PndMutableContainerI<BSEmcRecoHit> *fRecoHitArray{nullptr};
239 
240  std::unique_ptr<TF1> f1PEDFunction;
241  std::unique_ptr<TF1> f2PEDFunction;
242  std::unique_ptr<TF1> fHighPEDFunction;
243 
244  ClassDef(BSEmcFlagSplitOffs, 1);
245 };
246 
247 #endif /*BSEMCFLAGSPLITOFFS_HH*/
Base Process class.
Definition: PndProcess.h:36
double FindEnergyClosestCluster(const std::vector< const BSEmcCluster *> &ClusterArray, const std::vector< const BSEmcDigi *> &DigiArray, const BSEmcDigiInfo_t &max)
Find the next closest Cluster to the current maximum and return its energy.
Resembles/Contains all information a particle hitting the EMC can provide for later use in the PID st...
Definition: BSEmcRecoHit.h:43
double CalculateShowerMass(const std::vector< const BSEmcDigi *> &DigiArray, const BSEmcCluster *cluster)
Calculate the shower mass of a Cluster. The shower mass corresponds to the invariant mass of a cluste...
void Flag1PED(Cluster_Info &ClusterInfo, std::vector< int > &SplitOffSubclusterIds)
Collect the crystal Ids of Subclusters from 1 PED (Particle Energy Deposition) clusters that are mark...
friend F32vec4 max(const F32vec4 &a, const F32vec4 &b)
Definition: P4_F32vec4.h:37
Container for SplitOff parameters.
const std::vector< const BSEmcDigi * > & DigiArray
void Flag2PED(Cluster_Info &ClusterInfo, std::vector< int > &SplitOffSubclusterIds)
Collect the crystal Ids of Subclusters from 2 PED (Particle Energy Deposition) clusters that are mark...
a cluster (group of neighboring crystals) of hit emc crystals
Definition: BSEmcCluster.h:66
std::vector< BSEmcDigiInfo_t > FindSecondaryMaxima(const BSEmcDigiInfo_t &centralmax, const std::vector< BSEmcDigiInfo_t > &maxima)
Create an array of all the secondary maxima of a Cluster.
virtual void SetupParameters(const PndParameterRegister *t_parameterRegister)
Fetch all parameters from the PndParameterRegister.
Parameter for crystal positions.
bool HighPEDCut(const std::vector< const BSEmcDigi *> &DigiArray, const BSEmcSubCluster *subcluster1, const BSEmcSubCluster *subcluster2)
Evaluate if a high (>2) PED (Particle Energy Deposition) cluster (build out of 2 SubClusters) is dete...
std::map< int, std::vector< const BSEmcSubCluster * > > CreateClusterMap()
Create a Map that links Clusters to their corresponding Subclusters.
Cluster_Info(const std::vector< const BSEmcDigi *> &digis, const std::vector< const BSEmcCluster *> &clusters, const BSEmcCluster *current_cluster, const std::vector< const BSEmcSubCluster *> &subclusters)
const BSEmcSubCluster * FindSubCluster(const BSEmcDigiInfo_t &max, std::vector< const BSEmcSubCluster *> subcluster_array)
Search the Subcluster-array for the Subcluster that belongs to the current maximum.
const std::vector< const BSEmcSubCluster * > & SubclusterArray
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...
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
void SetClusterBranchName(const TString &t_branchname)
void SetDigiBranchName(const TString &t_branchname)
bool ShowerMassCut(const std::vector< const BSEmcDigi *> &DigiArray, const BSEmcCluster *cluster)
Evaluate if a 2 PED (Particle Energy Deposition) cluster is determined to include a Split-Off maximum...
void SetRecoHitBranchName(const TString &t_branchname)
bool RatioCut(const double ratio, const double distance)
Evaluate if a 1 PED (Particle Energy Deposition) cluster is determined to be a Split-Off maximum base...
void SetSubClusterBranchName(const TString &t_branchname)
Interface to a datacontainer to be used in PandaROOT.
double CalculateHighPEDShowerMass(const std::vector< const BSEmcDigi *> &DigiArray, const BSEmcSubCluster *subcluster1, const BSEmcSubCluster *subcluster2)
Calculate the shower mass of two Subclusters of a Cluster. The shower mass corresponds to the invaria...
virtual void RequestDataContainer(PndContainerRegister *t_register)
Pass the container register to the process, and get the processes container requirements.
Helper class to indirect the Parameter fetching via the FairRuntimeDb.
Neigbouring Relations based on a list of detectorIds.
void FlagHighPED(Cluster_Info &ClusterInfo, std::vector< int > &SplitOffSubclusterIds)
Collect the crystal Ids of Subclusters from high (>2) PED (Particle Energy Deposition) clusters that ...
represents a reconstructed (splitted) emc cluster
const std::vector< const BSEmcCluster * > & ClusterArray
virtual void GetDataContainer(PndContainerRegister *t_register)
Pass the container register to the process, and set the processes container requirements.
double CalculateDistance(const std::vector< const BSEmcDigi *> &DigiArray, const BSEmcDigiInfo_t &firstmax, const BSEmcDigiInfo_t &secondmax)
Calculate the distance between the centers of two given forward endcap crystals.
virtual ~BSEmcFlagSplitOffs()
double FindSmallestDistance(const std::vector< const BSEmcCluster *> &ClusterArray, const std::vector< const BSEmcDigi *> &DigiArray, const BSEmcDigiInfo_t &max)
Find the next closest Cluster to the current maximum and calculate the distance to its closest digi...
simple Struct used in Cluster classes to index crystal. Includes the weight of the crystal on the cur...
Definition: BSEmcCluster.h:51