761 {
765 if (not element) {
768 }
769 const AtlasDetectorID* aid = element->
getIdHelper();
770 if (not aid){
773 }
774
778 }
779 const PixelID* pixelIDp=static_cast<const PixelID*>(aid);
780 const PixelID& pixelID = *pixelIDp;
781 const InDetDD::PixelModuleDesign* design
782 (dynamic_cast<const InDetDD::PixelModuleDesign*>(&element->design()));
783 if (not design){
784 ATH_MSG_ERROR(
"Dynamic cast failed at line "<<__LINE__<<
" of NnClusterizationFactory.cxx.");
786 }
787 SG::ReadCondHandle<PixelChargeCalibCondData> calibDataHandle(
m_chargeDataKey);
788 const PixelChargeCalibCondData *calibData = *calibDataHandle;
789 const std::vector<Identifier>& rdos = pCluster.
rdoList();
790 const size_t rdoSize = rdos.size();
792 const std::vector<float>& chList = pCluster.
chargeList();
793 const std::vector<int>& totList = pCluster.
totList();
794 std::vector<float> chListRecreated{};
795 chListRecreated.reserve(rdoSize);
797 std::vector<int>::const_iterator
tot = totList.begin();
798 std::vector<Identifier>::const_iterator rdosBegin = rdos.begin();
799 std::vector<Identifier>::const_iterator rdosEnd = rdos.end();
800 std::vector<int> totListRecreated{};
801 totListRecreated.reserve(rdoSize);
802 std::vector<int>::const_iterator totRecreated = totListRecreated.begin();
803
805 IdentifierHash moduleHash = element->identifyHash();
806
807 for ( ; rdosBegin!= rdosEnd and
tot != totList.end(); ++
tot, ++rdosBegin, ++totRecreated ){
808
810 Identifier pixid = *rdosBegin;
812
813 std::array<InDetDD::PixelDiodeTree::CellIndexType,2> diode_idx
816 InDetDD::PixelDiodeTree::DiodeProxy si_param ( design->diodeProxyFromIdx(diode_idx));
817 std::uint32_t feValue = design->getFE(si_param);
818 auto diode_type = design->getDiodeType(si_param);
820 && design->numberOfConnectedCells( design->readoutIdOfCell(InDetDD::SiCellId(diode_idx[0],diode_idx[1])))>1) {
822 }
823
824 float charge = calibData->
getCharge(diode_type, moduleHash, feValue, tot0);
825 chListRecreated.push_back(
charge);
826 totListRecreated.push_back(tot0);
827 }
828
829 rdosBegin = rdos.begin();
830 rdosEnd = rdos.end();
831
832 tot = totList.begin();
833 totRecreated = totListRecreated.begin();
834
835 std::vector<float>::const_iterator
charge = chListRecreated.begin();
836 std::vector<float>::const_iterator chargeEnd = chListRecreated.end();
837 tot = totListRecreated.begin();
838 std::vector<int>::const_iterator totEnd = totListRecreated.end();
839 InDetDD::SiLocalPosition sumOfWeightedPositions(0,0,0);
840 double sumOfTot=0;
841 int rowMin = 999;
842 int rowMax = 0;
843 int colMin = 999;
844 int colMax = 0;
845 for (; (rdosBegin!= rdosEnd) and (
charge != chargeEnd) and (tot != totEnd); ++rdosBegin, ++
charge, ++
tot){
846 Identifier rId = *rdosBegin;
849 InDetDD::SiLocalPosition siLocalPosition (design->positionFromColumnRow(col,row));
851 sumOfWeightedPositions += (*charge)*siLocalPosition;
852 sumOfTot += (*charge);
853 } else {
854 sumOfWeightedPositions += ((
double)(*tot))*siLocalPosition;
855 sumOfTot += (
double)(*tot);
856 }
857 rowMin = std::min(row, rowMin);
858 rowMax = std::max(row, rowMax);
859 colMin = std::min(col, colMin);
860 colMax = std::max(col, colMax);
861
862 }
863 sumOfWeightedPositions /= sumOfTot;
864
865
866 InDetDD::SiCellId cellIdWeightedPosition=design->cellIdOfPosition(sumOfWeightedPositions);
867
868 if (!cellIdWeightedPosition.
isValid()){
870 }
871 int columnWeightedPosition=cellIdWeightedPosition.
etaIndex();
872 int rowWeightedPosition=cellIdWeightedPosition.
phiIndex();
873 ATH_MSG_VERBOSE(
" weighted pos row: " << rowWeightedPosition <<
" col: " << columnWeightedPosition );
874 int centralIndexX=(
m_sizeX-1)/2;
875 int centralIndexY=(
m_sizeY-1)/2;
876 if (std::abs(rowWeightedPosition-rowMin)>centralIndexX or
877 std::abs(rowWeightedPosition-rowMax)>centralIndexX){
878 ATH_MSG_VERBOSE(
" Cluster too large rowMin" << rowMin <<
" rowMax " << rowMax <<
" centralX " << centralIndexX);
880 }
881 if (std::abs(columnWeightedPosition-colMin)>centralIndexY or
882 std::abs(columnWeightedPosition-colMax)>centralIndexY){
883 ATH_MSG_VERBOSE(
" Cluster too large colMin" << colMin <<
" colMax " << colMax <<
" centralY " << centralIndexY);
885 }
889 }
891 rdosBegin = rdos.begin();
892 charge = chListRecreated.begin();
893 chargeEnd = chListRecreated.end();
894 tot = totListRecreated.begin();
895 ATH_MSG_VERBOSE(
" Putting together the n. " << rdos.size() <<
" rdos into a matrix." );
896 Identifier pixidentif=pCluster.
identify();
900 for (;(
charge != chargeEnd) and (rdosBegin!= rdosEnd); ++rdosBegin, ++
charge, ++
tot){
901 Identifier rId = *rdosBegin;
902 unsigned int absrow = pixelID.
phi_index(rId)-rowWeightedPosition+centralIndexX;
903 unsigned int abscol = pixelID.
eta_index(rId)-columnWeightedPosition+centralIndexY;
907 }
911 }
912 InDetDD::SiCellId cellId = element->cellIdFromIdentifier(*rdosBegin);
913 InDetDD::SiDiodesParameters diodeParameters = design->parameters(cellId);
914 double pitchY = diodeParameters.
width().
xEta();
917 } else {
919
922 input.matrixOfToT[absrow][abscol]*=3;
923 }
924 }else{
925
926 if ( (
input.ClusterPixLayer==0) and (
input.ClusterPixBarrelEC==0)){
927 input.matrixOfToT[absrow][abscol]*=3;
928 }
929 }
930
931 }
932 if (std::abs(pitchY-0.4)>1e-5){
933 input.vectorOfPitchesY[abscol]=pitchY;
934 }
935 }
938 input.useTrackInfo=
false;
940 InDetDD::SiLocalPosition centroid(prdLocPos);
946 float trkphicomp = my_track.dot(my_phiax);
947 float trketacomp = my_track.dot(my_etaax);
948 float trknormcomp = my_track.dot(my_normal);
949 double bowphi = std::atan2(trkphicomp,trknormcomp);
950 double boweta = std::atan2(trketacomp,trknormcomp);
952 if(bowphi > M_PI_2) bowphi -=
M_PI;
953 if(bowphi < -M_PI_2) bowphi +=
M_PI;
954 int readoutside = design->readoutSide();
955 double angle = std::atan(std::tan(bowphi)-readoutside*tanl);
958 if (boweta>M_PI_2) boweta-=
M_PI;
959 if (boweta<-M_PI_2) boweta+=
M_PI;
962 input.rowWeightedPosition=rowWeightedPosition;
963 input.columnWeightedPosition=columnWeightedPosition;
964 ATH_MSG_VERBOSE(
" RowWeightedPosition: " << rowWeightedPosition <<
" ColWeightedPosition: " << columnWeightedPosition );
966 }
#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 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_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.