ATLAS Offline Software
Loading...
Searching...
No Matches
SCT_ClusterValidationNtupleWriter.cxx
Go to the documentation of this file.
1/*
2 Copyright (C) 2002-2025 CERN for the benefit of the ATLAS collaboration
3*/
4
6// SCT_ClusterValidationNtupleWriter.cxx
8
10
22#include "TrkTrack/Track.h"
23
24// Gaudi
25#include "GaudiKernel/SmartDataPtr.h"
26#include "GaudiKernel/ITHistSvc.h"
27
28#include "TTree.h"
29
30using CLHEP::GeV;
31
32InDet::SCT_ClusterValidationNtupleWriter::SCT_ClusterValidationNtupleWriter(const std::string& name, ISvcLocator* pSvcLocator):
33 AthAlgorithm(name, pSvcLocator),
34 m_sctid{nullptr},
35 m_riocontainer{nullptr},
36 m_nt{nullptr},
37 m_runNumber{0},
39 m_lumiBlock{0},
40 m_timeStamp{0},
42 m_nRIOs{0},
43 m_rioLoc1{nullptr},
44 m_rioSurfaceX{nullptr},
45 m_rioSurfaceY{nullptr},
46 m_rioSurfaceZ{nullptr},
47 m_SctBarrelEndcap{nullptr},
48 m_SctLayerDisk{nullptr},
49 m_SctEtaModule{nullptr},
50 m_SctPhiModule{nullptr},
51 m_SctSide{nullptr},
52 m_SctDeltaPhi{nullptr},
53 m_SctHitErr{nullptr},
54 m_nSP{0},
55 m_sp_bec{nullptr},
56 m_sp_layer{nullptr},
57 m_sp_eta{nullptr},
58 m_sp_phi{nullptr},
59 m_sp_x{nullptr},
60 m_sp_y{nullptr},
61 m_sp_z{nullptr},
62 m_nRDOs{0},
63 m_sct_rdoGroupSize{nullptr},
64 m_sct_rdoIsOnTrack{nullptr},
65 m_sct_layer{nullptr},
66 m_sct_eta{nullptr},
67 m_sct_phi{nullptr},
68 m_sct_side{nullptr},
69 m_sct_barrelec{nullptr},
70 m_sct_firstStrip{nullptr},
71 m_sct_numHitsInWafer{nullptr},
72 m_sct_waferHash{nullptr},
73 m_sct_tbin{nullptr},
74 m_sct_rodid{nullptr},
75 m_sct_channel{nullptr},
77 m_scterr_bec{nullptr},
78 m_scterr_layer{nullptr},
79 m_scterr_eta{nullptr},
80 m_scterr_phi{nullptr},
81 m_scterr_side{nullptr},
82 m_scterr_rodid{nullptr},
83 m_scterr_channel{nullptr},
84 m_scterr_type{nullptr}
85
86 {
87 }
88
90
91 ATH_CHECK(detStore()->retrieve(m_sctid, "SCT_ID"));
92
93 if (m_fillBSErrs.value()) {
95 ATH_MSG_INFO("Retrieved tool " << m_byteStreamErrTool);
96
97 ATH_CHECK(m_cabling.retrieve());
98 ATH_MSG_INFO("Retrieved tool " << m_cabling);
99 } else {
100 m_byteStreamErrTool.disable();
101 m_cabling.disable();
102 }
103
104
105 // ---------------------------
106 // retrieve pointer to THistSvc
107 SmartIF<ITHistSvc> tHistSvc{Gaudi::svcLocator()->service("THistSvc")};
108 ATH_CHECK(tHistSvc.isValid());
109
110 // ---------------------------
111 // create tree and register it to THistSvc
112 m_nt = new TTree(TString(m_ntupleTreeName.value()), "SCT_Clusters");
113 // NB: we must not delete the tree, this is done by THistSvc
114 std::string fullNtupleName = "/"+m_ntupleFileName.value()+"/"+m_ntupleDirName.value()+"/"+m_ntupleTreeName.value();
115 StatusCode sc = tHistSvc->regTree(fullNtupleName, m_nt);
116 if (sc.isFailure()) {
117 ATH_MSG_ERROR( "Unable to register TTree : " << fullNtupleName );
118 return sc;
119 }
120 //-----------------
121 // add items
122 // event info:
123
124 m_nt->Branch("SCT_RunNumber", &m_runNumber, "run_number/I");
125 m_nt->Branch("SCT_EventNumber", &m_eventNumber, "event_number/I");
126 m_nt->Branch("SCT_LumiBlock", &m_lumiBlock, "lumi_block/I");
127 m_nt->Branch("SCT_TimeStamp", &m_timeStamp, "time_stamp/I");
128 m_nt->Branch("SCT_BunchCrossing", &m_bunchCrossing, "bunch_crossing/I");
129 m_nt->Branch("SCT_nRIOs", &m_nRIOs, "Number_of_RIOs/I");
130
131 // RIO info:
132 m_rioLoc1 = new std::vector<float>();
133 m_rioSurfaceX = new std::vector<float>();
134 m_rioSurfaceY = new std::vector<float>();
135 m_rioSurfaceZ = new std::vector<float>();
136 // SCT module info
137 m_SctBarrelEndcap= new std::vector<int>();
138 m_SctLayerDisk = new std::vector<int>();
139 m_SctEtaModule = new std::vector<int>();
140 m_SctPhiModule = new std::vector<int>();
141 m_SctSide = new std::vector<int>();
142 m_SctDeltaPhi = new std::vector<float>();
143 m_SctHitErr = new std::vector<float>();
144 // SCT RDO info
145 m_sct_rdoGroupSize = new std::vector<int>();
146 m_sct_rdoIsOnTrack = new std::vector<int>();
147 m_sct_layer = new std::vector<int>();
148 m_sct_eta = new std::vector<int>();
149 m_sct_phi = new std::vector<int>();
150 m_sct_side = new std::vector<int>();
151 m_sct_barrelec = new std::vector<int>();
152 m_sct_firstStrip = new std::vector<int>();
153 m_sct_numHitsInWafer = new std::vector<int>();
154 m_sct_waferHash = new std::vector<int>();
155 m_sct_tbin = new std::vector<int>();
156 m_sct_rodid = new std::vector<int>();
157 m_sct_channel = new std::vector<int>();
158 // SCT SpacePoint info
159 m_sp_bec = new std::vector<int>();
160 m_sp_layer = new std::vector<int>();
161 m_sp_eta = new std::vector<int>();
162 m_sp_phi = new std::vector<int>();
163 m_sp_x = new std::vector<float>();
164 m_sp_y = new std::vector<float>();
165 m_sp_z = new std::vector<float>();
166 // SCT BS error info
167 m_scterr_bec = new std::vector<int>();
168 m_scterr_layer = new std::vector<int>();
169 m_scterr_eta = new std::vector<int>();
170 m_scterr_phi = new std::vector<int>();
171 m_scterr_side = new std::vector<int>();
172 m_scterr_rodid = new std::vector<int>();
173 m_scterr_channel = new std::vector<int>();
174 m_scterr_type = new std::vector<int>();
175
176 if (m_fillCluster.value()) {
177 m_nt->Branch("SCT_DriftRadius", &m_rioLoc1);
178 m_nt->Branch("SCT_SurfaceX", &m_rioSurfaceX);
179 m_nt->Branch("SCT_SurfaceY", &m_rioSurfaceY);
180 m_nt->Branch("SCT_SurfaceZ", &m_rioSurfaceZ);
181
182 m_nt->Branch("SCT_BarrelEndcap", &m_SctBarrelEndcap);
183 m_nt->Branch("SCT_LayerDisk", &m_SctLayerDisk);
184 m_nt->Branch("SCT_EtaModule", &m_SctEtaModule);
185 m_nt->Branch("SCT_PhiModule", &m_SctPhiModule);
186 m_nt->Branch("SCT_Side", &m_SctSide);
187 m_nt->Branch("SCT_DeltaPhi", &m_SctDeltaPhi);
188 m_nt->Branch("SCT_HitErr", &m_SctHitErr);
189 }
190 if (m_fillSpacePoint.value()) {
191 m_nt->Branch("SP_SCT_nSpacePoints", &m_nSP);
192 m_nt->Branch("SP_SCT_BarrelEndcap", &m_sp_bec);
193 m_nt->Branch("SP_SCT_EtaModule", &m_sp_eta);
194 m_nt->Branch("SP_SCT_PhiModule", &m_sp_phi);
195 m_nt->Branch("SP_SCT_Layer", &m_sp_layer);
196 m_nt->Branch("SP_SCT_X", &m_sp_x);
197 m_nt->Branch("SP_SCT_Y", &m_sp_y);
198 m_nt->Branch("SP_SCT_Z", &m_sp_z);
199 }
200 if (m_fillRDO.value()) {
201 m_nt->Branch("RDO_SCT_nRDOs", &m_nRDOs);
202 m_nt->Branch("RDO_SCT_RDO_Group_Size", &m_sct_rdoGroupSize);
203 m_nt->Branch("RDO_SCT_Layer", &m_sct_layer);
204 m_nt->Branch("RDO_SCT_Eta", &m_sct_eta);
205 m_nt->Branch("RDO_SCT_Phi", &m_sct_phi);
206 m_nt->Branch("RDO_SCT_Side", &m_sct_side);
207 m_nt->Branch("RDO_SCT_Barrelec", &m_sct_barrelec);
208 m_nt->Branch("RDO_SCT_FirstStrip", &m_sct_firstStrip);
209 m_nt->Branch("RDO_SCT_NumHitsInWafer", &m_sct_numHitsInWafer);
210 m_nt->Branch("RDO_SCT_WaferHash", &m_sct_waferHash);
211 m_nt->Branch("RDO_SCT_TimeBin", &m_sct_tbin);
212 m_nt->Branch("RDO_SCT_RODId", &m_sct_rodid);
213 m_nt->Branch("RDO_SCT_Channel", &m_sct_channel);
214 if (m_doHitsOnTracks.value()) {
215 m_nt->Branch("RDO_SCT_isOnTrack", &m_sct_rdoIsOnTrack);
216 }
217 }
218 if (m_fillBSErrs.value()) {
219 m_nt->Branch("SCTErr_TotalNumBSErrs", &m_totalNumErrors,"numBSerrs/I");
220 m_nt->Branch("SCTErr_BEC", &m_scterr_bec);
221 m_nt->Branch("SCTErr_Layer", &m_scterr_layer);
222 m_nt->Branch("SCTErr_Eta", &m_scterr_eta);
223 m_nt->Branch("SCTErr_Phi", &m_scterr_phi);
224 m_nt->Branch("SCTErr_Side", &m_scterr_side);
225 m_nt->Branch("SCTErr_RODId", &m_scterr_rodid);
226 m_nt->Branch("SCTErr_Channel", &m_scterr_channel);
227 m_nt->Branch("SCTErr_Type", &m_scterr_type);
228 }
229
230 // Read Handle Key
231 ATH_CHECK( m_eventInfoKey.initialize() );
232 ATH_CHECK( m_jo_riocontainername.initialize(m_fillCluster.value()) );
233 ATH_CHECK( m_dataObjectName.initialize(m_fillRDO.value()) );
235 ATH_CHECK( m_inputTrackCollection.initialize(m_fillRDO.value() and m_doHitsOnTracks.value()) );
236
237 // Read Cond Handle Key
238 ATH_CHECK( m_SCTDetEleCollKey.initialize( m_fillCluster.value() ) );
239
240 return sc;
241}
242
244
245 //-------------
246 // get some event properties
248 if (not eventInfo.isValid()) {
249 ATH_MSG_ERROR( "Could not retrieve event info" );
250 }
251 m_runNumber = eventInfo->runNumber();
252 m_eventNumber = eventInfo->eventNumber();
253 m_lumiBlock = eventInfo->lumiBlock();
254 m_timeStamp = eventInfo->timeStamp();
255 m_bunchCrossing = eventInfo->bcid();
256
257 // reset variables
258 m_nRIOs = 0;
259 m_rioLoc1->clear();
260 m_rioSurfaceX->clear();
261 m_rioSurfaceY->clear();
262 m_rioSurfaceZ->clear();
263 m_SctBarrelEndcap->clear();
264 m_SctLayerDisk->clear();
265 m_SctEtaModule->clear();
266 m_SctPhiModule->clear();
267 m_SctSide->clear();
268 m_SctDeltaPhi->clear();
269 m_SctHitErr->clear();
270
271 m_nRDOs = 0;
272 m_sct_rdoGroupSize->clear();
273 m_sct_rdoIsOnTrack->clear();
274 m_sct_layer->clear();
275 m_sct_eta->clear();
276 m_sct_phi->clear();
277 m_sct_side->clear();
278 m_sct_barrelec->clear();
279 m_sct_firstStrip->clear();
280 m_sct_numHitsInWafer->clear();
281 m_sct_waferHash->clear();
282 m_sct_tbin->clear();
283 m_sct_rodid->clear();
284 m_sct_channel->clear();
285
286 m_nSP = 0;
287 m_sp_bec->clear();
288 m_sp_layer->clear();
289 m_sp_eta->clear();
290 m_sp_phi->clear();
291 m_sp_x->clear();
292 m_sp_y->clear();
293 m_sp_z->clear();
294
296 m_scterr_bec->clear();
297 m_scterr_layer->clear();
298 m_scterr_eta->clear();
299 m_scterr_phi->clear();
300 m_scterr_side->clear();
301 m_scterr_rodid->clear();
302 m_scterr_channel->clear();
303 m_scterr_type->clear();
304
305 // Retrieve containers which are required
306
307 // Container with SCT RIOs
308 m_riocontainer = nullptr;
309 if ( m_fillCluster.value()) {
311 if (not h_riocontainer.isValid()) {
312 ATH_MSG_DEBUG("Could not get PrepRawDataContainer");
313 } else {
314 m_riocontainer = &*h_riocontainer;
315 }
316 }
317
318 // SpacePoint container
319 const SpacePointContainer* p_spContainer = nullptr;
320 if (m_fillSpacePoint.value()) {
322 if (not h_spContainer.isValid()) {
323 ATH_MSG_DEBUG("Could not get SpacePointContainer");
324 } else {
325 p_spContainer = &*h_spContainer;
326 }
327 }
328
329 // RDO container
330 using SCTRawDataType = SCT_RDORawData;
331 const SCT_RDO_Container* p_rdocontainer = nullptr;
332 std::vector<Identifier> RDOsOnTracks;
333 if (m_fillRDO.value()) {
335 if (not h_rdocontainer.isValid()) {
336 ATH_MSG_DEBUG( "Failed to retrieve SCT RDO container" );
337 } else {
338 p_rdocontainer = &*h_rdocontainer;
339 }
340 if (m_doHitsOnTracks.value()) {
341 //Track container
343 if (not tracks.isValid()) {
344 ATH_MSG_ERROR("Track container not found");
345 } else {
346 // assemble list of RDOs on Tracks
347 for (int i=0; i<(int)tracks->size(); i++) {
348 const Trk::Track *track=(*tracks)[i];
349 if (track == nullptr) {
350 ATH_MSG_ERROR("no pointer to track!");
351 break;
352 }
353 // Get pointer to track state on surfaces
354 const Trk::TrackStates* trackStates=track->trackStateOnSurfaces();
355 if (trackStates == nullptr) {
356 ATH_MSG_WARNING("for current track is TrackStateOnSurfaces == Null, no data will be written for this track");
357 } else {
358 // Loop over all track states on surfaces
359 for (Trk::TrackStates::const_iterator it=trackStates->begin(); it!=trackStates->end(); ++it) {
360 // Get pointer to RIO of right type
361 const InDet::SiClusterOnTrack *clus =
362 dynamic_cast<const InDet::SiClusterOnTrack*>((*it)->measurementOnTrack());
363 if (clus) {
364 // Get Pointer to prepRawDataObject
365 const InDet::SiCluster *RawDataClus
366 = dynamic_cast<const InDet::SiCluster*>(clus->prepRawData());
367 if (RawDataClus==nullptr) {
368 ATH_MSG_WARNING("SiCluster WITHOUT prepRawData!!!!");
369 break;
370 }
371 // if Cluster is in SCT ...
372 if (RawDataClus->detectorElement()->isSCT()) {
373
374 const std::vector<Identifier>& rdoList = RawDataClus->rdoList();
375 RDOsOnTracks.insert(RDOsOnTracks.end(),rdoList.begin(),rdoList.end());
376 }
377 }
378 }
379 }
380 }
381 }
382 } // end of m_doHitsOnTracks
383 }
384
385
386 // Fill clusters
387 if (m_fillCluster.value() && m_riocontainer !=nullptr) {
388
389 int RIOindex = 0;
390
391 // -----------------------
392 // get all the RIO_Collections in the container
393 InDet::SCT_ClusterContainer::const_iterator containerIterator = m_riocontainer->begin();
394 for( ; containerIterator != m_riocontainer->end(); ++containerIterator) {
395 ATH_MSG_DEBUG( "There are " << (*containerIterator)->size() << " entries in the PrepRawDataCollection" );
396
397 // ---------------------------------
398 //get all the RIOs in the collection
399
400 InDet::SCT_ClusterCollection::const_iterator rioIterator = (*containerIterator)->begin();
401 for (; rioIterator != (*containerIterator)->end(); ++rioIterator) {
402 // get the surface center of the RIO
403 if (!(*rioIterator)) {
404 ATH_MSG_WARNING( "nullptr to RIO" );
405 continue;
406 }
407 if (!((*rioIterator)->detectorElement())) {
408 ATH_MSG_WARNING( "in RIO: nullptr to detElement" );
409 continue;
410 }
411
412 if (m_nRIOs >=500000) {
413 ATH_MSG_WARNING( "reached max. number of RIO entries in the ntuple" );
414 m_nt->Fill();
415 return StatusCode::SUCCESS;
416
417 }
418 const Amg::Vector3D surfaceGlobPos = (*rioIterator)->detectorElement()->center( (*rioIterator)->identify() ) ;
419 // fill surface global position
420 m_rioSurfaceX->push_back(float(surfaceGlobPos.x()));
421 m_rioSurfaceY->push_back(float(surfaceGlobPos.y()));
422 m_rioSurfaceZ->push_back(float(surfaceGlobPos.z()));
423 // get the local position of the RIO
424 const Amg::Vector2D locPos = (*rioIterator)->localPosition();
425 // fill local position
426 m_rioLoc1->push_back(float(locPos[Trk::locX]));
427
428 Identifier clId = (*rioIterator)->identify();
429 const SCT_Cluster& cluster = **rioIterator;
430 const InDet::SiWidth& width = cluster.width();
431 m_SctDeltaPhi->push_back(float(width.phiR()));
432 m_SctLayerDisk->push_back(int(m_sctid->layer_disk(clId)));
433 m_SctEtaModule->push_back(int(m_sctid->eta_module(clId)));
434 m_SctPhiModule->push_back(int(m_sctid->phi_module(clId)));
435 m_SctSide->push_back(int(m_sctid->side(clId)));
436 m_SctBarrelEndcap->push_back(int(m_sctid->barrel_ec(clId))) ; //endcap or barrel
437 //determine hit error
438 // bool SctCluster_is_1dim = (cluster.localParameters().parameterKey() == 1);
439 /*if (SctCluster_is_1dim)*/
440 m_SctHitErr->push_back( Amg::error(cluster.localCovariance(),1));
441 // else {
442 // HepSymMatrix CovMat;
443 // CovMat = cluster.localErrorMatrix();covariance();
444 // if (CovMat.num_col() == 2) {
445 // //ATH_MSG_DEBUG( "hit CovMat:" << CovMat[0,0] << " " << CovMat[0,1] << " " );
446 // //ATH_MSG_DEBUG( " " << CovMat[1,0] << " " << CovMat[1,1] << " " );
447 // const double hitErr = sqrt(CovMat[0][0]);
448 // }
449 // m_SctHitErr->push_back(hitErr);
450 //
451 // }
452 //
453 // count the RIO
454 RIOindex++;
455 }
456 }
457 m_nRIOs = RIOindex;
458 }
459
461
462 if (m_fillSpacePoint.value() && p_spContainer != nullptr) {
464 std::pair<IdentifierHash, IdentifierHash> sp_clusInfo;
465 //loop over SCT space points collections
466 for(SpacePointContainer::const_iterator it=p_spContainer->begin(); it!=p_spContainer->end(); ++it) {
467 const SpacePointCollection *colNext=&(**it);
468 if (!colNext) continue;
469
470 //loop over SpacePoints
471 for(p_sp=colNext->begin(); p_sp!=colNext->end(); ++p_sp) {
472 m_nSP++;
473 const Trk::SpacePoint& sp = **p_sp;
474 // Getting [layer/phi] from the one of the two clusters
475 sp_clusInfo = sp.elementIdList();
476 IdentifierHash first_clus = sp_clusInfo.first;
477 Identifier waferId = m_sctid->wafer_id(first_clus);
478 m_sp_bec->push_back(m_sctid->barrel_ec(waferId));
479 m_sp_layer->push_back(m_sctid->layer_disk(waferId));
480 m_sp_phi->push_back(m_sctid->phi_module(waferId));
481 m_sp_eta->push_back(m_sctid->eta_module(waferId));
483 // HepPoint3D point = sp.globalPosition();
484 Amg::Vector3D point = sp.globalPosition();
485 m_sp_x->push_back(point.x());
486 m_sp_y->push_back(point.y());
487 m_sp_z->push_back(point.z());
488 }
489 }
490 }
492 if (m_fillRDO.value() && p_rdocontainer !=nullptr) {
493
494 SCT_RDO_Container::const_iterator col_it = p_rdocontainer->begin();
495 SCT_RDO_Container::const_iterator lastCol = p_rdocontainer->end();
496 for( ; col_it!= lastCol ; ++col_it) {
497 const InDetRawDataCollection<SCTRawDataType>* SCT_Collection(*col_it);
498
499 if (!SCT_Collection) continue; // select only SCT RDOs
500 Identifier theWaferIdOfTheRDOCollection = SCT_Collection->identify();
501 unsigned int theHashOfTheRDOCollection= m_sctid->wafer_hash(theWaferIdOfTheRDOCollection);
503 uint32_t onlineID = m_cabling->getOnlineIdFromHash(theHashOfTheRDOCollection);
504 SCT_OnlineId online(onlineID);
505 uint32_t rod = online.rod();
506 uint32_t fibre = online.fibre();
507
508 DataVector<SCTRawDataType>::const_iterator p_rdo=SCT_Collection->begin() ;
509 DataVector<SCTRawDataType>::const_iterator end_rdo = SCT_Collection->end();
510 int totalNumberOfStrips=0;
511 int thisBec = m_sctid->barrel_ec(theWaferIdOfTheRDOCollection);
512 int thisLayerDisk = m_sctid->layer_disk(theWaferIdOfTheRDOCollection);
513 int thisPhi = m_sctid->phi_module(theWaferIdOfTheRDOCollection);
514 int thisEta = m_sctid->eta_module(theWaferIdOfTheRDOCollection);
515 int thisSide = m_sctid->side(theWaferIdOfTheRDOCollection);
516
517 m_nRDOs += SCT_Collection->size();
518 for(; p_rdo!=end_rdo; ++p_rdo) {
519
520 // SCT RDO Group Size;
521 m_sct_rdoGroupSize->push_back((*p_rdo)->getGroupSize());
522 totalNumberOfStrips=totalNumberOfStrips+((*p_rdo)->getGroupSize());
523
524 Identifier SCT_Identifier = (*p_rdo)->identify();
525
526 // SCT_ClusterStruct cluster;
527 m_sct_firstStrip->push_back(m_sctid->strip(SCT_Identifier));
528
529 //Identifier wafer_id = m_sctid->wafer_id(SCT_Identifier);
530
531 m_sct_layer->push_back(thisLayerDisk);
532 m_sct_eta->push_back(thisEta);
533 m_sct_phi->push_back(thisPhi);
534 m_sct_side->push_back(thisSide);
535 m_sct_barrelec->push_back(thisBec);
536 m_sct_numHitsInWafer->push_back(totalNumberOfStrips);
537 m_sct_waferHash->push_back(theHashOfTheRDOCollection);
538 const SCT3_RawData* rdo3 = dynamic_cast<const SCT3_RawData*>(*p_rdo);
539 if (rdo3!=nullptr) {
540 m_sct_tbin->push_back(rdo3->getTimeBin());
541 } else {
542 m_sct_tbin->push_back(-1);
543 }
544 m_sct_rodid->push_back(rod);
545 m_sct_channel->push_back(fibre);
546
547 if (m_doHitsOnTracks.value()) {
548 int isOnTrack = 0;
549 if (find(RDOsOnTracks.begin(),RDOsOnTracks.end(),SCT_Identifier) != RDOsOnTracks.end())
550 isOnTrack = 1;
551 m_sct_rdoIsOnTrack->push_back(isOnTrack);
552 }
553 }
554 }
555 }
556
558 if (m_fillBSErrs.value()) {
563 for (int type=0; type < SCT_ByteStreamErrors::NUM_ERROR_TYPES; ++type) {
564 const std::set<IdentifierHash> errorSet = m_byteStreamErrTool->getErrorSet(type);
565
566 int eta=0,phi=0,bec=0,layer=0,side=0;
567 m_totalNumErrors += errorSet.size();
568 for(const auto& idHash : errorSet) {
569 Identifier itId = m_sctid->wafer_id(idHash);
570 layer = m_sctid->layer_disk(itId);
571 side = m_sctid->side(itId);
572 eta = m_sctid->eta_module(itId);
573 phi = m_sctid->phi_module(itId);
574 bec = m_sctid->barrel_ec(itId);
575 m_scterr_type->push_back(type);
576 m_scterr_bec->push_back(bec);
577 m_scterr_layer->push_back(layer);
578 m_scterr_eta->push_back(eta);
579 m_scterr_phi->push_back(phi);
580 m_scterr_side->push_back(side);
581
583 uint32_t onlineID = m_cabling->getOnlineIdFromHash(idHash);
584 SCT_OnlineId online(onlineID);
585 uint32_t rod = online.rod();
586 uint32_t fibre = online.fibre();
587 m_scterr_rodid->push_back((int)rod);
588 m_scterr_channel->push_back((int)fibre);
589 }
590
591 }
592 }
593 m_nt->Fill();
594 return StatusCode::SUCCESS;
595}
596
597
599 ATH_MSG_INFO( "SCT_ClusterValidationNtupleWriter finalize()" );
600 delete m_rioLoc1;
601 delete m_rioSurfaceX;
602 delete m_rioSurfaceY;
603 delete m_rioSurfaceZ;
604 delete m_SctBarrelEndcap;
605 delete m_SctLayerDisk;
606 delete m_SctEtaModule;
607 delete m_SctPhiModule;
608 delete m_SctSide;
609 delete m_SctDeltaPhi;
610 delete m_SctHitErr;
611 delete m_sp_bec;
612 delete m_sp_layer;
613 delete m_sp_eta;
614 delete m_sp_phi;
615 delete m_sp_x;
616 delete m_sp_y;
617 delete m_sp_z;
618 delete m_sct_rdoGroupSize;
619 delete m_sct_rdoIsOnTrack;
620 delete m_sct_layer;
621 delete m_sct_eta;
622 delete m_sct_phi;
623 delete m_sct_side;
624 delete m_sct_barrelec;
625 delete m_sct_firstStrip;
627 delete m_sct_waferHash;
628 delete m_sct_tbin;
629 delete m_sct_rodid;
630 delete m_sct_channel;
631 delete m_scterr_bec;
632 delete m_scterr_layer;
633 delete m_scterr_eta;
634 delete m_scterr_phi;
635 delete m_scterr_side;
636 delete m_scterr_rodid;
637 delete m_scterr_channel;
638 delete m_scterr_type;
639
640 m_rioLoc1=nullptr;
641 m_rioSurfaceX=nullptr;
642 m_rioSurfaceY=nullptr;
643 m_rioSurfaceZ=nullptr;
644 m_SctBarrelEndcap=nullptr;
645 m_SctLayerDisk=nullptr;
646 m_SctEtaModule=nullptr;
647 m_SctPhiModule=nullptr;
648 m_SctSide=nullptr;
649 m_SctDeltaPhi=nullptr;
650 m_SctHitErr=nullptr;
651 m_sp_bec=nullptr;
652 m_sp_layer=nullptr;
653 m_sp_eta=nullptr;
654 m_sp_phi=nullptr;
655 m_sp_x=nullptr;
656 m_sp_y=nullptr;
657 m_sp_z=nullptr;
658 m_sct_rdoGroupSize=nullptr;
659 m_sct_rdoIsOnTrack=nullptr;
660 m_sct_layer=nullptr;
661 m_sct_eta=nullptr;
662 m_sct_phi=nullptr;
663 m_sct_side=nullptr;
664 m_sct_barrelec=nullptr;
665 m_sct_firstStrip=nullptr;
666 m_sct_numHitsInWafer=nullptr;
667 m_sct_waferHash=nullptr;
668 m_sct_tbin=nullptr;
669 m_sct_rodid=nullptr;
670 m_sct_channel=nullptr;
671 m_scterr_bec=nullptr;
672 m_scterr_layer=nullptr;
673 m_scterr_eta=nullptr;
674 m_scterr_phi=nullptr;
675 m_scterr_side=nullptr;
676 m_scterr_rodid=nullptr;
677 m_scterr_channel=nullptr;
678 m_scterr_type=nullptr;
679
680 return StatusCode::SUCCESS;
681}
Scalar eta() const
pseudorapidity method
Scalar phi() const
phi method
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_ERROR(x)
#define ATH_MSG_INFO(x)
#define ATH_MSG_WARNING(x)
#define ATH_MSG_DEBUG(x)
An STL vector of pointers that by default owns its pointed-to elements.
static Double_t sp
static Double_t sc
This is an Identifier helper class for the SCT subdetector.
Header file for a utility class to hold the online id.
InDetRawDataContainer< InDetRawDataCollection< SCT_RDORawData > > SCT_RDO_Container
Handle class for reading from StoreGate.
const double width
AthAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
Constructor with parameters:
const ServiceHandle< StoreGateSvc > & detStore() const
DataModel_detail::const_iterator< DataVector > const_iterator
Definition DataVector.h:838
const_iterator end() const noexcept
Return a const_iterator pointing past the end of the collection.
const_iterator begin() const noexcept
Return a const_iterator pointing at the beginning of the collection.
size_type size() const noexcept
Returns the number of elements in the collection.
const_iterator end() const
return const_iterator for end of container
const_iterator begin() const
return const_iterator for first entry
This is a "hash" representation of an Identifier.
virtual Identifier identify() const override final
std::vector< int > * m_scterr_phi
phi of the SCT wafer
SG::ReadHandleKey< SCT_ClusterContainer > m_jo_riocontainername
std::vector< int > * m_SctSide
from IdHelper: side index (0/1)
std::vector< int > * m_sct_phi
phi of the SCT wafer
std::vector< int > * m_sp_layer
index of the SCT-layer in which the SCT wafer is positioned for SpacePoint
std::vector< float > * m_SctHitErr
please provide description!
std::vector< int > * m_sp_eta
eta index of the SCT-layer in which the SCT wafer is positioned for SpacePoint
std::vector< int > * m_sct_eta
eta of the SCT wafer
std::vector< int > * m_sp_bec
Barrel or endcap index (barrel: 0, endcap: +/-2) for SpacePoint.
int m_eventNumber
event number for current PRD vector
std::vector< int > * m_sct_numHitsInWafer
number of hits in the SCT wafer
std::vector< float > * m_rioLoc1
local x coordinate of strip UNIT:mm
std::vector< int > * m_scterr_bec
barrel/endcap index (barrel: 0, endcap: +/-2)
std::vector< int > * m_sct_channel
channel within ROD of the RDO
std::vector< int > * m_scterr_rodid
online ID of ROD containing link
std::vector< int > * m_scterr_side
side of the SCT wafer (0 or 1) within the module
std::vector< float > * m_rioSurfaceY
global x coordinate of SCT wafer center UNIT:mm
StringProperty m_ntupleTreeName
jobOption: Ntuple tree name
BooleanProperty m_doHitsOnTracks
flag to book, access and fill RDO isOnTrack or not
BooleanProperty m_fillBSErrs
flag to book, access and fill ByteStream errors or not
std::vector< int > * m_scterr_layer
layer (barrel) or disk (endcap) of wafer with the error
std::vector< int > * m_sct_barrelec
barrel/endcap index (barrel: 0, endcap: +/-2)
std::vector< int > * m_sct_firstStrip
index (could be from 0 to 767) of the fired strip within the SCT wafer
std::vector< int > * m_SctEtaModule
from IdHelper: module index in eta
virtual StatusCode finalize() override
standard Athena-Algorithm method
std::vector< int > * m_sct_layer
index of the SCT-layer in which the SCT wafer is positioned
virtual StatusCode execute() override
standard Athena-Algorithm method
virtual StatusCode initialize() override
standard Athena-Algorithm method
std::vector< int > * m_sp_phi
phi index of the SCT-layer in which the SCT wafer is positioned for SpacePoint
SG::ReadHandleKey< TrackCollection > m_inputTrackCollection
std::vector< float > * m_rioSurfaceZ
global x coordinate of SCT wafer center UNIT:mm
BooleanProperty m_fillCluster
flag to book, access and fill Cluster or not
std::vector< float > * m_sp_z
z position of SpacePoint in ATLAS coordinate system (mm)
std::vector< int > * m_scterr_eta
eta of the SCT wafer
StringProperty m_ntupleDirName
jobOption: Ntuple directory name
std::vector< int > * m_sct_waferHash
index (could be from 0 to 8175) of the fired SCT wafer
std::vector< int > * m_scterr_channel
online channel no.
std::vector< float > * m_SctDeltaPhi
please provide description!
SG::ReadCondHandleKey< InDetDD::SiDetectorElementCollection > m_SCTDetEleCollKey
std::vector< float > * m_rioSurfaceX
global x coordinate of SCT wafer center UNIT:mm
BooleanProperty m_fillRDO
flag to book, access and fill RDO or not
std::vector< int > * m_SctLayerDisk
from IdHelper: layer/disk index
ToolHandle< ISCT_ByteStreamErrorsTool > m_byteStreamErrTool
std::vector< int > * m_SctBarrelEndcap
from IdHelper: pos/neg barrel (+/-1) and pos/neg endcap (+/-2) UNIT:1:bar, 2:ec
BooleanProperty m_fillSpacePoint
flag to book, access and fill SpacePoints or not
std::vector< int > * m_sct_side
side of the SCT wafer (0 or 1) within the SCT module
SCT_ClusterValidationNtupleWriter(const std::string &name, ISvcLocator *pSvcLocator)
Standard Athena-Algorithm Constructor.
SG::ReadHandleKey< SCT_RDO_Container > m_dataObjectName
StringProperty m_ntupleFileName
jobOption: Ntuple file name
std::vector< float > * m_sp_x
x position of SpacePoint in ATLAS coordinate system (mm)
std::vector< int > * m_scterr_type
type of BS error (as defined in SCT_ByteStreamErrs enum in ISCT_ByteStreamErrorsSvc....
const InDet::SCT_ClusterContainer * m_riocontainer
container of RIOs
SG::ReadHandleKey< SpacePointContainer > m_spacePointContainerName
std::vector< int > * m_SctPhiModule
from IdHelper: module index in phi
std::vector< float > * m_sp_y
y position of SpacePoint in ATLAS coordinate system (mm)
RIO_OnTrack base class for Silicon detector in the InnerDetector.
const InDet::SiWidth & width() const
return width class reference
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...
int getTimeBin() const
SCT_OnlineId is a class to hold an online id number and provide check on validity,...
virtual bool isValid() override final
Can the handle be successfully dereferenced?
const Amg::MatrixX & localCovariance() const
return const ref to the error matrix
const std::vector< Identifier > & rdoList() const
return the List of rdo identifiers (pointers)
virtual const Trk::PrepRawData * prepRawData() const =0
returns the PrepRawData (also known as RIO) object to which this RIO_OnTrack is associated.
std::string find(const std::string &s)
return a remapped string
Definition hcg.cxx:138
double error(const Amg::MatrixX &mat, int index)
return diagonal error of the matrix caller should ensure the matrix is symmetric and the index is in ...
Eigen::Matrix< double, 2, 1 > Vector2D
Eigen::Matrix< double, 3, 1 > Vector3D
DataVector< const Trk::TrackStateOnSurface > TrackStates
@ locX
Definition ParamDefs.h:37