|
ATLAS Offline Software
|
#include <TRT_LocalOccupancy.h>
|
const TRT_ID * | m_TRTHelper {} |
| External tools:
More...
|
|
ToolHandle< ITRT_CalDbTool > | m_CalDbTool {this, "TRTCalDbTool", "TRT_CalDbTool", ""} |
|
SG::ReadHandleKey< TRT_DriftCircleContainer > | m_trt_driftcircles { this, "TRT_DriftCircleCollection", "TRT_DriftCircles", "m_trt_driftcircles" } |
|
SG::ReadCondHandleKey< TRTCond::AliveStraws > | m_strawReadKey {this,"AliveStraws","AliveStraws","AliveStraws in-key"} |
|
SG::ReadCondHandleKey< TRTCond::StrawStatusData > | m_strawStatusKey {this,"StrawStatus","StrawStatusData","StrawStatus key"} |
|
SG::ReadHandleKey< OccupancyData > | m_occupancyCacheRead {"OccupancyData"} |
|
SG::WriteHandleKey< OccupancyData > | m_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, ""} |
|
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.
◆ TRT_LocalOccupancy()
InDet::TRT_LocalOccupancy::TRT_LocalOccupancy |
( |
const std::string & |
t, |
|
|
const std::string & |
n, |
|
|
const IInterface * |
p |
|
) |
| |
◆ 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.
268 if (!driftCircleContainer.isValid()){
273 bool allOfEndcapAFound[2][
NLOCALPHI] = {{
false}};
279 if (track_local[
i][j] < 1)
continue;
282 if (
data.m_hit_local[
i][j] > 0)
continue;
285 if (!colNext)
continue;
288 for(; p_rdo!=p_rdo_end; ++p_rdo){
299 if (i_total !=
i ||
phi != j)
continue;
301 if (
i%3==1 && lay>4) allOfEndcapAFound[(
i<3?0:1)][
phi]=
true;
303 data.m_hit_local[i_total][
phi] +=1;
308 int stws =
data.m_stw_local[
i][j];
319 if (
i%3!=1)
continue;
321 if (track_local[
i][j] < 1)
continue;
322 if (!allOfEndcapAFound[(
i<3?0:1)][j] && !region_rescaled[
i][j]){
326 data.m_occ_local[
i][j]/=(
data.m_stws_ratio[(
i<3?0:1)][j]);
327 region_rescaled[
i][j]=
true;
329 else if (allOfEndcapAFound[(
i<3?0:1)][j] && region_rescaled[
i][j]){
333 data.m_occ_local[
i][j]*=(
data.m_stws_ratio[(
i<3?0:1)][j]);
334 region_rescaled[
i][j]=
false;
◆ 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.
407 if (
det == -1) arrayindex = 1;
408 else if (
det == -2) {
409 if (lay < 6) arrayindex = 2;
412 else if (
det == 1) arrayindex = 4;
414 if (lay < 6) arrayindex = 5;
417 else ATH_MSG_WARNING(
" detector value is: " <<
det <<
", out of range -2, -1, 1, 2, so THIS IS NOT TRT!!!");
◆ getData()
◆ 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.
197 std::map<int,int> hitCounter;
198 std::map<int,double> occResults;
202 for ( ; RDO_collection_iter!= RDO_collection_end; ++RDO_collection_iter) {
204 if (!RDO_Collection)
continue;
205 if (!RDO_Collection->empty()){
222 unsigned int word = (*r)->getWord();
226 unsigned mask = 0x02000000;
227 bool SawZero =
false;
229 for(tdcvalue=0;tdcvalue<24;++tdcvalue)
231 if ( (word &
mask) && SawZero)
break;
232 if ( !(word &
mask) ) SawZero =
true;
234 if(tdcvalue==7 || tdcvalue==15)
mask>>=1;
236 if(tdcvalue!=0 && tdcvalue!=24) {
251 const std::array<int,TRTCond::AliveStraws::NTOTAL> &straws = strawCounts->
getStwTotal();
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]);
◆ 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.
81 std::vector<float>
output ;
83 ATH_MSG_INFO(
"Cannot compute Global Occupancies in trigger environment! Returning empty vector");
89 ATH_MSG_INFO(
"Cannot get occupancy data. Returning empty vector.");
93 output.push_back(
data->m_occ_total[0]*1.e-2 ) ;
94 output.push_back(
data->m_occ_total[1]*1.e-2 ) ;
95 output.push_back(
data->m_occ_total[2]*1.e-2 ) ;
96 output.push_back(
data->m_occ_total[3]*1.e-2 ) ;
97 output.push_back(
data->m_occ_total[4]*1.e-2 ) ;
98 output.push_back(
data->m_occ_total[5]*1.e-2 ) ;
99 output.push_back(
data->m_occ_total[6]*1.e-2 ) ;
103 <<
"\t EndcapA C: " <<
output.at(2) <<
"\t EndcapB C: "
105 <<
"\t EndcapA A: " <<
output.at(5)
106 <<
"\t EndcapB A: " <<
output.at(6));
◆ initialize()
StatusCode InDet::TRT_LocalOccupancy::initialize |
( |
| ) |
|
|
overridevirtual |
standard Athena-Algorithm method
Definition at line 51 of file TRT_LocalOccupancy.cxx.
71 std::string OccupancyCacheName =
"GlobalTRTOccupancyData";
77 return StatusCode::SUCCESS;
◆ isMiddleBXOn()
bool InDet::TRT_LocalOccupancy::isMiddleBXOn |
( |
unsigned int |
word | ) |
|
|
staticprivate |
◆ LocalOccupancy() [1/2]
float InDet::TRT_LocalOccupancy::LocalOccupancy |
( |
const EventContext & |
ctx, |
|
|
const double |
eta, |
|
|
const double |
phi |
|
) |
| const |
|
overridevirtual |
◆ 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.
112 ATH_MSG_DEBUG(
"Compute LocalOccupancy(const Trk::Track& track ) for tool: " <<
name());
119 for (;tsos!=tsosEnd;++tsos) {
142 track_local[i_total-1][
phi] +=1;
146 std::unique_ptr<OccupancyData> data_ptr;
147 const OccupancyData*
data =
nullptr;
151 data = data_ptr.get();
157 ATH_MSG_INFO(
"Cannot get occupancy data. Returning 0.");
161 float averageocc = 0;
163 const std::array<std::array<int,NLOCALPHI>,
NLOCAL> &stw_local =
data->m_stw_local;
165 for (
int i=0;
i<6; ++
i){
166 for (
int j = 0; j < 32; j++){
168 float hits_array = track_local[
i][j] ;
169 if (hits_array<1)
continue;
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);
178 averageocc += (occ*hits_array);
181 ATH_MSG_DEBUG(
"new track: " <<
i <<
" " << j <<
"\t" << hits_array <<
"\t" << occ );
184 if (nhits>0) averageocc = averageocc / nhits;
185 ATH_MSG_DEBUG(
"Compute LocalOccupancy(const Trk::Track& track ) for tool: " << averageocc <<
" is over" );
◆ makeData()
Definition at line 465 of file TRT_LocalOccupancy.cxx.
471 auto data = std::make_unique<OccupancyData>(strawCounts->getStwLocal());
478 if ( driftCircleContainer.isValid() ) {
481 if(!colNext)
continue;
485 for(; p_rdo!=p_rdo_end; ++p_rdo){
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;
505 const std::array<int,NTOTAL> &stw_total = strawCounts->getStwTotal();
506 const std::array<std::array<int,NLOCALPHI>,
NLOCAL> &stw_local = strawCounts->getStwLocal();
512 int stws = stw_total[
i];
520 int stws = stw_local[
i][j];
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]);
◆ makeDataTrigger()
Definition at line 534 of file TRT_LocalOccupancy.cxx.
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();
543 for (
int i=0;
i<5; ++
i){
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];
◆ mapEtaToPartition()
int InDet::TRT_LocalOccupancy::mapEtaToPartition |
( |
const double |
eta | ) |
const |
|
private |
◆ mapPhiToPhisector()
int InDet::TRT_LocalOccupancy::mapPhiToPhisector |
( |
const double |
phi | ) |
|
|
staticprivate |
◆ passValidityGate()
bool InDet::TRT_LocalOccupancy::passValidityGate |
( |
unsigned int |
word, |
|
|
float |
t0 |
|
) |
| const |
|
private |
Definition at line 384 of file TRT_LocalOccupancy.cxx.
385 bool foundInterval =
false;
386 unsigned mask = 0x02000000;
388 while ( !foundInterval && (
i < 24) ) {
390 float thisTime = ((0.5+
i)*3.125)-
t0;
394 if (
i == 7 ||
i == 15)
398 return foundInterval;
◆ m_CalDbTool
◆ m_highGate
Gaudi::Property<float> InDet::TRT_LocalOccupancy::m_highGate {this, "HighGate", 42.1875*Gaudi::Units::ns, ""} |
|
private |
◆ m_highWideGate
Gaudi::Property<float> InDet::TRT_LocalOccupancy::m_highWideGate {this, "HighWideGate", 54.6875*Gaudi::Units::ns, ""} |
|
private |
◆ m_isTrigger
Gaudi::Property<bool> InDet::TRT_LocalOccupancy::m_isTrigger {this, "isTrigger", false, ""} |
|
private |
◆ m_lowGate
Gaudi::Property<float> InDet::TRT_LocalOccupancy::m_lowGate {this, "LowGate", 14.0625*Gaudi::Units::ns, ""} |
|
private |
◆ m_lowWideGate
Gaudi::Property<float> InDet::TRT_LocalOccupancy::m_lowWideGate {this, "LowWideGate", 20.3125*Gaudi::Units::ns, ""} |
|
private |
◆ m_occupancyCacheRead
◆ m_occupancyCacheWrite
◆ m_strawReadKey
◆ m_strawStatusKey
◆ m_T0Shift
Gaudi::Property<bool> InDet::TRT_LocalOccupancy::m_T0Shift {this, "includeT0Shift", true, "choice to use T0shift or not"} |
|
private |
◆ m_trt_driftcircles
◆ m_TRTHelper
const TRT_ID* InDet::TRT_LocalOccupancy::m_TRTHelper {} |
|
private |
◆ NLOCAL
const int InDet::TRT_LocalOccupancy::NLOCAL = 6 |
|
static |
◆ NLOCALPHI
const int InDet::TRT_LocalOccupancy::NLOCALPHI = 32 |
|
static |
◆ NTOTAL
const int InDet::TRT_LocalOccupancy::NTOTAL = 7 |
|
static |
◆ NWHEEL
const int InDet::TRT_LocalOccupancy::NWHEEL = 34 |
|
static |
The documentation for this class was generated from the following files:
def retrieve(aClass, aKey=None)
const std::array< int, NTOTAL > & getStwTotal() const
Gaudi::Property< bool > m_isTrigger
char data[hepevt_bytes_allocation_ATLAS]
int mapEtaToPartition(const double eta) const
Const iterator class for DataVector/DataList.
const OccupancyData * getData(const EventContext &ctx) const
SG::ReadCondHandleKey< TRTCond::AliveStraws > m_strawReadKey
Scalar phi() const
phi method
IdentifierHash straw_hash(Identifier straw_id) const
straw hash from id - optimized
Gaudi::Property< bool > m_T0Shift
Gaudi::Property< float > m_highGate
SG::ReadHandleKey< OccupancyData > m_occupancyCacheRead
std::vector< ALFA_RawData_p1 > t0
Gaudi::Property< float > m_highWideGate
Gaudi::Property< float > m_lowWideGate
virtual bool rioType(RIO_OnTrackType::Type type) const =0
Method checking the Rio On Track type.
void countHitsNearTrack(const EventContext &ctx, OccupancyData &data, int track_local[NLOCAL][NLOCALPHI]) const
bool empty() const
Test if the key is blank.
static int mapPhiToPhisector(const double phi)
int findArrayTotalIndex(const int det, const int lay) const
To convert from array index to det id and viceversa.
std::unique_ptr< OccupancyData > makeData(const EventContext &ctx) const
static const int NLOCALPHI
SG::ReadHandleKey< TRT_DriftCircleContainer > m_trt_driftcircles
const_iterator end() const
return const_iterator for end of container
#define CHECK(...)
Evaluate an expression and check for errors.
virtual bool type(MeasurementBaseType::Type type) const =0
Interface method checking the type.
const_iterator begin() const
return const_iterator for first entry
StatusCode initialize(bool used=true)
If this object is used as a property, then this should be called during the initialize phase.
int barrel_ec(const Identifier &id) const
Values of different levels (failure returns 0)
int layer_or_wheel(const Identifier &id) const
Gaudi::Property< float > m_lowGate
Trk::PrepRawDataCollection< TRT_DriftCircle > TRT_DriftCircleCollection
std::unique_ptr< OccupancyData > makeDataTrigger(const EventContext &ctx) const
StatusCode initialize(bool used=true)
int phi_module(const Identifier &id) const
const_iterator end() const noexcept
Return a const_iterator pointing past the end of the collection.
bool passValidityGate(unsigned int word, float t0) const
#define ATH_MSG_WARNING(x)
const TRT_ID * m_TRTHelper
External tools:
const boost::regex re(r_e)
Identifier identify() const
return the identifier -extends MeasurementBase
SG::WriteHandleKey< OccupancyData > m_occupancyCacheWrite
SG::ReadCondHandleKey< TRTCond::StrawStatusData > m_strawStatusKey
ToolHandle< ITRT_CalDbTool > m_CalDbTool
This is a "hash" representation of an Identifier. This encodes a 32 bit index which can be used to lo...
const_iterator begin() const noexcept
Return a const_iterator pointing at the beginning of the collection.