1 #ifndef RecoTracker_TkTrackingRegions_TrackingRegionsFromSuperClustersProducer_H 2 #define RecoTracker_TkTrackingRegions_TrackingRegionsFromSuperClustersProducer_H 56 #include "TEnumConstant.h" 58 template<
typename MyEnum> MyEnum strToEnum(
std::string const& enumConstName){
59 TEnum* en = TEnum::GetEnum(
typeid(MyEnum));
61 if (TEnumConstant
const* enc = en->GetConstant(enumConstName.c_str())){
62 return static_cast<MyEnum
>(enc->GetValue());
64 throw cms::Exception(
"Configuration") <<enumConstName<<
" is not a valid member of "<<
typeid(MyEnum).
name();
71 if(enumConstName==
"kNever")
return MyEnum::kNever;
72 else if(enumConstName==
"kForSiStrips")
return MyEnum::kForSiStrips;
73 else if(enumConstName==
"kAlways")
return MyEnum::kAlways;
75 throw cms::Exception(
"InvalidConfiguration") <<enumConstName<<
" is not a valid member of "<<
typeid(MyEnum).
name()<<
" (or strToEnum needs updating, this is a manual translation found at "<<__FILE__<<
" line "<<__LINE__<<
")";
97 std::vector<std::unique_ptr<TrackingRegion> >
103 std::unique_ptr<TrackingRegion>
145 event.getByToken(token,handle);
173 auto superClustersTags = regionPSet.
getParameter<std::vector<edm::InputTag> >(
"superClusters");
184 for(
const auto&
tag : superClustersTags){
196 desc.
add<
double>(
"ptMin", 1.5);
197 desc.
add<
double>(
"originRadius", 0.2);
198 desc.
add<
double>(
"originHalfLength", 15.0)->
setComment(
"z range is +/- this value except when using the beamspot (useZInBeamspot=true)");
199 desc.
add<
double>(
"deltaPhiRegion",0.4);
200 desc.
add<
double>(
"deltaEtaRegion",0.1);
201 desc.
add<
bool>(
"useZInVertex",
false)->setComment(
"use the leading vertex position +/-orginHalfLength, mutually exclusive with useZInBeamspot");
202 desc.
add<
bool>(
"useZInBeamspot",
true)->setComment(
"use the beamspot position +/- nrSigmaForBSDeltaZ* sigmaZ_{bs}, mutually exclusive with useZInVertex");
203 desc.
add<
double>(
"nrSigmaForBSDeltaZ",3.0)->
setComment(
"# of sigma to extend the z region when using the beamspot, only active if useZInBeamspot=true");
204 desc.
add<
double>(
"minBSDeltaZ",0.0)->
setComment(
"a minimum value of the beamspot sigma z to use, only active if useZInBeamspot=true");
205 desc.
add<
double>(
"defaultZ",0.)->
setComment(
"the default z position, only used if useZInVertex and useZInBeamspot are both false");
206 desc.
add<
bool>(
"precise",
true);
210 desc.
add<std::vector<edm::InputTag> >(
"superClusters", std::vector<edm::InputTag>{
edm::InputTag{
"hltEgammaSuperClustersToPixelMatch"}});
216 descriptions.
add(
"trackingRegionsFromSuperClusters", descRegion);
221 std::vector<std::unique_ptr<TrackingRegion> >
227 double deltaZVertex=0;
238 auto superClustersHandle = getHandle(iEvent,superClustersToken);
239 for(
auto& superClusterRef : *superClustersHandle){
255 if(!verticesHandle->empty()){
257 const auto&
pv = verticesHandle->front();
270 const double bsSigmaZ =
std::sqrt(beamSpotHandle->sigmaZ()*beamSpotHandle->sigmaZ() +
271 beamSpotHandle->sigmaZ0Error()*beamSpotHandle->sigmaZ0Error());
284 std::unique_ptr<TrackingRegion>
292 const double energy = superCluster.
energy();
295 return std::make_unique<RectangularEtaPhiTrackingRegion>(freeTrajState.
momentum(),
310 throw cms::Exception(
"InvalidConfiguration") <<
" when constructing TrackingRegionsFromSuperClustersProducer both useZInVertex ("<<
useZInVertex_<<
") and useZInBeamspot ("<<
useZInBeamspot_<<
") can not be true as they are mutually exclusive options"<<std::endl;
T getParameter(std::string const &) const
void setComment(std::string const &value)
const math::XYZPoint & position() const
cluster centroid position
static FreeTrajectoryState get(MagneticField const &magField, GlobalPoint const &xmeas, GlobalPoint const &xvert, float momentum, TrackCharge charge)
RectangularEtaPhiTrackingRegion::UseMeasurementTracker whereToUseMeasTracker_
Global3DPoint GlobalPoint
double nrSigmaForBSDeltaZ_
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
std::vector< Vertex > VertexCollection
collection of Vertex objects
math::XYZPoint Point
point in the space
std::vector< std::unique_ptr< TrackingRegion > > regions(const edm::Event &iEvent, const edm::EventSetup &iSetup) const override
TrackingRegionsFromSuperClustersProducer(const edm::ParameterSet &cfg, edm::ConsumesCollector &&cc)
edm::EDGetTokenT< reco::BeamSpot > beamSpotToken_
std::vector< edm::EDGetTokenT< std::vector< reco::SuperClusterRef > > > superClustersTokens_
double energy() const
cluster energy
ParameterDescriptionBase * add(U const &iLabel, T const &value)
GlobalVector momentum() const
std::unique_ptr< TrackingRegion > createTrackingRegion(const reco::SuperCluster &superCluster, const GlobalPoint &vtxPos, const double deltaZVertex, const Charge charge, const MeasurementTrackerEvent *measTrackerEvent, const MagneticField &magField) const
void add(std::string const &label, ParameterSetDescription const &psetDescription)
~TrackingRegionsFromSuperClustersProducer() override
edm::EDGetTokenT< reco::VertexCollection > verticesToken_
edm::EDGetTokenT< MeasurementTrackerEvent > measTrackerEventToken_
bool isUninitialized() const
GlobalPoint getVtxPos(const edm::Event &iEvent, double &deltaZVertex) const
void validateConfigSettings() const