50 : beamSpotTag_(
"offlineBeamSpot"),
51 theUpdator(0),thePropagator(0),theMeasurementTracker(0),
52 theSetup(0), theMatcher_(0),
53 cacheIDMagField_(0),cacheIDCkfComp_(0),cacheIDTrkGeom_(0),
54 tibOriginZCut_(pset.getParameter<double>(
"tibOriginZCut")),
55 tidOriginZCut_(pset.getParameter<double>(
"tidOriginZCut")),
56 tecOriginZCut_(pset.getParameter<double>(
"tecOriginZCut")),
57 monoOriginZCut_(pset.getParameter<double>(
"monoOriginZCut")),
58 tibDeltaPsiCut_(pset.getParameter<double>(
"tibDeltaPsiCut")),
59 tidDeltaPsiCut_(pset.getParameter<double>(
"tidDeltaPsiCut")),
60 tecDeltaPsiCut_(pset.getParameter<double>(
"tecDeltaPsiCut")),
61 monoDeltaPsiCut_(pset.getParameter<double>(
"monoDeltaPsiCut")),
62 tibPhiMissHit2Cut_(pset.getParameter<double>(
"tibPhiMissHit2Cut")),
63 tidPhiMissHit2Cut_(pset.getParameter<double>(
"tidPhiMissHit2Cut")),
64 tecPhiMissHit2Cut_(pset.getParameter<double>(
"tecPhiMissHit2Cut")),
65 monoPhiMissHit2Cut_(pset.getParameter<double>(
"monoPhiMissHit2Cut")),
66 tibZMissHit2Cut_(pset.getParameter<double>(
"tibZMissHit2Cut")),
67 tidRMissHit2Cut_(pset.getParameter<double>(
"tidRMissHit2Cut")),
68 tecRMissHit2Cut_(pset.getParameter<double>(
"tecRMissHit2Cut")),
69 tidEtaUsage_(pset.getParameter<double>(
"tidEtaUsage")),
70 tidMaxHits_(pset.getParameter<int>(
"tidMaxHits")),
71 tecMaxHits_(pset.getParameter<int>(
"tecMaxHits")),
72 monoMaxHits_(pset.getParameter<int>(
"monoMaxHits")),
73 maxSeeds_(pset.getParameter<int>(
"maxSeeds"))
76 if (pset.
exists(
"measurementTrackerName"))
80 if (pset.
exists(
"beamSpot"))
123 for (
unsigned int i=0;
i<clusters->size();++
i) {
126 LogDebug (
"run") <<
"new cluster, calling findSeedsFromCluster";
131 LogDebug (
"run") <<
"Nr of superclusters: "<<clusters->size()
132 <<
", no. of ElectronSeeds found = " << out.size();
143 layer1Hits_.clear() ;
144 layer2Hits_.clear() ;
145 backupLayer2Hits_.clear() ;
149 double sCenergy = seedCluster->energy();
151 double scEta = seedCluster->eta();
153 double scz = sCposition.z();
154 double scr =
sqrt(
pow(sCposition.x(),2)+
pow(sCposition.y(),2));
156 double pT = sCenergy * seedCluster->position().rho()/
sqrt(seedCluster->x()*seedCluster->x()+seedCluster->y()*seedCluster->y()+seedCluster->z()*seedCluster->z());
158 double magneticField = 3.8;
161 double phiVsRSlope = -3.00e-3 * magneticField / pT / 2.;
166 GlobalPoint superCluster(sCposition.x(),sCposition.y(),sCposition.z());
175 int chargeHypothesis;
176 double chargeSelector = sCenergy - (int)sCenergy;
177 if(chargeSelector >= 0.5) chargeHypothesis = -1;
178 if(chargeSelector < 0.5) chargeHypothesis = 1;
182 double phiFake = phiDiff(superCluster.phi(),chargeHypothesis * phiVsRSlope * (scr - rFake));
183 double zFake = (rFake*(scz-z0)-r0*scz+scr*z0)/(scr-r0);
184 double xFake = rFake *
cos(phiFake);
185 double yFake = rFake *
sin(phiFake);
201 std::vector<BarrelDetLayer*> tibLayers = gst->
tibLayers();
205 std::vector<ForwardDetLayer*> tecLayers;
206 std::vector<ForwardDetLayer*> tidLayers;
208 tecLayers = gst->negTecLayers();
209 tidLayers = gst->negTidLayers();
212 tecLayers = gst->posTecLayers();
213 tidLayers = gst->posTidLayers();
224 std::vector<bool> useDL = useDetLayer(scEta);
242 bool hasLay1Hit =
false;
243 bool hasLay2Hit =
false;
244 bool hasBackupHit =
false;
248 std::vector<TrajectoryMeasurement> tib1measurements;
249 if(useDL.at(0)) tib1measurements = layerMeasurements.
measurements(*tib1,initialTSOS,*thePropagator,*theEstimator);
250 std::vector<TrajectoryMeasurement> tib2measurements;
251 if(useDL.at(1)) tib2measurements = layerMeasurements.
measurements(*tib2,initialTSOS,*thePropagator,*theEstimator);
257 for(std::vector<TrajectoryMeasurement>::const_iterator tmIter = tib1measurements.begin(); tmIter != tib1measurements.end(); ++ tmIter){
259 const SiStripMatchedRecHit2D* matchedHit = matchedHitConverter(hit);
261 GlobalPoint position = trackerGeometryHandle->idToDet(matchedHit->geographicalId())->surface().toGlobal(matchedHit->localPosition());
262 if(preselection(position, superCluster, phiVsRSlope, 1)){
264 layer1Hits_.push_back(matchedHit);
269 for(std::vector<TrajectoryMeasurement>::const_iterator tmIter = tib2measurements.begin(); tmIter != tib2measurements.end(); ++ tmIter){
271 const SiStripMatchedRecHit2D* matchedHit = matchedHitConverter(hit);
273 GlobalPoint position = trackerGeometryHandle->idToDet(matchedHit->geographicalId())->surface().toGlobal(matchedHit->localPosition());
274 if(preselection(position, superCluster, phiVsRSlope, 1)){
276 layer2Hits_.push_back(matchedHit);
281 if(!(hasLay1Hit && hasLay2Hit)) useTID =
true;
282 if(
std::abs(scEta) > tidEtaUsage_) useTID =
true;
283 std::vector<TrajectoryMeasurement> tid1measurements;
284 if(useDL.at(2) && useTID) tid1measurements = layerMeasurements.
measurements(*tid1,initialTSOS,*thePropagator,*theEstimator);
285 std::vector<TrajectoryMeasurement> tid2measurements;
286 if(useDL.at(3) && useTID) tid2measurements = layerMeasurements.
measurements(*tid2,initialTSOS,*thePropagator,*theEstimator);
287 std::vector<TrajectoryMeasurement> tid3measurements;
288 if(useDL.at(4) && useTID) tid3measurements = layerMeasurements.
measurements(*tid3,initialTSOS,*thePropagator,*theEstimator);
290 for(std::vector<TrajectoryMeasurement>::const_iterator tmIter = tid1measurements.begin(); tmIter != tid1measurements.end(); ++ tmIter){
291 if(tid1MHC < tidMaxHits_){
293 const SiStripMatchedRecHit2D* matchedHit = matchedHitConverter(hit);
295 GlobalPoint position = trackerGeometryHandle->idToDet(matchedHit->geographicalId())->surface().toGlobal(matchedHit->localPosition());
296 if(preselection(position, superCluster, phiVsRSlope, 2)){
299 layer1Hits_.push_back(matchedHit);
301 layer2Hits_.push_back(matchedHit);
303 }
else if(useDL.at(8) && tid1BHC < monoMaxHits_){
304 const SiStripRecHit2D* backupHit = backupHitConverter(hit);
306 GlobalPoint position = trackerGeometryHandle->idToDet(backupHit->geographicalId())->surface().toGlobal(backupHit->localPosition());
307 if(preselection(position, superCluster, phiVsRSlope, 4) && position.
perp() > 37.){
310 backupLayer2Hits_.push_back(backupHit);
317 for(std::vector<TrajectoryMeasurement>::const_iterator tmIter = tid2measurements.begin(); tmIter != tid2measurements.end(); ++ tmIter){
318 if(tid2MHC < tidMaxHits_){
320 const SiStripMatchedRecHit2D* matchedHit = matchedHitConverter(hit);
322 GlobalPoint position = trackerGeometryHandle->idToDet(matchedHit->geographicalId())->surface().toGlobal(matchedHit->localPosition());
323 if(preselection(position, superCluster, phiVsRSlope, 2)){
326 layer1Hits_.push_back(matchedHit);
328 layer2Hits_.push_back(matchedHit);
330 }
else if(useDL.at(8) && tid2BHC < monoMaxHits_){
331 const SiStripRecHit2D* backupHit = backupHitConverter(hit);
333 GlobalPoint position = trackerGeometryHandle->idToDet(backupHit->geographicalId())->surface().toGlobal(backupHit->localPosition());
334 if(preselection(position, superCluster, phiVsRSlope, 4) && position.
perp() > 37.){
337 backupLayer2Hits_.push_back(backupHit);
344 for(std::vector<TrajectoryMeasurement>::const_iterator tmIter = tid3measurements.begin(); tmIter != tid3measurements.end(); ++ tmIter){
345 if(tid3MHC < tidMaxHits_){
347 const SiStripMatchedRecHit2D* matchedHit = matchedHitConverter(hit);
349 GlobalPoint position = trackerGeometryHandle->idToDet(matchedHit->geographicalId())->surface().toGlobal(matchedHit->localPosition());
350 if(preselection(position, superCluster, phiVsRSlope, 2)){
353 layer1Hits_.push_back(matchedHit);
355 layer2Hits_.push_back(matchedHit);
357 }
else if(useDL.at(8) && tid3BHC < monoMaxHits_){
358 const SiStripRecHit2D* backupHit = backupHitConverter(hit);
360 GlobalPoint position = trackerGeometryHandle->idToDet(backupHit->geographicalId())->surface().toGlobal(backupHit->localPosition());
361 if(preselection(position, superCluster, phiVsRSlope, 4) && position.
perp() > 37.){
364 backupLayer2Hits_.push_back(backupHit);
371 std::vector<TrajectoryMeasurement> tec1measurements;
372 if(useDL.at(5)) tec1measurements = layerMeasurements.
measurements(*tec1,initialTSOS,*thePropagator,*theEstimator);
373 std::vector<TrajectoryMeasurement> tec2measurements;
374 if(useDL.at(6)) tec2measurements = layerMeasurements.
measurements(*tec2,initialTSOS,*thePropagator,*theEstimator);
375 std::vector<TrajectoryMeasurement> tec3measurements;
376 if(useDL.at(7)) tec3measurements = layerMeasurements.
measurements(*tec3,initialTSOS,*thePropagator,*theEstimator);
378 for(std::vector<TrajectoryMeasurement>::const_iterator tmIter = tec1measurements.begin(); tmIter != tec1measurements.end(); ++ tmIter){
379 if(tec1MHC < tecMaxHits_){
381 const SiStripMatchedRecHit2D* matchedHit = matchedHitConverter(hit);
383 GlobalPoint position = trackerGeometryHandle->idToDet(matchedHit->geographicalId())->surface().toGlobal(matchedHit->localPosition());
384 if(preselection(position, superCluster, phiVsRSlope, 3)){
387 layer1Hits_.push_back(matchedHit);
389 layer2Hits_.push_back(matchedHit);
395 for(std::vector<TrajectoryMeasurement>::const_iterator tmIter = tec2measurements.begin(); tmIter != tec2measurements.end(); ++ tmIter){
396 if(tec2MHC < tecMaxHits_){
398 const SiStripMatchedRecHit2D* matchedHit = matchedHitConverter(hit);
400 GlobalPoint position = trackerGeometryHandle->idToDet(matchedHit->geographicalId())->surface().toGlobal(matchedHit->localPosition());
401 if(preselection(position, superCluster, phiVsRSlope, 3)){
404 layer1Hits_.push_back(matchedHit);
406 layer2Hits_.push_back(matchedHit);
412 for(std::vector<TrajectoryMeasurement>::const_iterator tmIter = tec3measurements.begin(); tmIter != tec3measurements.end(); ++ tmIter){
413 if(tec3MHC < tecMaxHits_){
415 const SiStripMatchedRecHit2D* matchedHit = matchedHitConverter(hit);
417 GlobalPoint position = trackerGeometryHandle->idToDet(matchedHit->geographicalId())->surface().toGlobal(matchedHit->localPosition());
418 if(preselection(position, superCluster, phiVsRSlope, 3)){
421 layer2Hits_.push_back(matchedHit);
428 if( hasLay1Hit && hasLay2Hit ){
430 for (std::vector<const SiStripMatchedRecHit2D*>::const_iterator hit1 = layer1Hits_.begin() ; hit1!= layer1Hits_.end(); ++hit1) {
431 for (std::vector<const SiStripMatchedRecHit2D*>::const_iterator hit2 = layer2Hits_.begin() ; hit2!= layer2Hits_.end(); ++hit2) {
433 if(seedCounter < maxSeeds_){
435 if(checkHitsAndTSOS(hit1,hit2,scr,scz,pT,scEta)) {
441 SiStripMatchedRecHit2D *
hit;
442 hit=
new SiStripMatchedRecHit2D(*(dynamic_cast <const SiStripMatchedRecHit2D *> (*hit1) ) );
443 recHits_.push_back(hit);
444 hit=
new SiStripMatchedRecHit2D(*(dynamic_cast <const SiStripMatchedRecHit2D *> (*hit2) ) );
445 recHits_.push_back(hit);
451 result.push_back(seed);
465 if(hasLay1Hit && hasBackupHit && seedCounter == 0){
467 for (std::vector<const SiStripMatchedRecHit2D*>::const_iterator hit1 = layer1Hits_.begin() ; hit1!= layer1Hits_.end(); ++hit1) {
468 for (std::vector<const SiStripRecHit2D*>::const_iterator hit2 = backupLayer2Hits_.begin() ; hit2!= backupLayer2Hits_.end(); ++hit2) {
470 if(seedCounter < maxSeeds_){
472 if(altCheckHitsAndTSOS(hit1,hit2,scr,scz,pT,scEta)) {
478 SiStripMatchedRecHit2D *innerHit;
479 innerHit=
new SiStripMatchedRecHit2D(*(dynamic_cast <const SiStripMatchedRecHit2D *> (*hit1) ) );
480 recHits_.push_back(innerHit);
481 SiStripRecHit2D *outerHit;
482 outerHit=
new SiStripRecHit2D(*(dynamic_cast <const SiStripRecHit2D *> (*hit2) ) );
483 recHits_.push_back(outerHit);
489 result.push_back(seed);
506 std::vector<const SiStripMatchedRecHit2D*>::const_iterator hit2,
507 double rc,
double zc,
double pT,
double scEta) {
509 bool seedCutsSatisfied =
false;
514 double r1 =
sqrt(hit1Pos.x()*hit1Pos.x() + hit1Pos.y()*hit1Pos.y());
515 double phi1 = hit1Pos.phi();
516 double z1=hit1Pos.z();
519 double r2 =
sqrt(hit2Pos.x()*hit2Pos.x() + hit2Pos.y()*hit2Pos.y());
520 double phi2 = hit2Pos.phi();
521 double z2 = hit2Pos.z();
527 double curv = pT*100*.877;
530 double a = (
r2-
r1)/(2*curv);
533 double phiMissHit2=0;
537 double zMissHit2 = z2 - (
r2*(zc-z1)-
r1*zc+rc*z1)/(rc-
r1);
539 double rPredHit2 =
r1 + (rc-
r1)/(zc-z1)*(z2-z1);
540 double rMissHit2 =
r2 - rPredHit2;
547 if(zVar1 > 75 && zVar1 < 95 && (zVar2 > 18 || zVar2 < 5)) zDiff =
false;
548 if(zVar1 > 100 && zVar1 < 110 && (zVar2 > 35 || zVar2 < 5)) zDiff =
false;
549 if(zVar1 > 125 && zVar1 < 150 && (zVar2 > 18 || zVar2 < 5)) zDiff =
false;
551 if(subdetector == 1){
553 if(
r1 > 23 && r1 < 28 && r2 > 31 &&
r2 < 37) tibExtraCut = 1;
555 }
else if(subdetector == 2){
557 if(
r1 > 23 && r1 < 34 && r2 > 26 &&
r2 < 42) tidExtraCut = 1;
559 }
else if(subdetector == 3){
561 if(
r1 > 23 && r1 < 32 && r2 > 26 &&
r2 < 42) tecExtraCut = 1;
567 if(!seedCutsSatisfied)
return false;
581 double vertexZ = z1 - (
r1 * (zc - z1) ) / (rc -
r1);
586 if (!helix.
isValid())
return false;
591 if (!propagatedState.isValid())
return false;
596 if (!propagatedState_out.isValid())
return false;
608 std::vector<const SiStripRecHit2D*>::const_iterator hit2,
609 double rc,
double zc,
double pT,
double scEta) {
611 bool seedCutSatisfied =
false;
616 double r1 =
sqrt(hit1Pos.x()*hit1Pos.x() + hit1Pos.y()*hit1Pos.y());
617 double phi1 = hit1Pos.phi();
618 double z1=hit1Pos.z();
621 double r2 =
sqrt(hit2Pos.x()*hit2Pos.x() + hit2Pos.y()*hit2Pos.y());
622 double phi2 = hit2Pos.phi();
623 double z2 = hit2Pos.z();
629 double curv = pT*100*.877;
632 double a = (
r2-
r1)/(2*curv);
634 double phiMissHit2 = 0;
642 if(!seedCutSatisfied)
return false;
657 double vertexZ = z1 - (
r1 * (zc - z1) ) / (rc -
r1);
662 if (!helix.
isValid())
return false;
667 if (!propagatedState.isValid())
return false;
672 if (!propagatedState_out.isValid())
return false;
685 double r = position.
perp();
686 double phi = position.
phi();
687 double z = position.
z();
688 double scr = superCluster.
perp();
689 double scphi = superCluster.
phi();
690 double scz = superCluster.
z();
692 double deltaPsi = psi - (scr-
r)*phiVsRSlope;
693 double antiDeltaPsi = psi - (r-scr)*phiVsRSlope;
700 double originZ = (scr*z - r*scz)/(scr-r);
706 }
else if(hitLayer == 2){
708 }
else if(hitLayer == 3){
710 }
else if(hitLayer == 4){
733 const SiStripMatchedRecHit2D* matchedHit =
dynamic_cast<const SiStripMatchedRecHit2D*
>(trh);
739 const SiStripRecHit2D* backupHit =
dynamic_cast<const SiStripRecHit2D*
>(trh);
746 if(variable > 0 && variable < 1.8){
747 useDetLayer.push_back(
true);
749 useDetLayer.push_back(
false);
751 if(variable > 0 && variable < 1.5){
752 useDetLayer.push_back(
true);
754 useDetLayer.push_back(
false);
756 if(variable > 1 && variable < 2.1){
757 useDetLayer.push_back(
true);
759 useDetLayer.push_back(
false);
761 if(variable > 1 && variable < 2.2){
762 useDetLayer.push_back(
true);
764 useDetLayer.push_back(
false);
766 if(variable > 1 && variable < 2.3){
767 useDetLayer.push_back(
true);
769 useDetLayer.push_back(
false);
771 if(variable > 1.8 && variable < 2.5){
772 useDetLayer.push_back(
true);
774 useDetLayer.push_back(
false);
776 if(variable > 1.8 && variable < 2.5){
777 useDetLayer.push_back(
true);
779 useDetLayer.push_back(
false);
781 if(variable > 1.8 && variable < 2.5){
782 useDetLayer.push_back(
true);
784 useDetLayer.push_back(
false);
786 if(variable > 1.2 && variable < 1.6){
787 useDetLayer.push_back(
true);
789 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
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)
virtual void update(const edm::Event &) const =0
double tidPhiMissHit2Cut_
std::vector< bool > useDetLayer(double scEta)
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)
static int position[TOTALCHAMBERS][3]
std::map< std::string, int, std::less< std::string > > psi
double tibPhiMissHit2Cut_
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
TrajectoryStateOnSurface TSOS
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
void findSeedsFromCluster(edm::Ref< reco::SuperClusterCollection >, edm::Handle< reco::BeamSpot >, reco::ElectronSeedCollection &)
~SiStripElectronSeedGenerator()
double tecPhiMissHit2Cut_
double phiDiff(double phi1, double phi2)
PTrajectoryStateOnDet pts_
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 &)
void setup(std::vector< TH2F > &depth, std::string name, std::string units="")
Power< A, B >::type pow(const A &a, const B &b)
edm::InputTag beamSpotTag_
unsigned long long cacheIDMagField_