22#include "CaloGeoHelpers/CaloSampling.h"
25#include "CaloEvent/CaloCluster.h"
26#include "CaloEvent/CaloClusterContainer.h"
38 ISvcLocator* pSvcLocator) :
147 m_m2_r =
new std::vector<float>;
180 return StatusCode::FAILURE;
192 (
"etaTotal"+
m_suffix+
"/F").c_str());
194 (
"phiTotal"+
m_suffix+
"/F").c_str());
240 (
"cl_ncells"+
m_suffix+
"/I").c_str());
283 return StatusCode::SUCCESS;
296 return StatusCode::SUCCESS;
352 const int lastScintInLayer[] = {11, 23, 29, 35, 41, 47};
359 StatusCode
sc =
evtStore()->retrieve(theEventInfo,
"TBEventInfo");
360 if (
sc.isFailure() ) {
362 (
"Cannot retrieve TBEventInfo from StoreGate" );
364 return StatusCode::FAILURE;
370 return StatusCode::FAILURE;
375 (
"No filled cell_id vector for random trigger event" );
377 return StatusCode::FAILURE;
404 if (
sc.isFailure()) {
407 (
"cannot allocate CaloCellContainer with key <"
409 <<
"> for random trigger event");
413 for (
const CaloCell* cell : *cellContainer) {
415 for (
int icell=0; icell<(int)
m_cell_id->size(); icell++) {
416 if ((
int)
id.get_identifier32().get_compact() == (*
m_cell_id)[icell]) {
418 (*m_cell_energy)[icell] = (float)cell->energy();
419 int ind = (*m_cell_ind_cluster)[icell];
420 (*m_eCluster)[ind] += (float)cell->energy();
428 return StatusCode::SUCCESS;
465 return StatusCode::FAILURE;
470 for (
const CaloCell* cell : *cellContainer) {
473 rh->
SetCellID(icell,
id.get_identifier32().get_compact());
493 elecNoise->getNoise(
id, cell->gain()));
499 m_tree->GetUserInfo()->Add(rh);
511 return StatusCode::FAILURE;
530 return StatusCode::FAILURE;
535 int nScint = 0;
int nLayer = 0;
538 "/"<<scint->isSignalOverflow()<<
" ");
539 if (scint->isSignalOverflow()) novflow++;
540 signal += scint->getSignal();
541 if (nScint == lastScintInLayer[nLayer]) {
544 novflow = 0; signal = 0;
549 if (
msgLvl(MSG::VERBOSE)) {
550 msg()<<MSG::VERBOSE<<
"nOverflow: ";
551 for (
int i=0; i<nLayer; i++) {
552 msg()<<MSG::VERBOSE<<(*m_wtcNOverflow)[i]<<
" ";
555 msg()<<MSG::VERBOSE<<
"Signals: ";
556 for (
int i=0; i<nLayer; i++) {
557 msg()<<MSG::VERBOSE<<(*m_wtcSignal)[i]<<
" ";
566 sc =
evtStore()->retrieve(clusterContainer,
"EMTBClusters");
567 if (
sc.isFailure()) {
569 (
"cannot allocate CaloClusterContainer with key <"
570 <<
"EMTBClusters" <<
">" );
574 if ( clusterContainer->
size()== 1) {
577 float e = (float)cluster->
energy();
582 return StatusCode::FAILURE;
589 sc =
evtStore()->retrieve(clusterContainer,
"EMTBClusters");
590 if (
sc.isFailure()) {
592 (
"cannot allocate CaloClusterContainer with key <"
593 <<
"EMTBClusters" <<
">" );
597 if ( clusterContainer->
size()== 1) {
600 float e = (float)cluster->
energy();
605 return StatusCode::FAILURE;
612 if (
sc.isFailure()) {
614 (
"cannot allocate CaloClusterContainer with key <"
623 if ( clusterContainer->
size() < 1) {
624 ATH_MSG_ERROR (
" wrong CaloClusterContainer container size = " <<
627 return StatusCode::FAILURE;
631 float eAbsTotal = 0.;
632 for (
const CaloCluster* cluster : *clusterContainer) {
633 m_nCells += cluster->getNumberOfCells();
635 m_eCluster->push_back((
float)cluster->energy());
638 m_eTotal += (float)cluster->energy();
639 eAbsTotal += fabs((
float)cluster->energy());
640 m_etaTotal += fabs((
float)cluster->energy())*(float)cluster->eta();
641 m_phiTotal += fabs((
float)cluster->energy())*(float)cluster->phi();
649 for (; itc!=cluster->cell_end(); itc++) {
652 m_cell_id->push_back(
id.get_identifier32().get_compact());
658 if (
m_calo_id->calo_sample(
id) == (
int)CaloSampling::EME2)
659 m_eEME2 += (float)cell->energy();
660 if (
m_calo_id->calo_sample(
id) == (
int)CaloSampling::EME3)
661 m_eEME3 += (float)cell->energy();
662 if (
m_calo_id->calo_sample(
id) == (
int)CaloSampling::HEC0)
663 m_eHEC0 += (float)cell->energy();
664 if (
m_calo_id->calo_sample(
id) == (
int)CaloSampling::HEC1)
665 m_eHEC1 += (float)cell->energy();
666 if (
m_calo_id->calo_sample(
id) == (
int)CaloSampling::HEC2)
667 m_eHEC2 += (float)cell->energy();
668 if (
m_calo_id->calo_sample(
id) == (
int)CaloSampling::FCAL0)
670 if (
m_calo_id->calo_sample(
id) == (
int)CaloSampling::FCAL1)
672 if (
m_calo_id->calo_sample(
id) == (
int)CaloSampling::FCAL2)
678 float m1_eta = -9999;
679 float m1_phi = -9999;
681 float m2_lambda = -9999;
682 float delta_phi = -9999;
683 float delta_theta = -9999;
684 float delta_alpha = -9999;
685 float center_x = -9999;
686 float center_y = -9999;
687 float center_z = -9999;
688 float center_lambda = -9999;
689 float lateral = -9999;
690 float longitudinal = -9999;
691 float eng_frac_em = -9999;
692 float eng_frac_max = -9999;
693 float eng_frac_core = -9999;
694 float m1_dens = -9999;
695 float m2_dens = -9999;
697 for (; it_mom != cluster->endMoment(
false); ++it_mom) {
779 if (eAbsTotal > 0.) {
780 const float inv_eAbsTotal = 1. / eAbsTotal;
796 std::ifstream xyFile;
799 xyFile.open(filename.c_str());
800 if (!xyFile.is_open()) {
802 return StatusCode::FAILURE;
805 while ( getline(xyFile, line,
'\n') ) {
807 std::istringstream buf(line);
809 buf >>
run >>
x >>
y >> e;
811 if (
run ==
m_nRun && xyFile.good())
return StatusCode::SUCCESS;
814 return StatusCode::FAILURE;
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_VERBOSE(x)
#define ATH_MSG_WARNING(x)
Definition of CaloDetDescrManager.
AthAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
Constructor with parameters:
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
ServiceHandle< StoreGateSvc > & evtStore()
const ServiceHandle< StoreGateSvc > & detStore() const
bool msgLvl(const MSG::Level lvl) const
Container class for CaloCell.
Data object for each calorimeter readout cell.
Storable container for CaloCluster.
@ CENTER_Y
Cluster Centroid ( ).
@ DELTA_ALPHA
Angular shower axis deviation from IP-to-Center.
@ SECOND_LAMBDA
Second Moment in .
@ CENTER_Z
Cluster Centroid ( ).
@ FIRST_PHI
First Moment in .
@ DELTA_PHI
Angular shower axis deviation ( ) from IP-to-Center.
@ ENG_FRAC_EM
Energy fraction in EM calorimeters.
@ SECOND_ENG_DENS
Second Moment in E/V.
@ CENTER_X
Cluster Centroid ( ).
@ FIRST_ENG_DENS
First Moment in E/V.
@ LATERAL
Normalized lateral moment.
@ SECOND_R
Second Moment in .
@ DELTA_THETA
Angular shower axis deviation ( ) from IP-to-Center.
@ ENG_FRAC_MAX
Energy fraction of hottest cell.
@ CENTER_LAMBDA
Shower depth at Cluster Centroid.
@ FIRST_ETA
First Moment in .
@ ENG_FRAC_CORE
Energy fraction of the sum of the hottest cells in each sampling.
@ LONGITUDINAL
Normalized longitudinal moment.
const double & getValue() const
returns the value of this moment
moment_type getMomentType() const
Function access to moment type.
const CaloClusterMoment & getMoment() const
Function access to CaloClusterMoment.
Principal data class for CaloCell clusters.
MomentStoreIter moment_iterator
Moment iterator type for CaloCluster clients.
CaloCompositeCellBase< CaloClusterNavigable >::cell_iterator cell_iterator
Iterator on CaloCell s.
virtual double energy() const
Return energy.
This class groups all DetDescr information related to a CaloCell.
float dphi() const
cell dphi
float deta() const
cell deta
float volume() const
cell volume
DataModel_detail::const_iterator< DataVector > const_iterator
const_iterator begin() const noexcept
Return a const_iterator pointing at the beginning of the collection.
size_type size() const noexcept
Returns the number of elements in the collection.
static std::string find_file(const std::string &logical_file_name, const std::string &search_path)
float getBeamMomentum() const
unsigned int getRunNum() const
std::string m_txtFileWithXY
Text file containing xCryo and yTable.
std::vector< float > * m_delta_phi
std::vector< float > * m_m1_phi
std::vector< float > * m_eng_frac_em
std::string m_WTCContainerName
std::vector< float > * m_eng_frac_max
std::vector< float > * m_m2_r
std::vector< float > * m_cell_quality
std::vector< int > * m_nCellCluster
float m_beamMom
Run number.
std::vector< float > * m_eng_frac_core
std::vector< float > * m_center_z
float m_xCryo
Beam momentum.
std::vector< float > * m_etaCluster
std::vector< float > * m_m2_lambda
unsigned short m_evType
z-coordinate of the calorimeter surface at which beam coordinates calculated
TBTree_CaloClusterH6(const std::string &name, ISvcLocator *pSvcLocator)
std::string m_caloCellContainerName
virtual StatusCode initialize() override
int m_nEventRandomTrigger
std::vector< float > * m_eCluster
std::vector< float > * m_longitudinal
std::vector< float > * m_center_lambda
std::vector< float > * m_lateral
std::string m_rootfile_name
std::vector< int > * m_cell_gain
std::vector< float > * m_phiCluster
std::vector< int > * m_cell_id
std::vector< float > * m_m1_eta
std::vector< float > * m_center_x
StatusCode getXcryoYtable(float &x, float &y, float &eBeam)
Get Xcryo and Ytable from a text file.
std::vector< float > * m_cell_time
std::vector< float > * m_m1_dens
const CaloCell_ID * m_calo_id
std::vector< float > * m_center_y
SG::ReadCondHandleKey< CaloNoise > m_elecNoiseKey
virtual StatusCode finalize() override
std::vector< short > * m_wtcNOverflow
std::vector< float > * m_wtcSignal
virtual StatusCode execute() override
std::vector< float > * m_delta_alpha
std::vector< int > * m_cell_ind_cluster
std::vector< float > * m_delta_theta
std::vector< float > * m_cell_energy
std::vector< float > * m_m2_dens
virtual ~TBTree_CaloClusterH6()
std::string m_clusterContainerName