11#include "GaudiKernel/ToolHandle.h"
15#include "CaloDetDescr/CaloDetDescrElement.h"
20#include "GaudiKernel/INTupleSvc.h"
21#include "GaudiKernel/NTuple.h"
22#include "GaudiKernel/IToolSvc.h"
26using CaliWaveIt = LArCaliWaveContainer::LArCaliWaves::const_iterator;
61 ATH_MSG_INFO (
"LArTimePhysPrediction in initialize()" );
69 NTupleFilePtr file1(
ntupleSvc(),
"/NTUPLES/FILE1");
72 return StatusCode::FAILURE;
74 NTuplePtr nt(
ntupleSvc(),
"/NTUPLES/FILE1/MyNtuple");
76 nt=
ntupleSvc()->book(
"/NTUPLES/FILE1/MyNtuple",CLID_ColumnWiseTuple,
"Timing ntuple");
80 return StatusCode::FAILURE;
111 return StatusCode::SUCCESS;
118 const double meter2ns = 3.33564095;
125 double CalibCables=0;
126 double LSignalFCAL=0;
150 IAlgTool* algTool =
nullptr;
151 ATH_CHECK( toolSvc()->retrieveTool(
"CaloDepthTool", algTool,
this) );
188 if ( cell_it == cell_it_e ) {
198 for ( ; cell_it != cell_it_e; ++cell_it) {
201 std::cout <<
"nchannels " << nchannels << std::endl;
206 if ( wave_it == wave_it_e ) {
217 id = cabling->cnvToIdentifier(chid);
219 ATH_MSG_ERROR (
"LArCabling exception caught for channel " << MSG::hex << chid << MSG::dec );
223 Channel = onlineHelper->
channel(chid);
225 const std::vector<HWIdentifier>& calibLineV = clCont->
calibSlotLine(chid);
226 std::vector<HWIdentifier>::const_iterator calibLineIt = calibLineV.begin();
227 CalibLine = onlineHelper->
channel(*calibLineIt) ;
241 layer=fcalId->module(
id);}
248 pos_neg = onlineHelper->
pos_neg(chid);
249 barrel_ec = onlineHelper->
barrel_ec(chid);
251 slot = onlineHelper->
slot(chid);
261 if(theDDE==
nullptr) {
262 ATH_MSG_INFO (
"CellIndex = " << theHash <<
" has a DDE pointer NULL " );
266 real_eta = theDDE->
eta();
267 real_phi = theDDE->
phi();
277 if(layer==0) radius=4398.;
278 if(layer==1) radius=4806.;
279 if(layer==2) radius=5359.;
280 if(layer==3) radius=5840.;
288 for ( ; wave_it != wave_it_e; ++wave_it) {
294 dt = wave_it->getDt();
295 tcali = dt * larWaveHelper.
getMax(*wave_it);
297 const unsigned Nbase=5;
302 double amax = larWaveHelper.
getMaxAmp(*wave_it);
303 unsigned int imax=larWaveHelper.
getMax(*wave_it);
305 for (
unsigned int i=1; i<
imax ; i++) {
306 asamp1=wave_it->getSample(i);
307 asamp2=wave_it->getSample(i-1);
308 if((asamp1-
base)>amax*0.10 && (asamp2-
base)<amax*0.10)
309 rT0 = i-1+(0.01*amax-(asamp2-
base))/(asamp1-asamp2);
314 if(emId->
is_lar_em(
id) && barrel_ec==0) TOF = fabs(radius)*TMath::CosH(real_eta)* meter2ns/1000;
315 else TOF = fabs(radius)/TMath::TanH(fabs(real_eta))* meter2ns/1000;
320 for(
int ieta=0;ieta<16;ieta++){
339 if((emId->
is_lar_em(
id) && abs(barrel_ec)==1 && FT==2 && real_eta>0 && slot>10) || (emId->
is_lar_em(
id) && abs(barrel_ec)==1 && FT==3 && real_eta>0 && slot<3)) DeltaTTC=
m_vDeltaTTC_ECA_SPEC[0][1];
343 if((emId->
is_lar_em(
id) && abs(barrel_ec)==1 && FT==9 && real_eta>0 && slot>10) || (emId->
is_lar_em(
id) && abs(barrel_ec)==1 && FT==10 && real_eta>0 && slot<3)) DeltaTTC=
m_vDeltaTTC_ECA_SPEC[1][1];
347 if((emId->
is_lar_em(
id) && abs(barrel_ec)==1 && FT==15 && real_eta>0 && slot>10) || (emId->
is_lar_em(
id) && abs(barrel_ec)==1 && FT==16 && real_eta>0 && slot<3)) DeltaTTC=
m_vDeltaTTC_ECA_SPEC[2][1];
351 if((emId->
is_lar_em(
id) && abs(barrel_ec)==1 && FT==21 && real_eta>0 && slot>10) || (emId->
is_lar_em(
id) && abs(barrel_ec)==1 && FT==21 && real_eta>0 && slot<3)) DeltaTTC=
m_vDeltaTTC_ECA_SPEC[3][1];
355 if((emId->
is_lar_em(
id) && abs(barrel_ec)==1 && FT==2 && real_eta<0 && slot>10) || (emId->
is_lar_em(
id) && abs(barrel_ec)==1 && FT==3 && real_eta<0 && slot<3)) DeltaTTC=
m_vDeltaTTC_ECC_SPEC[0][1];
359 if((emId->
is_lar_em(
id) && abs(barrel_ec)==1 && FT==9 && real_eta<0 && slot>10) || (emId->
is_lar_em(
id) && abs(barrel_ec)==1 && FT==10 && real_eta<0 && slot<3)) DeltaTTC=
m_vDeltaTTC_ECC_SPEC[1][1];
363 if((emId->
is_lar_em(
id) && abs(barrel_ec)==1 && FT==15 && real_eta<0 && slot>10) || (emId->
is_lar_em(
id) && abs(barrel_ec)==1 && FT==16 && real_eta<0 && slot<3)) DeltaTTC=
m_vDeltaTTC_ECC_SPEC[2][1];
367 if((emId->
is_lar_em(
id) && abs(barrel_ec)==1 && FT==21 && real_eta<0 && slot>10) || (emId->
is_lar_em(
id) && abs(barrel_ec)==1 && FT==21 && real_eta<0 && slot<3)) DeltaTTC=
m_vDeltaTTC_ECC_SPEC[3][1];
375 if(pos_neg==1 && emId->
is_lar_em(
id) && abs(barrel_ec)==0) tphys=tcali-CalibCables+TOF+DeltaTTC+8+0.3*
m_sLTP;
376 else if(pos_neg==0 && emId->
is_lar_em(
id) && abs(barrel_ec)==0) tphys=tcali-CalibCables+TOF+DeltaTTC+0.3*
m_sLTP;
377 else if(pos_neg==1 && emId->
is_lar_em(
id) && abs(barrel_ec)==1) tphys=tcali-CalibCables+TOF+DeltaTTC+8;
380 else tphys=tcali-CalibCables+TOF+DeltaTTC;
384 if(emId->
is_lar_em(
id) && abs(barrel_ec)==0){
385 for(
int ieta=0;ieta<16;ieta++){
489 return StatusCode::SUCCESS ;
Scalar eta() const
pseudorapidity method
Scalar phi() const
phi method
#define ATH_CHECK
Evaluate an expression and check for errors.
#define ATH_MSG_VERBOSE(x)
Definition of CaloDetDescrManager.
Definition of CaloDetDescriptor.
LArCaliWaveContainer::LArCaliWaves::const_iterator CaliWaveIt
LArCaliWaveContainer::ConstConditionsMapIterator CaliCellIt
AthAlgorithm(const std::string &name, ISvcLocator *pSvcLocator)
Constructor with parameters:
Gaudi::Details::PropertyBase & declareProperty(Gaudi::Property< T, V, H > &t)
const ServiceHandle< StoreGateSvc > & detStore() const
bool is_lar_em(Identifier id) const
bool is_lar_fcal(Identifier id) const
bool is_lar_hec(Identifier id) const
IdentifierHash calo_cell_hash(const Identifier cellId) const
create hash id from 'global' cell id
Helper class for offline cell identifiers.
const LArFCAL_ID * fcal_idHelper() const
access to FCAL idHelper
CaloSampling::CaloSample CaloSample
const LArEM_ID * em_idHelper() const
access to EM idHelper
const LArHEC_ID * hec_idHelper() const
access to HEC idHelper
This class groups all DetDescr information related to a CaloCell.
CaloCell_ID::CaloSample getSampling() const
cell sampling
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 provides the client interface for accessing the detector description information common to...
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.
Liquid Argon Cumulative Wave Container.
const std::vector< HWIdentifier > & calibSlotLine(const HWIdentifier id) const
HWIdentifier channelId() const
ConditionsMap::const_iterator ConstConditionsMapIterator
ConstConditionsMapIterator begin(unsigned int gain) const
get iterator for all channels for a gain
ConstConditionsMapIterator end(unsigned int gain) const
end of all channels for this gain
int eta(const Identifier id) const
return eta according to :
int phi(const Identifier id) const
return phi according to :
int sampling(const Identifier id) const
return sampling according to :
Helper class for LArEM offline identifiers.
int eta(const Identifier id) const
eta [0,63] module 1 ; [0,31] module 2 ; [0,15] module 3
int phi(const Identifier id) const
phi [0,15]
Helper class for LArFCAL offline identifiers.
int phi(const Identifier id) const
return phi[0,63] outer part [0,31] inner part
int eta(const Identifier id) const
return eta [0,9] outer part [0,3] inner part
int sampling(const Identifier id) const
return sampling [0,3] (only 0 for supercells)
Helper class for LArHEC offline identifiers.
Exception class for LAr Identifiers.
int feedthrough(const HWIdentifier id) const
Return the feedthrough of a hardware cell identifier : feedthrough = [0,31] Barrel - A/C side or H/...
int slot(const HWIdentifier id) const
Return the slot number of a hardware cell identifier: slot = [1,15] Slot-ID in top part of the crat...
int barrel_ec(const HWIdentifier id) const
Return the position barrel or endcap of a hardware cell identifier: barrel_ec = [0,...
int channel(const HWIdentifier id) const
Return the channel number of a hardware cell identifier channel = [0,127] in all FEB.
int pos_neg(const HWIdentifier id) const
Return the side of a hardware cell identifier pos_neg = [0,1] positive-side or negative-side Barrel...
HWIdentifier feb_Id(int barrel_ec, int pos_neg, int feedthrough, int slot) const
Create feb_Id from fields.
NTuple::Item< double > m_TOF
std::vector< std::vector< double > > m_vDeltaTTC_EMB
NTuple::Item< double > m_real_phi
NTuple::Item< double > m_SignalCables
SG::ReadCondHandleKey< LArCalibLineMapping > m_calibMapKey
std::string m_groupingType
SG::ReadCondHandleKey< LArOnOffIdMapping > m_cablingKey
NTuple::Item< double > m_CalibCables
std::vector< std::vector< double > > m_vDeltaTTC_ECA_SPEC
virtual StatusCode stop() override
NTuple::Item< double > m_t0
NTuple::Item< long > m_is_lar_em
NTuple::Item< long > m_is_lar_hec
NTuple::Item< long > m_layer
NTuple::Item< double > m_DeltaTTC
NTuple::Item< long > m_phi
NTuple::Item< long > m_barrel_ec
std::vector< double > m_vEtaMin_EMB
NTuple::Item< long > m_pos_neg
NTuple::Item< long > m_eta
LArTimePhysPrediction(const std::string &name, ISvcLocator *pSvcLocator)
std::vector< std::vector< double > > m_vLSignal_EMB
NTuple::Item< long > m_slot
SG::ReadCondHandleKey< CaloDetDescrManager > m_caloMgrKey
NTuple::Item< double > m_real_eta
NTuple::Item< long > m_FEBid
NTuple::Item< double > m_tPhysPredicted
virtual StatusCode initialize() override
NTuple::Item< long > m_Channel
NTuple::Item< double > m_tCalibPredicted
std::vector< std::vector< double > > m_vDeltaTTC_ECC_SPEC
NTuple::Item< long > m_Chid
std::vector< std::vector< double > > m_vLCalib_EMB
NTuple::Item< long > m_is_lar_fcal
NTuple::Item< double > m_tcali
ServiceHandle< ITHistSvc > m_thistSvc
NTuple::Item< long > m_FT
std::vector< double > m_vEtaMax_EMB
CaloDepthTool * m_CaloDepthTool
std::vector< std::vector< double > > m_vDeltaTTC_EC
std::vector< double > m_vLSignal_FCAL
NTuple::Item< long > m_CalibLine
double getMaxAmp(const LArWave &theWave) const
double getBaseline(const LArWave &theWave, unsigned nBase) const
unsigned int getMax(const LArWave &theWave) const
return index of maximum sample