-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
24 changed files
with
1,182 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
#ifndef CondFormats_HcalObjects_AbsHFPhase1AlgoData_h_ | ||
#define CondFormats_HcalObjects_AbsHFPhase1AlgoData_h_ | ||
|
||
#include <typeinfo> | ||
|
||
#include "boost/serialization/base_object.hpp" | ||
#include "boost/serialization/export.hpp" | ||
|
||
// Archive headers are needed here for the serialization registration to work. | ||
// <cassert> is needed for the archive headers to work. | ||
#if !defined(__GCCXML__) | ||
#include <cassert> | ||
#include "CondFormats/Serialization/interface/eos/portable_iarchive.hpp" | ||
#include "CondFormats/Serialization/interface/eos/portable_oarchive.hpp" | ||
#endif /* #if !defined(__GCCXML__) */ | ||
|
||
// | ||
// Classes inheriting from this one are supposed to configure algorithms | ||
// that inherit from AbsHFPhase1Algo (in package RecoLocalCalo/HcalRecAlgos) | ||
// | ||
class AbsHFPhase1AlgoData | ||
{ | ||
public: | ||
inline virtual ~AbsHFPhase1AlgoData() {} | ||
|
||
// Comparison operators. Note that they are not virtual and should | ||
// not be overriden by derived classes. These operators are very | ||
// useful for I/O testing. | ||
inline bool operator==(const AbsHFPhase1AlgoData& r) const | ||
{return (typeid(*this) == typeid(r)) && this->isEqual(r);} | ||
inline bool operator!=(const AbsHFPhase1AlgoData& r) const | ||
{return !(*this == r);} | ||
|
||
protected: | ||
// Method needed to compare objects for equality. | ||
// Must be implemented by derived classes. | ||
virtual bool isEqual(const AbsHFPhase1AlgoData&) const = 0; | ||
|
||
private: | ||
friend class boost::serialization::access; | ||
template <typename Ar> | ||
inline void serialize(Ar& ar, unsigned /* version */) {} | ||
}; | ||
|
||
BOOST_CLASS_EXPORT_KEY(AbsHFPhase1AlgoData) | ||
|
||
#endif // CondFormats_HcalObjects_AbsHFPhase1AlgoData_h_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,60 @@ | ||
#include <algorithm> | ||
#include "DataFormats/HcalRecHit/interface/HFQIE10Info.h" | ||
|
||
HFQIE10Info::HFQIE10Info() | ||
: adc_(0), | ||
charge_(0.f), | ||
: charge_(0.f), | ||
energy_(0.f), | ||
timeRising_(0.f), | ||
timeFalling_(-1.f) | ||
timeFalling_(-1.f), | ||
raw_{INVALID_RAW, INVALID_RAW, INVALID_RAW, INVALID_RAW, INVALID_RAW}, | ||
nRaw_(0), | ||
soi_(0) | ||
{ | ||
} | ||
|
||
HFQIE10Info::HFQIE10Info(const HcalDetId& id, const int i_adc, | ||
HFQIE10Info::HFQIE10Info(const HcalDetId& id, | ||
const float i_charge, const float i_energy, | ||
const float i_timeRising, const float i_timeFalling) | ||
const float i_timeRising, const float i_timeFalling, | ||
const raw_type* rawData, const unsigned nData, | ||
const unsigned i_soi) | ||
: id_(id), | ||
adc_(i_adc), | ||
charge_(i_charge), | ||
energy_(i_energy), | ||
timeRising_(i_timeRising), | ||
timeFalling_(i_timeFalling) | ||
timeFalling_(i_timeFalling), | ||
raw_{INVALID_RAW, INVALID_RAW, INVALID_RAW, INVALID_RAW, INVALID_RAW}, | ||
nRaw_(std::min(nData, N_RAW_MAX)), | ||
soi_(0) | ||
{ | ||
if (nData) | ||
{ | ||
unsigned tbegin = 0; | ||
if (i_soi >= nData) | ||
{ | ||
// No SOI in the data. This situation is not normal | ||
// but can not be addressed in this code. | ||
if (nData > nRaw_) | ||
tbegin = nData - nRaw_; | ||
soi_ = nRaw_; | ||
} | ||
else | ||
{ | ||
if (nData > nRaw_) | ||
{ | ||
// Want to keep at least 2 presamples | ||
if (i_soi > 2U) | ||
{ | ||
tbegin = i_soi - 2U; | ||
if (tbegin + nRaw_ > nData) | ||
tbegin = nData - nRaw_; | ||
} | ||
} | ||
soi_ = i_soi - tbegin; | ||
} | ||
|
||
raw_type* to = &raw_[0]; | ||
const raw_type* from = rawData + tbegin; | ||
for (unsigned i=0; i<nRaw_; ++i) | ||
*to++ = *from++; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.