..........................................................
62{
64
65 SG::ReadCondHandle<CaloDetDescrManager> caloMgrHandle{
m_caloMgrKey};
67 const CaloDetDescrManager* caloDDMgr = *caloMgrHandle;
68
69 std::vector<SG::WriteHandle<CaloCellContainer> > truthCells;
70 std::vector<SG::WriteHandle<xAOD::CaloClusterContainer> > truthClusters;
71 std::vector<SG::WriteHandle<CaloClusterCellLinkContainer> > truthLinks;
72
73
74
76
78 ATH_CHECK(truthCells.back().record(std::make_unique<CaloCellContainer>()));
79
82
84 ATH_CHECK(truthLinks.back().record(std::make_unique<CaloClusterCellLinkContainer>()));
85 }
86
87
89 std::vector<const CaloCalibrationHitContainer*> calibHitContainers(nCont,nullptr);
90 for (
unsigned int i=0;
i<nCont;
i++) {
93 ATH_MSG_DEBUG(
" Retrieved container " << calibHitContainers[i]->
Name() <<
" with size " << calibHitContainers[i]->
Size() );
94 if( calibHitContainers[i]->
Size() == 0 ) {
96 }
97 }
98 ATH_MSG_DEBUG(
"CaloCalibrationHitContainers retrieved successfuly" );
99
100
102 int em_nchan=0;
103 int hec_nchan=0;
104 int fcal_nchan=0;
105 int tile_nchan=0;
106
107 std::vector<Identifier>
ID;
108
109 using CellPtr = std::unique_ptr<CaloCell>;
110 std::vector<CellPtr> CellsEtot;
111 std::vector<CellPtr> CellsEvis;
112 std::vector<CellPtr> CellsEem;
113
114 int nhitsInactive = 0;
115
116 for (
unsigned int i=0;
i<calibHitContainers.size();
i++) {
117 for( const auto *const calibhit: *(calibHitContainers[i])) {
118
120
121 double Etot = calibhit->energyTotal();
122 double Eem = calibhit->energy(0);
123 double Enonem = calibhit->energy(1);
124 double Evis = Eem + Enonem;
125
126 Identifier id=calibhit->cellID();
127
128
129 if (i>0) {
130
131 bool isNewId = true;
132 for (
int n=0;
n<nhitsInactive;
n++) {
133 if( id == ID[n] ) {
134 CellsEtot[
n]->addEnergy(Etot);
135 CellsEvis[
n]->addEnergy(Evis);
136 CellsEem[
n]->addEnergy(Eem);
137 isNewId = false;
138 break;
139 }
140 }
141 if(!isNewId) continue;
142 }
143
144
147 const CaloDetDescrElement* caloDDE = caloDDMgr->
get_element(
id);
153 }
156 const CaloDetDescrElement* caloDDE = caloDDMgr->
get_element(
id);
162 }
163 else {
166 continue;
167 }
168 }
169 if (i==0) nhitsInactive = (
int)
ID.size();
170 }
171
172
173
174
175
176
177
179
180 for(
int itr=0; itr!=
nchan; itr++) {
185 ++em_nchan;
186 }
187 }
188 if(em_nchan) {
190 }
191
192 for(
int itr=0; itr!=
nchan; itr++) {
197 ++hec_nchan;
198 }
199 }
200 if(hec_nchan){
202 }
203
204 for(
int itr=0; itr!=
nchan; itr++) {
209 ++fcal_nchan;
210 }
211 }
212 if(fcal_nchan) {
214 }
215
216 for(
int itr=0; itr!=
nchan; itr++) {
221 ++tile_nchan;
222 }
223 }
224 if(tile_nchan) {
226 }
233
235
237
242 if (!truthCluster[i]) {
244 return StatusCode::FAILURE;
245 }
246 for (const auto cell: *truthCells[i]) {
248 truthCluster[
i]->
addCell( truthCells[i]->findIndex(
cell->caloDDE()->calo_hash()) , 1.);
249 }
250
254 truthClusters[i].
ptr()));
255
257 }
258
260 return StatusCode::SUCCESS;
261}
#define ATH_MSG_DEBUG(x,...)
#define ATH_MSG_VERBOSE(x,...)
#define ATH_MSG_FATAL(x,...)
ServiceHandle< StoreGateSvc > & evtStore()
static void calculateKine(xAOD::CaloCluster *clu, const bool useweight=true, const bool updateLayers=true, const bool useGPUCriteria=false)
Helper class to calculate cluster kinematics based on cells.
static std::unique_ptr< xAOD::CaloCluster > makeCluster(const CaloCellContainer *cellCont)
Creates a valid CaloCluster with a private Aux-Store and CellLink container.
static StatusCode AddContainerWriteHandle(SG::WriteHandle< xAOD::CaloClusterContainer > &clusColl)
Creates a new xAOD::CaloClusterContainer in the given WriteHandle + CaloClusterAuxContainer and recor...
static StatusCode finalizeClusters(SG::WriteHandle< CaloClusterCellLinkContainer > &h, xAOD::CaloClusterContainer *pClusterColl)
Finalize clusters (move CaloClusterCellLink to a separate container).
const CaloDetDescrElement * get_element(const Identifier &cellId) const
get element by its identifier
void setClusterSize(const ClusterSize)
Get cluster size.
bool addCell(const unsigned index, const double weight)
Method to add a cell to the cluster (Beware: Kinematics not updated!).
bool isGenStable(const T &p)
Determine if the particle is stable at the generator (not det-sim) level,.
ID
//////////////////////////////////////// JetAlgorithmType::ID defines most common physics jet finding...
CaloCluster_v1 CaloCluster
Define the latest version of the calorimeter cluster class.