1 #include <unordered_map> 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();
96 for (
unsigned int i = 0;
i < layers.
size();
i++)
98 for (
unsigned int j = 0; j < 3; ++j)
102 layers[
i][j].name());
135 for (
auto &
v : g.
theLayers[
i].isOuterHitOfCell)
v.clear();
140 template <
typename T_HitDoublets,
typename T_GeneratorOrPairsFunction>
142 T_GeneratorOrPairsFunction generatorOrPairsFunction) {
143 for (
unsigned int i = 0;
i < layers.
size();
i++)
145 for (
unsigned int j = 0; j < 3; ++j)
149 layers[
i][j].name());
173 const bool nonEmpty = generatorOrPairsFunction(layers[
i][j - 1], layers[
i][j], hitDoublets);
178 innerVertex->theOuterLayers.push_back(
vertexIndex);
181 innerVertex->theOuterLayerPairs.push_back(
202 <<
"CAHitTripletGenerator expects SeedingLayerSetsHits::numberOfLayersInSet() to be 3, got " 207 std::vector<HitDoublets> hitDoublets;
212 createGraphStructure(layers,g);
214 hitDoublets.emplace_back(thePairGenerator.
doublets(region, ev, es, inner, outer));
222 std::vector<const HitDoublets *> hitDoubletsPtr;
223 hitDoubletsPtr.reserve(hitDoublets.size());
224 for(
const auto&
e: hitDoublets)
225 hitDoubletsPtr.emplace_back(&
e);
227 hitTriplets(region, result, hitDoubletsPtr, g, es);
232 std::vector<OrderedHitSeeds>&
result,
237 std::vector<const HitDoublets *> hitDoublets;
244 std::vector<CACell::CAntuplet> foundTriplets;
247 for(
const auto& regionLayerPairs: regionDoublets) {
251 foundTriplets.clear();
254 createGraphStructure(layers, g);
257 clearGraphStructure(layers, g);
259 fillGraph(layers, g, hitDoublets,
262 std::vector<const HitDoublets *>& hitDoublets) {
264 auto found = std::find_if(regionLayerPairs.begin(), regionLayerPairs.end(),
265 std::bind(layerPairEqual, _1, inner.
index(), outer.
index()));
266 if(
found != regionLayerPairs.end()) {
267 hitDoublets.emplace_back(&(
found->doublets()));
276 auto & allCells = ca.getAllCells();
281 std::array<float, 3> bc_r;
282 std::array<float, 3> bc_z;
283 std::array<float, 3> bc_errZ2;
284 std::array<GlobalPoint, 3> gps;
285 std::array<GlobalError, 3> ges;
286 std::array<bool, 3> barrels;
288 unsigned int numberOfFoundTriplets = foundTriplets.size();
289 for (
unsigned int tripletId = 0; tripletId < numberOfFoundTriplets;
293 OrderedHitTriplet tmpTriplet(allCells[foundTriplets[tripletId][0]].getInnerHit(),
294 allCells[foundTriplets[tripletId][0]].getOuterHit(),
295 allCells[foundTriplets[tripletId][1]].getOuterHit());
301 for (
unsigned int i = 0;
i < 2; ++
i)
303 auto const& ahit = allCells[foundTriplets[tripletId][
i]].getInnerHit();
304 gps[
i] = ahit->globalPosition();
305 ges[
i] = ahit->globalPositionError();
306 barrels[
i] =
isBarrel(ahit->geographicalId().subdetId());
309 auto const& ahit = allCells[foundTriplets[tripletId][1]].getOuterHit();
310 gps[2] = ahit->globalPosition();
311 ges[2] = ahit->globalPositionError();
312 barrels[2] =
isBarrel(ahit->geographicalId().subdetId());
319 const float abscurv =
std::abs(curvature);
320 const float thisMaxChi2 = maxChi2Eval.
value(abscurv);
321 float chi2 = std::numeric_limits<float>::quiet_NaN();
327 const float simpleCot = (gps.back().z() - gps.front().z())
328 / (gps.back().perp() - gps.front().perp());
330 for (
int i = 0;
i < 3; ++
i)
339 bc_z[
i] = point.
z() - region.
origin().
z();
343 error.
rerr(point) *
sqr(simpleCot);
346 chi2 = rzLine.
chi2();
350 RZLine rzLine(gps, ges, barrels);
351 chi2 = rzLine.
chi2();
368 result[
index].emplace_back(tmpTriplet);
377 std::vector<const HitDoublets *>& hitDoublets,
CAGraph&
g,
379 std::vector<CACell::CAntuplet> foundTriplets;
387 unsigned int numberOfFoundTriplets = foundTriplets.size();
392 std::array<float, 3> bc_r;
393 std::array<float, 3> bc_z;
394 std::array<float, 3> bc_errZ2;
395 std::array < GlobalPoint, 3 > gps;
396 std::array < GlobalError, 3 > ges;
397 std::array<bool, 3> barrels;
399 for (
unsigned int tripletId = 0; tripletId < numberOfFoundTriplets;
403 OrderedHitTriplet tmpTriplet(allCells[foundTriplets[tripletId][0]].getInnerHit(),
404 allCells[foundTriplets[tripletId][0]].getOuterHit(),
405 allCells[foundTriplets[tripletId][1]].getOuterHit());
411 for (
unsigned int i = 0;
i < 2; ++
i)
413 auto const& ahit = allCells[foundTriplets[tripletId][
i]].getInnerHit();
414 gps[
i] = ahit->globalPosition();
415 ges[
i] = ahit->globalPositionError();
416 barrels[
i] =
isBarrel(ahit->geographicalId().subdetId());
419 auto const& ahit = allCells[foundTriplets[tripletId][1]].getOuterHit();
420 gps[2] = ahit->globalPosition();
421 ges[2] = ahit->globalPositionError();
422 barrels[2] =
isBarrel(ahit->geographicalId().subdetId());
429 const float abscurv =
std::abs(curvature);
430 const float thisMaxChi2 = maxChi2Eval.
value(abscurv);
431 float chi2 = std::numeric_limits<float>::quiet_NaN();
436 const float simpleCot = (gps.back().z() - gps.front().z())
437 / (gps.back().perp() - gps.front().perp());
439 for (
int i = 0;
i < 3; ++
i)
448 bc_z[
i] = point.
z() - region.
origin().
z();
452 error.
rerr(point) *
sqr(simpleCot);
455 chi2 = rzLine.
chi2();
459 RZLine rzLine(gps, ges, barrels);
460 chi2 = rzLine.
chi2();
478 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)
GlobalPoint const & origin() const
def create(alignables, pedeDump, additionalData, outputFile, config)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
bool exists(std::string const ¶meterName) const
checks if a parameter exists
std::vector< CACell > & getAllCells()
void hitNtuplets(const IntermediateHitDoublets ®ionDoublets, std::vector< OrderedHitSeeds > &result, const edm::EventSetup &es, const SeedingLayerSetsHits &layers)
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)
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 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
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()