10#include "CaloEvent/CaloClusterContainer.h"
36 return StatusCode::SUCCESS;
55 return StatusCode::FAILURE;
72 const float zCalo = 30000.;
73 float beam_coor_x = track->getUslope()*zCalo + track->getUintercept() + xCryo;
74 float beam_coor_y = track->getVslope()*zCalo + track->getVintercept();
77 bool sx2 = (std::log(track->getChi2_u())>-10 && track->getChi2_u()!=1000);
78 bool sx3 = (beam_coor_x!=0 || track->getUintercept()!=0 || track->getUslope()!=0 );
81 bool sy2 = (std::log(track->getChi2_v())>-10 && track->getChi2_v()!=1000);
82 bool sy3 = (beam_coor_y!=0 || track->getVintercept()!=0 || track->getVslope()!=0 );
84 if(! (sx1 && sx2 && sx3 && sy1 && sy2 && sy3)) {
85 ATH_MSG_DEBUG (
"CheckTrackParams failed: "<<sx1<<
" "<<sx2<<
" "<<sx3<<
" / "<<sy1<<
" "<<sy2<<
" "<<sy3);
88 setFilterPassed(
false);
89 return StatusCode::SUCCESS;
96 for(
int ll=0; ll<(int)
m_scint_prim.size(); ++ll) has_energy[ll]=
false;
104 scnum = hit->GetSC();
105 if(scnum <= 0)
continue;
107 ATH_MSG_DEBUG (
"Scint: "<<scnum<<
", track: "<<hit->GetTrackID()<<
", energy: "<<hit->GetEdep());
108 if( (scnum==
m_scint_prim[i]) && (hit->GetTrackID() == 1) && (hit->GetEdep() > 0.)) {
109 has_energy[i] =
true;
117 scnum = hit->GetSC();
118 if(scnum <= 0)
continue;
120 ATH_MSG_DEBUG (
"Scint: "<<scnum<<
", track: "<<hit->GetTrackID()<<
", energy: "<<hit->GetEdep());
121 if( (scnum==
m_scint_prim[i]) && (hit->GetTrackID() == 1) && (hit->GetEdep() > 0.)) {
122 has_energy[i] =
true;
126 for(
int ll=0; ll<(int)
m_scint_prim.size(); ++ll) has_energy[0] = has_energy[0] && has_energy[ll];
128 ATH_MSG_DEBUG (
"CheckPrimaryTrack failed, no energy deposit in all asked scint." );
131 setFilterPassed(
false);
132 return StatusCode::SUCCESS;
141 scnum = hit->GetSC();
142 if(scnum <= 0)
continue;
143 if(hit->GetSC() == 5 && (hit->GetTrackID() == 1)) {
147 setFilterPassed(
false);
148 return StatusCode::SUCCESS;
160 unsigned int cSize = theCluster->getClusterSize();
161 if(cL != 0 && eD > 0. && cSize > 1) {
168 setFilterPassed(
false);
169 return StatusCode::SUCCESS;
175 const TBTrack* mytrack =
nullptr;
183 setFilterPassed(
false);
184 return StatusCode::SUCCESS;
190 setFilterPassed(
false);
191 return StatusCode::SUCCESS;
195 setFilterPassed(
true);
196 return StatusCode::SUCCESS;
201 return StatusCode::SUCCESS;
208 std::string m_txtFileWithXY =
"xcryo_ytable.txt";
211 std::ifstream xyFile;
214 xyFile.open(filename.c_str());
215 if (!xyFile.is_open()) {
216 ATH_MSG_ERROR (
"File " << m_txtFileWithXY <<
" fail to open in $DATAPATH");
217 return StatusCode::FAILURE;
219 while ( getline(xyFile, line,
'\n') ) {
221 std::istringstream buf(line);
223 buf >>
run >>
x >>
y >> e;
225 if (
run==
m_nRun && xyFile.good())
return StatusCode::SUCCESS;
227 return StatusCode::FAILURE;
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_VERBOSE(x)
AthenaHitsVector< LArG4H6FrontHit > LArG4H6FrontHitCollection
AthAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
Constructor with parameters:
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
ServiceHandle< StoreGateSvc > & evtStore()
Storable container for CaloCluster.
@ FIRST_ENG_DENS
First Moment in E/V.
@ CENTER_LAMBDA
Shower depth at Cluster Centroid.
Principal data class for CaloCell clusters.
static std::string find_file(const std::string &logical_file_name, const std::string &search_path)
StatusCode getXcryoYtable(float &x, float &y, float &eBeam)
std::vector< int > m_scint_prim
virtual StatusCode execute() override
bool m_readFileforXcryo
Get Xcryo and Ytable from a text file.
virtual StatusCode initialize() override
virtual StatusCode finalize() override
TBBeamQualityMC(const std::string &name, ISvcLocator *pSvcLocator)
std::string m_clusterCollName
float getBeamMomentum() const
unsigned int getRunNum() const
double getVintercept() const
double getUintercept() const
double getCryoHitv() const
double getCryoHitu() const
double chi2(TH1 *h0, TH1 *h1)
int run(int argc, char *argv[])