21bool testbit (
unsigned int x,
unsigned int i)
23 return (
x & (1U << i)) != 0;
33 if (log.level() <= MSG::DEBUG) log<< MSG::DEBUG <<
"Reading CaloClusterContainerCnv_p5" <<
endmsg;
48 std::vector<float> temp_Moments;
52 std::vector<float>::const_iterator i_mom = temp_Moments.begin();
53 std::vector<float>::const_iterator i_mom_e = temp_Moments.end();
56 unsigned int nkeys = keys.size();
60 std::vector<float> tmp_badChannelEta;
61 std::vector<float> tmp_badChannelPhi;
66 std::vector<float> tmp_rawE;
67 std::vector<float> tmp_rawEtaPhiM;
69 C.expandToFloat(pers->
m_rawE,tmp_rawE);
70 std::vector<float>::const_iterator iraw1 = tmp_rawE.begin();
71 std::vector<float>::const_iterator iraw2 = tmp_rawE.end();
75 std::vector<float>::const_iterator iraw3 = tmp_rawEtaPhiM.begin();
76 std::vector<float>::const_iterator iraw4 = tmp_rawEtaPhiM.end();
82 bool mom_overrun_err =
false;
83 bool store_overrun_err =
false;
84 bool raw_overrun_err =
false;
91 log << MSG::WARNING <<
" problem to decode bad channel information, not filled..." <<
endmsg;
96 for(;itp!=itp_e;++itp) {
99 CaloCluster* transCluster = clusters.nextElementPtr();
114 for (
int i=0;i<nVar;++i) {
118 for (
int j=0;j<nSamplings; ++j){
122 if (c1 < dataStore_size)
126 if (!store_overrun_err) {
128 "CaloClusterContainerCnv_p5")
129 <<
"Corrupted data: data store array overrun "
130 << pers->
m_vec.size() <<
" clusters "
131 << nkeys <<
" moment keys "
132 << temp_Moments.size() <<
" total moments.";
133 store_overrun_err =
true;
137 static_cast<samptype
>(j),
143 static_cast<samptype
>(j));
160 for (
unsigned short i=0;i<nkeys;++i) {
162 if (i_mom == i_mom_e) {
164 if (!mom_overrun_err) {
166 "CaloClusterContainerCnv_p5")
167 <<
"Corrupted data: moment array overrun "
168 << pers->
m_vec.size() <<
" clusters "
169 << nkeys <<
" moment keys "
170 << temp_Moments.size() <<
" total moments.";
171 mom_overrun_err =
true;
178 transStore.insert (transStore.end(), CaloClusterMomentStore::moment_store::value_type( keys[i], val ) );
185 while (ibad1 != ibad2 && (*ibad1) ==
index) {
186 float eta = tmp_badChannelEta[nbad] + transCluster->
eta();
200 if (iraw1 != iraw2) {
201 if (std::fabs(transCluster->
e())>0.1) {
202 transCluster->
m_rawE = (*iraw1) * transCluster->
e();
205 transCluster->
m_rawE = (*iraw1);
208 if (iraw3 != iraw4) {
209 transCluster->
m_rawEta = (*iraw3) + transCluster->
eta();
212 if (iraw3 != iraw4) {
216 if (iraw3 == iraw4 && !raw_overrun_err) {
218 "CaloClusterContainerCnv_p5")
219 <<
"Corrupted data: raw array overrun "
220 << pers->
m_vec.size() <<
" clusters "
221 << tmp_rawE.size() <<
" raw values.";
222 raw_overrun_err =
true;
224 if (iraw3 != iraw4) {
225 transCluster->
m_rawM = (*iraw3);
240 if (i_mom != i_mom_e && !mom_overrun_err) {
242 "CaloClusterContainerCnv_p5")
243 <<
"Corrupted data: not all moments read "
244 << pers->
m_vec.size() <<
" clusters "
245 << nkeys <<
" moment keys "
246 << temp_Moments.size() <<
" total moments "
247 << i_mom-temp_Moments.begin() <<
" read.";
250 if (c1 != dataStore_size && !store_overrun_err) {
252 "CaloClusterContainerCnv_p5")
253 <<
"Corrupted data: not all data store members read "
254 << dataStore_size <<
" elements "
258 if (iraw1 != iraw2 && !raw_overrun_err) {
260 "CaloClusterContainerCnv_p5")
261 <<
"Corrupted data: not all raw values read "
262 << pers->
m_vec.size() <<
" clusters "
263 << tmp_rawE.size() <<
" raw values "
264 << iraw1-tmp_rawE.begin() <<
" read.";
267 if (iraw3 != iraw4 && !raw_overrun_err) {
269 "CaloClusterContainerCnv_p5")
270 <<
"Corrupted data: not all raw values read "
271 << pers->
m_vec.size() <<
" clusters "
272 << tmp_rawEtaPhiM.size() <<
" raw values "
273 << iraw3-tmp_rawEtaPhiM.begin() <<
" read.";
277 if (ibad1 != ibad2) {
279 "CaloClusterContainerCnv_p5")
280 <<
"Corrupted data: not all bad data read "
294 MsgStream &log)
const
296 if (log.level() <= MSG::DEBUG) log<< MSG::DEBUG <<
"Writing CaloClusterContainerCnv_p5" <<
endmsg;
336 for (
int w=0; w<nMom; w++){
344 "CaloClusterContainerCnv_p5")
345 <<
"Inconsistent number of cluster moments: cluster "
346 << it2 - trans->
begin() <<
" of " << trans->
size()
347 <<
" have " << ms.size()
353 std::vector<float> temp_Moments;
355 std::vector<float> tmp_badChannelEta;
356 std::vector<float> tmp_badChannelPhi;
358 std::vector<float> tmp_rawE;
359 std::vector<float> tmp_rawEtaPhiM;
360 tmp_rawE.reserve(trans->
size());
361 tmp_rawEtaPhiM.reserve(3*trans->
size());
365 for(;it!=it_e;++it,++itp) {
383 for (
int i=0;i<nVar;++i) {
388 for (
int j=0;j<nSamplings; ++j)
389 if ( testbit(cl.m_samplingPattern, j)) {
391 (
static_cast<vartype
>(i),
392 static_cast<samptype
>(j)));
397 for (
int j=0;j<nSamplings; ++j)
398 if ( testbit(cl.m_samplingPattern, j))
404 for (
int j=0;j<nSamplings; ++j)
405 if ( testbit(cl.m_samplingPattern, j))
407 static_cast<samptype
>(j)))
408 if (log.level() <= MSG::DEBUG) log<< MSG::DEBUG<<
"BIG PROBLEM ! not stored and has value:"
410 static_cast<samptype
>(j))
412 <<
"\t sampling: "<<j<<
endmsg;
420 std::vector<unsigned short>::const_iterator itk =
422 std::vector<unsigned short>::const_iterator itk_e =
425 cl.m_momentStore.begin();
427 cl.m_momentStore.end();
428 for (; itk != itk_e; ++itk) {
430 if (itm != itm_e && itm.getMomentType() == *itk) {
431 val = (*itm).getValue();
435 itm = cl.m_momentStore.find
438 val = (*itm).getValue();
442 temp_Moments.push_back(val);
450 float etac =
bad.getEta()-(cl.eta());
454 short status = ((sampl & 0xff) | ((flag.packedData() & 0xff) << 8));
455 tmp_badChannelEta.push_back(etac);
456 tmp_badChannelPhi.push_back(phic);
463 if (std::fabs(e)>0.1) {
464 float eratio = cl.m_rawE / e;
465 tmp_rawE.push_back( eratio);
468 tmp_rawE.push_back( cl.m_rawE);
469 tmp_rawEtaPhiM.push_back( cl.m_rawEta-cl.eta());
471 tmp_rawEtaPhiM.push_back( dphi);
472 tmp_rawEtaPhiM.push_back( cl.m_rawM);
488 C.reduce(tmp_rawE,pers->
m_rawE);
505 MsgStream& log)
const
529 MsgStream& log)
const
Scalar eta() const
pseudorapidity method
Scalar phi() const
phi method
CaloPhiRange class declaration.
Helpers for checking error return status codes and reporting errors.
#define REPORT_MESSAGE_WITH_CONTEXT(LVL, CONTEXT_NAME)
Report a message, with an explicitly specified context name.
char data[hepevt_bytes_allocation_ATLAS]
virtual void setAthenaBarCode(AthenaBarCode_t id)
CaloTowerSegCnv_p1 m_caloTowerSegCnv
ElementLinkCnv_p2< ElementLink< CaloShowerContainer > > m_showerElementLinkCnv
ElementLinkCnv_p2< ElementLink< CaloCellLinkContainer > > m_cellElementLinkCnv
ElementLinkCnv_p2< ElementLink< CaloShowerContainer > >::State ShowerLinkState
P4EEtaPhiMCnv_p2 m_P4EEtaPhiMCnv
virtual void transToPers(const CaloClusterContainer *trans, CaloClusterContainer_p5 *pers, MsgStream &log) const override
ElementLinkCnv_p2< ElementLink< CaloCellLinkContainer > >::State CellLinkState
virtual void persToTrans(const CaloClusterContainer_p5 *pers, CaloClusterContainer *trans, MsgStream &log) const override
std::vector< unsigned int > m_rawE
std::vector< float > m_dataStore
CaloTowerSeg_p1 m_towerSeg
contType::iterator iterator
CaloClusterMomentContainer_p2 m_momentContainer
std::vector< short > m_badClusIndexList
unsigned int m_varTypePattern
contType::const_iterator const_iterator
ElementLinkContNames_p2 m_linkNames
std::vector< unsigned int > m_badPhiList
std::vector< short > m_badLayerStatusList
std::vector< unsigned int > m_badEtaList
std::vector< unsigned int > m_rawEtaPhiM
Storable container for CaloCluster.
virtual const CaloTowerSeg & getTowerSeg() const
Retrieve tower segmentation.
virtual void setTowerSeg(const CaloTowerSeg &towerSeg)
Set tower segmentation into CaloClusterContainer.
std::vector< unsigned short > m_Mkey
unsigned short m_nMoments
std::vector< unsigned int > m_Mvalue
Stores CaloClusterMoment in a keyed map.
CaloClusterMomentIterator moment_iterator
External moment iterator type.
virtual void setMomentStore(const moment_store &rMomStore)
Set internal store.
CaloClusterMoment::MomentType moment_type
Moment type.
std::map< moment_key, moment_value > moment_store
Internal moment store type.
cell_link_type m_cellLink
Local pointer to cell store.
Principal data class for CaloCell clusters.
double eta0() const
Returns raw of cluster seed.
CaloClusterMomentStore m_momentStore
cluster moments
double m_rawEta
Stores raw signal.
virtual double getBasicEnergy() const
Access basic energy scale signal.
void resetBadChannel()
Reset Bad channel list.
unsigned int m_samplingPattern
Sampling pattern.
double m_altE
Stores calibrated (cell weight) signal.
void addBadChannel(const CaloClusterBadChannelData &badChannel)
Add Bad channel information.
virtual double e() const
Retrieve energy independent of signal state.
double m_altPhi
Stores calibrated (cell weight) signal.
std::vector< CaloClusterBadChannelData > badChannelList
Get Bad Channel information.
virtual double eta() const
Retrieve eta independent of signal state.
double getTime() const
Access cluster time.
double m_phi0
Cluster seed .
bool m_endcap
Flag is true if at least one cell in EMB.
double m_altM
Stores calibrated (cell weight) signal.
double m_rawM
Stores raw signal.
bool setDefaultSignalState(signalstate_t s)
Sets default signal state.
void setClusterSize(unsigned int theClusterSize)
Set cluster size.
void setTime(double theTime)
Set cluster time.
unsigned int getClusterSize() const
Get cluster size.
data_link_type m_dataLink
{
virtual double phi() const
Retrieve phi independent of signal state.
CaloSamplingData m_dataStore
{\ brief Cached Stores
double m_eta0
Cluster seed .
virtual void setBasicEnergy(double theEnergy)
Set basic energy scale signal.
double phi0() const
Returns raw of cluster seed.
bool m_barrel
Flag is true if at least one cell in EMB.
double m_altEta
Stores calibrated (cell weight) signal.
double m_rawPhi
Stores raw signal.
double m_rawE
Stores raw signal.
CaloRecoStatus m_status
Calorimeter reconstruction status.
static double fix(double phi)
static double diff(double phi1, double phi2)
simple phi1 - phi2 calculation, but result is fixed to respect range.
reconstruction status indicator
virtual const store_type & getStatusWord() const
retrieve the entire status word
Simple data object to store all variables in calorimeter samplings.
size_t getNumberOfSamplings() const
Set variable type pattern for this store.
CaloVariableType::VariableType variable_key_type
Variable look-up type.
unsigned int m_varTypePattern
value_type retrieveData(variable_key_type theVariable, sampling_key_type theSampling) const
Retrieve const reference to individual variable.
CaloSampling::CaloSample sampling_key_type
Sampling look-up key type.
size_t getNumberOfVariableTypes() const
Return number of variable types.
bool storeData(variable_key_type theVariable, sampling_key_type theSampling, value_type theData)
}
bool removeVariable(variable_key_type theVariable, sampling_key_type theSampling)
Remove a certain variable.
Data object stores CaloTower segmentation.
void expandToFloat(const std::vector< unsigned int > &vc, std::vector< float > &vf)
void reduce(const std::vector< float > &vf, std::vector< unsigned int > &vi)
a typed memory pool that saves time spent allocation small object.
DataModel_detail::const_iterator< DataVector > const_iterator
void reserve(size_type n)
Attempt to preallocate enough memory for a specified number of elements.
value_type push_back(value_type pElem)
Add an element to the end of the collection.
const_iterator end() const noexcept
Return a const_iterator pointing past the end of the collection.
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.
void clear()
Erase all the elements in the collection.
static const AthenaBarCode_t UNDEFINEDBARCODE
@ VIEW_ELEMENTS
this data object is a view, it does not own its elmts
hold the test vectors and ease the comparison
P4EEtaPhiMFloat_p2 m_P4EEtaPhiM
ElementLinkInt_p2 m_dataLink
unsigned int m_caloRecoStatus
ElementLinkInt_p2 m_cellLink
unsigned int m_clusterSize
unsigned int m_samplingPattern