795 {
799 if (not element) {
802 }
803 const AtlasDetectorID* aid = element->
getIdHelper();
804 if (not aid){
807 }
808
812 }
813 const PixelID* pixelIDp=static_cast<const PixelID*>(aid);
814 const PixelID& pixelID = *pixelIDp;
815 const InDetDD::PixelModuleDesign* design
816 (dynamic_cast<const InDetDD::PixelModuleDesign*>(&element->design()));
817 if (not design){
818 ATH_MSG_ERROR(
"Dynamic cast failed at line "<<__LINE__<<
" of NnClusterizationFactory.cxx.");
820 }
821 SG::ReadCondHandle<PixelChargeCalibCondData> calibDataHandle(
m_chargeDataKey);
822 const PixelChargeCalibCondData *calibData = *calibDataHandle;
823 const std::vector<Identifier>& rdos = pCluster.
rdoList();
824 const size_t rdoSize = rdos.size();
826 const std::vector<float>& chList = pCluster.
chargeList();
827 const std::vector<int>& totList = pCluster.
totList();
828 std::vector<float> chListRecreated{};
829 chListRecreated.reserve(rdoSize);
831 std::vector<int>::const_iterator
tot = totList.begin();
832 std::vector<Identifier>::const_iterator rdosBegin = rdos.begin();
833 std::vector<Identifier>::const_iterator rdosEnd = rdos.end();
834 std::vector<int> totListRecreated{};
835 totListRecreated.reserve(rdoSize);
836 std::vector<int>::const_iterator totRecreated = totListRecreated.begin();
837
839 IdentifierHash moduleHash = element->identifyHash();
840
841 for ( ; rdosBegin!= rdosEnd and
tot != totList.end(); ++
tot, ++rdosBegin, ++totRecreated ){
842
844 Identifier pixid = *rdosBegin;
846
847 std::array<InDetDD::PixelDiodeTree::CellIndexType,2> diode_idx
850 InDetDD::PixelDiodeTree::DiodeProxy si_param ( design->diodeProxyFromIdx(diode_idx));
851 std::uint32_t feValue = design->getFE(si_param);
852 auto diode_type = design->getDiodeType(si_param);
854 && design->numberOfConnectedCells( design->readoutIdOfCell(InDetDD::SiCellId(diode_idx[0],diode_idx[1])))>1) {
856 }
857
858 float charge = calibData->
getCharge(diode_type, moduleHash, feValue, tot0);
859 chListRecreated.push_back(
charge);
860 totListRecreated.push_back(tot0);
861 }
862
863 rdosBegin = rdos.begin();
864 rdosEnd = rdos.end();
865
866 tot = totList.begin();
867 totRecreated = totListRecreated.begin();
868
869 std::vector<float>::const_iterator
charge = chListRecreated.begin();
870 std::vector<float>::const_iterator chargeEnd = chListRecreated.end();
871 tot = totListRecreated.begin();
872 std::vector<int>::const_iterator totEnd = totListRecreated.end();
873 InDetDD::SiLocalPosition sumOfWeightedPositions(0,0,0);
874 double sumOfTot=0;
875 int rowMin = 999;
876 int rowMax = 0;
877 int colMin = 999;
878 int colMax = 0;
879 for (; (rdosBegin!= rdosEnd) and (
charge != chargeEnd) and (tot != totEnd); ++rdosBegin, ++
charge, ++
tot){
880 Identifier rId = *rdosBegin;
883 InDetDD::SiLocalPosition siLocalPosition (design->positionFromColumnRow(col,row));
885 sumOfWeightedPositions += (*charge)*siLocalPosition;
886 sumOfTot += (*charge);
887 } else {
888 sumOfWeightedPositions += ((
double)(*tot))*siLocalPosition;
889 sumOfTot += (
double)(*tot);
890 }
891 rowMin = std::min(row, rowMin);
892 rowMax = std::max(row, rowMax);
893 colMin = std::min(col, colMin);
894 colMax = std::max(col, colMax);
895
896 }
897 sumOfWeightedPositions /= sumOfTot;
898
899
900 InDetDD::SiCellId cellIdWeightedPosition=design->cellIdOfPosition(sumOfWeightedPositions);
901
902 if (!cellIdWeightedPosition.
isValid()){
904 }
905 int columnWeightedPosition=cellIdWeightedPosition.
etaIndex();
906 int rowWeightedPosition=cellIdWeightedPosition.
phiIndex();
907 ATH_MSG_VERBOSE(
" weighted pos row: " << rowWeightedPosition <<
" col: " << columnWeightedPosition );
908 int centralIndexX=(
m_sizeX-1)/2;
909 int centralIndexY=(
m_sizeY-1)/2;
910 if (std::abs(rowWeightedPosition-rowMin)>centralIndexX or
911 std::abs(rowWeightedPosition-rowMax)>centralIndexX){
912 ATH_MSG_VERBOSE(
" Cluster too large rowMin" << rowMin <<
" rowMax " << rowMax <<
" centralX " << centralIndexX);
914 }
915 if (std::abs(columnWeightedPosition-colMin)>centralIndexY or
916 std::abs(columnWeightedPosition-colMax)>centralIndexY){
917 ATH_MSG_VERBOSE(
" Cluster too large colMin" << colMin <<
" colMax " << colMax <<
" centralY " << centralIndexY);
919 }
923 }
924
925
926
928 input.vectorOfPitchesY.assign(
m_sizeY, design->etaPitch());
929 input.vectorOfPitchesX.assign(
m_sizeX, design->phiPitch());
930 } else {
932 }
933 rdosBegin = rdos.begin();
934 charge = chListRecreated.begin();
935 chargeEnd = chListRecreated.end();
936 tot = totListRecreated.begin();
937 ATH_MSG_VERBOSE(
" Putting together the n. " << rdos.size() <<
" rdos into a matrix." );
938 Identifier pixidentif=pCluster.
identify();
942 for (;(
charge != chargeEnd) and (rdosBegin!= rdosEnd); ++rdosBegin, ++
charge, ++
tot){
943 Identifier rId = *rdosBegin;
944 unsigned int absrow = pixelID.
phi_index(rId)-rowWeightedPosition+centralIndexX;
945 unsigned int abscol = pixelID.
eta_index(rId)-columnWeightedPosition+centralIndexY;
949 }
953 }
954 InDetDD::SiCellId cellId = element->cellIdFromIdentifier(*rdosBegin);
955 InDetDD::SiDiodesParameters diodeParameters = design->parameters(cellId);
956 double pitchY = diodeParameters.
width().
xEta();
957 double pitchX = diodeParameters.
width().
xPhi();
960 } else {
962
965 input.matrixOfToT[absrow][abscol]*=3;
966 }
967 }else{
968
969 if ( (
input.ClusterPixLayer==0) and (
input.ClusterPixBarrelEC==0)){
970 input.matrixOfToT[absrow][abscol]*=3;
971 }
972 }
973
974 }
976 input.vectorOfPitchesY[abscol]=pitchY;
977 input.vectorOfPitchesX[absrow]=pitchX;
978 } else if (std::abs(pitchY-0.4)>1e-5){
979
980 input.vectorOfPitchesY[abscol]=pitchY;
981 }
982 }
985 input.useTrackInfo=
false;
987 InDetDD::SiLocalPosition centroid(prdLocPos);
993 float trkphicomp = my_track.dot(my_phiax);
994 float trketacomp = my_track.dot(my_etaax);
995 float trknormcomp = my_track.dot(my_normal);
996 double bowphi = std::atan2(trkphicomp,trknormcomp);
997 double boweta = std::atan2(trketacomp,trknormcomp);
999 if(bowphi > M_PI_2) bowphi -=
M_PI;
1000 if(bowphi < -M_PI_2) bowphi +=
M_PI;
1001 int readoutside = design->readoutSide();
1002 double angle = std::atan(std::tan(bowphi)-readoutside*tanl);
1005 if (boweta>M_PI_2) boweta-=
M_PI;
1006 if (boweta<-M_PI_2) boweta+=
M_PI;
1009 input.rowWeightedPosition=rowWeightedPosition;
1010 input.columnWeightedPosition=columnWeightedPosition;
1011 ATH_MSG_VERBOSE(
" RowWeightedPosition: " << rowWeightedPosition <<
" ColWeightedPosition: " << columnWeightedPosition );
1013 }
#define ATH_MSG_WARNING(x)
double charge(const T &p)
double angle(const GeoTrf::Vector2D &a, const GeoTrf::Vector2D &b)
static constexpr std::array< PixelDiodeTree::CellIndexType, 2 > makeCellIndex(T local_x_idx, T local_y_idx)
Create a 2D cell index from the indices in local-x (phi, row) and local-y (eta, column) direction.
int phiIndex() const
Get phi index. Equivalent to strip().
bool isValid() const
Test if its in a valid state.
int etaIndex() const
Get eta index.
const SiLocalPosition & width() const
width of the diodes:
double xPhi() const
position along phi direction:
double xEta() const
position along eta direction:
const AtlasDetectorID * getIdHelper() const
Returns the id helper (inline).
SG::ReadCondHandleKey< PixelChargeCalibCondData > m_chargeDataKey
ToolHandle< ISiLorentzAngleTool > m_pixelLorentzAngleTool
Gaudi::Property< bool > m_useXPitches
Gaudi::Property< bool > m_doRunI
const std::vector< int > & totList() const
const std::vector< float > & chargeList() const
virtual const InDetDD::SiDetectorElement * detectorElement() const override final
return the detector element corresponding to this PRD The pointer will be zero if the det el is not d...
float getCharge(InDetDD::PixelDiodeType type, unsigned int moduleHash, unsigned int FE, float ToT) const
int eta_index(const Identifier &id) const
int layer_disk(const Identifier &id) const
Identifier wafer_id(int barrel_ec, int layer_disk, int phi_module, int eta_module) const
For a single crystal.
int barrel_ec(const Identifier &id) const
Values of different levels (failure returns 0).
IdentifierHash wafer_hash(Identifier wafer_id) const
wafer hash from id
int eta_module(const Identifier &id) const
int phi_index(const Identifier &id) const
const Amg::Vector2D & localPosition() const
return the local position reference
Identifier identify() const
return the identifier
const std::vector< Identifier > & rdoList() const
return the List of rdo identifiers (pointers)
Eigen::Matrix< double, 2, 1 > Vector2D
row
Appending html table to final .html summary file.