Commit ceb4ca2a authored by Niels Van Eldik's avatar Niels Van Eldik Committed by Graeme Stewart
Browse files

Migrated to new fiels svc (InDetLowBetaFinder-02-00-01)

parent aaff09d7
2014-03-31 Niels van Eldik
* Migrated to new fiels svc
* Tagged as InDetLowBetaFinder-02-00-01
2013-11-13 Nick Styles <nicholas.styles -at- cern.ch>
* Migrated to Eigen/newTrack EDM
* Tagged as InDetLowBetaFinder-02-00-00
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
///////////////////////////////////////////////////////////////////
// LowBetaAlg.h, (c) ATLAS Detector software
///////////////////////////////////////////////////////////////////
/* class LowBetaAlg
LowBetaAlg is an algoirthm for the identification of Charged Stable
Massive Particles based on tracking information mainly from the TRT.
Timing information and energy deposition are used to indentify
candidate tracks and make measurement of beta and excess ionization
comparing to relativistic particles.
author Christopher.Marino <Christopher.Marino@cern.ch>
*/
#ifndef LOWBETAALG_H
#define LOWBETAALG_H
#include "AthenaBaseComps/AthAlgorithm.h"
#include "TRT_ConditionsServices/ITRT_CalDbSvc.h"
#include "GaudiKernel/ToolHandle.h"
#include "MagFieldInterfaces/IMagFieldSvc.h"
/////////////////////////////////////////////////////////////////////////////
class AtlasDetectorID;
class Identifier;
class TRT_ID;
class TrtToolBetaLiklihood;
class ITRT_ToT_dEdx;
// Predeclare histogram classes that you use.
namespace InDetDD{ class TRT_DetectorManager; }
namespace Trk {class Track;}
namespace Rec { class TrackParticleContainer;
class TrackParticle; }
namespace InDet
{
class LowBetaAlg:public AthAlgorithm {
public:
LowBetaAlg (const std::string& name, ISvcLocator* pSvcLocator);
StatusCode initialize();
StatusCode execute();
StatusCode finalize();
std::vector<float> ChargedSMPindicators(const Trk::Track& track);
protected:
const TRT_ID* m_trtId; // TRT ID helper (identifying barrel/wheels and global position)
const InDetDD::TRT_DetectorManager* m_TRTdetMgr; // TRT detector manager (to get ID helper)
unsigned int m_minTRThits; // Minimum number of TRT hits to give PID.
float m_RcorrZero; // Inputs for R Correction
float m_RcorrOne; // Inputs for R Correction
float m_RcorrTwo; // Inputs for R Correction
float m_TimingOffset; // timing offset for trailing bit time
bool m_mcswitch;
//std::string m_tracksName; //!< Name of track container in StoreGate
std::string m_trackParticleCollection; //!< Name of track container in StoreGate
std::string m_InDetLowBetaOutputName; //!< Name of output container to store results
/** trying to get ahold of the TRT calib DB: */
ServiceHandle<ITRT_CalDbSvc> m_trtconddbsvc;
ServiceHandle<MagField::IMagFieldSvc> m_fieldServiceHandle;
private: // Functions/variables for using TrtToolsBetaLiklihood, see TrtToolsWrapper.cxx
//////////
////////// Member variables needed for TrtToolBetaLiklihood to function properly
//////////
// The actual TrtToolBetaLiklihood class instance (all the rest here is the wrapper)
TrtToolBetaLiklihood* m_TrtTool;
ToolHandle<ITRT_ToT_dEdx> m_TRTdEdxTool;
bool m_TrtToolsSuccess;
// boolean value that specifies whether TrtToolBetaLiklihood was initialized successfully
bool m_TrtToolInitSuccess;
// Track refit container
//std::string m_RefittedTracksContainerName;
std::string m_UnslimmedTracksContainerName;
//////////
////////// ATHENA function equivalents (call from corresponding function)
//////////
StatusCode initializeTrtToolBetaLiklihood();
int finalizeTrtToolBetaLiklihood();
//////////
////////// Conditions Database interaction functions
//////////
// Function for updating the TRT conditions database entries
// Adapted from TRT_DriftFunctionTool.cxx
StatusCode update(IOVSVC_CALLBACK_ARGS);
//////////
////////// Wrapper functions for calling TrtToolBetaLiklihood
//////////
// A wrapper intermediary for the TrtToolBetaLiklihood::TRT_FEbeta function
// Meant to be called from LowBetaAlg.cxx, via InDet::LowBetaAlg::ChargedSMPindicators
// Returns a vector of results from TRT_FEbeta where:
// vector[0] = LikelihoodBeta
// vector[1] = LikelihoodError
std::vector<float> callTrtToolBetaLiklihood(const Trk::Track& track);
// Gather all of the necessary data that the TRT_FEbeta function takes as inputs
// Sets all of the input arguments
StatusCode parseDataForTrtToolBetaLiklihood(const Trk::Track& track,
std::vector<int>* TRT_bitpattern,std::vector<int>* TRT_bec,std::vector<int>* TRT_strawlayer,std::vector<int>* TRT_layer,
std::vector<float>* TRT_t0,std::vector<float>* TRT_estDrift,std::vector<float>* TRT_R,std::vector<float>* TRT_R_track,
std::vector<float>* TrackX,std::vector<float>* TrackY,std::vector<float>* TrackZ,float* RecPt,float* RecEta, std::vector<int>* TRT_isTube);
};
}//end of namespace
#endif // LOWBETAALG_H
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
static float febBAR[5] = {0.0975128, 1.70409,1.06566, -4.57807, 2.63147};
static float febEC[5] = {0.152854, 0.335952,3.45123, -5.07784, 2.07303};
/*
Copyright (C) 2002-2017 CERN for the benefit of the ATLAS collaboration
*/
#ifndef TRTCHAMP_H
#define TRTCHAMP_H
#include <vector>
#include <string>
// Root libraries
#include "TMath.h"
#include "TApplication.h"
#include "TFile.h"
#include "TH1.h"
#include "TMinuit.h"
//-----------------------------------------------------------------------------------------------//
// //
// TRTChamp / TrtToolBetaLiklihood //
// Authors: C. Gay, B. Mills, S. Schramm 2009-2011 Univ. British Columbia / ATLAS Canada //
// Contact developers at mills.wj@gmail.com //
// Use default calibrations at your own risk! //
// //
//-----------------------------------------------------------------------------------------------//
class TrtToolBetaLiklihood {
public:
TrtToolBetaLiklihood();
// Some control parameters gathered here for convenience:
// Values are given in TrtToolsBetaLiklihood.cpp at the top of the file
// Done this way to fix the one-definition rule of C++
// hit radius bins
static const int NRFEBINS;
static const double RFEMIN;
static const double RFEMAX;
//eta bins
static const int NETABINS;
static const double ETAMIN;
static const double ETAMAX;
static const double etadelta;
static const double raddelta;
//r(t) constants
static const double RT0;
static const double RT1;
static const double RT2;
static const double RT3;
//struct to collect all the info parsed from a raw TRT hit:
struct HIT {
int LBit;
int FBit;
int LGap;
int BoT;
int becIdx;
float t0;
int nHT;
float pathlen;
float dlD;
float dlR;
float hitR;
float fitR;
int cxnFail;
float estDrift;
int isTube;
};
//user's function for getting the ML estimate of beta from TRT FE info:
std::vector<float> TRT_FEbeta(std::vector<int> TRT_bitpattern, std::vector<int> TRT_bec, std::vector<int> TRT_strawlayer,
std::vector<int> TRT_layer, std::vector<float> TRT_t0, std::vector<float> TRT_estDrift, std::vector<float> TRT_R,
std::vector<float> TRT_R_track, std::vector<float> TrackX, std::vector<float>TrackY,
std::vector<float> TrackZ, float RecPt, float RecEta, std::vector<int> TRT_isTube);
float TRT_CorrectFEbeta(float beta, float eta); //applies bias correction to extracted FE beta.
void TRT_LoadPriors(std::string priorFileName); //loads priors, LBitTemplates.root in the run dir
// Load the default prior values
int TRT_LoadDefaultPriors();
// Specify how many prior values are expected
unsigned int TRT_NumPriors();
// Update a specific prior value
void TRT_UpdatePriorValues(int radiusIndex, int etaIndex, int barrelOrEndcap, double* bitValues);
//Prior generation - out of date, do not use!
void TRT_SetupPriors(); //declare the empty histos for a new batch of priors
void TRT_FillPriors(std::vector<int> TRT_bitpattern, std::vector<int> TRT_bec, std::vector<int> TRT_strawlayer,
std::vector<int> TRT_layer, std::vector<float> TRT_t0, std::vector<float> TRT_R,
std::vector<float> TRT_R_track, std::vector<float> TrackX, std::vector<float> TrackY,
std::vector<float> TrackZ, float RecPt, float RecEta);
void TRT_SavePriors();
private:
//internal functions, shouldn't be called except as per TRT_FEbeta:
void TRT_SelectFEhits(); //chooses decent looking hits to pass on to fitting
void TRT_BitPattern(int hitP, int *lowPat, int *highPat, HIT &hit); //parses TRT hits into useful info.
void TRT_PropLenCorr(HIT hit, int *corrLBits, float *corrLBitWeight, int *corrFBits, float *corrFBitWeight); //fixes reflection in electronics.
void TRT_FEbeta_min(float &beta, float &betaSigmaLo, float &betaSigmaUp); //handles MINUIT for the TRT FE beta fit.
void TRT_SelectFEpriors(TrtToolBetaLiklihood::HIT hit, int *corrLBits, float *corrLBitWeight);
//void TRT_solveCubic(float DCrad, float &estDrift);
};
#endif
package InDetLowBetaFinder
author Christopher Marino
# general athena dependecies
use AtlasPolicy AtlasPolicy-*
use AthenaBaseComps AthenaBaseComps-* Control
use AtlasROOT AtlasROOT-* External
use GaudiInterface GaudiInterface-* External
use MagFieldInterfaces MagFieldInterfaces-* MagneticField
private
use StoreGate StoreGate-* Control
use TrkTrack TrkTrack-* Tracking/TrkEvent
use InDetIdentifier InDetIdentifier-* InnerDetector/InDetDetDescr
use InDetRIO_OnTrack InDetRIO_OnTrack-* InnerDetector/InDetRecEvent
use InDetLowBetaInfo InDetLowBetaInfo-* InnerDetector/InDetRecEvent
use TrkParameters TrkParameters-* Tracking/TrkEvent
use TrkRIO_OnTrack TrkRIO_OnTrack-* Tracking/TrkEvent
use TrkParticleBase TrkParticleBase-* Tracking/TrkEvent
use Particle Particle-* Reconstruction
use TRT_ToT_Tools TRT_ToT_Tools-* InnerDetector/InDetRecTools
end_private
use TRT_ConditionsServices TRT_ConditionsServices-* InnerDetector/InDetConditions
private
use TRT_ConditionsData TRT_ConditionsData-* InnerDetector/InDetConditions
apply_tag ROOTMathLibs
end_private
library InDetLowBetaFinder *.cxx -s=components *.cxx
apply_pattern component_library
#########################
#changes to fix errors
########################
#remove:
#use AtlasAIDA AtlasAIDA-* External
#remove version number:
#use BFieldAth BFieldAth-01-* MagneticField
#use TrkParticleBase TrkParticleBase-00-* Tracking/TrkEvent
#include "InDetLowBetaFinder/LowBetaAlg.h"
#include "GaudiKernel/DeclareFactoryEntries.h"
using namespace InDet;
DECLARE_ALGORITHM_FACTORY( LowBetaAlg )
DECLARE_FACTORY_ENTRIES(InDetLowBetaFinder) {
DECLARE_ALGORITHM( LowBetaAlg )
}
#include "GaudiKernel/LoadFactoryEntries.h"
LOAD_FACTORY_ENTRIES(InDetLowBetaFinder)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment