1 #include <unordered_map>
32 using namespace ctfseeding;
38 bool needSeedingLayerSetsHits) :
42 caThetaCut( cfg.getParameter<double>(
"CAThetaCut")),
43 caPhiCut(cfg.getParameter<double>(
"CAPhiCut")),
44 caHardPtCut(cfg.getParameter<double>(
"CAHardPtCut"))
47 if(needSeedingLayerSetsHits)
50 if (cfg.
exists(
"SeedComparitorPSet"))
53 > (
"SeedComparitorPSet");
56 if (comparitorName !=
"none")
70 desc.
add<
double>(
"extraHitRPhitolerance", 0.06);
71 desc.
add<
bool>(
"useBendingCorrection",
false);
72 desc.
add<
double>(
"CAThetaCut", 0.00125);
73 desc.
add<
double>(
"CAPhiCut", 0.1);
74 desc.
add<
double>(
"CAHardPtCut", 0);
77 descMaxChi2.
add<
double>(
"pt1", 0.8);
78 descMaxChi2.add<
double>(
"pt2", 2);
79 descMaxChi2.add<
double>(
"value1", 50);
80 descMaxChi2.add<
double>(
"value2", 8);
81 descMaxChi2.add<
bool>(
"enabled",
true);
86 descComparitor.setAllowAnything();
95 template <
typename T_HitDoublets,
typename T_GeneratorOrPairsFunction>
97 T_GeneratorOrPairsFunction generatorOrPairsFunction) {
99 for (
unsigned int i = 0;
i < layers.
size();
i++)
101 for (
unsigned int j = 0;
j < 3; ++
j)
103 auto vertexIndex = 0;
105 layers[
i][
j].name());
109 layers[
i][
j].hits().
size());
114 vertexIndex = foundVertex - g.
theLayers.begin();
139 const bool nonEmpty = generatorOrPairsFunction(layers[
i][
j - 1], layers[
i][
j], hitDoublets);
142 g.
theLayers[vertexIndex].theInnerLayers.push_back(
144 innerVertex->theOuterLayers.push_back(vertexIndex);
145 g.
theLayers[vertexIndex].theInnerLayerPairs.push_back(
147 innerVertex->theOuterLayerPairs.push_back(
168 <<
"CAHitTripletGenerator expects SeedingLayerSetsHits::numberOfLayersInSet() to be 3, got "
173 std::vector<HitDoublets> hitDoublets;
179 hitDoublets.emplace_back(thePairGenerator.
doublets(region, ev, es, inner, outer));
187 std::vector<const HitDoublets *> hitDoubletsPtr;
188 hitDoubletsPtr.reserve(hitDoublets.size());
189 for(
const auto&
e: hitDoublets)
190 hitDoubletsPtr.emplace_back(&
e);
192 hitTriplets(region, result, hitDoubletsPtr, g, es);
202 std::vector<const HitDoublets *> hitDoublets;
210 using namespace std::placeholders;
211 auto found = std::find_if(regionLayerPairs.
begin(), regionLayerPairs.
end(), std::bind(layerPairEqual, _1, inner.
index(), outer.
index()));
212 if(
found != regionLayerPairs.
end()) {
213 hitDoublets.emplace_back(&(
found->doublets()));
225 std::vector<const HitDoublets *>& hitDoublets,
const CAGraph& g,
227 std::vector<CACell::CAntuplet> foundTriplets;
233 unsigned int numberOfFoundTriplets = foundTriplets.size();
238 std::array<float, 3> bc_r;
239 std::array<float, 3> bc_z;
240 std::array<float, 3> bc_errZ2;
241 std::array < GlobalPoint, 3 > gps;
242 std::array < GlobalError, 3 > ges;
243 std::array<bool, 3> barrels;
245 for (
unsigned int tripletId = 0; tripletId < numberOfFoundTriplets;
250 foundTriplets[tripletId][0]->getOuterHit(),
251 foundTriplets[tripletId][1]->getOuterHit());
253 auto isBarrel = [](
const unsigned id) ->
bool
257 for (
unsigned int i = 0;
i < 2; ++
i)
259 auto const& ahit = foundTriplets[tripletId][
i]->getInnerHit();
260 gps[
i] = ahit->globalPosition();
261 ges[
i] = ahit->globalPositionError();
262 barrels[
i] =
isBarrel(ahit->geographicalId().subdetId());
265 auto const& ahit = foundTriplets[tripletId][1]->getOuterHit();
266 gps[2] = ahit->globalPosition();
267 ges[2] = ahit->globalPositionError();
268 barrels[2] =
isBarrel(ahit->geographicalId().subdetId());
275 const float abscurv =
std::abs(curvature);
276 const float thisMaxChi2 = maxChi2Eval.
value(abscurv);
277 float chi2 = std::numeric_limits<float>::quiet_NaN();
282 const float simpleCot = (gps.back().z() - gps.front().z())
283 / (gps.back().perp() - gps.front().perp());
285 for (
int i = 0;
i < 3; ++
i)
294 bc_z[
i] = point.
z() - region.
origin().
z();
298 error.
rerr(point) *
sqr(simpleCot);
301 chi2 = rzLine.
chi2();
305 RZLine rzLine(gps, ges, barrels);
306 chi2 = rzLine.
chi2();
324 result.push_back(tmpTriplet);
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
T getParameter(std::string const &) const
unsigned short numberOfLayersInSet() const
Get number of layers in each SeedingLayerSets.
const QuantityDependsPt maxChi2
std::vector< LayerSetAndLayers > layers(const SeedingLayerSetsHits &sets)
const_iterator begin() const
GlobalPoint const & origin() const
bool getByToken(EDGetToken token, Handle< PROD > &result) const
bool isBarrel(GeomDetEnumerators::SubDetector m)
const_iterator end() const
bool exists(std::string const ¶meterName) const
checks if a parameter exists
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
CAHitTripletGenerator(const edm::ParameterSet &cfg, edm::ConsumesCollector &&iC, bool needSeedingLayerSetsHits=true)
The Signals That Services Can Subscribe To This is based on ActivityRegistry and is current per Services can connect to the signals distributed by the ActivityRegistry in order to monitor the activity of the application Each possible callback has some defined which we here list in angle e g
const bool useBendingCorrection
Range curvature(double transverseIP) const
edm::EDGetTokenT< SeedingLayerSetsHits > theSeedingLayerToken
T inversePt(T curvature, const edm::EventSetup &iSetup)
T x() const
Cartesian x coordinate.
QuantityDependsPtEval evaluator(const edm::EventSetup &es) const
T curvature(T InversePt, const edm::EventSetup &iSetup)
std::vector< CALayer > theLayers
Abs< T >::type abs(const T &t)
void initEvent(const edm::Event &ev, const edm::EventSetup &es)
float value(float curvature) const
ParameterDescriptionBase * add(U const &iLabel, T const &value)
std::vector< CALayerPair > theLayerPairs
HitDoublets doublets(const TrackingRegion ®, const edm::Event &ev, const edm::EventSetup &es, Layers layers)
const TrackingRegion & region() const
virtual void hitTriplets(const TrackingRegion ®, OrderedHitTriplets &triplets, const edm::Event &ev, const edm::EventSetup &es)
from base class
unsigned short LayerIndex
T rerr(const GlobalPoint &aPoint) const
Square< F >::type sqr(const F &f)
std::vector< int > theRootLayers
static void fillDescriptions(edm::ParameterSetDescription &desc)
const float extraHitRPhitolerance
LayerCacheType theLayerCache
void hitNtuplets(const IntermediateHitDoublets::RegionLayerSets ®ionLayerPairs, OrderedHitTriplets &result, const edm::EventSetup &es, const SeedingLayerSetsHits &layers)
void findTriplets(const std::vector< const HitDoublets * > &hitDoublets, std::vector< CACell::CAntuplet > &foundTriplets, const TrackingRegion ®ion, const float thetaCut, const float phiCut, const float hardPtCut)
std::unique_ptr< SeedComparitor > theComparitor
unsigned short size() const
Get the number of SeedingLayerSets.
static unsigned int minLayers
tuple size
Write out results.
T get(const Candidate &c)
*vegas h *****************************************************used in the default bin number in original ***version of VEGAS is ***a higher bin number might help to derive a more precise ***grade subtle point
virtual ~CAHitTripletGenerator()