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(
"Configuration") <<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 virtual std::vector<std::unique_ptr<TrackingRegion> >
103 std::unique_ptr<TrackingRegion>
133 event.getByToken(token,handle);
155 auto superClustersTags = regionPSet.
getParameter<std::vector<edm::InputTag> >(
"superClusters");
166 for(
const auto&
tag : superClustersTags){
178 desc.
add<
double>(
"ptMin", 1.5);
179 desc.
add<
double>(
"originRadius", 0.2);
180 desc.
add<
double>(
"originHalfLength", 15.0);
181 desc.
add<
double>(
"deltaPhiRegion",0.4);
182 desc.
add<
double>(
"deltaEtaRegion",0.1);
183 desc.
add<
bool>(
"useZInVertex",
false);
184 desc.
add<
bool>(
"precise",
true);
188 desc.
add<std::vector<edm::InputTag> >(
"superClusters", std::vector<edm::InputTag>());
194 descriptions.
add(
"trackingRegionsFromSuperClusters", descRegion);
199 std::vector<std::unique_ptr<TrackingRegion> >
205 double deltaZVertex=0;
216 auto superClustersHandle = getHandle(iEvent,superClustersToken);
217 for(
auto& superClusterRef : *superClustersHandle){
231 if(!verticesHandle->empty()){
233 const auto&
pv = verticesHandle->front();
243 const double sigmaZ = beamSpotHandle->sigmaZ();
244 const double sigmaZ0Error = beamSpotHandle->sigmaZ0Error();
245 deltaZVertex = 3*
std::sqrt(sigmaZ*sigmaZ+sigmaZ0Error*sigmaZ0Error);
252 std::unique_ptr<TrackingRegion>
260 const double energy = superCluster.
energy();
263 return std::make_unique<RectangularEtaPhiTrackingRegion>(freeTrajState.
momentum(),
T getParameter(std::string const &) const
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
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
std::vector< Vertex > VertexCollection
collection of Vertex objects
math::XYZPoint Point
point in the space
virtual ~TrackingRegionsFromSuperClustersProducer()
virtual 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)
edm::EDGetTokenT< reco::VertexCollection > verticesToken_
edm::EDGetTokenT< MeasurementTrackerEvent > measTrackerEventToken_
bool isUninitialized() const
GlobalPoint getVtxPos(const edm::Event &iEvent, double &deltaZVertex) const