46 {
47 const EventContext &ctx = Gaudi::Hive::currentContext();
49 if (!pixel_container.isValid())
50 {
52 return StatusCode::RECOVERABLE;
53 }
54 ATH_MSG_DEBUG(
"Pixel Cluster container found: " << pixel_container->size() <<
" collections" );
55 SG::ReadCondHandle<PixelChargeCalibCondData> calibDataHandle(
m_chargeDataKey, ctx);
56 const PixelChargeCalibCondData *calibData = *calibDataHandle;
57
58 int overflowIBLToT=0;
61 }
62
63 typedef InDet::PixelClusterContainer::const_iterator ClusterIter;
64 ClusterIter itrCluster;
65 ClusterIter itrClubeg=pixel_container->begin();
66 ClusterIter itrCluend=pixel_container->end();
67 for( itrCluster=itrClubeg;itrCluster!=itrCluend;++itrCluster){
69 if (!ClusterCollection) continue;
71 const InDet::PixelCluster* theCluster = *p_clus;
72 const std::vector<Identifier>& RDOs = theCluster->
rdoList();
73 const std::vector<int>& ToTs = theCluster->
totList();
74 const std::vector<float>& Charges = theCluster->
chargeList();
75 auto theNonConstCluster = const_cast<InDet::PixelCluster*> (theCluster);
76 ATH_MSG_DEBUG(
"cluster RDOs , size, ToTs, size, Charges, size "<< RDOs <<
" "<<RDOs.size()<<
" "<< ToTs<<
" " <<ToTs.size()<<
" "<<Charges<<
" "<<Charges.size());
77
78 const InDetDD::SiDetectorElement* element=theCluster->
detectorElement();
79 if (element==0) {
81 return StatusCode::FAILURE;
82 }
83 const AtlasDetectorID* aid = element->
getIdHelper();
84 if (aid==0){
86 }
87 const PixelID* pixelIDp=dynamic_cast<const PixelID*>(aid);
88 if (!pixelIDp){
90 return StatusCode::FAILURE;
91 }
92 const PixelID& pixelID = *pixelIDp;
93
94 int nRDO=RDOs.size();
95
96 if(ToTs.size()==0 && Charges.size()!=0){
97
98 auto biggest_charge = std::max_element(std::begin(Charges), std::end(Charges));
99 ATH_MSG_DEBUG(
"Max element of Charges is " << *biggest_charge);
100 if(*biggest_charge==0.) return StatusCode::SUCCESS;
101
102 int sumToT = 0;
103 std::vector<int> totList;
104
105 for (
int i=0;
i<nRDO;
i++) {
106 Identifier pixid=RDOs[
i];
108
109 Identifier moduleID = pixelID.
wafer_id(pixid);
110 IdentifierHash moduleHash = pixelID.
wafer_hash(moduleID);
113 int totInt = calibData->
getToT(type, moduleHash, FE, Charges[i]);
114
116 int tot0 = totInt;
117 if ( totInt >= overflowIBLToT ) totInt = overflowIBLToT;
118 msg(MSG::DEBUG) <<
"barrel_ec = " << pixelID.
barrel_ec(pixid) <<
" layer_disque = " << pixelID.
layer_disk(pixid) <<
" ToT = " << tot0 <<
" Real ToT = " << totInt <<
endmsg;
119 }
120
121 totList.push_back( totInt ) ;
122 ATH_MSG_DEBUG(
"from Charge --> ToT " << Charge <<
" "<< totInt);
123 sumToT += totInt;
124 }
126 theNonConstCluster->setToTList (std::move (totList));
127 }
128
129 }
130
131 }
132
133
134 return StatusCode::SUCCESS;
135}
DataModel_detail::const_iterator< DataVector > const_iterator
Standard const_iterator.
const AtlasDetectorID * getIdHelper() const
Returns the id helper (inline)
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...
Trk::PrepRawDataCollection< PixelCluster > PixelClusterCollection
constexpr int getFEI4OverflowToT() const
float getToT(InDetDD::PixelDiodeType type, unsigned int moduleHash, unsigned int FE, float Q) const
ServiceHandle< InDetDD::IPixelReadoutManager > m_pixelReadout
SG::ReadHandleKey< InDet::PixelClusterContainer > m_pixelsClustersKey
SG::ReadCondHandleKey< PixelChargeCalibCondData > m_chargeDataKey
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
const std::vector< Identifier > & rdoList() const
return the List of rdo identifiers (pointers)