196 typedef recHitContainer::const_iterator const_iterator;
197 typedef std::pair<const_iterator,const_iterator> range;
208 edm::LogInfo(
"")<<
"\n\n =================> Treating event "<<e.
id()<<
" Number of seeds "<<elSeeds.
product()->size();
216 float dphi1=0., dphi2=0., drz1=0., drz2=0.;
217 float phi1=0., phi2=0., rz1=0., rz2=0.;
219 for( ElectronSeedCollection::const_iterator MyS= (*elSeeds).begin(); MyS != (*elSeeds).end(); ++MyS) {
221 LogDebug(
"") <<
"\nSeed nr "<<is<<
": ";
222 range
r=(*MyS).recHits();
223 LogDebug(
"")<<
" Number of RecHits= "<<(*MyS).nHits();
227 DetId id1 = (*it).geographicalId();
228 det1 = pDD->idToDet(id1);
229 LogDebug(
"") <<
" First hit local x,y,z "<<(*it).localPosition()<<
" det "<<id1.
det()<<
" subdet "<<id1.
subdetId();
234 DetId id2 = (*it).geographicalId();
235 det2 = pDD->idToDet(id2);
236 LogDebug(
"") <<
" Second hit local x,y,z "<<(*it).localPosition()<<
" det "<<id2.
det()<<
" subdet "<<id2.
subdetId();
237 LogDebug(
"") <<
" Second hit global "<<det2->
toGlobal((*it).localPosition());
243 for (TrackingRecHitCollection::const_iterator rhits=r.first; rhits!=r.second; rhits++) det = pDD->idToDet(((*rhits)).geographicalId());
251 if (caloCluster.
isNull())
continue;
253 LogDebug(
"")<<
" ElectronSeed superCluster energy: "<<theClus->energy()<<
", position: "<<theClus->position();
255 LogDebug(
"")<<
" ElectronSeed supercluster Et: "<<theClus->energy()*
sin(2.*atan(
exp(-theClus->position().eta())));
257 LogDebug(
"")<<
" ElectronSeed supercluster eta: "<<theClus->position().eta();
258 LogDebug(
"")<<
" ElectronSeed seed charge: "<<(*MyS).getCharge();
265 int charge = int((*MyS).getCharge());
266 GlobalPoint xmeas(theClus->position().x(),theClus->position().y(),theClus->position().z());
267 GlobalPoint vprim(theBeamSpot->position().x(),theBeamSpot->position().y(),theBeamSpot->position().z());
268 float energy = theClus->energy();
283 DetId id=(*it).geographicalId();
284 const GeomDet *geomdet=pDD->idToDet((*it).geographicalId());
293 std::pair<bool,double> est;
296 float SCl_phi = xmeas.phi();
297 float localDphi = SCl_phi-hitPos.
phi();
300 if(
std::abs(localDphi)>2.5)
continue;
306 if (
id.subdetId()%2==1) {
313 DetId id2=(*it).geographicalId();
314 const GeomDet *geomdet2=pDD->idToDet((*it).geographicalId());
318 double pxHit1z = hitPos.
z();
319 double pxHit1x = hitPos.
x();
320 double pxHit1y = hitPos.
y();
321 double r1diff = (pxHit1x-vprim.x())*(pxHit1x-vprim.x()) + (pxHit1y-vprim.y())*(pxHit1y-vprim.y());
323 double r2diff = (xmeas.x()-pxHit1x)*(xmeas.x()-pxHit1x) + (xmeas.y()-pxHit1y)*(xmeas.y()-pxHit1y);
325 double zVertexPred = pxHit1z - r1diff*(xmeas.z()-pxHit1z)/r2diff;
327 GlobalPoint vertexPred(vprim.x(),vprim.y(),zVertexPred);
335 phi2 = hitPos2.
phi();
337 rz2 = hitPos2.
perp();
350 histetclu_->Fill(theClus->energy()*
sin(2.*atan(
exp(-theClus->position().eta()))));
353 histq_->Fill((*MyS).getCharge());
365 seedQ[is] = (*MyS).getCharge();
378 seedLayer1[is] = pxfid1.
disk();
385 seedLayer1[is] = tibid1.
layer();
392 seedLayer1[is] = tidid1.
wheel();
399 seedLayer1[is] = tobid1.
layer();
406 seedLayer1[is] = tecid1.
wheel();
427 seedLayer2[is] = pxfid2.
disk();
434 seedLayer2[is] = tibid2.
layer();
441 seedLayer2[is] = tidid2.
wheel();
448 seedLayer2[is] = tobid2.
layer();
455 seedLayer2[is] = tecid2.
wheel();
476 e.
getByLabel(
"correctedHybridSuperClusters", clusters);
487 const HepMC::GenEvent* MCEvt = HepMCEvt->GetEvent();
489 HepMC::FourVector pAssSim;
491 for (HepMC::GenEvent::particle_const_iterator partIter = MCEvt->particles_begin();
492 partIter != MCEvt->particles_end(); ++partIter) {
494 for (HepMC::GenEvent::vertex_const_iterator vertIter = MCEvt->vertices_begin();
495 vertIter != MCEvt->vertices_end(); ++vertIter) {
498 HepMC::GenVertex * creation = (*partIter)->production_vertex();
500 HepMC::FourVector momentum = (*partIter)->momentum();
502 int id = (*partIter)->pdg_id();
503 LogDebug(
"") <<
"MC particle id " <<
id <<
", creationVertex " << (*creation) <<
" cm, initialMomentum " << momentum.rho() <<
" GeV/c" << std::endl;
505 if (
id == 11 ||
id == -11) {
509 if ( (*partIter)->production_vertex() ) {
510 if ( (*partIter)->production_vertex()->particles_begin(
HepMC::parents) !=
512 mother = *((*partIter)->production_vertex()->particles_begin(
HepMC::parents));
514 if ( ((mother == 0) || ((mother != 0) && (mother->pdg_id() == 23))
515 || ((mother != 0) && (mother->pdg_id() == 32))
516 || ((mother != 0) && (
std::abs(mother->pdg_id()) == 24)))) {
518 pAssSim = genPc->momentum();
525 if (
std::abs(pAssSim.eta())> 2.5)
continue;
532 bool okSeedFound =
false;
533 double seedOkRatio = 999999.;
537 for( ElectronSeedCollection::const_iterator gsfIter= (*elSeeds).begin(); gsfIter != (*elSeeds).end(); ++gsfIter) {
541 for (TrackingRecHitCollection::const_iterator rhits=r.first; rhits!=r.second; rhits++) det = pDD->idToDet(((*rhits)).geographicalId());
547 double dphi = phi-pAssSim.phi();
549 dphi = dphi < 0? (CLHEP::twopi) + dphi : dphi - CLHEP::twopi;
551 if ( deltaR < 0.15 ){
555 double tmpSeedRatio = p/pAssSim.t();
557 seedOkRatio = tmpSeedRatio;
558 bestElectronSeed=*gsfIter;
573 mcEta[ip] = pAssSim.eta();
574 mcPhi[ip] = pAssSim.phi();
575 mcPt[ip] = pAssSim.perp();
576 mcQ[ip] = ((
id == 11) ? -1.: +1.);
582 seedOkRatio = 999999.;
585 for( ElectronSeedCollection::const_iterator gsfIter= (*elSeeds).begin(); gsfIter != (*elSeeds).end(); ++gsfIter) {
587 range r=gsfIter->recHits();
589 for (TrackingRecHitCollection::const_iterator rhits=r.first; rhits!=r.second; rhits++) det = pDD->idToDet(((*rhits)).geographicalId());
595 double dphi = phi-pAssSim.phi();
597 dphi = dphi < 0? (CLHEP::twopi) + dphi : dphi - CLHEP::twopi;
599 if (gsfIter->isEcalDriven()) {
600 if ( deltaR < 0.15 ){
604 double tmpSeedRatio = p/pAssSim.t();
606 seedOkRatio = tmpSeedRatio;
607 bestElectronSeed=*gsfIter;
625 seedOkRatio = 999999.;
628 for( ElectronSeedCollection::const_iterator gsfIter= (*elSeeds).begin(); gsfIter != (*elSeeds).end(); ++gsfIter) {
630 range r=gsfIter->recHits();
632 for (TrackingRecHitCollection::const_iterator rhits=r.first; rhits!=r.second; rhits++) det = pDD->idToDet(((*rhits)).geographicalId());
638 double dphi = phi-pAssSim.phi();
640 dphi = dphi < 0? (CLHEP::twopi) + dphi : dphi - CLHEP::twopi;
642 if (gsfIter->isTrackerDriven()) {
643 if ( deltaR < 0.15 ){
647 double tmpSeedRatio = p/pAssSim.t();
649 seedOkRatio = tmpSeedRatio;
650 bestElectronSeed=*gsfIter;
GlobalPoint toGlobal(const Point2DBase< Scalar, LocalTag > lp) const
unsigned int layer() const
layer id
float superclusterEnergy[10]
GlobalPoint toGlobal(const Local2DPoint &lp) const
Conversion to the global R.F. from the R.F. of the GeomDet.
Sin< T >::type sin(const T &t)
float superclusterPhi[10]
Geom::Phi< T > phi() const
bool isNull() const
Checks for null.
GlobalPoint globalPosition() const
bool getByType(Handle< PROD > &result) const
TH1F * histtrackerdrivenetaMCmatched_
edm::InputTag inputCollection_
uint32_t rawId() const
get the raw id
recHitContainer::const_iterator const_iterator
TH1F * histecaldrivenptMCmatched_
int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum) ...
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
GlobalVector momentum() const
TH1F * histecaldriveneMCmatched_
unsigned int disk() const
disk id
double deltaR(double eta1, double eta2, double phi1, double phi2)
virtual TrajectoryStateOnSurface propagate(const TrajectoryStateOnSurface &tsos, const Plane &plane) const
GlobalPoint position() const
float superclusterEta[10]
TH1F * histecaldrivenetaMCmatched_
REF castTo() const
cast to a concrete type
T const * product() const
unsigned int wheel() const
wheel id
TH1F * histtrackerdriveneMCmatched_
unsigned int layer() const
layer id
GlobalVector globalMomentum() const
const BoundPlane & surface() const
The nominal surface of the GeomDet.
Detector det() const
get the detector field from this detid
Power< A, B >::type pow(const A &a, const B &b)
TH1F * histtrackerdrivenptMCmatched_
unsigned int wheel() const
wheel id