ATLAS Offline Software
Classes | Public Member Functions | Static Public Attributes | Private Member Functions | Static Private Member Functions | Private Attributes | List of all members
InDet::TRT_LocalOccupancy Class Reference

#include <TRT_LocalOccupancy.h>

Inheritance diagram for InDet::TRT_LocalOccupancy:
Collaboration diagram for InDet::TRT_LocalOccupancy:

Classes

struct  OccupancyData
 

Public Member Functions

 TRT_LocalOccupancy (const std::string &, const std::string &, const IInterface *)
 
virtual StatusCode initialize () override
 standard Athena-Algorithm method More...
 
virtual float LocalOccupancy (const EventContext &ctx, const Trk::Track &track) const override
 Return the local occupancy for the sectors crossed by a given track. More...
 
virtual float LocalOccupancy (const EventContext &ctx, const double eta, const double phi) const override
 
virtual std::map< int, double > getDetectorOccupancy (const EventContext &ctx, const TRT_RDO_Container *p_trtRDOContainer) const override
 Return a map of the occupancy in the barrel (-1,+1) and endcaps (-2,+2) More...
 
virtual std::vector< float > GlobalOccupancy (const EventContext &ctx) const override
 Return the global occupancy of the event. More...
 

Static Public Attributes

static const int NTOTAL = 7
 
static const int NLOCAL = 6
 
static const int NWHEEL = 34
 
static const int NLOCALPHI = 32
 

Private Member Functions

const OccupancyDatagetData (const EventContext &ctx) const
 
std::unique_ptr< OccupancyDatamakeData (const EventContext &ctx) const
 
std::unique_ptr< OccupancyDatamakeDataTrigger (const EventContext &ctx) const
 
bool passValidityGate (unsigned int word, float t0) const
 
void countHitsNearTrack (const EventContext &ctx, OccupancyData &data, int track_local[NLOCAL][NLOCALPHI]) const
 
int findArrayTotalIndex (const int det, const int lay) const
 To convert from array index to det id and viceversa. More...
 
int mapEtaToPartition (const double eta) const
 

Static Private Member Functions

static bool isMiddleBXOn (unsigned int word)
 
static int mapPhiToPhisector (const double phi)
 

Private Attributes

const TRT_IDm_TRTHelper {}
 External tools:
More...
 
ToolHandle< ITRT_CalDbToolm_CalDbTool {this, "TRTCalDbTool", "TRT_CalDbTool", ""}
 
SG::ReadHandleKey< TRT_DriftCircleContainerm_trt_driftcircles { this, "TRT_DriftCircleCollection", "TRT_DriftCircles", "m_trt_driftcircles" }
 
SG::ReadCondHandleKey< TRTCond::AliveStrawsm_strawReadKey {this,"AliveStraws","AliveStraws","AliveStraws in-key"}
 
SG::ReadCondHandleKey< TRTCond::StrawStatusDatam_strawStatusKey {this,"StrawStatus","StrawStatusData","StrawStatus key"}
 
SG::ReadHandleKey< OccupancyDatam_occupancyCacheRead {"OccupancyData"}
 
SG::WriteHandleKey< OccupancyDatam_occupancyCacheWrite {"OccupancyData"}
 
Gaudi::Property< bool > m_isTrigger {this, "isTrigger", false, ""}
 
Gaudi::Property< bool > m_T0Shift {this, "includeT0Shift", true, "choice to use T0shift or not"}
 
Gaudi::Property< float > m_lowGate {this, "LowGate", 14.0625*Gaudi::Units::ns, ""}
 
Gaudi::Property< float > m_highGate {this, "HighGate", 42.1875*Gaudi::Units::ns, ""}
 
Gaudi::Property< float > m_lowWideGate {this, "LowWideGate", 20.3125*Gaudi::Units::ns, ""}
 
Gaudi::Property< float > m_highWideGate {this, "HighWideGate", 54.6875*Gaudi::Units::ns, ""}
 

Detailed Description

TRT_LocalOccupancy is a tool to compute the TRT occupancy for the elements crossed by a track.

This tool has to be called with: StartEvent() before checking occupancy for a given track, so the different volumes are computed.

Then, for each track call LocalOccupancy( Track ) and a will be returned.

Author
Alejandro Alonso: Aleja.nosp@m.ndro.nosp@m..Alon.nosp@m.so@c.nosp@m.ern.c.nosp@m.h

Definition at line 52 of file TRT_LocalOccupancy.h.

Constructor & Destructor Documentation

◆ TRT_LocalOccupancy()

InDet::TRT_LocalOccupancy::TRT_LocalOccupancy ( const std::string &  t,
const std::string &  n,
const IInterface *  p 
)

Definition at line 42 of file TRT_LocalOccupancy.cxx.

45  :
46  base_class(t,n,p)
47 {
48 }

Member Function Documentation

◆ countHitsNearTrack()

void InDet::TRT_LocalOccupancy::countHitsNearTrack ( const EventContext &  ctx,
OccupancyData data,
int  track_local[NLOCAL][NLOCALPHI] 
) const
private

Definition at line 262 of file TRT_LocalOccupancy.cxx.

