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,
222 throw std::runtime_error(
"Dynamic cast failed for design in ClusterMakerTool.cxx");
224 int rowMin = design->rows();
226 int colMin = design->columns();
228 float qRowMin = 0;
float qRowMax = 0;
229 float qColMin = 0;
float qColMax = 0;
230 std::vector<float> chargeList;
231 int nRDO=rdoList.size();
233 chargeList.reserve(nRDO);
234 for (
int i=0;
i<nRDO;
i++) {
245 charge = ToT/8.0*(8000.0-1200.0)+1200.0;
247 chargeList.push_back(
charge);
251 for (
int i=0;
i<nRDO;
i++) {
256 if (calibData) {
charge=chargeList[
i]; }
290 if(qRowMin+qRowMax > 0) omegax = qRowMax/
float(qRowMin+qRowMax);
291 if(qColMin+qColMax > 0) omegay = qColMax/
float(qColMin+qColMax);
300 double Ax[3] = {T(0,0),T(1,0),T(2,0)};
301 double Ay[3] = {T(0,1),T(1,1),T(2,1)};
302 double R [3] = {T(0,3),T(1,3),T(2,3)};
305 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]);
311 errorMatrix.setIdentity();
316 double eta = std::abs(globalPos.eta());
317 double zPitch =
width.z()/colRow.y();
322 throw std::runtime_error(
"Wrong helper type in ClusterMakerTool.cxx.");
325 int layer =
pid->layer_disk(clusterID);
327 switch (errorStrategy){
341 if (offlineCalibData) {
346 errorMatrix.fillSymmetric(0,0,
pow(phiError,2));
347 errorMatrix.fillSymmetric(1,1,
pow(etaError,2));
353 errorMatrix.fillSymmetric(0,0,square(phiError));
354 errorMatrix.fillSymmetric(1,1,square(etaError));
359 errorMatrix.fillSymmetric(1,1,square(zPitch)*
ONE_TWELFTH);
378 static_assert(std::is_same_v<ClusterType, PixelCluster> ||
379 std::is_same_v<std::remove_pointer_t<ClusterType>,
381 "Not an InDet::PixelCluster or xAOD::PixelCluster");
383 return newInDetpixelCluster(newClusterID, locpos,
385 std::forward<IdentifierVec>(rdoList),
387 std::forward<ToTList>(totList),
388 std::move(chargeList),
391 std::move(errorMatrix),
398 return AddNewxAODpixelCluster(*cluster)(newClusterID,
401 std::forward<IdentifierVec>(rdoList),
403 std::forward<ToTList>(totList),
419 std::vector<Identifier>&& rdoList,
421 std::vector<int>&& totList,
433 return makePixelCluster<PixelCluster>(
454 const std::vector<Identifier>& rdoList,
456 const std::vector<int>& totList,
468 return makePixelCluster<xAOD::PixelCluster*>(
505 std::vector<Identifier>&& rdoList,
508 int errorStrategy)
const
520 errorMatrix.setIdentity();
526 switch (errorStrategy){
538 else if(colRow.x() == 2){
552 else if(colRow.x() == 2){
569 double v0 = (errorMatrix)(0,0)*
w*
w;
570 double v1 = (errorMatrix)(1,1);
571 errorMatrix.fillSymmetric(0,0,cs2*
v0+sn2*v1);
572 errorMatrix.fillSymmetric(0,1,sn*sqrt(cs2)*(
v0-v1));
573 errorMatrix.fillSymmetric(1,1,sn2*
v0+cs2*v1);
576 return SCT_Cluster(clusterID, locpos, std::move(rdoList),
width, element, std::move(errorMatrix));
583 int phiClusterSize)
const{
592 if(phiClusterSize > 3)
return 14.6*
micrometer;
594 if(
layer == 0 &&
phi == 0)
return sigmaL0Phi0[phiClusterSize-1];
595 if(
layer == 1 &&
phi == 0)
return sigmaL1Phi0[phiClusterSize-1];
596 if(
layer == 2 &&
phi == 0)
return sigmaL2Phi0[phiClusterSize-1];
597 if(
layer == 0 &&
phi == 1)
return sigmaL0Phi1[phiClusterSize-1];
598 if(
layer == 1 &&
phi == 1)
return sigmaL1Phi1[phiClusterSize-1];
599 if(
layer == 2 &&
phi == 1)
return sigmaL2Phi1[phiClusterSize-1];