** Warning **
Issuing rollback() due to DESTROY without explicit disconnect() of DBD::mysql::db handle dbname=lxr at /lxr/lib/LXR/Common.pm line 1113.
Last-Modified: Fri, 21 Sep 2023 01:53:21 GMT
Content-Type: text/html; charset=utf-8
/CMSSW_13_3_X_2023-09-20-2300/RecoLocalTracker/SiPhase2Clusterizer/plugins/Phase2TrackerClusterizerAlgorithm.cc
File indexing completed on 2023-03-17 11:19:31
0001 #include "Phase2TrackerClusterizerAlgorithm.h "
0002
0003 #include "Geometry /CommonTopologies /interface /PixelTopology.h "
0004
0005
0006
0007
0008
0009 Phase2TrackerClusterizerAlgorithm::Phase2TrackerClusterizerAlgorithm(unsigned int maxClusterSize ,
0010 unsigned int maxNumberClusters)
0011 : maxClusterSize_ (maxClusterSize ), maxNumberClusters_(maxNumberClusters), nrows_ (0), ncols_ (0) {}
0012
0013
0014
0015
0016
0017 void Phase2TrackerClusterizerAlgorithm::setup (const PixelGeomDetUnit * pixDet ) {
0018 const PixelTopology & topol (pixDet ->specificTopology ());
0019 nrows_ = topol .nrows ();
0020 ncols_ = topol .ncolumns ();
0021 matrix_ = decltype (matrix_ )(nrows_ , ncols_ );
0022 }
0023
0024
0025
0026
0027
0028 void Phase2TrackerClusterizerAlgorithm::clusterizeDetUnit (const edm ::DetSet <Phase2TrackerDigi >& digis ,
0029 Phase2TrackerCluster1DCollectionNew ::FastFiller & clusters ) {
0030
0031 fillMatrix (digis .begin (), digis .end ());
0032
0033
0034 unsigned int numberClusters(0);
0035 Phase2TrackerDigi firstDigi ;
0036 unsigned int sizeCluster(0);
0037 bool closeCluster(false );
0038 bool HIPbit(false );
0039
0040
0041
0042
0043 for (unsigned int col (0); col < ncols_ ; ++col ) {
0044 for (unsigned int row (0); row < nrows_ ; ++row ) {
0045
0046 if (matrix_ (row , col )) {
0047
0048 if (sizeCluster == 0) {
0049
0050 firstDigi = Phase2TrackerDigi (row , col );
0051 sizeCluster = 1;
0052 }
0053
0054 else
0055 ++sizeCluster;
0056
0057 closeCluster = ((maxClusterSize_ != 0 and sizeCluster >= maxClusterSize_ ) ? true : false );
0058 }
0059
0060 else
0061 closeCluster = ((sizeCluster != 0) ? true : false );
0062
0063
0064 HIPbit |= (matrix_ (row , col ) == 2);
0065
0066
0067 if (sizeCluster != 0 and row == (nrows_ - 1))
0068 closeCluster = true ;
0069
0070
0071 if (closeCluster) {
0072
0073 clusters .push_back (Phase2TrackerCluster1D (firstDigi , sizeCluster, HIPbit));
0074
0075 sizeCluster = 0;
0076
0077 ++numberClusters;
0078 HIPbit = false ;
0079 }
0080
0081
0082 if (maxNumberClusters_ != 0 and numberClusters > maxNumberClusters_)
0083 return ;
0084 }
0085 }
0086
0087
0088 clearMatrix(digis .begin (), digis .end ());
0089 }
0090
0091
0092
0093
0094
0095 void Phase2TrackerClusterizerAlgorithm::fillMatrix (edm ::DetSet <Phase2TrackerDigi >::const_iterator begin ,
0096 edm ::DetSet <Phase2TrackerDigi >::const_iterator end ) {
0097 for (edm ::DetSet <Phase2TrackerDigi >::const_iterator di (begin ); di != end ; ++di )
0098 matrix_ .set (di ->row (), di ->column (), true , di ->overThreshold ());
0099 }
0100
0101
0102
0103
0104
0105 void Phase2TrackerClusterizerAlgorithm::clearMatrix(edm ::DetSet <Phase2TrackerDigi >::const_iterator begin ,
0106 edm ::DetSet <Phase2TrackerDigi >::const_iterator end ) {
0107 for (edm ::DetSet <Phase2TrackerDigi >::const_iterator di (begin ); di != end ; ++di )
0108 matrix_ .set (di ->row (), di ->column (), false , false );
0109 }