265 {
266 
268  if (!driftCircleContainer.isValid()){
269  ATH_MSG_FATAL("driftCircleContainer " << m_trt_driftcircles << " not available");
270  return;
271  }
272 
273  bool allOfEndcapAFound[2][NLOCALPHI] = {{false}};
274 
275  for (int i=0; i<NLOCAL; ++i){
276  for (int j=0; j<NLOCALPHI; ++j){
277 
278  // we are only interested in filling regions through which track passed
279  if (track_local[i][j] < 1) continue;
280 
281  // if we already filled this region, skip it
282  if (data.m_hit_local[i][j] > 0) continue;
283 
284  for (const InDet::TRT_DriftCircleCollection *colNext : *driftCircleContainer) {
285  if (!colNext) continue;
286  DataVector<TRT_DriftCircle>::const_iterator p_rdo = colNext->begin();
287  DataVector<TRT_DriftCircle>::const_iterator p_rdo_end = colNext->end();
288  for(; p_rdo!=p_rdo_end; ++p_rdo){
289  const TRT_DriftCircle* rdo = (*p_rdo);
290  if(!rdo) continue;
291 
292  Identifier id = rdo->identify();
293 
294  int det = m_TRTHelper->barrel_ec( id) ;
295  int lay = m_TRTHelper->layer_or_wheel( id) ;
296  int phi = m_TRTHelper->phi_module( id) ;
297  int i_total = findArrayTotalIndex(det, lay)-1;
298 
299  if (i_total != i || phi != j) continue; // only fill the one region [i][j]
300 
301  if (i%3==1 && lay>4) allOfEndcapAFound[(i<3?0:1)][phi]=true; //why the rescaling below?
302 
303  data.m_hit_local[i_total][phi] +=1;
304  }
305  }
306 
307  int hits = data.m_hit_local[i][j];
308  int stws = data.m_stw_local[i][j];
309  data.m_occ_local[i][j] = int(hits*100) / stws;
310 
311  }
312  }
313 
314  bool region_rescaled[NLOCAL][NLOCALPHI] = {{false}};
315 
316  // rescale endcap A regions if not all wheels were counted
317  for (int i=0; i<NLOCAL; ++i){
318  for (int j=0; j<NLOCALPHI; ++j){
319  if (i%3!=1) continue; // only looking in endcapA
320  // we are only interested in regions through which track passed
321  if (track_local[i][j] < 1) continue;
322  if (!allOfEndcapAFound[(i<3?0:1)][j] && !region_rescaled[i][j]){
323  // if there are no hits in last wheel of endcapA
324  // && we haven't already rescaled this region:
325  // scale it down so the denominator is realistic
326  data.m_occ_local[i][j]/=(data.m_stws_ratio[(i<3?0:1)][j]);
327  region_rescaled[i][j]=true;
328  }
329  else if (allOfEndcapAFound[(i<3?0:1)][j] && region_rescaled[i][j]){
330  // if there are hits in last wheel of endcapA
331  // && we already rescaled this region:
332  // scale it back up to count all of endcapA
333  data.m_occ_local[i][j]*=(data.m_stws_ratio[(i<3?0:1)][j]);
334  region_rescaled[i][j]=false;
335  }
336  }
337  }
338 
339  }

◆ findArrayTotalIndex()

int InDet::TRT_LocalOccupancy::findArrayTotalIndex ( const int  det,
const int  lay 
) const
private

To convert from array index to det id and viceversa.

Definition at line 403 of file TRT_LocalOccupancy.cxx.

403  {
404  int arrayindex = 0; // to be reset below
405  // NOTE: Below, arrayindex starts at 1
406  // because index 0 is filled with TOTAL value.
407  if (det == -1) arrayindex = 1; // barrel side C
408  else if (det == -2) { // endcap side C
409  if (lay < 6) arrayindex = 2; // wheel A
410  else arrayindex = 3; // wheel B
411  }
412  else if (det == 1) arrayindex = 4; // barrel side A
413  else if (det == 2) { // endcap side A
414  if (lay < 6) arrayindex = 5; // wheel A
415  else arrayindex = 6; // wheel B
416  }
417  else ATH_MSG_WARNING(" detector value is: " << det << ", out of range -2, -1, 1, 2, so THIS IS NOT TRT!!!");
418  return arrayindex;
419  }

◆ getData()

const TRT_LocalOccupancy::OccupancyData * InDet::TRT_LocalOccupancy::getData ( const EventContext &  ctx) const
private

Definition at line 452 of file TRT_LocalOccupancy.cxx.

453 {
455  if (rh.isValid()){
456  return rh.cptr();
457  }
458 
460  return wh.put (makeData(ctx), true);
461 }

◆ getDetectorOccupancy()

std::map< int, double > InDet::TRT_LocalOccupancy::getDetectorOccupancy ( const EventContext &  ctx,
const TRT_RDO_Container p_trtRDOContainer 
) const
overridevirtual

Return a map of the occupancy in the barrel (-1,+1) and endcaps (-2,+2)

Definition at line 191 of file TRT_LocalOccupancy.cxx.

