11 #include "CLHEP/Units/SystemOfUnits.h"
12 #include "CLHEP/Matrix/SymMatrix.h"
13 #include "GaudiKernel/ToolHandle.h"
14 #include "GaudiKernel/ServiceHandle.h"
37 inline double square(
const double x){
51 std::vector<Identifier>&& rdoList,
53 std::vector<int>&& totList,
54 std::vector<float>&& chargeList,
70 std::move(chargeList),
85 class AddNewxAODpixelCluster {
88 : m_cluster(&cluster) {}
93 const std::vector<Identifier>& rdoList,
95 const std::vector<int>& totList,
96 const std::vector<float>& chargeList,
107 Eigen::Matrix<float,2,1> localPosition(locpos.x(), locpos.y());
109 localCovariance(0, 0) = locErrMat(0, 0);
110 localCovariance(1, 1) = locErrMat(1, 1);
112 m_cluster->setMeasurement<2>(idHash, localPosition, localCovariance);
113 m_cluster->setRDOlist(rdoList);
114 m_cluster->globalPosition() = globpos.cast<
float>();
115 m_cluster->setToTlist(totList);
117 m_cluster->setChargelist(chargeList);
119 m_cluster->setLVL1A(lvl1a);
120 m_cluster->setChannelsInPhiEta(
width.colRow()[0],
width.colRow()[1]);
121 m_cluster->setWidthInEta(
static_cast<float>(
width.widthPhiRZ()[1]));
122 m_cluster->setOmegas(omegax, omegay);
123 m_cluster->setIsSplit(
split);
124 m_cluster->setSplitProbabilities(splitProb1, splitProb2);
143 const std::string&
n,
144 const IInterface*
p) :
147 declareInterface<ClusterMakerTool>(
this);
173 return StatusCode::SUCCESS;
197 template <
typename ClusterType,
typename IdentifierVec,
typename ToTList>
201 IdentifierVec&& rdoList,
214 const EventContext& ctx,
223 throw std::runtime_error(
"Dynamic cast failed for design in ClusterMakerTool.cxx");
225 int rowMin = design->rows();
227 int colMin = design->columns();
229 float qRowMin = 0;
float qRowMax = 0;
230 float qColMin = 0;
float qColMax = 0;
231 std::vector<float> chargeList;
232 int nRDO=rdoList.size();
234 chargeList.reserve(nRDO);
235 for (
int i=0;
i<nRDO;
i++) {
246 charge = ToT/8.0*(8000.0-1200.0)+1200.0;
248 chargeList.push_back(
charge);
252 for (
int i=0;
i<nRDO;
i++) {
257 if (calibData) {
charge=chargeList[
i]; }
291 if(qRowMin+qRowMax > 0) omegax = qRowMax/
float(qRowMin+qRowMax);
292 if(qColMin+qColMax > 0) omegay = qColMax/
float(qColMin+qColMax);
301 double Ax[3] = {T(0,0),T(1,0),T(2,0)};
302 double Ay[3] = {T(0,1),T(1,1),T(2,1)};
303 double R [3] = {T(0,3),T(1,3),T(2,3)};
306 Amg::Vector3D globalPos(M[0]*Ax[0]+M[1]*Ay[0]+R[0],M[0]*Ax[1]+M[1]*Ay[1]+R[1],M[0]*Ax[2]+M[1]*Ay[2]+R[2]);
312 errorMatrix.setIdentity();
317 double eta = std::abs(globalPos.eta());
318 double zPitch =
width.z()/colRow.y();
323 throw std::runtime_error(
"Wrong helper type in ClusterMakerTool.cxx.");
326 int layer =
pid->layer_disk(clusterID);
328 switch (errorStrategy){
342 if (offlineCalibData) {
347 errorMatrix.fillSymmetric(0,0,
pow(phiError,2));
354 errorMatrix.fillSymmetric(0,0,square(phiError));
355 errorMatrix.fillSymmetric(1,1,square(
etaError));
360 errorMatrix.fillSymmetric(1,1,square(zPitch)*
ONE_TWELFTH);
379 static_assert(std::is_same_v<ClusterType, PixelCluster> ||
380 std::is_same_v<std::remove_pointer_t<ClusterType>,
382 "Not an InDet::PixelCluster or xAOD::PixelCluster");
384 return newInDetpixelCluster(newClusterID, locpos,
386 std::forward<IdentifierVec>(rdoList),
388 std::forward<ToTList>(totList),
389 std::move(chargeList),
392 std::move(errorMatrix),
399 return AddNewxAODpixelCluster(*cluster)(newClusterID,
402 std::forward<IdentifierVec>(rdoList),
404 std::forward<ToTList>(totList),
420 std::vector<Identifier>&& rdoList,
422 std::vector<int>&& totList,
433 const EventContext& ctx)
const
435 return makePixelCluster<PixelCluster>(
457 const std::vector<Identifier>& rdoList,
459 const std::vector<int>& totList,
470 const EventContext& ctx)
const
472 return makePixelCluster<xAOD::PixelCluster*>(
510 std::vector<Identifier>&& rdoList,
513 int errorStrategy)
const
525 errorMatrix.setIdentity();
531 switch (errorStrategy){
543 else if(colRow.x() == 2){
557 else if(colRow.x() == 2){
574 double v0 = (errorMatrix)(0,0)*
w*
w;
575 double v1 = (errorMatrix)(1,1);
576 errorMatrix.fillSymmetric(0,0,cs2*
v0+sn2*v1);
577 errorMatrix.fillSymmetric(0,1,sn*sqrt(cs2)*(
v0-v1));
578 errorMatrix.fillSymmetric(1,1,sn2*
v0+cs2*v1);
581 return SCT_Cluster(clusterID, locpos, std::move(rdoList),
width, element, std::move(errorMatrix));
588 int phiClusterSize)
const{
597 if(phiClusterSize > 3)
return 14.6*
micrometer;
599 if(
layer == 0 && phi == 0)
return sigmaL0Phi0[phiClusterSize-1];
600 if(
layer == 1 && phi == 0)
return sigmaL1Phi0[phiClusterSize-1];
601 if(
layer == 2 && phi == 0)
return sigmaL2Phi0[phiClusterSize-1];
602 if(
layer == 0 && phi == 1)
return sigmaL0Phi1[phiClusterSize-1];
603 if(
layer == 1 && phi == 1)
return sigmaL1Phi1[phiClusterSize-1];
604 if(
layer == 2 && phi == 1)
return sigmaL2Phi1[phiClusterSize-1];
608 <<
layer <<
" and phi = " << phi);