#include <TauTagger.h>
Collaboration diagram for Atlfast::TauTagger:
Public Member Functions | |
TauTagger (const std::string &name, ISvcLocator *pSvcLocator) | |
~TauTagger () | |
StatusCode | initialize () |
StatusCode | execute () |
StatusCode | finalize () |
RandFlat * | randFlat () |
double | GetIDEff (TauContainer::const_iterator) |
void | makeInterpolator (Interpolator *&intptr, std::string intname, bool contbounds) |
Private Attributes | |
HepRandomEngine * | m_randEngine |
RandFlat * | m_randFlat |
TesIO * | m_tesIO |
std::vector< std::vector< double > > | m_IDEff_sig |
std::vector< std::vector< double > > | m_IDEff_bg |
std::string | m_tau1P_EffFile |
Identification Efficiency Parametrisation - Input File. | |
std::string | m_tau1P_RejFile |
std::string | m_tau2P_EffFile |
std::string | m_tau2P_RejFile |
std::string | m_tau3P_EffFile |
std::string | m_tau3P_RejFile |
bool | m_interpolateTauIdent |
std::string | m_tauLocation |
Interpolator * | m_tau1P_eff_interpolator |
Interpolator * | m_tau1P_rej_interpolator |
Interpolator * | m_tau2P_eff_interpolator |
Interpolator * | m_tau2P_rej_interpolator |
Interpolator * | m_tau3P_eff_interpolator |
Interpolator * | m_tau3P_rej_interpolator |
Definition at line 20 of file TauTagger.h.
Atlfast::TauTagger::TauTagger | ( | const std::string & | name, | |
ISvcLocator * | pSvcLocator | |||
) |
Constructor
type | type of tool | |
name | name of tool | |
parent | pointer to the IInterface of the parent component |
Definition at line 32 of file TauTagger.cxx.
00033 : Algorithm( name, pSvcLocator ), 00034 m_randEngine(0), 00035 m_randFlat(0), 00036 m_tesIO(0), 00037 m_tau1P_eff_interpolator(0), 00038 m_tau1P_rej_interpolator(0), 00039 m_tau2P_eff_interpolator(0), 00040 m_tau2P_rej_interpolator(0), 00041 m_tau3P_eff_interpolator(0), 00042 m_tau3P_rej_interpolator(0) 00043 00044 { 00045 //Default private parameters 00046 00047 m_interpolateTauIdent = true; 00048 m_tauLocation = "/Event/AtlfastTaus"; 00049 m_tau1P_EffFile = "atlfastDatafiles/tau1P_EffFile.txt"; 00050 m_tau1P_RejFile = "atlfastDatafiles/tau1P_RejFile.txt"; 00051 m_tau2P_EffFile = "atlfastDatafiles/tau2P_EffFile.txt"; 00052 m_tau2P_RejFile = "atlfastDatafiles/tau2P_RejFile.txt"; 00053 m_tau3P_EffFile = "atlfastDatafiles/tau3P_EffFile.txt"; 00054 m_tau3P_RejFile = "atlfastDatafiles/tau3P_RejFile.txt"; 00055 00056 //Declare joboption properties here... 00057 declareProperty( "interpolateTauIdent", m_interpolateTauIdent ); 00058 declareProperty( "TauLocation", m_tauLocation ); 00059 declareProperty( "tau1P_EffFile", m_tau1P_EffFile ); 00060 declareProperty( "tau1P_RejFile", m_tau1P_RejFile ); 00061 declareProperty( "tau2P_EffFile", m_tau2P_EffFile ); 00062 declareProperty( "tau2P_RejFile", m_tau2P_RejFile ); 00063 declareProperty( "tau3P_EffFile", m_tau3P_EffFile ); 00064 declareProperty( "tau3P_RejFile", m_tau3P_RejFile ); 00065 }
Atlfast::TauTagger::~TauTagger | ( | ) |
StatusCode Atlfast::TauTagger::initialize | ( | ) |
Tool initialization
Definition at line 78 of file TauTagger.cxx.
00079 { 00080 MsgStream p_log( msgSvc(), name() ); 00081 00082 p_log << MSG::DEBUG << "Initialising TauTagger" << endreq; 00083 00084 GlobalEventData* ged = GlobalEventData::Instance(); 00085 int randSeed = ged->randSeed() ; 00086 m_tesIO = new TesIO(ged->mcLocation(), ged->justHardScatter()); 00087 00088 m_randEngine = new HepJamesRandom( randSeed ); 00089 m_randFlat = new RandFlat( m_randEngine); 00090 00091 00092 // Create interpolator for tau efficiencies 00093 makeInterpolator(m_tau1P_eff_interpolator, m_tau1P_EffFile , true); 00094 makeInterpolator(m_tau1P_rej_interpolator, m_tau1P_RejFile , true); 00095 makeInterpolator(m_tau2P_eff_interpolator, m_tau2P_EffFile , true); 00096 makeInterpolator(m_tau2P_rej_interpolator, m_tau2P_RejFile , true); 00097 makeInterpolator(m_tau3P_eff_interpolator, m_tau3P_EffFile , true); 00098 makeInterpolator(m_tau3P_rej_interpolator, m_tau3P_RejFile , true); 00099 00100 return StatusCode::SUCCESS; 00101 }
StatusCode Atlfast::TauTagger::execute | ( | ) |
Tool execution
Definition at line 106 of file TauTagger.cxx.
00107 { 00108 MsgStream p_log( msgSvc(), name() ); 00109 00110 p_log << MSG::DEBUG << "Executing TauTagger" << endreq; 00111 00112 const TauContainer* container(0); 00113 if(!m_tesIO->getDH(container, m_tauLocation)){ 00114 p_log << MSG::ERROR 00115 << "Could not get DataHandle for " << m_tauLocation 00116 << endreq ; 00117 return StatusCode::SUCCESS ; 00118 } 00119 00120 TauContainer::const_iterator p_iterF = container->begin(); 00121 for( ; p_iterF != container->end(); p_iterF++ ) 00122 { 00123 00124 //------------------------------------------------- 00125 // Make Identification Decision 00126 //------------------------------------------------- 00127 00128 //long tr_NTrack = (*p_iterF)->nTrack(); 00129 //int tr_IsTrueTau = (*p_iterF)->isTrueTau(); 00130 int tr_Discriminant = 0; 00131 00132 double idEff=GetIDEff(p_iterF); 00133 00134 float rid = randFlat()->fire(); 00135 if(rid<idEff) tr_Discriminant = 1; 00136 p_log << MSG::DEBUG << "Discriminant Tag = " 00137 << tr_Discriminant <<" ( rand seed = "<< rid 00138 << " id Eff. = "<< idEff << " )" << endreq; 00139 (*p_iterF)->setDiscriminant(tr_Discriminant); 00140 } 00141 00142 return StatusCode::SUCCESS; 00143 }
StatusCode Atlfast::TauTagger::finalize | ( | ) |
Tool finalization
Definition at line 146 of file TauTagger.cxx.
00147 { 00148 00149 MsgStream p_log( msgSvc(), name() ); 00150 p_log << MSG::DEBUG << "TauTagger Finalize "<< endreq; 00151 00152 // Note from CLHEP/Random/RandFlat instructions: 00153 // "If the engine is passed by pointer then the corresponding engine 00154 // object will be deleted by the RandFlat destructor.If the engine is 00155 // passed by reference then the corresponding engine object will not be 00156 // deleted by the RandFlat destructor." 00157 // So don't delete the random engine after m_randflat. 00158 00159 if (m_randFlat) delete m_randFlat; 00160 00161 if (m_tau1P_eff_interpolator) delete m_tau1P_eff_interpolator; 00162 if (m_tau1P_rej_interpolator) delete m_tau1P_rej_interpolator; 00163 if (m_tau2P_eff_interpolator) delete m_tau2P_eff_interpolator; 00164 if (m_tau2P_rej_interpolator) delete m_tau2P_rej_interpolator; 00165 if (m_tau3P_eff_interpolator) delete m_tau3P_eff_interpolator; 00166 if (m_tau3P_rej_interpolator) delete m_tau3P_rej_interpolator; 00167 00168 return StatusCode::SUCCESS; 00169 }
RandFlat* Atlfast::TauTagger::randFlat | ( | ) | [inline] |
double Atlfast::TauTagger::GetIDEff | ( | TauContainer::const_iterator | ) |
Definition at line 173 of file TauTagger.cxx.
00173 { 00174 00175 // Find Identification efficiency for tau candidate to pass 00176 // discriminant. 00177 00178 MsgStream p_log( msgSvc(), name() ); 00179 00180 double IDEff = 0.0; 00181 00182 // Input to interpolators 00183 double pt_in_GeV = (*p_iterF)->pt()/GeV; 00184 double etatau = (*p_iterF)->eta(); 00185 int nTrack = (int) (*p_iterF)->nTrack(); 00186 deque<double> input_values; 00187 input_values.push_back( pt_in_GeV ); 00188 input_values.push_back( fabs(etatau) ); 00189 00190 if (nTrack==1){ 00191 if( (*p_iterF)->isTrueTau()==1 ){ 00192 IDEff = m_interpolateTauIdent ? 00193 m_tau1P_eff_interpolator->interpolate(input_values) : 00194 m_tau1P_eff_interpolator->getNearestValue(input_values); 00195 } else if ( (*p_iterF)->isTrueTau()==0 ){ 00196 IDEff = m_interpolateTauIdent ? 00197 m_tau1P_rej_interpolator->interpolate(input_values) : 00198 m_tau1P_rej_interpolator->getNearestValue(input_values); 00199 } 00200 } 00201 if (nTrack==2){ 00202 if( (*p_iterF)->isTrueTau()==1 ){ 00203 IDEff = m_interpolateTauIdent ? 00204 m_tau2P_eff_interpolator->interpolate(input_values) : 00205 m_tau2P_eff_interpolator->getNearestValue(input_values); 00206 } else if ( (*p_iterF)->isTrueTau()==0 ){ 00207 IDEff = m_interpolateTauIdent ? 00208 m_tau2P_rej_interpolator->interpolate(input_values) : 00209 m_tau2P_rej_interpolator->getNearestValue(input_values); 00210 } 00211 } 00212 if (nTrack>=3){ 00213 if( (*p_iterF)->isTrueTau()==1 ){ 00214 IDEff = m_interpolateTauIdent ? 00215 m_tau3P_eff_interpolator->interpolate(input_values) : 00216 m_tau3P_eff_interpolator->getNearestValue(input_values); 00217 } else if ( (*p_iterF)->isTrueTau()==0 ){ 00218 IDEff = m_interpolateTauIdent ? 00219 m_tau3P_rej_interpolator->interpolate(input_values) : 00220 m_tau3P_rej_interpolator->getNearestValue(input_values); 00221 } 00222 } 00223 00224 p_log << MSG::DEBUG << "Tau"<<nTrack<<"P true="<<(*p_iterF)->isTrueTau() 00225 <<"; pT= "<<pt_in_GeV << " GeV; eta= "<<etatau 00226 <<";\tideff= "<<IDEff <<endreq; 00227 00228 return IDEff; 00229 }
void Atlfast::TauTagger::makeInterpolator | ( | Interpolator *& | intptr, | |
std::string | intname, | |||
bool | contbounds | |||
) |
Definition at line 232 of file TauTagger.cxx.
00232 { 00233 MsgStream p_log( msgSvc(), name() ); 00234 std::string fn = PathResolver::find_file(intname, "DATAPATH"); 00235 intptr = new Interpolator(fn); 00236 p_log << MSG::DEBUG << "Made Interpolator from input file " << fn << endreq; 00237 if (contbounds) intptr->setContinuousBoundaries(); 00238 return; 00239 }
HepRandomEngine* Atlfast::TauTagger::m_randEngine [private] |
Definition at line 61 of file TauTagger.h.
RandFlat* Atlfast::TauTagger::m_randFlat [private] |
Definition at line 62 of file TauTagger.h.
TesIO* Atlfast::TauTagger::m_tesIO [private] |
Definition at line 64 of file TauTagger.h.
std::vector< std::vector<double> > Atlfast::TauTagger::m_IDEff_sig [private] |
Definition at line 66 of file TauTagger.h.
std::vector< std::vector<double> > Atlfast::TauTagger::m_IDEff_bg [private] |
Definition at line 67 of file TauTagger.h.
std::string Atlfast::TauTagger::m_tau1P_EffFile [private] |
std::string Atlfast::TauTagger::m_tau1P_RejFile [private] |
Definition at line 71 of file TauTagger.h.
std::string Atlfast::TauTagger::m_tau2P_EffFile [private] |
Definition at line 72 of file TauTagger.h.
std::string Atlfast::TauTagger::m_tau2P_RejFile [private] |
Definition at line 73 of file TauTagger.h.
std::string Atlfast::TauTagger::m_tau3P_EffFile [private] |
Definition at line 74 of file TauTagger.h.
std::string Atlfast::TauTagger::m_tau3P_RejFile [private] |
Definition at line 75 of file TauTagger.h.
bool Atlfast::TauTagger::m_interpolateTauIdent [private] |
Definition at line 78 of file TauTagger.h.
std::string Atlfast::TauTagger::m_tauLocation [private] |
Definition at line 80 of file TauTagger.h.
Definition at line 83 of file TauTagger.h.
Definition at line 84 of file TauTagger.h.
Definition at line 85 of file TauTagger.h.
Definition at line 86 of file TauTagger.h.
Definition at line 87 of file TauTagger.h.
Definition at line 88 of file TauTagger.h.