193 {
195  const TRTCond::StrawStatusData *strawStatus{*strawStatusHandle};
196 
197  std::map<int,int> hitCounter;
198  std::map<int,double> occResults;
199 
200  TRT_RDO_Container::const_iterator RDO_collection_iter = p_trtRDOContainer->begin();
201  TRT_RDO_Container::const_iterator RDO_collection_end = p_trtRDOContainer->end();
202  for ( ; RDO_collection_iter!= RDO_collection_end; ++RDO_collection_iter) {
203  const InDetRawDataCollection<TRT_RDORawData>* RDO_Collection(*RDO_collection_iter);
204  if (!RDO_Collection) continue;
205  if (!RDO_Collection->empty()){
206  DataVector<TRT_RDORawData>::const_iterator r,rb=RDO_Collection->begin(),re=RDO_Collection->end();
207 
208  for(r=rb; r!=re; ++r) {
209  if (!*r)
210  continue;
211 
212  Identifier rdo_id = (*r)->identify();
213  IdentifierHash straw_hash = m_TRTHelper->straw_hash(rdo_id);
214 
215  //Check if straw is OK
216  if (strawStatus->findStatus(straw_hash) != TRTCond::StrawStatus::Good) {
217  continue;
218  }
219 
220  int det = m_TRTHelper->barrel_ec(rdo_id) ;
221 
222  unsigned int word = (*r)->getWord();
223 
224  double t0 = 0.;
225  if (m_T0Shift) {
226  unsigned mask = 0x02000000;
227  bool SawZero = false;
228  int tdcvalue;
229  for(tdcvalue=0;tdcvalue<24;++tdcvalue)
230  {
231  if ( (word & mask) && SawZero) break;
232  if ( !(word & mask) ) SawZero = true;
233  mask>>=1;
234  if(tdcvalue==7 || tdcvalue==15) mask>>=1;
235  }
236  if(tdcvalue!=0 && tdcvalue!=24) {
237  t0 = m_CalDbTool->getT0(rdo_id);
238  }
239  }
240 
241  if (!passValidityGate(word, t0)) continue;
242 
243  hitCounter[det] +=1;
244  }
245  }
246  }
247 
249  const TRTCond::AliveStraws* strawCounts{*strawHandle};
250 
251  const std::array<int,TRTCond::AliveStraws::NTOTAL> &straws = strawCounts->getStwTotal();
252 
253  occResults[-1] = (double)hitCounter[-1]/(double)straws[1];
254  occResults[-2] = (double)hitCounter[-2]/(double)(straws[2] + straws[3]);
255  occResults[1] = (double)hitCounter[1] /(double)straws[4];
256  occResults[2] = (double)hitCounter[2] /(double)(straws[5] + straws[6]);
257 
258  return occResults;
259 }

◆ GlobalOccupancy()

std::vector< float > InDet::TRT_LocalOccupancy::GlobalOccupancy ( const EventContext &  ctx) const
overridevirtual

Return the global occupancy of the event.

7 Floats: TRT, Barrel A / C, endcapA/B A/C

Definition at line 80 of file TRT_LocalOccupancy.cxx.

80  {
81  std::vector<float> output ;
82  if (m_isTrigger) {
83  ATH_MSG_INFO("Cannot compute Global Occupancies in trigger environment! Returning empty vector");
84  return output;
85  }
86 
87  const OccupancyData* data = getData(ctx);
88  if (!data) {
89  ATH_MSG_INFO("Cannot get occupancy data. Returning empty vector.");
90  return output;
91  }
92 
93  output.push_back( data->m_occ_total[0]*1.e-2 ) ; // Whole TRT
94  output.push_back( data->m_occ_total[1]*1.e-2 ) ; // Barrel C
95  output.push_back( data->m_occ_total[2]*1.e-2 ) ; // EndcapA C
96  output.push_back( data->m_occ_total[3]*1.e-2 ) ; // EndcapB C
97  output.push_back( data->m_occ_total[4]*1.e-2 ) ; // Barrel A
98  output.push_back( data->m_occ_total[5]*1.e-2 ) ; // EndcapA A
99  output.push_back( data->m_occ_total[6]*1.e-2 ) ; // EndcapB A
100 
101  ATH_MSG_DEBUG("Compute Global Occupancy: whole TRT: "
102  << output.at(0) << "\t Barrel C: " << output.at(1)
103  << "\t EndcapA C: " << output.at(2) << "\t EndcapB C: "
104  << output.at(3) << "\t Barrel A: " << output.at(4)
105  << "\t EndcapA A: " << output.at(5)
106  << "\t EndcapB A: " << output.at(6));
107  return output;
108 }

◆ initialize()

StatusCode InDet::TRT_LocalOccupancy::initialize ( )
overridevirtual

standard Athena-Algorithm method

Definition at line 51 of file TRT_LocalOccupancy.cxx.

52 {
53  // The TRT helper:
54  CHECK( detStore()->retrieve(m_TRTHelper, "TRT_ID") );
55 
56  // access to t0 and straw status
57  if (m_T0Shift) {
58  CHECK( m_CalDbTool.retrieve());
59  }
60  else { //use wider validity gate if no T0 shift
63  }
64 
65  //Initialize ReadHandleKeys - AllowEmpty has to be kept for overlay client passing RDOs as input arg
67 
70 
71  std::string OccupancyCacheName = "GlobalTRTOccupancyData";
72  m_occupancyCacheRead = OccupancyCacheName;
73  m_occupancyCacheWrite = OccupancyCacheName;
74  ATH_CHECK(m_occupancyCacheRead.initialize());
75  ATH_CHECK(m_occupancyCacheWrite.initialize());
76 
77  return StatusCode::SUCCESS;
78 }

◆ isMiddleBXOn()

bool InDet::TRT_LocalOccupancy::isMiddleBXOn ( unsigned int  word)
staticprivate

Definition at line 373 of file TRT_LocalOccupancy.cxx.

