52 #include "TEnumConstant.h"
54 template <
typename MyEnum>
55 MyEnum strToEnum(
std::string const& enumConstName) {
56 TEnum* en = TEnum::GetEnum(
typeid(MyEnum));
58 if (TEnumConstant
const* enc = en->GetConstant(enumConstName.c_str())) {
59 return static_cast<MyEnum>(enc->GetValue());
61 throw cms::Exception(
"Configuration") << enumConstName <<
" is not a valid member of " <<
typeid(MyEnum).
name();
64 throw cms::Exception(
"LogicError") <<
typeid(MyEnum).
name() <<
" not recognised by ROOT";
69 if (enumConstName ==
"kNever")
70 return MyEnum::kNever;
71 else if (enumConstName ==
"kForSiStrips")
72 return MyEnum::kForSiStrips;
73 else if (enumConstName ==
"kAlways")
74 return MyEnum::kAlways;
77 << enumConstName <<
" is not a valid member of " <<
typeid(MyEnum).
name()
78 <<
" (or strToEnum needs updating, this is a manual translation found at " << __FILE__ <<
" line " << __LINE__
103 const double deltaZVertex,
138 template <
typename T>
168 auto superClustersTags = regionPSet.
getParameter<std::vector<edm::InputTag>>(
"superClusters");
179 for (
const auto&
tag : superClustersTags) {
187 desc.
add<
double>(
"ptMin", 1.5);
188 desc.
add<
double>(
"originRadius", 0.2);
189 desc.
add<
double>(
"originHalfLength", 15.0)
190 ->
setComment(
"z range is +/- this value except when using the beamspot (useZInBeamspot=true)");
191 desc.
add<
double>(
"deltaPhiRegion", 0.4);
192 desc.
add<
double>(
"deltaEtaRegion", 0.1);
193 desc.
add<
bool>(
"useZInVertex",
false)
194 ->setComment(
"use the leading vertex position +/-orginHalfLength, mutually exclusive with useZInBeamspot");
195 desc.
add<
bool>(
"useZInBeamspot",
true)
197 "use the beamspot position +/- nrSigmaForBSDeltaZ* sigmaZ_{bs}, mutually exclusive with useZInVertex");
198 desc.
add<
double>(
"nrSigmaForBSDeltaZ", 3.0)
199 ->
setComment(
"# of sigma to extend the z region when using the beamspot, only active if useZInBeamspot=true");
200 desc.
add<
double>(
"minBSDeltaZ", 0.0)
201 ->
setComment(
"a minimum value of the beamspot sigma z to use, only active if useZInBeamspot=true");
202 desc.
add<
double>(
"defaultZ", 0.)
203 ->
setComment(
"the default z position, only used if useZInVertex and useZInBeamspot are both false");
204 desc.
add<
bool>(
"precise",
true);
207 ->setComment(
"only used if useZInBeamspot is true");
209 desc.
add<std::vector<edm::InputTag>>(
"superClusters",
210 std::vector<edm::InputTag>{
edm::InputTag{
"hltEgammaSuperClustersToPixelMatch"}});
216 descriptions.
add(
"trackingRegionsFromSuperClusters", descRegion);
223 double deltaZVertex = 0;
234 auto superClustersHandle = getHandle(
iEvent, superClustersToken);
235 for (
auto& superClusterRef : *superClustersHandle) {
251 if (!verticesHandle->empty()) {
253 const auto&
pv = verticesHandle->front();
265 const double bsSigmaZ =
std::sqrt(beamSpotHandle->sigmaZ() * beamSpotHandle->sigmaZ() +
266 beamSpotHandle->sigmaZ0Error() * beamSpotHandle->sigmaZ0Error());
281 const double deltaZVertex,
289 return std::make_unique<RectangularEtaPhiTrackingRegion>(fts.momentum(),
304 <<
" when constructing TrackingRegionsFromSuperClustersProducer both useZInVertex (" <<
useZInVertex_
305 <<
") and useZInBeamspot (" <<
useZInBeamspot_ <<
") can not be true as they are mutually exclusive options"
316 "TrackingRegionsFromSuperClustersProducer");