51 : beamSpotTag_(tokens.token_bs),
52 theUpdator(0),thePropagator(0),theMeasurementTracker(0),
53 theMeasurementTrackerEventTag(tokens.token_mte),
54 theSetup(0), theMatcher_(0),
55 cacheIDMagField_(0),cacheIDCkfComp_(0),cacheIDTrkGeom_(0),
56 tibOriginZCut_(pset.getParameter<double>(
"tibOriginZCut")),
57 tidOriginZCut_(pset.getParameter<double>(
"tidOriginZCut")),
58 tecOriginZCut_(pset.getParameter<double>(
"tecOriginZCut")),
59 monoOriginZCut_(pset.getParameter<double>(
"monoOriginZCut")),
60 tibDeltaPsiCut_(pset.getParameter<double>(
"tibDeltaPsiCut")),
61 tidDeltaPsiCut_(pset.getParameter<double>(
"tidDeltaPsiCut")),
62 tecDeltaPsiCut_(pset.getParameter<double>(
"tecDeltaPsiCut")),
63 monoDeltaPsiCut_(pset.getParameter<double>(
"monoDeltaPsiCut")),
64 tibPhiMissHit2Cut_(pset.getParameter<double>(
"tibPhiMissHit2Cut")),
65 tidPhiMissHit2Cut_(pset.getParameter<double>(
"tidPhiMissHit2Cut")),
66 tecPhiMissHit2Cut_(pset.getParameter<double>(
"tecPhiMissHit2Cut")),
67 monoPhiMissHit2Cut_(pset.getParameter<double>(
"monoPhiMissHit2Cut")),
68 tibZMissHit2Cut_(pset.getParameter<double>(
"tibZMissHit2Cut")),
69 tidRMissHit2Cut_(pset.getParameter<double>(
"tidRMissHit2Cut")),
70 tecRMissHit2Cut_(pset.getParameter<double>(
"tecRMissHit2Cut")),
71 tidEtaUsage_(pset.getParameter<double>(
"tidEtaUsage")),
72 tidMaxHits_(pset.getParameter<
int>(
"tidMaxHits")),
73 tecMaxHits_(pset.getParameter<
int>(
"tecMaxHits")),
74 monoMaxHits_(pset.getParameter<
int>(
"monoMaxHits")),
75 maxSeeds_(pset.getParameter<
int>(
"maxSeeds"))
78 if (pset.
exists(
"measurementTrackerName"))
131 for (
unsigned int i=0;
i<clusters->size();++
i) {
134 LogDebug (
"run") <<
"new cluster, calling findSeedsFromCluster";
139 LogDebug (
"run") <<
"Nr of superclusters: "<<clusters->size()
140 <<
", no. of ElectronSeeds found = " << out.size();
158 double sCenergy = seedCluster->energy();
160 double scEta = seedCluster->eta();
162 double scz = sCposition.z();
163 double scr =
sqrt(
pow(sCposition.x(),2)+
pow(sCposition.y(),2));
165 double pT = sCenergy * seedCluster->position().rho()/
sqrt(seedCluster->x()*seedCluster->x()+seedCluster->y()*seedCluster->y()+seedCluster->z()*seedCluster->z());
171 double phiVsRSlope = -3.00e-3 * magneticField / pT / 2.;
176 GlobalPoint superCluster(sCposition.x(),sCposition.y(),sCposition.z());
185 int chargeHypothesis;
186 double chargeSelector = sCenergy - (
int)sCenergy;
187 if(chargeSelector >= 0.5) chargeHypothesis = -1;
188 else {chargeHypothesis = 1;}
192 double phiFake =
phiDiff(superCluster.phi(),chargeHypothesis * phiVsRSlope * (scr - rFake));
193 double zFake = (rFake*(scz-z0)-r0*scz+scr*z0)/(scr-r0);
194 double xFake = rFake *
cos(phiFake);
195 double yFake = rFake *
sin(phiFake);
216 std::vector<const BarrelDetLayer*> tibLayers = gst->
tibLayers();
217 const DetLayer* tib1 = tibLayers.at(0);
218 const DetLayer* tib2 = tibLayers.at(1);
220 std::vector<const ForwardDetLayer*> tecLayers;
221 std::vector<const ForwardDetLayer*> tidLayers;
231 const DetLayer* tid1 = tidLayers.at(0);
232 const DetLayer* tid2 = tidLayers.at(1);
233 const DetLayer* tid3 = tidLayers.at(2);
234 const DetLayer* tec1 = tecLayers.at(0);
235 const DetLayer* tec2 = tecLayers.at(1);
236 const DetLayer* tec3 = tecLayers.at(2);
257 bool hasLay1Hit =
false;
258 bool hasLay2Hit =
false;
259 bool hasBackupHit =
false;
263 std::vector<TrajectoryMeasurement> tib1measurements;
265 std::vector<TrajectoryMeasurement> tib2measurements;
272 for(std::vector<TrajectoryMeasurement>::const_iterator tmIter = tib1measurements.begin(); tmIter != tib1measurements.end(); ++ tmIter){
277 if(
preselection(position, superCluster, phiVsRSlope, 1)){
284 for(std::vector<TrajectoryMeasurement>::const_iterator tmIter = tib2measurements.begin(); tmIter != tib2measurements.end(); ++ tmIter){
289 if(
preselection(position, superCluster, phiVsRSlope, 1)){
296 if(!(hasLay1Hit && hasLay2Hit)) useTID =
true;
298 std::vector<TrajectoryMeasurement> tid1measurements;
300 std::vector<TrajectoryMeasurement> tid2measurements;
302 std::vector<TrajectoryMeasurement> tid3measurements;
305 for(std::vector<TrajectoryMeasurement>::const_iterator tmIter = tid1measurements.begin(); tmIter != tid1measurements.end(); ++ tmIter){
311 if(
preselection(position, superCluster, phiVsRSlope, 2)){
322 if(
preselection(position, superCluster, phiVsRSlope, 4) && position.
perp() > 37.){
332 for(std::vector<TrajectoryMeasurement>::const_iterator tmIter = tid2measurements.begin(); tmIter != tid2measurements.end(); ++ tmIter){
338 if(
preselection(position, superCluster, phiVsRSlope, 2)){
349 if(
preselection(position, superCluster, phiVsRSlope, 4) && position.
perp() > 37.){
359 for(std::vector<TrajectoryMeasurement>::const_iterator tmIter = tid3measurements.begin(); tmIter != tid3measurements.end(); ++ tmIter){
365 if(
preselection(position, superCluster, phiVsRSlope, 2)){
376 if(
preselection(position, superCluster, phiVsRSlope, 4) && position.
perp() > 37.){
386 std::vector<TrajectoryMeasurement> tec1measurements;
388 std::vector<TrajectoryMeasurement> tec2measurements;
390 std::vector<TrajectoryMeasurement> tec3measurements;
393 for(std::vector<TrajectoryMeasurement>::const_iterator tmIter = tec1measurements.begin(); tmIter != tec1measurements.end(); ++ tmIter){
399 if(
preselection(position, superCluster, phiVsRSlope, 3)){
410 for(std::vector<TrajectoryMeasurement>::const_iterator tmIter = tec2measurements.begin(); tmIter != tec2measurements.end(); ++ tmIter){
416 if(
preselection(position, superCluster, phiVsRSlope, 3)){
427 for(std::vector<TrajectoryMeasurement>::const_iterator tmIter = tec3measurements.begin(); tmIter != tec3measurements.end(); ++ tmIter){
433 if(
preselection(position, superCluster, phiVsRSlope, 3)){
443 if( hasLay1Hit && hasLay2Hit ){
445 for (std::vector<const SiStripMatchedRecHit2D*>::const_iterator hit1 =
layer1Hits_.begin() ; hit1!=
layer1Hits_.end(); ++hit1) {
446 for (std::vector<const SiStripMatchedRecHit2D*>::const_iterator hit2 =
layer2Hits_.begin() ; hit2!=
layer2Hits_.end(); ++hit2) {
466 result.push_back(seed);
480 if(hasLay1Hit && hasBackupHit && seedCounter == 0){
482 for (std::vector<const SiStripMatchedRecHit2D*>::const_iterator hit1 =
layer1Hits_.begin() ; hit1!=
layer1Hits_.end(); ++hit1) {
497 outerHit=
new SiStripRecHit2D(*(dynamic_cast <const SiStripRecHit2D *> (*hit2) ) );
504 result.push_back(seed);
521 std::vector<const SiStripMatchedRecHit2D*>::const_iterator hit2,
522 double rc,
double zc,
double pT,
double scEta) {
524 bool seedCutsSatisfied =
false;
529 double r1 =
sqrt(hit1Pos.
x()*hit1Pos.
x() + hit1Pos.
y()*hit1Pos.
y());
530 double phi1 = hit1Pos.
phi();
531 double z1=hit1Pos.
z();
534 double r2 =
sqrt(hit2Pos.
x()*hit2Pos.
x() + hit2Pos.
y()*hit2Pos.
y());
535 double phi2 = hit2Pos.
phi();
536 double z2 = hit2Pos.
z();
542 double curv = pT*100*.877;
545 double a = (r2-
r1)/(2*curv);
548 double phiMissHit2=0;
552 double zMissHit2 = z2 - (r2*(zc-z1)-r1*zc+rc*z1)/(rc-
r1);
554 double rPredHit2 = r1 + (rc-
r1)/(zc-z1)*(z2-z1);
555 double rMissHit2 = r2 - rPredHit2;
562 if(zVar1 > 75 && zVar1 < 95 && (zVar2 > 18 || zVar2 < 5)) zDiff =
false;
563 if(zVar1 > 100 && zVar1 < 110 && (zVar2 > 35 || zVar2 < 5)) zDiff =
false;
564 if(zVar1 > 125 && zVar1 < 150 && (zVar2 > 18 || zVar2 < 5)) zDiff =
false;
566 if(subdetector == 1){
568 if(r1 > 23 && r1 < 28 && r2 > 31 && r2 < 37) tibExtraCut = 1;
570 }
else if(subdetector == 2){
572 if(r1 > 23 && r1 < 34 && r2 > 26 && r2 < 42) tidExtraCut = 1;
574 }
else if(subdetector == 3){
576 if(r1 > 23 && r1 < 32 && r2 > 26 && r2 < 42) tecExtraCut = 1;
582 if(!seedCutsSatisfied)
return false;
590 double vertexZ = z1 - (r1 * (zc - z1) ) / (rc -
r1);
599 FastHelix helix(hit2Pos,hit1Pos,eleVertex,nomField,&*bfield);
600 if (!helix.
isValid())
return false;
605 if (!propagatedState.isValid())
return false;
610 if (!propagatedState_out.
isValid())
return false;
622 std::vector<const SiStripRecHit2D*>::const_iterator hit2,
623 double rc,
double zc,
double pT,
double scEta) {
625 bool seedCutSatisfied =
false;
630 double r1 =
sqrt(hit1Pos.
x()*hit1Pos.
x() + hit1Pos.
y()*hit1Pos.
y());
631 double phi1 = hit1Pos.
phi();
632 double z1=hit1Pos.
z();
635 double r2 =
sqrt(hit2Pos.
x()*hit2Pos.
x() + hit2Pos.
y()*hit2Pos.
y());
636 double phi2 = hit2Pos.
phi();
637 double z2 = hit2Pos.
z();
643 double curv = pT*100*.877;
646 double a = (r2-
r1)/(2*curv);
648 double phiMissHit2 = 0;
656 if(!seedCutSatisfied)
return false;
665 double vertexZ = z1 - (r1 * (zc - z1) ) / (rc -
r1);
674 FastHelix helix(hit2Pos,hit1Pos,eleVertex,nomField,&*bfield);
675 if (!helix.
isValid())
return false;
680 if (!propagatedState.isValid())
return false;
685 if (!propagatedState_out.
isValid())
return false;
698 double r = position.
perp();
699 double phi = position.
phi();
700 double z = position.
z();
701 double scr = superCluster.
perp();
702 double scphi = superCluster.
phi();
703 double scz = superCluster.
z();
705 double deltaPsi = psi - (scr-
r)*phiVsRSlope;
706 double antiDeltaPsi = psi - (r-
scr)*phiVsRSlope;
713 double originZ = (scr*z - r*scz)/(scr-r);
719 }
else if(hitLayer == 2){
721 }
else if(hitLayer == 3){
723 }
else if(hitLayer == 4){
759 if(variable > 0 && variable < 1.8){
760 useDetLayer.push_back(
true);
762 useDetLayer.push_back(
false);
764 if(variable > 0 && variable < 1.5){
765 useDetLayer.push_back(
true);
767 useDetLayer.push_back(
false);
769 if(variable > 1 && variable < 2.1){
770 useDetLayer.push_back(
true);
772 useDetLayer.push_back(
false);
774 if(variable > 1 && variable < 2.2){
775 useDetLayer.push_back(
true);
777 useDetLayer.push_back(
false);
779 if(variable > 1 && variable < 2.3){
780 useDetLayer.push_back(
true);
782 useDetLayer.push_back(
false);
784 if(variable > 1.8 && variable < 2.5){
785 useDetLayer.push_back(
true);
787 useDetLayer.push_back(
false);
789 if(variable > 1.8 && variable < 2.5){
790 useDetLayer.push_back(
true);
792 useDetLayer.push_back(
false);
794 if(variable > 1.8 && variable < 2.5){
795 useDetLayer.push_back(
true);
797 useDetLayer.push_back(
false);
799 if(variable > 1.2 && variable < 1.6){
800 useDetLayer.push_back(
true);
802 useDetLayer.push_back(
false);
T getParameter(std::string const &) const
unsigned long long cacheIdentifier() const
double z0() const
z coordinate
std::vector< TrajectoryMeasurement > measurements(const DetLayer &layer, const TrajectoryStateOnSurface &startingState, const Propagator &prop, const MeasurementEstimator &est) const
bool checkHitsAndTSOS(std::vector< const SiStripMatchedRecHit2D * >::const_iterator hit1, std::vector< const SiStripMatchedRecHit2D * >::const_iterator hit2, double scr, double scz, double pT, double scEta)
double tidPhiMissHit2Cut_
std::vector< bool > useDetLayer(double scEta)
int nominalValue() const
The nominal field value for this map in kGauss.
bool getByToken(EDGetToken token, Handle< PROD > &result) const
GlobalPoint toGlobal(const Local2DPoint &lp) const
Conversion to the global R.F. from the R.F. of the GeomDet.
double monoPhiMissHit2Cut_
Sin< T >::type sin(const T &t)
std::string theMeasurementTrackerName
const MeasurementTracker * theMeasurementTracker
Geom::Phi< T > phi() const
edm::ESHandle< MagneticField > theMagField
bool exists(std::string const ¶meterName) const
checks if a parameter exists
TransientTrackingRecHit::ConstRecHitPointer ConstRecHitPointer
Chi2MeasurementEstimator * theEstimator
def setup(process, global_tag, zero_tesla=False)
const SiStripMatchedRecHit2D * matchedHitConverter(ConstRecHitPointer crhp)
edm::EDGetTokenT< reco::BeamSpot > beamSpotTag_
edm::EDGetTokenT< MeasurementTrackerEvent > theMeasurementTrackerEventTag
std::map< std::string, int, std::less< std::string > > psi
double tibPhiMissHit2Cut_
TrajectoryStateOnSurface update(const TrajectoryStateOnSurface &, const TrackingRecHit &) const
PRecHitContainer recHits_
Cos< T >::type cos(const T &t)
Abs< T >::type abs(const T &t)
const edm::EventSetup * theSetup
SiStripElectronSeedGenerator(const edm::ParameterSet &, const Tokens &)
virtual LocalPoint localPosition() const final
std::vector< ElectronSeed > ElectronSeedCollection
collection of ElectronSeed objects
edm::ESHandle< TrackerGeometry > trackerGeometryHandle
unsigned long long cacheIDTrkGeom_
edm::Handle< reco::BeamSpot > theBeamSpot
PropagatorWithMaterial * thePropagator
int whichSubdetector(std::vector< const SiStripMatchedRecHit2D * >::const_iterator hit)
void findSeedsFromCluster(edm::Ref< reco::SuperClusterCollection >, edm::Handle< reco::BeamSpot >, const MeasurementTrackerEvent &trackerData, reco::ElectronSeedCollection &)
bool preselection(GlobalPoint position, GlobalPoint superCluster, double phiVsRSlope, int hitLayer)
TrajectoryStateOnSurface TSOS
virtual TrackingRecHit const * hit() const
unsigned long long cacheIDCkfComp_
std::vector< BarrelDetLayer const * > const & tibLayers() const
const SiStripRecHit2D * backupHitConverter(ConstRecHitPointer crhp)
bool altCheckHitsAndTSOS(std::vector< const SiStripMatchedRecHit2D * >::const_iterator hit1, std::vector< const SiStripRecHit2D * >::const_iterator hit2, double scr, double scz, double pT, double scEta)
void setupES(const edm::EventSetup &setup)
std::vector< ForwardDetLayer const * > const & posTecLayers() const
XYZPointD XYZPoint
point in space with cartesian internal representation
std::vector< const SiStripMatchedRecHit2D * > layer2Hits_
TrajectoryStateOnSurface propagate(STA const &state, SUR const &surface) const
~SiStripElectronSeedGenerator()
std::vector< ForwardDetLayer const * > const & negTidLayers() const
double tecPhiMissHit2Cut_
double phiDiff(double phi1, double phi2)
void setCaloCluster(const CaloClusterRef &clus)
PTrajectoryStateOnDet pts_
std::vector< ForwardDetLayer const * > const & posTidLayers() const
char data[epos_bytes_allocation]
static int position[264][3]
const TrackerGeomDet * idToDet(DetId) const override
double y0() const
y coordinate
edm::ESHandle< MeasurementTracker > measurementTrackerHandle
std::vector< const SiStripRecHit2D * > backupLayer2Hits_
void run(edm::Event &, const edm::EventSetup &setup, const edm::Handle< reco::SuperClusterCollection > &, reco::ElectronSeedCollection &)
GlobalTrajectoryParameters stateAtVertex() const
DetId geographicalId() const
std::vector< ForwardDetLayer const * > const & negTecLayers() const
std::vector< const SiStripMatchedRecHit2D * > layer1Hits_
T const * product() const
Power< A, B >::type pow(const A &a, const B &b)
unsigned long long cacheIDMagField_
double x0() const
x coordinate