373  {
374  // check that there is at least one hit in middle 25 ns
375  unsigned mask = 0x00010000;
376  int i=0;
377  for (i=0; i<8; ++i) {
378  if (word & mask) return true;
379  mask >>= 1;
380  }
381 return false;
382 }

◆ LocalOccupancy() [1/2]

float InDet::TRT_LocalOccupancy::LocalOccupancy ( const EventContext &  ctx,
const double  eta,
const double  phi 
) const
overridevirtual

Definition at line 341 of file TRT_LocalOccupancy.cxx.

343  {
344  // take eta, phi of track, RoI, ... what have you
345  // return local occupancy in an appropriate region of the detector
346  // size of region is:
347  // - 1 of 6 partitions (barrel, endcapA, endcapB, sides A & C)
348  // - 1 of 32 phi modules (in triangular shape of chips, not 'pie slices')
349  ATH_MSG_DEBUG("LocalOccupancy(eta,phi)");
350 
351  const OccupancyData* data = getData(ctx);
352  if (!data) {
353  ATH_MSG_ERROR ("Cannot get occupancy data.");
354  return 0;
355  }
356 
357  int partition=mapEtaToPartition(t_eta);
358  int phisector=mapPhiToPhisector(t_phi);
359 
360  if (partition > 5 || phisector > 31) {
361  ATH_MSG_DEBUG("mapping failed ; returning global occ");
362  return data->m_occ_total[0]*1.e-2 ;
363  }
364 
365  float mapped_occ = data->m_occ_local[partition][phisector]*1.e-2;
366  ATH_MSG_DEBUG("returning mapped occupancy");
367  return mapped_occ;
368 
369  }

◆ LocalOccupancy() [2/2]

float InDet::TRT_LocalOccupancy::LocalOccupancy ( const EventContext &  ctx,
const Trk::Track track 
) const
overridevirtual

Return the local occupancy for the sectors crossed by a given track.

Definition at line 111 of file TRT_LocalOccupancy.cxx.

111  {
112  ATH_MSG_DEBUG("Compute LocalOccupancy(const Trk::Track& track ) for tool: " << name());
113 
114  int track_local[NLOCAL][NLOCALPHI]= {{0}};
115 
116  const Trk::TrackStates* trackStates = track.trackStateOnSurfaces();
117  Trk::TrackStates::const_iterator tsos =trackStates->begin();
118  Trk::TrackStates::const_iterator tsosEnd =trackStates->end();
119  for (;tsos!=tsosEnd;++tsos) {
120  const Trk::MeasurementBase* mesb = (*tsos)->measurementOnTrack();
121  if (!mesb) {
122  continue;
123  }
124  const InDet::TRT_DriftCircleOnTrack* driftcircle = nullptr;
126  const Trk::RIO_OnTrack* tmpRio = static_cast<const Trk::RIO_OnTrack*>(mesb);
128  driftcircle = static_cast<const InDet::TRT_DriftCircleOnTrack*>(tmpRio);
129  }
130  }
131 
132  if(!driftcircle) {
133  continue;
134  }
135 
136  Identifier id=driftcircle->identify();
137  int det = m_TRTHelper->barrel_ec( id) ;
138  int lay = m_TRTHelper->layer_or_wheel( id) ;
139  int phi = m_TRTHelper->phi_module( id) ;
140 
141  int i_total = findArrayTotalIndex(det, lay);
142  track_local[i_total-1][phi] +=1;
143 
144  }
145 
146  std::unique_ptr<OccupancyData> data_ptr;
147  const OccupancyData* data = nullptr;
148  if (m_isTrigger) {
149  data_ptr = makeDataTrigger(ctx);
150  countHitsNearTrack(ctx, *data_ptr, track_local);
151  data = data_ptr.get();
152  }
153  else
154  data = getData(ctx);
155 
156  if (!data) {
157  ATH_MSG_INFO("Cannot get occupancy data. Returning 0.");
158  return 0;
159  }
160 
161  float averageocc = 0;
162  int nhits = 0;
163  const std::array<std::array<int,NLOCALPHI>,NLOCAL> &stw_local = data->m_stw_local;
164 
165  for (int i=0; i<6; ++i){
166  for (int j = 0; j < 32; j++){
167 
168  float hits_array = track_local[i][j] ;
169  if (hits_array<1) continue;
170  float occ=0;
171  occ = (data->m_occ_local [i][j])*1.e-2 ;
172  if (stw_local[i][j] != 0){
173  if(occ == 0 && float(hits_array)/stw_local[i][j] > 0.01){
174  ATH_MSG_DEBUG("Occupancy is 0 for : " << i << " " << j << " BUT THERE ARE HITS!!!: " << hits_array);
175  continue;
176  }
177  }
178  averageocc += (occ*hits_array);
179  nhits += hits_array;
180 
181  ATH_MSG_DEBUG("new track: " << i << " " << j << "\t" << hits_array << "\t" << occ );
182  }
183  }
184  if (nhits>0) averageocc = averageocc / nhits;
185  ATH_MSG_DEBUG("Compute LocalOccupancy(const Trk::Track& track ) for tool: " << averageocc << " is over" );
186 
187  return averageocc;
188 }

◆ makeData()

std::unique_ptr< TRT_LocalOccupancy::OccupancyData > InDet::TRT_LocalOccupancy::makeData ( const EventContext &  ctx) const
private

Definition at line 465 of file TRT_LocalOccupancy.cxx.

