BOSS 7.1.2
BESIII Offline Software System
Loading...
Searching...
No Matches
EmcRecHit2Cluster.cxx
Go to the documentation of this file.
1//
2// Convert from Hit Map to Cluster Map
3//
4// Wang.Zhe 2004, 3, 29
5//
6#include <iostream>
7
10
11// Constructors and destructors
14
17
19 RecEmcClusterMap& aClusterMap)
20{
21 RecEmcHitMap tHitMap,aBufferHitMap;
22 RecEmcHitMap::iterator pHitMap,pBufferHitMap;
23 tHitMap=aHitMap;
24
25 RecEmcID CellId;
26 RecEmcIDVector NearCell;
27 i_RecEmcIDVector pNearCell;
28
29 RecEmcCluster aCluster;
30
33
34 while(!tHitMap.empty())
35 {
36 double eCluster=0; //total energy of a cluster
37 double emax=0; //seed's energy of a cluster
38 RecEmcID idmax; //seed's id of a cluster
39
40 // Search a cluster.
41 pHitMap=tHitMap.begin();
42 aBufferHitMap[pHitMap->first]=pHitMap->second;
43 tHitMap.erase(pHitMap);
44 aCluster.Clear();
45 while(!aBufferHitMap.empty())
46 {
47 pBufferHitMap=aBufferHitMap.begin();
48 CellId=pBufferHitMap->first;
49 NearCell=nhb.GetNeighbors(CellId);
50 for(pNearCell=NearCell.begin();
51 pNearCell!=NearCell.end();
52 pNearCell++)
53 {
54 pHitMap=tHitMap.find(*pNearCell);
55 if(pHitMap!=tHitMap.end())
56 {
57 aBufferHitMap[pHitMap->first]=pHitMap->second;
58 tHitMap.erase(pHitMap);
59 }
60 }
61
62 // Find seed
63 if(pBufferHitMap->second.getEnergy()>emax) {
64 emax=pBufferHitMap->second.getEnergy();
65 idmax=pBufferHitMap->first;
66 }
67
68 eCluster+=pBufferHitMap->second.getEnergy();
69 aCluster.Insert(pBufferHitMap->second);
70 aBufferHitMap.erase(pBufferHitMap);
71 }
72 // Now, done and save it.
73 if(eCluster>Para.EThresholdCluster())
74 {
75 aCluster.ClusterId(idmax);
76 aClusterMap[idmax]=aCluster;
77 //aClusterMap[aCluster.ClusterId()]=aCluster;
78 }
79 }
80
81}
82
map< RecEmcID, RecEmcCluster, less< RecEmcID > > RecEmcClusterMap
RecEmcIDVector::iterator i_RecEmcIDVector
vector< RecEmcID > RecEmcIDVector
map< RecEmcID, RecEmcHit, less< RecEmcID > > RecEmcHitMap
Definition RecEmcHit.h:75
void Convert(const RecEmcHitMap &aHitMap, RecEmcClusterMap &aClusterMap)
RecEmcIDVector GetNeighbors(const Identifier &id)
static EmcRecParameter & GetInstance()
double EThresholdCluster() const
void Insert(const RecEmcHit &aHit)
void ClusterId(const RecEmcID id)