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();
152 layer1Hits_.clear() ;
153 layer2Hits_.clear() ;
154 backupLayer2Hits_.clear() ;
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());
168 double magneticField = 3.8;
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 if(chargeSelector < 0.5) 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);
201 float nomField = bfield->nominalValue();
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;
223 tecLayers = gst->negTecLayers();
224 tidLayers = gst->negTidLayers();
227 tecLayers = gst->posTecLayers();
228 tidLayers = gst->posTidLayers();
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);
239 std::vector<bool> useDL = useDetLayer(scEta);
257 bool hasLay1Hit =
false;
258 bool hasLay2Hit =
false;
259 bool hasBackupHit =
false;
263 std::vector<TrajectoryMeasurement> tib1measurements;
264 if(useDL.at(0)) tib1measurements = layerMeasurements.
measurements(*tib1,initialTSOS,*thePropagator,*theEstimator);
265 std::vector<TrajectoryMeasurement> tib2measurements;
266 if(useDL.at(1)) tib2measurements = layerMeasurements.
measurements(*tib2,initialTSOS,*thePropagator,*theEstimator);
272 for(std::vector<TrajectoryMeasurement>::const_iterator tmIter = tib1measurements.begin(); tmIter != tib1measurements.end(); ++ tmIter){
277 if(
preselection(position, superCluster, phiVsRSlope, 1)){
279 layer1Hits_.push_back(matchedHit);
284 for(std::vector<TrajectoryMeasurement>::const_iterator tmIter = tib2measurements.begin(); tmIter != tib2measurements.end(); ++ tmIter){
289 if(
preselection(position, superCluster, phiVsRSlope, 1)){
291 layer2Hits_.push_back(matchedHit);
296 if(!(hasLay1Hit && hasLay2Hit)) useTID =
true;
297 if(
std::abs(scEta) > tidEtaUsage_) useTID =
true;
298 std::vector<TrajectoryMeasurement> tid1measurements;
299 if(useDL.at(2) && useTID) tid1measurements = layerMeasurements.
measurements(*tid1,initialTSOS,*thePropagator,*theEstimator);
300 std::vector<TrajectoryMeasurement> tid2measurements;
301 if(useDL.at(3) && useTID) tid2measurements = layerMeasurements.
measurements(*tid2,initialTSOS,*thePropagator,*theEstimator);
302 std::vector<TrajectoryMeasurement> tid3measurements;
303 if(useDL.at(4) && useTID) tid3measurements = layerMeasurements.
measurements(*tid3,initialTSOS,*thePropagator,*theEstimator);
305 for(std::vector<TrajectoryMeasurement>::const_iterator tmIter = tid1measurements.begin(); tmIter != tid1measurements.end(); ++ tmIter){
306 if(tid1MHC < tidMaxHits_){
311 if(
preselection(position, superCluster, phiVsRSlope, 2)){
314 layer1Hits_.push_back(matchedHit);
316 layer2Hits_.push_back(matchedHit);
318 }
else if(useDL.at(8) && tid1BHC < monoMaxHits_){
322 if(
preselection(position, superCluster, phiVsRSlope, 4) && position.
perp() > 37.){
325 backupLayer2Hits_.push_back(backupHit);
332 for(std::vector<TrajectoryMeasurement>::const_iterator tmIter = tid2measurements.begin(); tmIter != tid2measurements.end(); ++ tmIter){
333 if(tid2MHC < tidMaxHits_){
338 if(
preselection(position, superCluster, phiVsRSlope, 2)){
341 layer1Hits_.push_back(matchedHit);
343 layer2Hits_.push_back(matchedHit);
345 }
else if(useDL.at(8) && tid2BHC < monoMaxHits_){
349 if(
preselection(position, superCluster, phiVsRSlope, 4) && position.
perp() > 37.){
352 backupLayer2Hits_.push_back(backupHit);
359 for(std::vector<TrajectoryMeasurement>::const_iterator tmIter = tid3measurements.begin(); tmIter != tid3measurements.end(); ++ tmIter){
360 if(tid3MHC < tidMaxHits_){
365 if(
preselection(position, superCluster, phiVsRSlope, 2)){
368 layer1Hits_.push_back(matchedHit);
370 layer2Hits_.push_back(matchedHit);
372 }
else if(useDL.at(8) && tid3BHC < monoMaxHits_){
376 if(
preselection(position, superCluster, phiVsRSlope, 4) && position.
perp() > 37.){
379 backupLayer2Hits_.push_back(backupHit);
386 std::vector<TrajectoryMeasurement> tec1measurements;
387 if(useDL.at(5)) tec1measurements = layerMeasurements.
measurements(*tec1,initialTSOS,*thePropagator,*theEstimator);
388 std::vector<TrajectoryMeasurement> tec2measurements;
389 if(useDL.at(6)) tec2measurements = layerMeasurements.
measurements(*tec2,initialTSOS,*thePropagator,*theEstimator);
390 std::vector<TrajectoryMeasurement> tec3measurements;
391 if(useDL.at(7)) tec3measurements = layerMeasurements.
measurements(*tec3,initialTSOS,*thePropagator,*theEstimator);
393 for(std::vector<TrajectoryMeasurement>::const_iterator tmIter = tec1measurements.begin(); tmIter != tec1measurements.end(); ++ tmIter){
394 if(tec1MHC < tecMaxHits_){
399 if(
preselection(position, superCluster, phiVsRSlope, 3)){
402 layer1Hits_.push_back(matchedHit);
404 layer2Hits_.push_back(matchedHit);
410 for(std::vector<TrajectoryMeasurement>::const_iterator tmIter = tec2measurements.begin(); tmIter != tec2measurements.end(); ++ tmIter){
411 if(tec2MHC < tecMaxHits_){
416 if(
preselection(position, superCluster, phiVsRSlope, 3)){
419 layer1Hits_.push_back(matchedHit);
421 layer2Hits_.push_back(matchedHit);
427 for(std::vector<TrajectoryMeasurement>::const_iterator tmIter = tec3measurements.begin(); tmIter != tec3measurements.end(); ++ tmIter){
428 if(tec3MHC < tecMaxHits_){
433 if(
preselection(position, superCluster, phiVsRSlope, 3)){
436 layer2Hits_.push_back(matchedHit);
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) {
448 if(seedCounter < maxSeeds_){
450 if(checkHitsAndTSOS(hit1,hit2,scr,scz,pT,scEta)) {
458 recHits_.push_back(hit);
460 recHits_.push_back(hit);
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) {
483 for (std::vector<const SiStripRecHit2D*>::const_iterator hit2 = backupLayer2Hits_.begin() ; hit2!= backupLayer2Hits_.end(); ++hit2) {
485 if(seedCounter < maxSeeds_){
487 if(altCheckHitsAndTSOS(hit1,hit2,scr,scz,pT,scEta)) {
495 recHits_.push_back(innerHit);
497 outerHit=
new SiStripRecHit2D(*(dynamic_cast <const SiStripRecHit2D *> (*hit2) ) );
498 recHits_.push_back(outerHit);
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);
596 float nomField = bfield->nominalValue();
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);
671 float nomField = bfield->nominalValue();
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);
void setCaloCluster(const CaloClusterRef &, unsigned char hitsMask=0, int subDet2=0, int subDet1=0, float hoe1=std::numeric_limits< float >::infinity(), float hoe2=std::numeric_limits< float >::infinity())
T getParameter(std::string const &) const
unsigned long long cacheIdentifier() const
std::vector< TrajectoryMeasurement > measurements(const DetLayer &layer, const TrajectoryStateOnSurface &startingState, const Propagator &prop, const MeasurementEstimator &est) const
virtual FreeTrajectoryState propagate(const FreeTrajectoryState &ftsStart, const GlobalPoint &pDest) const final
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)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
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
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
Cos< T >::type cos(const T &t)
tuple preselection
PRESELECTION
Abs< T >::type abs(const T &t)
const edm::EventSetup * theSetup
SiStripElectronSeedGenerator(const edm::ParameterSet &, const Tokens &)
std::vector< ElectronSeed > ElectronSeedCollection
collection of ElectronSeed objects
edm::ESHandle< TrackerGeometry > trackerGeometryHandle
tuple Chi2MeasurementEstimator
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)
XYZPointD XYZPoint
point in space with cartesian internal representation
T const * product() const
~SiStripElectronSeedGenerator()
double tecPhiMissHit2Cut_
double phiDiff(double phi1, double phi2)
PTrajectoryStateOnDet pts_
char data[epos_bytes_allocation]
static int position[264][3]
edm::ESHandle< MeasurementTracker > measurementTrackerHandle
void run(edm::Event &, const edm::EventSetup &setup, const edm::Handle< reco::SuperClusterCollection > &, reco::ElectronSeedCollection &)
GlobalTrajectoryParameters stateAtVertex() const
DetId geographicalId() const
virtual LocalPoint localPosition() const
void setup(std::vector< TH2F > &depth, std::string name, std::string units="")
Power< A, B >::type pow(const A &a, const B &b)
unsigned long long cacheIDMagField_