466 {
467  // count live straws
469  const TRTCond::AliveStraws* strawCounts{*strawHandle};
470 
471  auto data = std::make_unique<OccupancyData>(strawCounts->getStwLocal());
472 
473  // put # hits in vectors
474  if ( m_trt_driftcircles.empty() ) {
475  ATH_MSG_WARNING("No TRT Drift Circles key is empty");
476  } else {
478  if ( driftCircleContainer.isValid() ) {
479  ATH_MSG_DEBUG("Found Drift Circles in StoreGate");
480  for (const InDet::TRT_DriftCircleCollection *colNext : *driftCircleContainer) {
481  if(!colNext) continue;
482  // loop over DCs
483  DataVector<TRT_DriftCircle>::const_iterator p_rdo = colNext->begin();
484  DataVector<TRT_DriftCircle>::const_iterator p_rdo_end = colNext->end();
485  for(; p_rdo!=p_rdo_end; ++p_rdo){
486  const TRT_DriftCircle* rdo = (*p_rdo);
487  if(!rdo) continue;
488  Identifier id = rdo->identify();
489 
490  int det = m_TRTHelper->barrel_ec( id) ;
491  int lay = m_TRTHelper->layer_or_wheel( id) ;
492  int phi = m_TRTHelper->phi_module( id) ;
493  int i_total = findArrayTotalIndex(det, lay);
494 
495  data->m_hit_total[0] +=1;
496  data->m_hit_total[i_total] +=1;
497  data->m_hit_local[i_total-1][phi] +=1;
498  }
499  }
500  } else {
501  ATH_MSG_WARNING("No TRT Drift Circles in StoreGate");
502  }
503  }
504 
505  const std::array<int,NTOTAL> &stw_total = strawCounts->getStwTotal();
506  const std::array<std::array<int,NLOCALPHI>,NLOCAL> &stw_local = strawCounts->getStwLocal();
507 
508  // Calculate Occs:
509  for (int i=0; i<NTOTAL; ++i) {
510  float occ = 0;
511  int hits = data->m_hit_total[i];
512  int stws = stw_total[i];
513  if (stws>0) occ = float(hits*100)/stws;
514  data->m_occ_total[i] = int(occ);
515  }
516  for (int i=0; i<NLOCAL; ++i) {
517  for (int j=0; j<NLOCALPHI; ++j) {
518  float occ = 0;
519  int hits = data->m_hit_local[i][j];
520  int stws = stw_local[i][j];
521  if (stws>0) occ = float(hits*100)/stws;
522  data->m_occ_local[i][j] = int(occ);
523  }
524  }
525 
526  ATH_MSG_DEBUG("Active straws: " << stw_total[0] << "\t total number of hits: "
527  << data->m_hit_total[0]
528  << "\t occ: " << data->m_occ_total[0]);
529  return data;
530 }

◆ makeDataTrigger()

std::unique_ptr< TRT_LocalOccupancy::OccupancyData > InDet::TRT_LocalOccupancy::makeDataTrigger ( const EventContext &  ctx) const
private

Definition at line 534 of file TRT_LocalOccupancy.cxx.

535 {
537  const TRTCond::AliveStraws* strawCounts{*strawHandle};
538 
539  auto data = std::make_unique<OccupancyData>(strawCounts->getStwLocal());
540  const std::array<std::array<int,NLOCALPHI>,NLOCAL> &stw_local = strawCounts->getStwLocal();;
541  const std::array<std::array<int,NLOCALPHI>,NWHEEL> &stw_wheel = strawCounts->getStwWheel();
542 
543  for (int i=0; i<5; ++i){
544  for (int j=0; j<NLOCALPHI; ++j){
545  data->m_stws_ratio[0][j]+=float(stw_wheel[i+3 ][j])/stw_local[1][j];
546  data->m_stws_ratio[1][j]+=float(stw_wheel[i+20][j])/stw_local[4][j];
547  }
548  }
549 
550  return data;
551 }

◆ mapEtaToPartition()

int InDet::TRT_LocalOccupancy::mapEtaToPartition ( const double  eta) const
private

Definition at line 434 of file TRT_LocalOccupancy.cxx.

434  {
435 
436  int partition=7;
437 
438  double abseta = fabs(t_eta);
439 
440  // do eta selection
441  if ( abseta <= 0.90 ) partition = 0;
442  else if ( abseta > 0.90 && abseta <= 1.55 ) partition = 1;
443  else if ( abseta > 1.55 && abseta <= 2.00 ) partition = 2;
444  else ATH_MSG_DEBUG("abs(eta) > 2.0 ; not in TRT!");
445 
446  if (t_eta>0.) partition += 3; // side A
447 
448  return partition;
449 }

◆ mapPhiToPhisector()

int InDet::TRT_LocalOccupancy::mapPhiToPhisector ( const double  phi)
staticprivate

Definition at line 421 of file TRT_LocalOccupancy.cxx.

421  {
422 
423  int phisector=33;
424  // do phi selection
425  // shift all phi to positive numbers
426  float dphi = 0; // TBD
427 
428  double phi2pi = (t_phi > 0) ? t_phi : t_phi + 2*M_PI;
429 
430  phisector = int ( (phi2pi + dphi)*32./(2*M_PI) );
431  return phisector;
432 }

◆ passValidityGate()

bool InDet::TRT_LocalOccupancy::passValidityGate ( unsigned int  word,
float  t0 
) const
private

