@@ -137,10 +137,6 @@ PixelCPETemplateReco::localPosition(DetParam const & theDetParam, ClusterParam &
137137
138138 SiPixelTemplate templ (thePixelTemp_);
139139
140- // Make from cluster (a SiPixelCluster) a boost multi_array_2d called
141- // clust_array_2d.
142- boost::multi_array<float , 2 > clust_array_2d (boost::extents[cluster_matrix_size_x][cluster_matrix_size_y]);
143-
144140 // Preparing to retrieve ADC counts from the SiPixeltheClusterParam.theCluster-> In the cluster,
145141 // we have the following:
146142 // int minPixelRow(); // Minimum pixel index in the x direction (low edge).
@@ -176,37 +172,48 @@ PixelCPETemplateReco::localPosition(DetParam const & theDetParam, ClusterParam &
176172 lp = theDetParam.theTopol ->localPosition ( MeasurementPoint (tmp_x, tmp_y) );
177173 }
178174
179- // Copy clust's pixels (calibrated in electrons) into clust_array_2d;
180- for (int i=0 ; i!=theClusterParam.theCluster ->size (); ++i )
175+ // first compute matrix size
176+ int mrow=0 , mcol=0 ;
177+ for (int i=0 ; i!=theClusterParam.theCluster ->size (); ++i )
178+ {
179+ auto pix = theClusterParam.theCluster ->pixel (i);
180+ int irow = int (pix.x );
181+ int icol = int (pix.y );
182+ mrow = std::max (mrow,irow);
183+ mcol = std::max (mcol,icol);
184+ }
185+ mrow -= row_offset; mrow+=1 ; mrow = std::min (mrow,cluster_matrix_size_x);
186+ mcol -= col_offset; mcol+=1 ; mcol = std::min (mcol,cluster_matrix_size_y);
187+ assert (mrow>0 ); assert (mcol>0 );
188+
189+ float clustMatrix[mrow][mcol];
190+ memset (clustMatrix,0 ,sizeof (float )*mrow*mcol);
191+
192+ // Copy clust's pixels (calibrated in electrons) into clusMatrix;
193+ for (int i=0 ; i!=theClusterParam.theCluster ->size (); ++i )
181194 {
182195 auto pix = theClusterParam.theCluster ->pixel (i);
183- // *pixIter dereferences to Pixel struct, with public vars x, y, adc (all float)
184- // 02/13/2008 [email protected] : type of x, y and adc has been changed to unsigned char, unsigned short, unsigned short 185- // in DataFormats/SiPixelCluster/interface/SiPixeltheClusterParam.theCluster->h so the type cast to int is redundant. Leave it there, it
186- // won't hurt.
187- int irow = int (pix.x ) - row_offset; // &&& do we need +0.5 ???
188- int icol = int (pix.y ) - col_offset; // &&& do we need +0.5 ???
196+ int irow = int (pix.x ) - row_offset;
197+ int icol = int (pix.y ) - col_offset;
189198
190- // Gavril : what do we do here if the row/column is larger than cluster_matrix_size_x/cluster_matrix_size_y = 7/21 ?
199+ // Gavril : what do we do here if the row/column is larger than cluster_matrix_size_x/cluster_matrix_size_y ?
191200 // Ignore them for the moment...
192- if ( irow<cluster_matrix_size_x && icol<cluster_matrix_size_y )
193- // 02/13/2008 [email protected] typecast pixIter->adc to float 194- clust_array_2d[irow][icol] = (float )pix.adc ;
201+ if ( (irow<mrow) & (icol<mcol) ) clustMatrix[irow][icol] = float (pix.adc );
202+
195203 }
196204
205+
197206 // Make and fill the bool arrays flagging double pixels
198- std::vector< bool > ydouble (cluster_matrix_size_y), xdouble (cluster_matrix_size_x) ;
207+ bool xdouble[mrow], ydouble[mcol] ;
199208 // x directions (shorter), rows
200- for (int irow = 0 ; irow < cluster_matrix_size_x; ++irow)
201- {
209+ for (int irow = 0 ; irow < mrow; ++irow)
202210 xdouble[irow] = theDetParam.theRecTopol ->isItBigPixelInX ( irow+row_offset );
203- }
204-
205- // y directions (longer), columns
206- for (int icol = 0 ; icol < cluster_matrix_size_y; ++icol)
207- {
211+
212+ // y directions (longer), columns
213+ for (int icol = 0 ; icol < mcol; ++icol)
208214 ydouble[icol] = theDetParam.theRecTopol ->isItBigPixelInY ( icol+col_offset );
209- }
215+
216+ SiPixelTemplateReco::ClusMatrix clusterPayload{&clustMatrix[0 ][0 ], xdouble, ydouble, mrow,mcol};
210217
211218 // Output:
212219 float nonsense = -99999 .9f ; // nonsense init value
@@ -231,7 +238,7 @@ PixelCPETemplateReco::localPosition(DetParam const & theDetParam, ClusterParam &
231238 theClusterParam.ierr =
232239 PixelTempReco2D ( ID, theClusterParam.cotalpha , theClusterParam.cotbeta ,
233240 locBz,
234- clust_array_2d, ydouble, xdouble ,
241+ clusterPayload ,
235242 templ,
236243 theClusterParam.templYrec_ , theClusterParam.templSigmaY_ , theClusterParam.templProbY_ ,
237244 theClusterParam.templXrec_ , theClusterParam.templSigmaX_ , theClusterParam.templProbX_ ,
@@ -286,14 +293,15 @@ PixelCPETemplateReco::localPosition(DetParam const & theDetParam, ClusterParam &
286293 // templQbin_ );
287294
288295
289- float dchisq;
290- float templProbQ_;
291296 std::vector< SiPixelTemplateStore2D > thePixelTemp2D_;
292297 SiPixelTemplate2D::pushfile (ID, thePixelTemp2D_);
293298 SiPixelTemplate2D templ2D_ (thePixelTemp2D_);
294299
295- theClusterParam.ierr =
296- SiPixelTemplateSplit::PixelTempSplit ( ID, theClusterParam.cotalpha , theClusterParam.cotbeta ,
300+ theClusterParam.ierr = -123 ;
301+ /*
302+ float dchisq;
303+ float templProbQ_;
304+ SiPixelTemplateSplit::PixelTempSplit( ID, theClusterParam.cotalpha, theClusterParam.cotbeta,
297305 clust_array_2d,
298306 ydouble, xdouble,
299307 templ,
@@ -305,7 +313,7 @@ PixelCPETemplateReco::localPosition(DetParam const & theDetParam, ClusterParam &
305313 dchisq,
306314 templ2D_ );
307315
308-
316+ */
309317 if ( theClusterParam.ierr != 0 )
310318 {
311319 LogDebug (" PixelCPETemplateReco::localPosition" ) <<
0 commit comments