15#include "GaudiKernel/ITHistSvc.h"
16#include "CaloDetDescr/CaloDetDescrElement.h"
36 m_tree =
new TTree(
"m_tree",
"Offset ntuple");
54 return StatusCode::SUCCESS;
85 return StatusCode::SUCCESS;
94 return StatusCode::SUCCESS;
104 const EventContext& ctx = Gaudi::Hive::currentContext();
124 return StatusCode::FAILURE;
132 std::vector<int> doneCell;
143 for (
unsigned int i=0;i<((
unsigned int)(
m_ncell));i++) {
149 Identifier id2 = cabling->cnvToIdentifier(hwid2);
150 int i2 = (int) (
m_calo_id->calo_cell_hash(id2));
155 if (doneCell[i2]>=0) {
166 cell.eta = calodde->
eta();
167 cell.phi = calodde->
phi();
174 cell.identifier = id2;
192 return StatusCode::FAILURE;
194 int channelNumber = eventInfo->mcChannelNumber();
211 ATH_MSG_WARNING(
" Neither low nor high Pt MinBias sample " << channelNumber <<
" set weight to 1.0 ");
221 for (
auto & inputHits : hitVectorHandles) {
222 if (!inputHits.isValid()) {
228 for (
const LArHit* hit : *inputHits)
231 double energy = hit->energy();
232 double time =hit->time();
235 cellID=
m_scidtool->offlineToSuperCellID(hitCellID);
241 if (index < m_ncell && index>=0 && std::fabs(time)<25.) {
253 return StatusCode::SUCCESS;
258 if (index < m_ncell && index>=0) {
260 if (index2<0)
return;
262 ATH_MSG_INFO(
" LArMinBiasAlg::addCell: for " <<
index <<
", " << index2 <<
" is out-of bounds for list of size " <<
m_CellList.size());
266 double oldAverage =
m_CellList[index2].average;
268 double oldAverage2 =
m_CellList[index2].offset;
270 double frac = oldN/(weight+oldN);
271 double Anew = weight+oldN;
272 double newAverage = frac*oldAverage + weight*energy/Anew;
273 double deltaE = energy-newAverage;
274 double newRMS = frac*(oldRMS + (newAverage-oldAverage)*(newAverage-oldAverage)) + weight*deltaE*deltaE/Anew;
276 double newAverage2 = frac*oldAverage2 + weight*eshift/Anew;
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_WARNING(x)
Helper class for offline supercell identifiers.
AthAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
Constructor with parameters:
const ServiceHandle< StoreGateSvc > & detStore() const
Helper base class for offline cell identifiers.
This class groups all DetDescr information related to a CaloCell.
float eta() const
cell eta
float phi() const
cell phi
const CaloDetDescrElement * get_element(const Identifier &cellId) const
get element by its identifier
This class initializes the Calo (LAr and Tile) offline identifiers.
value_type get_compact() const
Get the compact id.
This is a "hash" representation of an Identifier.
Identifier32 get_identifier32() const
Get the 32-bit version Identifier, will be invalid if >32 bits needed.
Class to store hit energy and time in LAr cell from G4 simulation.
std::vector< CellInfo > m_CellList
double m_average[MAX_SYM_CELLS]
virtual StatusCode initialize() override
Gaudi::Property< int > m_datasetID_lowPt
SG::ReadHandleKey< xAOD::EventInfo > m_eventInfoKey
double m_rms[MAX_SYM_CELLS]
SG::ReadHandleKeyArray< LArHitContainer > m_larHitKeys
SG::ReadCondHandleKey< LArOnOffIdMapping > m_cablingKey
double m_offset[MAX_SYM_CELLS]
int m_region[MAX_SYM_CELLS]
std::vector< int > m_symCellIndex
double m_nevt[MAX_SYM_CELLS]
Gaudi::Property< double > m_weight_lowPt
Gaudi::Property< int > m_datasetID_highPt
int m_layer[MAX_SYM_CELLS]
virtual StatusCode execute() override
SG::ReadCondHandleKey< CaloDetDescrManager > m_caloMgrKey
ToolHandle< ICaloSuperCellIDTool > m_scidtool
StringArrayProperty m_inputKeys
SG::ReadCondHandleKey< LArMCSym > m_mcSymKey
std::vector< double > m_eCell
float m_eta[MAX_SYM_CELLS]
virtual StatusCode stop() override
const CaloCell_Base_ID * m_calo_id
LArMinBiasAlg(const std::string &name, ISvcLocator *pSvcLocator)
Standard Athena-Algorithm Constructor.
Gaudi::Property< double > m_weight_highPt
~LArMinBiasAlg()
Default Destructor.
float m_phi[MAX_SYM_CELLS]
ServiceHandle< ITHistSvc > m_thistSvc
SG::ReadCondHandleKey< CaloSuperCellDetDescrManager > m_caloSCMgrKey
void addCell(int index, double e1, double e2, double wt=1.)
int m_ieta[MAX_SYM_CELLS]
int m_identifier[MAX_SYM_CELLS]
virtual bool isValid() override final
Can the handle be successfully dereferenced?