59 : beamSpotTag_(
"offlineBeamSpot"),
60 theUpdator(0),thePropagator(0),theMeasurementTracker(0),
61 theSetup(0),pts_(0),theMatcher_(0),
62 cacheIDMagField_(0),cacheIDCkfComp_(0),cacheIDTrkGeom_(0),
63 tibOriginZCut_(pset.getParameter<double>(
"tibOriginZCut")),
64 tidOriginZCut_(pset.getParameter<double>(
"tidOriginZCut")),
65 tecOriginZCut_(pset.getParameter<double>(
"tecOriginZCut")),
66 monoOriginZCut_(pset.getParameter<double>(
"monoOriginZCut")),
67 tibDeltaPsiCut_(pset.getParameter<double>(
"tibDeltaPsiCut")),
68 tidDeltaPsiCut_(pset.getParameter<double>(
"tidDeltaPsiCut")),
69 tecDeltaPsiCut_(pset.getParameter<double>(
"tecDeltaPsiCut")),
70 monoDeltaPsiCut_(pset.getParameter<double>(
"monoDeltaPsiCut")),
71 tibPhiMissHit2Cut_(pset.getParameter<double>(
"tibPhiMissHit2Cut")),
72 tidPhiMissHit2Cut_(pset.getParameter<double>(
"tidPhiMissHit2Cut")),
73 tecPhiMissHit2Cut_(pset.getParameter<double>(
"tecPhiMissHit2Cut")),
74 monoPhiMissHit2Cut_(pset.getParameter<double>(
"monoPhiMissHit2Cut")),
75 tibZMissHit2Cut_(pset.getParameter<double>(
"tibZMissHit2Cut")),
76 tidRMissHit2Cut_(pset.getParameter<double>(
"tidRMissHit2Cut")),
77 tecRMissHit2Cut_(pset.getParameter<double>(
"tecRMissHit2Cut")),
78 tidEtaUsage_(pset.getParameter<double>(
"tidEtaUsage")),
79 tidMaxHits_(pset.getParameter<int>(
"tidMaxHits")),
80 tecMaxHits_(pset.getParameter<int>(
"tecMaxHits")),
81 monoMaxHits_(pset.getParameter<int>(
"monoMaxHits")),
82 maxSeeds_(pset.getParameter<int>(
"maxSeeds"))
85 if (pset.
exists(
"measurementTrackerName"))
89 if (pset.
exists(
"beamSpot"))
132 for (
unsigned int i=0;
i<clusters->size();++
i) {
135 LogDebug (
"run") <<
"new cluster, calling findSeedsFromCluster";
140 LogDebug (
"run") <<
"Nr of superclusters: "<<clusters->size()
141 <<
", 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());
167 double magneticField = 3.8;
170 double phiVsRSlope = -3.00e-3 * magneticField / pT / 2.;
175 GlobalPoint superCluster(sCposition.x(),sCposition.y(),sCposition.z());
184 int chargeHypothesis;
185 double chargeSelector = sCenergy - (int)sCenergy;
186 if(chargeSelector >= 0.5) chargeHypothesis = -1;
187 if(chargeSelector < 0.5) chargeHypothesis = 1;
191 double phiFake = phiDiff(superCluster.phi(),chargeHypothesis * phiVsRSlope * (scr - rFake));
192 double zFake = (rFake*(scz-z0)-r0*scz+scr*z0)/(scr-r0);
193 double xFake = rFake *
cos(phiFake);
194 double yFake = rFake *
sin(phiFake);
210 std::vector<BarrelDetLayer*> tibLayers = gst->
tibLayers();
214 std::vector<ForwardDetLayer*> tecLayers;
215 std::vector<ForwardDetLayer*> tidLayers;
217 tecLayers = gst->negTecLayers();
218 tidLayers = gst->negTidLayers();
221 tecLayers = gst->posTecLayers();
222 tidLayers = gst->posTidLayers();
233 std::vector<bool> useDL = useDetLayer(scEta);
251 bool hasLay1Hit =
false;
252 bool hasLay2Hit =
false;
253 bool hasBackupHit =
false;
257 std::vector<TrajectoryMeasurement> tib1measurements;
258 if(useDL.at(0)) tib1measurements = layerMeasurements.
measurements(*tib1,initialTSOS,*thePropagator,*theEstimator);
259 std::vector<TrajectoryMeasurement> tib2measurements;
260 if(useDL.at(1)) tib2measurements = layerMeasurements.
measurements(*tib2,initialTSOS,*thePropagator,*theEstimator);
266 for(std::vector<TrajectoryMeasurement>::const_iterator tmIter = tib1measurements.begin(); tmIter != tib1measurements.end(); ++ tmIter){
271 if(preselection(position, superCluster, phiVsRSlope, 1)){
273 layer1Hits_.push_back(matchedHit);
278 for(std::vector<TrajectoryMeasurement>::const_iterator tmIter = tib2measurements.begin(); tmIter != tib2measurements.end(); ++ tmIter){
283 if(preselection(position, superCluster, phiVsRSlope, 1)){
285 layer2Hits_.push_back(matchedHit);
290 if(!(hasLay1Hit && hasLay2Hit)) useTID =
true;
291 if(
std::abs(scEta) > tidEtaUsage_) useTID =
true;
292 std::vector<TrajectoryMeasurement> tid1measurements;
293 if(useDL.at(2) && useTID) tid1measurements = layerMeasurements.
measurements(*tid1,initialTSOS,*thePropagator,*theEstimator);
294 std::vector<TrajectoryMeasurement> tid2measurements;
295 if(useDL.at(3) && useTID) tid2measurements = layerMeasurements.
measurements(*tid2,initialTSOS,*thePropagator,*theEstimator);
296 std::vector<TrajectoryMeasurement> tid3measurements;
297 if(useDL.at(4) && useTID) tid3measurements = layerMeasurements.
measurements(*tid3,initialTSOS,*thePropagator,*theEstimator);
299 for(std::vector<TrajectoryMeasurement>::const_iterator tmIter = tid1measurements.begin(); tmIter != tid1measurements.end(); ++ tmIter){
300 if(tid1MHC < tidMaxHits_){
305 if(preselection(position, superCluster, phiVsRSlope, 2)){
308 layer1Hits_.push_back(matchedHit);
310 layer2Hits_.push_back(matchedHit);
312 }
else if(useDL.at(8) && tid1BHC < monoMaxHits_){
316 if(preselection(position, superCluster, phiVsRSlope, 4) && position.
perp() > 37.){
319 backupLayer2Hits_.push_back(backupHit);
326 for(std::vector<TrajectoryMeasurement>::const_iterator tmIter = tid2measurements.begin(); tmIter != tid2measurements.end(); ++ tmIter){
327 if(tid2MHC < tidMaxHits_){
332 if(preselection(position, superCluster, phiVsRSlope, 2)){
335 layer1Hits_.push_back(matchedHit);
337 layer2Hits_.push_back(matchedHit);
339 }
else if(useDL.at(8) && tid2BHC < monoMaxHits_){
343 if(preselection(position, superCluster, phiVsRSlope, 4) && position.
perp() > 37.){
346 backupLayer2Hits_.push_back(backupHit);
353 for(std::vector<TrajectoryMeasurement>::const_iterator tmIter = tid3measurements.begin(); tmIter != tid3measurements.end(); ++ tmIter){
354 if(tid3MHC < tidMaxHits_){
359 if(preselection(position, superCluster, phiVsRSlope, 2)){
362 layer1Hits_.push_back(matchedHit);
364 layer2Hits_.push_back(matchedHit);
366 }
else if(useDL.at(8) && tid3BHC < monoMaxHits_){
370 if(preselection(position, superCluster, phiVsRSlope, 4) && position.
perp() > 37.){
373 backupLayer2Hits_.push_back(backupHit);
380 std::vector<TrajectoryMeasurement> tec1measurements;
381 if(useDL.at(5)) tec1measurements = layerMeasurements.
measurements(*tec1,initialTSOS,*thePropagator,*theEstimator);
382 std::vector<TrajectoryMeasurement> tec2measurements;
383 if(useDL.at(6)) tec2measurements = layerMeasurements.
measurements(*tec2,initialTSOS,*thePropagator,*theEstimator);
384 std::vector<TrajectoryMeasurement> tec3measurements;
385 if(useDL.at(7)) tec3measurements = layerMeasurements.
measurements(*tec3,initialTSOS,*thePropagator,*theEstimator);
387 for(std::vector<TrajectoryMeasurement>::const_iterator tmIter = tec1measurements.begin(); tmIter != tec1measurements.end(); ++ tmIter){
388 if(tec1MHC < tecMaxHits_){
393 if(preselection(position, superCluster, phiVsRSlope, 3)){
396 layer1Hits_.push_back(matchedHit);
398 layer2Hits_.push_back(matchedHit);
404 for(std::vector<TrajectoryMeasurement>::const_iterator tmIter = tec2measurements.begin(); tmIter != tec2measurements.end(); ++ tmIter){
405 if(tec2MHC < tecMaxHits_){
410 if(preselection(position, superCluster, phiVsRSlope, 3)){
413 layer1Hits_.push_back(matchedHit);
415 layer2Hits_.push_back(matchedHit);
421 for(std::vector<TrajectoryMeasurement>::const_iterator tmIter = tec3measurements.begin(); tmIter != tec3measurements.end(); ++ tmIter){
422 if(tec3MHC < tecMaxHits_){
427 if(preselection(position, superCluster, phiVsRSlope, 3)){
430 layer2Hits_.push_back(matchedHit);
437 if( hasLay1Hit && hasLay2Hit ){
439 for (std::vector<const SiStripMatchedRecHit2D*>::const_iterator hit1 = layer1Hits_.begin() ; hit1!= layer1Hits_.end(); ++hit1) {
440 for (std::vector<const SiStripMatchedRecHit2D*>::const_iterator hit2 = layer2Hits_.begin() ; hit2!= layer2Hits_.end(); ++hit2) {
442 if(seedCounter < maxSeeds_){
444 if(checkHitsAndTSOS(hit1,hit2,scr,scz,pT,scEta)) {
452 recHits_.push_back(hit);
454 recHits_.push_back(hit);
460 result.push_back(seed);
476 if(hasLay1Hit && hasBackupHit && seedCounter == 0){
478 for (std::vector<const SiStripMatchedRecHit2D*>::const_iterator hit1 = layer1Hits_.begin() ; hit1!= layer1Hits_.end(); ++hit1) {
479 for (std::vector<const SiStripRecHit2D*>::const_iterator hit2 = backupLayer2Hits_.begin() ; hit2!= backupLayer2Hits_.end(); ++hit2) {
481 if(seedCounter < maxSeeds_){
483 if(altCheckHitsAndTSOS(hit1,hit2,scr,scz,pT,scEta)) {
491 recHits_.push_back(innerHit);
493 outerHit=
new SiStripRecHit2D(*(dynamic_cast <const SiStripRecHit2D *> (*hit2) ) );
494 recHits_.push_back(outerHit);
500 result.push_back(seed);
519 std::vector<const SiStripMatchedRecHit2D*>::const_iterator hit2,
520 double rc,
double zc,
double pT,
double scEta) {
522 bool seedCutsSatisfied =
false;
527 double r1 =
sqrt(hit1Pos.x()*hit1Pos.x() + hit1Pos.y()*hit1Pos.y());
528 double phi1 = hit1Pos.phi();
529 double z1=hit1Pos.z();
532 double r2 =
sqrt(hit2Pos.x()*hit2Pos.x() + hit2Pos.y()*hit2Pos.y());
533 double phi2 = hit2Pos.phi();
534 double z2 = hit2Pos.z();
540 double curv = pT*100*.877;
543 double a = (r2-r1)/(2*curv);
546 double phiMissHit2=0;
550 double zMissHit2 = z2 - (r2*(zc-z1)-r1*zc+rc*z1)/(rc-r1);
552 double rPredHit2 = r1 + (rc-r1)/(zc-z1)*(z2-z1);
553 double rMissHit2 = r2 - rPredHit2;
560 if(zVar1 > 75 && zVar1 < 95 && (zVar2 > 18 || zVar2 < 5)) zDiff =
false;
561 if(zVar1 > 100 && zVar1 < 110 && (zVar2 > 35 || zVar2 < 5)) zDiff =
false;
562 if(zVar1 > 125 && zVar1 < 150 && (zVar2 > 18 || zVar2 < 5)) zDiff =
false;
564 if(subdetector == 1){
566 if(r1 > 23 && r1 < 28 && r2 > 31 && r2 < 37) tibExtraCut = 1;
568 }
else if(subdetector == 2){
570 if(r1 > 23 && r1 < 34 && r2 > 26 && r2 < 42) tidExtraCut = 1;
572 }
else if(subdetector == 3){
574 if(r1 > 23 && r1 < 32 && r2 > 26 && r2 < 42) tecExtraCut = 1;
580 if(!seedCutsSatisfied)
return false;
595 double vertexZ = z1 - (r1 * (zc - z1) ) / (rc - r1);
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;
671 double vertexZ = z1 - (r1 * (zc - z1) ) / (rc - r1);
676 if (!helix.
isValid())
return false;
681 if (!propagatedState.isValid())
return false;
686 if (!propagatedState_out.isValid())
return false;
699 double r = position.
perp();
700 double phi = position.
phi();
701 double z = position.
z();
702 double scr = superCluster.
perp();
703 double scphi = superCluster.
phi();
704 double scz = superCluster.
z();
706 double deltaPsi = psi - (scr-
r)*phiVsRSlope;
707 double antiDeltaPsi = psi - (r-scr)*phiVsRSlope;
714 double originZ = (scr*z - r*scz)/(scr-r);
720 }
else if(hitLayer == 2){
722 }
else if(hitLayer == 3){
724 }
else if(hitLayer == 4){
760 if(variable > 0 && variable < 1.8){
761 useDetLayer.push_back(
true);
763 useDetLayer.push_back(
false);
765 if(variable > 0 && variable < 1.5){
766 useDetLayer.push_back(
true);
768 useDetLayer.push_back(
false);
770 if(variable > 1 && variable < 2.1){
771 useDetLayer.push_back(
true);
773 useDetLayer.push_back(
false);
775 if(variable > 1 && variable < 2.2){
776 useDetLayer.push_back(
true);
778 useDetLayer.push_back(
false);
780 if(variable > 1 && variable < 2.3){
781 useDetLayer.push_back(
true);
783 useDetLayer.push_back(
false);
785 if(variable > 1.8 && variable < 2.5){
786 useDetLayer.push_back(
true);
788 useDetLayer.push_back(
false);
790 if(variable > 1.8 && variable < 2.5){
791 useDetLayer.push_back(
true);
793 useDetLayer.push_back(
false);
795 if(variable > 1.8 && variable < 2.5){
796 useDetLayer.push_back(
true);
798 useDetLayer.push_back(
false);
800 if(variable > 1.2 && variable < 1.6){
801 useDetLayer.push_back(
true);
803 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
TrajectoryStateTransform transformer_
FTS stateAtVertex() 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)
virtual void update(const edm::Event &) const
SiStripElectronSeedGenerator(const edm::ParameterSet &)
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
Chi2MeasurementEstimator * theEstimator
const SiStripMatchedRecHit2D * matchedHitConverter(ConstRecHitPointer crhp)
TrajectoryStateOnSurface TSOS
static int position[TOTALCHAMBERS][3]
std::map< std::string, int, std::less< std::string > > psi
virtual LocalPoint localPosition() const
double tibPhiMissHit2Cut_
PTrajectoryStateOnDet * pts_
Cos< T >::type cos(const T &t)
const edm::EventSetup * theSetup
std::vector< ElectronSeed > ElectronSeedCollection
collection of ElectronSeed objects
edm::ESHandle< TrackerGeometry > trackerGeometryHandle
tuple Chi2MeasurementEstimator
unsigned long long cacheIDTrkGeom_
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
edm::Handle< reco::BeamSpot > theBeamSpot
PropagatorWithMaterial * thePropagator
int whichSubdetector(std::vector< const SiStripMatchedRecHit2D * >::const_iterator hit)
bool preselection(GlobalPoint position, GlobalPoint superCluster, double phiVsRSlope, int hitLayer)
virtual TrajectoryStateOnSurface propagate(const TrajectoryStateOnSurface &tsos, const Plane &plane) const
unsigned long long cacheIDCkfComp_
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
const SiStripRecHitMatcher * theMatcher_
T const * product() const
static RecHitPointer build(const GeomDet *geom, const TrackingRecHit *rh, const SiStripRecHitMatcher *matcher, const StripClusterParameterEstimator *cpe=0, float weight=1., float annealing=1., bool computeCoarseLocalPosition=false)
void findSeedsFromCluster(edm::Ref< reco::SuperClusterCollection >, edm::Handle< reco::BeamSpot >, reco::ElectronSeedCollection &)
~SiStripElectronSeedGenerator()
double tecPhiMissHit2Cut_
double phiDiff(double phi1, double phi2)
std::vector< BarrelDetLayer * > const & tibLayers() const
TrajectoryStateOnSurface update(const TrajectoryStateOnSurface &, const TransientTrackingRecHit &) const
edm::ESHandle< MeasurementTracker > measurementTrackerHandle
void run(edm::Event &, const edm::EventSetup &setup, const edm::Handle< reco::SuperClusterCollection > &, reco::ElectronSeedCollection &)
DetId geographicalId() const
Power< A, B >::type pow(const A &a, const B &b)
edm::InputTag beamSpotTag_
unsigned long long cacheIDMagField_