38 using namespace ctfseeding;
43 extraHitRPhitolerance(cfg.getParameter<double>(
"extraHitRPhitolerance")),
45 fitFastCircle(cfg.getParameter<bool>(
"fitFastCircle")),
46 fitFastCircleChi2Cut(cfg.getParameter<bool>(
"fitFastCircleChi2Cut")),
47 useBendingCorrection(cfg.getParameter<bool>(
"useBendingCorrection")),
48 caThetaCut(cfg.getParameter<double>(
"CAThetaCut")),
49 caPhiCut(cfg.getParameter<double>(
"CAPhiCut")),
50 caHardPtCut(cfg.getParameter<double>(
"CAHardPtCut"))
52 if(needSeedingLayerSetsHits)
55 if (cfg.
exists(
"SeedComparitorPSet"))
60 if (comparitorName !=
"none")
72 desc.
add<
double>(
"extraHitRPhitolerance", 0.1);
73 desc.
add<
bool>(
"fitFastCircle",
false);
74 desc.
add<
bool>(
"fitFastCircleChi2Cut",
false);
75 desc.
add<
bool>(
"useBendingCorrection",
false);
76 desc.
add<
double>(
"CAThetaCut", 0.00125);
77 desc.
add<
double>(
"CAPhiCut", 10);
78 desc.
add<
double>(
"CAHardPtCut", 0);
81 descMaxChi2.
add<
double>(
"pt1", 0.2);
82 descMaxChi2.add<
double>(
"pt2", 1.5);
83 descMaxChi2.add<
double>(
"value1", 500);
84 descMaxChi2.add<
double>(
"value2", 50);
85 descMaxChi2.add<
bool>(
"enabled",
true);
90 descComparitor.setAllowAnything();
99 template <
typename T_HitDoublets,
typename T_GeneratorOrPairsFunction>
101 T_GeneratorOrPairsFunction generatorOrPairsFunction) {
102 for (
unsigned int i = 0;
i < layers.
size();
i++)
104 for (
unsigned int j = 0;
j < 4; ++
j)
106 auto vertexIndex = 0;
108 layers[
i][
j].name());
116 vertexIndex = foundVertex - g.
theLayers.begin();
141 const bool nonEmpty = generatorOrPairsFunction(layers[
i][
j-1], layers[
i][
j], hitDoublets);
144 g.
theLayers[vertexIndex].theInnerLayers.push_back(
146 innerVertex->theOuterLayers.push_back(vertexIndex);
147 g.
theLayers[vertexIndex].theInnerLayerPairs.push_back(
149 innerVertex->theOuterLayerPairs.push_back(
171 <<
"CAHitQuadrupletsGenerator expects SeedingLayerSetsHits::numberOfLayersInSet() to be 4, got "
177 std::vector<HitDoublets> hitDoublets;
181 fillGraph(layers, g, hitDoublets,
184 std::vector<HitDoublets>& hitDoublets) {
185 hitDoublets.emplace_back(thePairGenerator.
doublets(region, ev, es, inner, outer));
192 std::vector<const HitDoublets *> hitDoubletsPtr;
193 hitDoubletsPtr.reserve(hitDoublets.size());
194 for(
const auto&
e: hitDoublets)
195 hitDoubletsPtr.emplace_back(&
e);
207 std::vector<const HitDoublets *> hitDoublets;
214 fillGraph(layers, g, hitDoublets,
217 std::vector<const HitDoublets *>& hitDoublets) {
218 using namespace std::placeholders;
219 auto found = std::find_if(regionLayerPairs.
begin(), regionLayerPairs.
end(),
220 std::bind(layerPairEqual, _1, inner.
index(), outer.
index()));
221 if(
found != regionLayerPairs.
end()) {
222 hitDoublets.emplace_back(&(
found->doublets()));
233 std::vector<const HitDoublets *>& hitDoublets,
const CAGraph& g,
235 const int numberOfHitsInNtuplet = 4;
236 std::vector<CACell::CAntuplet> foundQuadruplets;
243 ca.
evolve(numberOfHitsInNtuplet);
245 ca.
findNtuplets(foundQuadruplets, numberOfHitsInNtuplet);
251 std::array<float, 4> bc_r;
252 std::array<float, 4> bc_z;
253 std::array<float, 4> bc_errZ2;
254 std::array<GlobalPoint, 4> gps;
255 std::array<GlobalError, 4> ges;
256 std::array<bool, 4> barrels;
258 unsigned int numberOfFoundQuadruplets = foundQuadruplets.size();
261 for (
unsigned int quadId = 0; quadId < numberOfFoundQuadruplets; ++quadId)
264 auto isBarrel = [](
const unsigned id) ->
bool
268 for(
unsigned int i = 0;
i< 3; ++
i)
270 auto const& ahit = foundQuadruplets[quadId][
i]->getInnerHit();
271 gps[
i] = ahit->globalPosition();
272 ges[
i] = ahit->globalPositionError();
273 barrels[
i] =
isBarrel(ahit->geographicalId().subdetId());
276 auto const& ahit = foundQuadruplets[quadId][2]->getOuterHit();
277 gps[3] = ahit->globalPosition();
278 ges[3] = ahit->globalPositionError();
279 barrels[3] =
isBarrel(ahit->geographicalId().subdetId());
289 const float abscurv =
std::abs(curvature);
290 const float thisMaxChi2 = maxChi2Eval.
value(abscurv);
294 SeedingHitSet tmpTriplet(foundQuadruplets[quadId][0]->getInnerHit(), foundQuadruplets[quadId][2]->getInnerHit(), foundQuadruplets[quadId][2]->getOuterHit());
303 float chi2 = std::numeric_limits<float>::quiet_NaN();
308 const float simpleCot = ( gps.back().z() - gps.front().z() ) / (gps.back().perp() - gps.front().perp() );
310 for (
int i=0;
i < 4; ++
i)
316 bc_z[
i] = point.
z() - region.
origin().
z();
317 bc_errZ2[
i] = (barrels[
i]) ? error.
czz() : error.
rerr(point)*
sqr(simpleCot);
320 chi2 = rzLine.
chi2();
323 RZLine rzLine(gps, ges, barrels);
324 chi2 = rzLine.
chi2();
343 result.emplace_back(foundQuadruplets[quadId][0]->getInnerHit(), foundQuadruplets[quadId][1]->getInnerHit(), foundQuadruplets[quadId][2]->getInnerHit(), foundQuadruplets[quadId][2]->getOuterHit());
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
T getParameter(std::string const &) const
unsigned short numberOfLayersInSet() const
Get number of layers in each SeedingLayerSets.
void findNtuplets(std::vector< CACell::CAntuplet > &, const unsigned int)
float value(float curvature) const
std::vector< LayerSetAndLayers > layers(const SeedingLayerSetsHits &sets)
const bool useBendingCorrection
void hitNtuplets(const IntermediateHitDoublets::RegionLayerSets ®ionLayerPairs, OrderedHitSeeds &result, const edm::EventSetup &es, const SeedingLayerSetsHits &layers)
const_iterator begin() const
void createAndConnectCells(const std::vector< const HitDoublets * > &, const TrackingRegion &, const float, const float, const float)
GlobalPoint const & origin() const
bool getByToken(EDGetToken token, Handle< PROD > &result) const
LayerCacheType theLayerCache
bool isBarrel(GeomDetEnumerators::SubDetector m)
CAHitQuadrupletGenerator(const edm::ParameterSet &cfg, edm::ConsumesCollector &&iC, bool needSeedingLayerSetsHits=true)
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)
std::unique_ptr< SeedComparitor > theComparitor
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
Range curvature(double transverseIP) const
virtual void hitQuadruplets(const TrackingRegion ®, OrderedHitSeeds &quadruplets, const edm::Event &ev, const edm::EventSetup &es)
from base class
T inversePt(T curvature, const edm::EventSetup &iSetup)
T x() const
Cartesian x coordinate.
static unsigned int minLayers
T curvature(T InversePt, const edm::EventSetup &iSetup)
std::vector< CALayer > theLayers
void initEvent(const edm::Event &ev, const edm::EventSetup &es)
Abs< T >::type abs(const T &t)
const float extraHitRPhitolerance
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 bool fitFastCircleChi2Cut
const TrackingRegion & region() const
unsigned short LayerIndex
const QuantityDependsPt maxChi2
T rerr(const GlobalPoint &aPoint) const
Square< F >::type sqr(const F &f)
std::vector< int > theRootLayers
static void fillDescriptions(edm::ParameterSetDescription &desc)
QuantityDependsPtEval evaluator(const edm::EventSetup &es) const
virtual ~CAHitQuadrupletGenerator()
unsigned short size() const
Get the number of SeedingLayerSets.
tuple size
Write out results.
edm::EDGetTokenT< SeedingLayerSetsHits > theSeedingLayerToken
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
void evolve(const unsigned int)