/home/bes3soft/bes3soft/Boss/7.0.2/dist/7.0.2/Reconstruction/EmcRec/EmcRec-01-02-57/src/EmcRecHit2Cluster.cxx

Go to the documentation of this file.
00001 //
00002 //  Convert from Hit Map to Cluster Map
00003 //
00004 //  Wang.Zhe 2004, 3, 29
00005 //
00006 #include <iostream>
00007 
00008 #include "EmcRec/EmcRecHit2Cluster.h" 
00009 #include "EmcRec/EmcRecParameter.h"
00010 
00011 // Constructors and destructors
00012 EmcRecHit2Cluster::EmcRecHit2Cluster()
00013 {}
00014 
00015 EmcRecHit2Cluster:: ~EmcRecHit2Cluster()
00016 {}
00017 
00018 void EmcRecHit2Cluster::Convert(const RecEmcHitMap& aHitMap,
00019                                    RecEmcClusterMap& aClusterMap)
00020 {
00021    RecEmcHitMap tHitMap,aBufferHitMap;
00022    RecEmcHitMap::iterator pHitMap,pBufferHitMap;
00023    tHitMap=aHitMap;
00024    
00025    RecEmcID CellId;
00026    RecEmcIDVector NearCell;
00027    i_RecEmcIDVector pNearCell;
00028    
00029    RecEmcCluster aCluster;
00030 
00031    EmcRecParameter& Para=EmcRecParameter::GetInstance();
00032    EmcRecNeighbor nhb;
00033    
00034    while(!tHitMap.empty())
00035    {
00036      double eCluster=0;   //total energy of a cluster
00037      double emax=0;   //seed's energy of a cluster
00038      RecEmcID idmax;    //seed's id of a cluster
00039      
00040            // Search a cluster.
00041            pHitMap=tHitMap.begin();
00042            aBufferHitMap[pHitMap->first]=pHitMap->second;
00043            tHitMap.erase(pHitMap);
00044            aCluster.Clear();
00045            while(!aBufferHitMap.empty())
00046            {
00047              pBufferHitMap=aBufferHitMap.begin();
00048              CellId=pBufferHitMap->first;
00049              NearCell=nhb.GetNeighbors(CellId);
00050              for(pNearCell=NearCell.begin();
00051                        pNearCell!=NearCell.end();
00052                        pNearCell++)
00053              {
00054                      pHitMap=tHitMap.find(*pNearCell);
00055                      if(pHitMap!=tHitMap.end())
00056                      {
00057                        aBufferHitMap[pHitMap->first]=pHitMap->second;
00058                        tHitMap.erase(pHitMap);
00059                      }
00060              }
00061 
00062        // Find seed
00063        if(pBufferHitMap->second.getEnergy()>emax) {
00064          emax=pBufferHitMap->second.getEnergy();
00065          idmax=pBufferHitMap->first;
00066        }
00067          
00068        eCluster+=pBufferHitMap->second.getEnergy();
00069              aCluster.Insert(pBufferHitMap->second);
00070              aBufferHitMap.erase(pBufferHitMap);
00071            }
00072          // Now, done and save it.
00073      if(eCluster>Para.EThresholdCluster())
00074      {
00075        aCluster.ClusterId(idmax);
00076              aClusterMap[idmax]=aCluster;
00077              //aClusterMap[aCluster.ClusterId()]=aCluster;
00078      }
00079    }
00080 
00081 }
00082 

Generated on Tue Nov 29 23:13:18 2016 for BOSS_7.0.2 by  doxygen 1.4.7