Definition at line 384 of file TRT_LocalOccupancy.cxx.

384  {
385  bool foundInterval = false;
386  unsigned mask = 0x02000000;
387  int i = 0;
388  while ( !foundInterval && (i < 24) ) {
389  if (word & mask) {
390  float thisTime = ((0.5+i)*3.125)-t0;
391  if (thisTime >= m_lowGate && thisTime <= m_highGate) foundInterval = true;
392  }
393  mask >>= 1;
394  if (i == 7 || i == 15)
395  mask >>= 1;
396  i++;
397  }
398  return foundInterval;
399 }

Member Data Documentation

◆ m_CalDbTool

ToolHandle< ITRT_CalDbTool > InDet::TRT_LocalOccupancy::m_CalDbTool {this, "TRTCalDbTool", "TRT_CalDbTool", ""}
private

Definition at line 112 of file TRT_LocalOccupancy.h.

◆ m_highGate

Gaudi::Property<float> InDet::TRT_LocalOccupancy::m_highGate {this, "HighGate", 42.1875*Gaudi::Units::ns, ""}
private

Definition at line 124 of file TRT_LocalOccupancy.h.

◆ m_highWideGate

Gaudi::Property<float> InDet::TRT_LocalOccupancy::m_highWideGate {this, "HighWideGate", 54.6875*Gaudi::Units::ns, ""}
private

Definition at line 127 of file TRT_LocalOccupancy.h.

◆ m_isTrigger

Gaudi::Property<bool> InDet::TRT_LocalOccupancy::m_isTrigger {this, "isTrigger", false, ""}
private

Definition at line 121 of file TRT_LocalOccupancy.h.

◆ m_lowGate

Gaudi::Property<float> InDet::TRT_LocalOccupancy::m_lowGate {this, "LowGate", 14.0625*Gaudi::Units::ns, ""}
private

Definition at line 123 of file TRT_LocalOccupancy.h.

◆ m_lowWideGate

Gaudi::Property<float> InDet::TRT_LocalOccupancy::m_lowWideGate {this, "LowWideGate", 20.3125*Gaudi::Units::ns, ""}
private

Definition at line 126 of file TRT_LocalOccupancy.h.

◆ m_occupancyCacheRead

SG::ReadHandleKey<OccupancyData> InDet::TRT_LocalOccupancy::m_occupancyCacheRead {"OccupancyData"}
private

Definition at line 118 of file TRT_LocalOccupancy.h.

◆ m_occupancyCacheWrite

SG::WriteHandleKey<OccupancyData> InDet::TRT_LocalOccupancy::m_occupancyCacheWrite {"OccupancyData"}
private

Definition at line 119 of file TRT_LocalOccupancy.h.

◆ m_strawReadKey

SG::ReadCondHandleKey<TRTCond::AliveStraws> InDet::TRT_LocalOccupancy::m_strawReadKey {this,"AliveStraws","AliveStraws","AliveStraws in-key"}
private

Definition at line 115 of file TRT_LocalOccupancy.h.

◆ m_strawStatusKey

SG::ReadCondHandleKey<TRTCond::StrawStatusData> InDet::TRT_LocalOccupancy::m_strawStatusKey {this,"StrawStatus","StrawStatusData","StrawStatus key"}
private

Definition at line 116 of file TRT_LocalOccupancy.h.

◆ m_T0Shift

Gaudi::Property<bool> InDet::TRT_LocalOccupancy::m_T0Shift {this, "includeT0Shift", true, "choice to use T0shift or not"}
private

Definition at line 122 of file TRT_LocalOccupancy.h.

◆ m_trt_driftcircles

SG::ReadHandleKey<TRT_DriftCircleContainer> InDet::TRT_LocalOccupancy::m_trt_driftcircles { this, "TRT_DriftCircleCollection", "TRT_DriftCircles", "m_trt_driftcircles" }
private

Definition at line 113 of file TRT_LocalOccupancy.h.

◆ m_TRTHelper

const TRT_ID* InDet::TRT_LocalOccupancy::m_TRTHelper {}
private

External tools:

Definition at line 111 of file TRT_LocalOccupancy.h.

◆ NLOCAL

const int InDet::TRT_LocalOccupancy::NLOCAL = 6
static

Definition at line 77 of file TRT_LocalOccupancy.h.

◆ NLOCALPHI

const int InDet::TRT_LocalOccupancy::NLOCALPHI = 32
static

Definition at line 79 of file TRT_LocalOccupancy.h.

◆ NTOTAL

const int InDet::TRT_LocalOccupancy::NTOTAL = 7
static

Definition at line 75 of file TRT_LocalOccupancy.h.

◆ NWHEEL

const int InDet::TRT_LocalOccupancy::NWHEEL = 34
static

Definition at line 78 of file TRT_LocalOccupancy.h.


