|
ATLAS Offline Software
|
Go to the documentation of this file.
14 #include "Identifier/Identifier.h"
17 #include "CoralBase/AttributeListSpecification.h"
18 #include "CoralBase/Blob.h"
53 auto it = theMap.find(
name);
54 if (
it != theMap.end()) {
71 declareInterface<ITRT_ElectronPidTool>(
this);
72 declareInterface<ITRT_ElectronToTTool>(
this);
90 if (
sc.isFailure())
return sc;
106 return StatusCode::SUCCESS;
125 std::vector<float> PIDvalues = Trk::eProbabilityDefault;
127 if (!perigee) {
return PIDvalues; }
138 const EventContext& ctx,
146 if(HTcalc==
nullptr) {
154 PIDNN = (*readHandlePIDNN);
162 std::vector<float> PIDvalues = Trk::eProbabilityDefault;
166 if (!perigee)
return PIDvalues;
172 double phi = parameterVector[
Trk::phi];
175 if (
tan(theta/2.0) < 0.0001) {
176 ATH_MSG_DEBUG(
" Track has negative theta or is VERY close to beampipe! "
177 "(tan(theta/2) < 0.0001). Returning default Pid values.");
182 ATH_MSG_DEBUG (
" Track momentum infinite! (i.e. q/p = 0). Returning default Pid values.");
186 double pTrk = fabs(1.0 /
qOverP);
187 double pT = pTrk *
sin(theta);
188 double eta = -
log(
tan(theta/2.0));
194 ATH_MSG_WARNING(
" Occupancy was outside allowed range! Returning default Pid values. Occupancy = "
201 ATH_MSG_DEBUG (
"check---------------------------------------------------------------------------------------");
202 ATH_MSG_DEBUG (
"check Got track: pT: " <<
pT <<
" eta: " << eta <<
" phi: " << phi);
203 ATH_MSG_DEBUG (
"check---------------------------------------------------------------------------------------");
206 double pHTel_prod = 1.0;
207 double pHTpi_prod = 1.0;
213 std::vector<double> hit_HTMB;
214 std::vector<double> hit_gasType;
215 std::vector<double> hit_tot;
216 std::vector<double> hit_L;
217 std::vector<double> hit_rTrkWire;
218 std::vector<double> hit_HitZ;
219 std::vector<double> hit_HitR;
220 std::vector<double> hit_isPrec;
222 unsigned int nTRThits = 0;
223 unsigned int nTRThitsHTMB = 0;
224 unsigned int nXehits = 0;
225 unsigned int nArhits = 0;
226 unsigned int nPrecHits = 0;
231 if (not recoTrackStates) {
241 for ( ; tsosIter != tsosIterEnd; ++tsosIter) {
244 if (!measurement)
continue;
257 if (!driftcircle)
continue;
263 if (isHTMB) nTRThitsHTMB++;
264 hit_HTMB.push_back(
static_cast<double>(isHTMB));
302 double rTrkWire = 0.;
303 bool hasTrackParameters =
true;
304 if ((*tsosIter)->trackParameters()) {
309 rTrkWire = fabs((*tsosIter)->trackParameters()->parameters()[
Trk::driftRadius]);
310 if (rTrkWire > 2.2) rTrkWire = 2.175;
313 hasTrackParameters =
false;
321 hit_HitZ.push_back(HitZ);
322 hit_HitR.push_back(HitR);
323 hit_rTrkWire.push_back(rTrkWire);
332 int SL_max[3] = {73, 96, 64};
333 if (StrawLayer > SL_max[TrtPart] || StrawLayer < 0) {
334 ATH_MSG_WARNING(
" StrawLayer was outside allowed range! TrtPart = " << TrtPart <<
" SL = " << StrawLayer);
338 double ZRpos[3] = {fabs(HitZ), HitR, HitR};
339 double ZRpos_min[3] = { 0.0, 630.0, 630.0};
340 double ZRpos_max[3] = {720.0, 1030.0, 1030.0};
341 if (ZRpos[TrtPart] > ZRpos_max[TrtPart]) {
342 ATH_MSG_WARNING(
" ZRpos was above allowed range - adjusted! TrtPart = " << TrtPart <<
" ZRpos = " << ZRpos[TrtPart]);
343 ZRpos[TrtPart] = ZRpos_max[TrtPart] - 0.001;
345 if (ZRpos[TrtPart] < ZRpos_min[TrtPart]) {
346 ATH_MSG_WARNING(
" ZRpos was below allowed range - adjusted! TrtPart = " << TrtPart <<
" ZRpos = " << ZRpos[TrtPart]);
347 ZRpos[TrtPart] = ZRpos_min[TrtPart] + 0.001;
359 if (
stat==2 ||
stat==3 ) { GasType = 0; }
360 else if (
stat==1 ||
stat==4 ) { GasType = 1; }
361 else if (
stat==5 ) { GasType = 1; }
362 else if (
stat==6 ) { GasType = 1; }
363 else if (
stat==7 ) { GasType = 1;
369 <<
", must be 'Good(2)||Xenon(3)' or 'Dead(1)||Argon(4)' or "
370 "'Krypton(5)' or 'EmulatedArgon(6)' or 'EmulatedKr(7)'!");
376 << nTRThits <<
" TrtPart: " << TrtPart
377 <<
" GasType: " << GasType <<
" SL: " << StrawLayer
378 <<
" ZRpos: " << ZRpos[TrtPart] <<
" TWdist: " << rTrkWire
383 hit_gasType.push_back(
static_cast<double>(GasType));
386 }
else if (GasType == 1) {
397 hit_isPrec.push_back(
static_cast<double>(isPrec));
422 if (pHTel > 0.999 || pHTpi > 0.999 || pHTel < 0.001 || pHTpi < 0.001) {
424 << pHTel <<
" pHTpi = " << pHTpi
425 <<
" TrtPart: " << TrtPart <<
" SL: " << StrawLayer
426 <<
" ZRpos: " << ZRpos[TrtPart] <<
" TWdist: " << rTrkWire
431 if (pHTel > 0.80 || pHTpi > 0.50 || pHTel < 0.025 || pHTpi < 0.010) {
433 << pHTel <<
" pHTpi = " << pHTpi
434 <<
" TrtPart: " << TrtPart <<
" SL: " << StrawLayer
435 <<
" ZRpos: " << ZRpos[TrtPart] <<
" TWdist: " << rTrkWire
441 if (isHTMB) {pHTel_prod *= pHTel; pHTpi_prod *= pHTpi;}
442 else {pHTel_prod *= 1.0-pHTel; pHTpi_prod *= 1.0-pHTpi;}
443 ATH_MSG_DEBUG (
"check pHT(el): " << pHTel <<
" pHT(pi): " << pHTpi );
454 ATH_MSG_DEBUG (
"check nTRThits: " << nTRThits <<
" : " << nTRThitsHTMB
455 <<
" pHTel_prod: " << pHTel_prod
456 <<
" pHTpi_prod: " << pHTpi_prod
483 (limProbHT * limProbToT) /
484 ((limProbHT * limProbToT) + ((1.0 - limProbHT) * (1.0 - limProbToT)));
494 std::map<std::string, std::map<std::string, double>> scalarInputs_NN = PIDNN->
getScalarInputs();
495 std::map<std::string, std::map<std::string, std::vector<double>>> vectorInputs_NN = PIDNN->
getVectorInputs();
498 double fAr =
static_cast<double>(nArhits) / nTRThits;
499 double fHTMB =
static_cast<double>(nTRThitsHTMB) / nTRThits;
500 double PHF =
static_cast<double>(nPrecHits) / nTRThits;
502 if (!scalarInputs_NN.empty()) {
503 std::map<std::string, double>& trackVarMap = scalarInputs_NN.begin()->second;
511 storeNNVariable(trackVarMap,
"dEdx",
static_cast<double>(dEdx_noHTHits));
514 if (!vectorInputs_NN.empty()) {
515 std::map<std::string, std::vector<double>>& hitVarMap = vectorInputs_NN.begin()->second;
528 for (
const auto& scalarInputs : scalarInputs_NN) {
530 for (
const auto&
variable : scalarInputs.second) {
534 for (
const auto& vectorInputs : vectorInputs_NN) {
536 for (
const auto&
variable : vectorInputs.second) {
556 ATH_MSG_ERROR(
"Found a wrong TRT part: "<<
BEC<<
" expected one of (-2,-1,1,2)");
567 static const int nlayers[2]={3,14};
580 static const int strawsPerBEC[2][14]={{19,24,30, 0, 0, 0,0,0,0,0,0,0,0,0},
581 {16,16,16,16,16,16,8,8,8,8,8,8,8,8}};
583 if(not(StrawLayer < strawsPerBEC[
part][
Layer])){
586 <<
" straws. Found index " << StrawLayer);
604 const int StrawLayer)
const
607 ATH_MSG_ERROR(
"TRT geometry fail. Returning default value.");
623 float Occupancy)
const
626 bool hasTrackPar =
true;
def retrieve(aClass, aKey=None)
def finalize(self)
_info( "content of StoreGate..." ) self.sg.dump()
Const iterator class for DataVector/DataList.
@ eProbabilityToT
Electron probability from Time-Over-Threshold (ToT) information.
virtual const TRT_DriftCircle * prepRawData() const override final
returns the PrepRawData - is a TRT_DriftCircle in this scope
@ eProbabilityBrem
Electron probability from Brem fitting (DNA).
This file defines the class for a collection of AttributeLists where each one is associated with a ch...
This is an Identifier helper class for the TRT subdetector. This class is a factory for creating comp...
virtual const Trk::Surface & associatedSurface() const override final
returns the surface for the local to global transformation
static float Limit(float prob)
virtual bool rioType(RIO_OnTrackType::Type type) const =0
Method checking the Rio On Track type.
const std::map< std::string, std::map< std::string, std::vector< double > > > & getVectorInputs() const
const Amg::Vector3D & center() const
Returns the center position of the Surface.
@ eProbabilityHT
Electron probability from High Threshold (HT) information.
@ TRTdEdx
dEdx from TRT ToT measurement.
@ eProbabilityNumberOfTRTHitsUsedFordEdx
Number of TRT hits used for dEdx measurement.
const ServiceHandle< StoreGateSvc > & detStore() const
The standard StoreGateSvc/DetectorStore Returns (kind of) a pointer to the StoreGateSvc.
A CondAttrListVec is an Athena DataObject holding a vector of CORAL AttributeLists,...
@ eProbabilityComb
Electron probability from combining the below probabilities.
::StatusCode StatusCode
StatusCode definition for legacy code.
@ eProbabilityNN
Electron probability from NN.
const std::map< std::string, std::map< std::string, double > > & getScalarInputs() const
#define CHECK(...)
Evaluate an expression and check for errors.
virtual bool type(MeasurementBaseType::Type type) const =0
Interface method checking the type.
int barrel_ec(const Identifier &id) const
Values of different levels (failure returns 0)
int straw_layer(const Identifier &id) const
int layer_or_wheel(const Identifier &id) const
const Amg::MatrixX & localCovariance() const
Interface method to get the localError.
double timeOverThreshold() const
returns time over threshold in ns for valid digits; zero otherwise
StatusCode initialize(bool used=true)
Eigen::Matrix< double, 3, 1 > Vector3D
static double calculateTrackLengthInStraw(const Trk::TrackStateOnSurface *trackState, const TRT_ID *identifier)
#define ATH_MSG_WARNING(x)
Identifier identify() const
return the identifier -extends MeasurementBase
double evaluate(std::map< std::string, std::map< std::string, double >> &scalarInputs, std::map< std::string, std::map< std::string, std::vector< double >>> &vectorInputs) const
@ TRTTrackOccupancy
TRT track occupancy.
virtual const Amg::Vector3D & globalPosition() const override final
return the global position of this RIO_OnTrack
unsigned int getWord() const
returns the TRT dataword
float getProbHT(float pTrk, Trk::ParticleHypothesis hypothesis, int TrtPart, int GasType, int StrawLayer, float ZR, float rTrkAnode, float Occupancy, bool hasTrackPars) const