CALO - Do not use runtime name to specialise behaviour for Ecal/Hcal
The following discussion from !3125 (closed) should be addressed:
-
@chenjia started a discussion: (+9 comments)
In short, the CALO currently uses the runtime name of a component to determine things like default data locations for Ecal/Hcal. This is problematic for a few reasons, see the thread above.
The proposal there is to move to a templated implementation, where Hcal and Ecal then get specific concrete instantiations of a templated algorithm, and then the template type is used instead of the name to perform the customisations.
Comment from the above
So its lines like
that I think are problematic here
KeyValue{"DetectorLocation", Utilities::DeCaloFutureLocation( name.substr( 6, 4 ) )}},
{KeyValue{"OutputDigitData", Utilities::CaloFutureDigitLocation( name.substr( 6, 4 ) )},
KeyValue{"OutputReadoutStatusData",
Utilities::CaloFutureRawBankReadoutStatusLocation( name.substr( 6, 4 ) )}} ) {}
Its those utilities that change the defaults based on the name that I think should change.
My proposal is something like, if you don't have something convenient already defined else where, define some label (enum, tag class) for Ecal and Ical
enum CaloType { Ecal, Hcal };
Then in the above template the entire algorithm on this enum
template <typename CALO>
class RawToDigits : public Algorithm::MultiTransformer<std::tuple<Event::Calo::Digits, RawBankReadoutStatus>(
const RawEvent& rawEvt, const DeCalorimeter& ),
Algorithm::Traits::usesConditions<DeCalorimeter>> {
and then change the location methods above to instead of using a string use the template type e.g.
Utilities::CaloFutureDigitLocation<CALO>()
where a new templated implementation of the above location method would return the correct location based on the template value, and also if its DetDesc or DD4HEP.
Finally, define the concrete implementations for Ecal and Hcal
using RawToDigitsEcal = RawToDigits<Ecal>;
using RawToDigitsHcal = RawToDigits<Hcal>;
you would then just use the above types as required for Ecal and Hcal.
( Note, the above is pseudo code, not tested etc. but you get the idea)