The documentation for this class was generated from the following files:
python.PyKernel.retrieve
def retrieve(aClass, aKey=None)
Definition: PyKernel.py:110
TRTCond::AliveStraws::getStwTotal
const std::array< int, NTOTAL > & getStwTotal() const
Definition: AliveStraws.h:23
InDet::TRT_LocalOccupancy::m_isTrigger
Gaudi::Property< bool > m_isTrigger
Definition: TRT_LocalOccupancy.h:121
AllowedVariables::e
e
Definition: AsgElectronSelectorTool.cxx:37
beamspotman.r
def r
Definition: beamspotman.py:676
data
char data[hepevt_bytes_allocation_ATLAS]
Definition: HepEvt.cxx:11
InDet::TRT_LocalOccupancy::mapEtaToPartition
int mapEtaToPartition(const double eta) const
Definition: TRT_LocalOccupancy.cxx:434
ATH_MSG_FATAL
#define ATH_MSG_FATAL(x)
Definition: AthMsgStreamMacros.h:34
DataModel_detail::const_iterator
Const iterator class for DataVector/DataList.
Definition: DVLIterator.h:82
InDet::TRT_LocalOccupancy::getData
const OccupancyData * getData(const EventContext &ctx) const
Definition: TRT_LocalOccupancy.cxx:452
InDet::TRT_LocalOccupancy::m_strawReadKey
SG::ReadCondHandleKey< TRTCond::AliveStraws > m_strawReadKey
Definition: TRT_LocalOccupancy.h:115
TRTCalib_Extractor.hits
hits
Definition: TRTCalib_Extractor.py:35
phi
Scalar phi() const
phi method
Definition: AmgMatrixBasePlugin.h:67
SG::ReadCondHandle
Definition: ReadCondHandle.h:44
ATH_MSG_INFO
#define ATH_MSG_INFO(x)
Definition: AthMsgStreamMacros.h:31
TRT_ID::straw_hash
IdentifierHash straw_hash(Identifier straw_id) const
straw hash from id - optimized
Definition: TRT_ID.h:768
CaloCellPos2Ntuple.int
int
Definition: CaloCellPos2Ntuple.py:24
WriteCellNoiseToCool.rb
rb
Definition: WriteCellNoiseToCool.py:229
TRTCalib_Extractor.det
det
Definition: TRTCalib_Extractor.py:36
InDet::TRT_LocalOccupancy::m_T0Shift
Gaudi::Property< bool > m_T0Shift
Definition: TRT_LocalOccupancy.h:122
InDet::TRT_LocalOccupancy::m_highGate
Gaudi::Property< float > m_highGate
Definition: TRT_LocalOccupancy.h:124
SG::ReadHandle
Definition: StoreGate/StoreGate/ReadHandle.h:70
TRTCond::StrawStatusData
Definition: StrawStatusData.h:17
InDet::TRT_LocalOccupancy::m_occupancyCacheRead
SG::ReadHandleKey< OccupancyData > m_occupancyCacheRead
Definition: TRT_LocalOccupancy.h:118
ALFA_EventTPCnv_Dict::t0
std::vector< ALFA_RawData_p1 > t0
Definition: ALFA_EventTPCnvDict.h:42
TRTCond::AliveStraws
Definition: AliveStraws.h:14
M_PI
#define M_PI
Definition: ActiveFraction.h:11
InDet::TRT_LocalOccupancy::m_highWideGate
Gaudi::Property< float > m_highWideGate
Definition: TRT_LocalOccupancy.h:127
InDet::TRT_LocalOccupancy::m_lowWideGate
Gaudi::Property< float > m_lowWideGate
Definition: TRT_LocalOccupancy.h:126
Trk::RIO_OnTrack::rioType
virtual bool rioType(RIO_OnTrackType::Type type) const =0
Method checking the Rio On Track type.
Trk::RIO_OnTrack
Definition: RIO_OnTrack.h:70
read_hist_ntuple.t
t
Definition: read_hist_ntuple.py:5
InDet::TRT_LocalOccupancy::countHitsNearTrack
void countHitsNearTrack(const EventContext &ctx, OccupancyData &data, int track_local[NLOCAL][NLOCALPHI]) const
Definition: TRT_LocalOccupancy.cxx:262
SG::VarHandleKey::empty
bool empty() const
Test if the key is blank.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:150
InDet::TRT_DriftCircleOnTrack
Definition: TRT_DriftCircleOnTrack.h:53
InDet::TRT_LocalOccupancy::mapPhiToPhisector
static int mapPhiToPhisector(const double phi)
Definition: TRT_LocalOccupancy.cxx:421
python.utils.AtlRunQueryLookup.mask
string mask
Definition: AtlRunQueryLookup.py:460
InDet::TRT_LocalOccupancy::findArrayTotalIndex
int findArrayTotalIndex(const int det, const int lay) const
To convert from array index to det id and viceversa.
Definition: TRT_LocalOccupancy.cxx:403
InDet::TRT_LocalOccupancy::makeData
std::unique_ptr< OccupancyData > makeData(const EventContext &ctx) const
Definition: TRT_LocalOccupancy.cxx:465
python.utils.AtlRunQueryDQUtils.p
p
Definition: AtlRunQueryDQUtils.py:210
ATH_MSG_ERROR
#define ATH_MSG_ERROR(x)
Definition: AthMsgStreamMacros.h:33
InDet::TRT_LocalOccupancy::NLOCALPHI
static const int NLOCALPHI
Definition: TRT_LocalOccupancy.h:79
lumiFormat.i
int i
Definition: lumiFormat.py:85
beamspotman.n
n
Definition: beamspotman.py:731
ATH_MSG_DEBUG
#define ATH_MSG_DEBUG(x)
Definition: AthMsgStreamMacros.h:29
InDet::TRT_LocalOccupancy::m_trt_driftcircles
SG::ReadHandleKey< TRT_DriftCircleContainer > m_trt_driftcircles
Definition: TRT_LocalOccupancy.h:113
InDetRawDataCollection
Definition: InDetRawDataCollection.h:31
parseDir.wh
wh
Definition: parseDir.py:46
ATH_CHECK
#define ATH_CHECK
Definition: AthCheckMacros.h:40
IdentifiableContainerMT::end
const_iterator end() const
return const_iterator for end of container
Definition: IdentifiableContainerMT.h:242
CHECK
#define CHECK(...)
Evaluate an expression and check for errors.
Definition: Control/AthenaKernel/AthenaKernel/errorcheck.h:422
Trk::MeasurementBase::type
virtual bool type(MeasurementBaseType::Type type) const =0
Interface method checking the type.
IdentifiableContainerMT::const_iterator
Definition: IdentifiableContainerMT.h:82
IdentifiableContainerMT::begin
const_iterator begin() const
return const_iterator for first entry
Definition: IdentifiableContainerMT.h:236
SG::VarHandleKey::initialize
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.
Definition: AthToolSupport/AsgDataHandles/Root/VarHandleKey.cxx:103
TRT_ID::barrel_ec
int barrel_ec(const Identifier &id) const
Values of different levels (failure returns 0)
Definition: TRT_ID.h:866
xAOD::double
double
Definition: CompositeParticle_v1.cxx:159
DataVector< const Trk::TrackStateOnSurface >
TRT_ID::layer_or_wheel
int layer_or_wheel(const Identifier &id) const
Definition: TRT_ID.h:884
InDet::TRT_LocalOccupancy::m_lowGate
Gaudi::Property< float > m_lowGate
Definition: TRT_LocalOccupancy.h:123
TRTCond::StrawStatus::Good
@ Good
Definition: StrawStatus.h:18
Trk::RIO_OnTrackType::TRT_DriftCircle
@ TRT_DriftCircle
Definition: RIO_OnTrack.h:59
merge.output
output
Definition: merge.py:17
Trk::MeasurementBase
Definition: MeasurementBase.h:58
python.PyKernel.detStore
detStore
Definition: PyKernel.py:41
InDet::TRT_LocalOccupancy::NWHEEL
static const int NWHEEL
Definition: TRT_LocalOccupancy.h:78
name
std::string name
Definition: Control/AthContainers/Root/debug.cxx:221
InDet::TRT_DriftCircleCollection
Trk::PrepRawDataCollection< TRT_DriftCircle > TRT_DriftCircleCollection
Definition: TRT_DriftCircleCollection.h:26
InDet::TRT_LocalOccupancy::makeDataTrigger
std::unique_ptr< OccupancyData > makeDataTrigger(const EventContext &ctx) const
Definition: TRT_LocalOccupancy.cxx:534
SG::CondHandleKey::initialize
StatusCode initialize(bool used=true)
TRT_ID::phi_module
int phi_module(const Identifier &id) const
Definition: TRT_ID.h:875
Trk::MeasurementBaseType::RIO_OnTrack
@ RIO_OnTrack
Definition: MeasurementBase.h:49
DataVector::end
const_iterator end() const noexcept
Return a const_iterator pointing past the end of the collection.
InDet::TRT_LocalOccupancy::passValidityGate
bool passValidityGate(unsigned int word, float t0) const
Definition: TRT_LocalOccupancy.cxx:384
SG::WriteHandle
Definition: StoreGate/StoreGate/WriteHandle.h:76
ATH_MSG_WARNING
#define ATH_MSG_WARNING(x)
Definition: AthMsgStreamMacros.h:32
InDet::TRT_LocalOccupancy::m_TRTHelper
const TRT_ID * m_TRTHelper
External tools:
Definition: TRT_LocalOccupancy.h:111
re
const boost::regex re(r_e)
Trk::RIO_OnTrack::identify
Identifier identify() const
return the identifier -extends MeasurementBase
Definition: RIO_OnTrack.h:152
StateLessPT_NewConfig.partition
partition
Definition: StateLessPT_NewConfig.py:49
InDet::TRT_LocalOccupancy::NLOCAL
static const int NLOCAL
Definition: TRT_LocalOccupancy.h:77
InDet::TRT_LocalOccupancy::m_occupancyCacheWrite
SG::WriteHandleKey< OccupancyData > m_occupancyCacheWrite
Definition: TRT_LocalOccupancy.h:119
InDet::TRT_LocalOccupancy::m_strawStatusKey
SG::ReadCondHandleKey< TRTCond::StrawStatusData > m_strawStatusKey
Definition: TRT_LocalOccupancy.h:116
InDet::TRT_LocalOccupancy::NTOTAL
static const int NTOTAL
Definition: TRT_LocalOccupancy.h:75
xAOD::track
@ track
Definition: TrackingPrimitives.h:512
InDet::TRT_LocalOccupancy::m_CalDbTool
ToolHandle< ITRT_CalDbTool > m_CalDbTool
Definition: TRT_LocalOccupancy.h:112
IdentifierHash
This is a "hash" representation of an Identifier. This encodes a 32 bit index which can be used to lo...
Definition: IdentifierHash.h:25
SG::AllowEmpty
@ AllowEmpty
Definition: StoreGate/StoreGate/VarHandleKey.h:30
readCCLHist.float
float
Definition: readCCLHist.py:83
DataVector::begin
const_iterator begin() const noexcept
Return a const_iterator pointing at the beginning of the collection.
Identifier
Definition: IdentifierFieldParser.cxx:14