CMS 3D CMS Logo

OutInConversionSeedFinder Class Reference

Id
OutInConversionSeedFinder.h,v 1.8 2008/05/08 20:41:27 nancy Exp
Date
2008/05/08 20:41:27
Revision
1.8
More...

#include <RecoEgamma/EgammaPhotonAlgos/interface/OutInConversionSeedFinder.h>

Inheritance diagram for OutInConversionSeedFinder:

ConversionSeedFinder

List of all members.

Public Member Functions

virtual void makeSeeds (const reco::CaloClusterPtr &aBC) const
virtual void makeSeeds (const edm::Handle< edm::View< reco::CaloCluster > > &allBc) const
 OutInConversionSeedFinder (const edm::ParameterSet &config)
virtual ~OutInConversionSeedFinder ()

Private Types

typedef FreeTrajectoryState FTS
typedef TrajectoryStateOnSurface TSOS

Private Member Functions

void completeSeed (const TrajectoryMeasurement &m1, FreeTrajectoryState &fts, const Propagator *, int layer) const
void createSeed (const TrajectoryMeasurement &m1, const TrajectoryMeasurement &m2) const
FreeTrajectoryState createSeedFTS (const TrajectoryMeasurement &m1, const TrajectoryMeasurement &m2) const
void fillClusterSeeds (const reco::CaloClusterPtr &bc) const
GlobalPoint fixPointRadius (const TrajectoryMeasurement &) const
MeasurementEstimatormakeEstimator (const DetLayer *, float dphi) const
std::pair< FreeTrajectoryState,
bool
makeTrackState (int charge) const
void startSeed (const FreeTrajectoryState &) const

Private Attributes

edm::ParameterSet conf_
int maxNumberOfOutInSeedsPerBC_
int nSeedsPerBC_
float the2ndHitdphi_
float the2ndHitdzConst_
float the2ndHitdznSigma_
std::vector
< TrajectoryMeasurement
theFirstMeasurements_


Detailed Description

Id
OutInConversionSeedFinder.h,v 1.8 2008/05/08 20:41:27 nancy Exp
Date
2008/05/08 20:41:27
Revision
1.8

Author:
Nancy Marinelli, U. of Notre Dame, US

Definition at line 34 of file OutInConversionSeedFinder.h.


Member Typedef Documentation

typedef FreeTrajectoryState OutInConversionSeedFinder::FTS [private]

Definition at line 39 of file OutInConversionSeedFinder.h.

typedef TrajectoryStateOnSurface OutInConversionSeedFinder::TSOS [private]

Definition at line 40 of file OutInConversionSeedFinder.h.


Constructor & Destructor Documentation

OutInConversionSeedFinder::OutInConversionSeedFinder ( const edm::ParameterSet config  ) 

Definition at line 28 of file OutInConversionSeedFinder.cc.

References LogDebug, maxNumberOfOutInSeedsPerBC_, the2ndHitdphi_, the2ndHitdzConst_, and the2ndHitdznSigma_.

00028                                                                                  : ConversionSeedFinder( conf ), conf_(conf)  
00029 {
00030 
00031   LogDebug("OutInConversionSeedFinder") << "OutInConversionSeedFinder CTOR " << "\n";      
00032 
00033   //the2ndHitdphi_ = 0.01; 
00034   the2ndHitdphi_ = 0.03; 
00035   the2ndHitdzConst_ = 5.;
00036   the2ndHitdznSigma_ = 2.;
00037   maxNumberOfOutInSeedsPerBC_=50;    
00038    
00039     
00040 }

OutInConversionSeedFinder::~OutInConversionSeedFinder (  )  [virtual]

Definition at line 45 of file OutInConversionSeedFinder.cc.

References LogDebug.

00045                                                       {
00046   LogDebug("OutInConversionSeedFinder") << "OutInConversionSeedFinder DTOR " << "\n";
00047  
00048 }


Member Function Documentation

void OutInConversionSeedFinder::completeSeed ( const TrajectoryMeasurement m1,
FreeTrajectoryState fts,
const Propagator propagator,
int  layer 
) const [private]

Definition at line 385 of file OutInConversionSeedFinder.cc.

References GeomDetEnumerators::barrel, createSeed(), i, int, DetLayer::location(), LogDebug, Propagator::propagationDirection(), TrajectoryMeasurement::recHit(), funct::sqrt(), GeometricSearchDet::surface(), the2ndHitdphi_, the2ndHitdzConst_, the2ndHitdznSigma_, and ConversionSeedFinder::theLayerList_.

Referenced by startSeed().

00387                                                                                              {
00388 
00389   //std::cout <<  "OutInConversionSeedFinder::completeSeed ilayer " << ilayer << "\n";
00390 
00391   MeasurementEstimator * newEstimator=0;
00392   const DetLayer * layer = theLayerList_[ilayer];
00393   
00394 
00395   if ( layer->location() == GeomDetEnumerators::barrel ) {
00396     // z error for 2nd hit is  2 sigma quadded with 5 cm
00397     LogDebug("OutInConversionSeedFinder") << " Barrel OutInConversionSeedFinder::completeSeed " << the2ndHitdznSigma_ << " " << the2ndHitdzConst_ << " " << the2ndHitdphi_ << "\n";
00398     float dz = sqrt(the2ndHitdznSigma_*the2ndHitdznSigma_*m1.recHit()->globalPositionError().czz() 
00399                     + the2ndHitdzConst_*the2ndHitdzConst_);
00400     newEstimator =
00401       new ConversionBarrelEstimator(-the2ndHitdphi_, the2ndHitdphi_, -dz, dz);
00402   }
00403   else {
00404     LogDebug("OutInConversionSeedFinder") << " EndCap OutInConversionSeedFinder::completeSeed " << the2ndHitdznSigma_ << " " << the2ndHitdzConst_ << " " << the2ndHitdphi_ << "\n";
00405     // z error for 2nd hit is 2sigma quadded with 5 cm
00406     //float m1dr = m1.recHit().globalPositionError().rerr(m1.recHit().globalPosition());
00407     float m1dr = sqrt(m1.recHit()->localPositionError().yy());
00408     float dr = sqrt(the2ndHitdznSigma_*the2ndHitdznSigma_*m1dr*m1dr 
00409                     + the2ndHitdzConst_*the2ndHitdznSigma_);
00410     // LogDebug("OutInConversionSeedFinder") << "second hit forward dr " << dr << " this hit " << m1dr << endl;
00411     newEstimator =
00412       new ConversionForwardEstimator(-the2ndHitdphi_, the2ndHitdphi_, dr);
00413   }
00414 
00415   LogDebug("OutInConversionSeedFinder") << "OutInConversionSeedFinder::completeSeed  ilayer " << ilayer <<  "\n"; 
00416   
00417   // Get the measurements consistent with the FTS and the Estimator
00418   TSOS tsos(fts, layer->surface() );
00419   LogDebug("OutInConversionSeedFinder") << "OutInConversionSeedFinder::completeSeed propagationDirection  " << int(propagator->propagationDirection() ) << "\n";               
00420   LogDebug("OutInConversionSeedFinder") << "OutInConversionSeedFinder::completeSeed pointer to estimator " << newEstimator << "\n";
00421 
00422   LayerMeasurements theLayerMeasurements_(this->getMeasurementTracker() );
00423   std::vector<TrajectoryMeasurement> measurements = theLayerMeasurements_.measurements( *layer, tsos, *propagator, *newEstimator);
00424   //std::cout << "OutInConversionSeedFinder::completeSeed Found " << measurements.size() << " second hits " << "\n";
00425   delete newEstimator;
00426 
00427   for(unsigned int i = 0; i < measurements.size(); ++i) {
00428     if( measurements[i].recHit()->isValid()  ) {
00429       createSeed(m1, measurements[i]);
00430     }
00431   }
00432 
00433 
00434 
00435   //LogDebug("OutInConversionSeedFinder") << "COMPLETED " << theSeeds_.size() << " SEEDS " << "\n";
00436 }

void OutInConversionSeedFinder::createSeed ( const TrajectoryMeasurement m1,
const TrajectoryMeasurement m2 
) const [private]

Definition at line 440 of file OutInConversionSeedFinder.cc.

References createSeedFTS(), TrajectoryMeasurement::estimate(), PV3DBase< T, PVType, FrameType >::eta(), TrajectoryStateOnSurface::freeTrajectoryState(), TrajectoryStateOnSurface::globalPosition(), TrajectoryStateOnSurface::isValid(), TrajectoryMeasurement::layer(), LogDebug, maxNumberOfOutInSeedsPerBC_, nSeedsPerBC_, oppositeToMomentum, PTrajectoryStateOnDet::parameters(), PV3DBase< T, PVType, FrameType >::perp(), TrajectoryStateTransform::persistentState(), PV3DBase< T, PVType, FrameType >::phi(), LocalTrajectoryParameters::position(), PropagatorWithMaterial::propagate(), TrajectoryMeasurement::recHit(), ConversionSeedFinder::theMF_, ConversionSeedFinder::theSeeds_, ConversionSeedFinder::theUpdator_, and KFUpdator::update().

Referenced by completeSeed().

00441                                                                                    {
00442 
00443   //std::cout  << "OutInConversionSeedFinder::createSeed  from hit1 " << m1.recHit()->globalPosition() << " r1 " << m1.recHit()->globalPosition().perp() << " and hit2 " << m2.recHit()->globalPosition() << " r2 " << m2.recHit()->globalPosition().perp() << "\n";
00444   
00445 
00446   FreeTrajectoryState fts = createSeedFTS(m1, m2);
00447 
00448 
00449   LogDebug("OutInConversionSeedFinder") << "OutInConversionSeedFinder::createSeed First point errors " <<m1.recHit()->parametersError() << "\n";
00450   LogDebug("OutInConversionSeedFinder") << "original cluster FTS " << fts <<"\n";
00451 
00452 
00453   PropagatorWithMaterial thePropagatorWithMaterial_ (oppositeToMomentum, 0.000511, &(*theMF_) );
00454   //std::cout  << "OutInConversionSeedFinder::createSeed propagation dir " << int( thePropagatorWithMaterial_.propagationDirection() ) << "\n"; 
00455   TrajectoryStateOnSurface state1 = thePropagatorWithMaterial_.propagate(fts,  m1.recHit()->det()->surface());
00456 
00457   // LogDebug("OutInConversionSeedFinder") << "hit surface " << h1.det().surface().position() << endl;
00458   // LogDebug("OutInConversionSeedFinder") << "prop to " << typeid(h1.det().surface()).name() << endl;
00459   // LogDebug("OutInConversionSeedFinder") << "prop to first hit " << state1 << endl; 
00460   // LogDebug("OutInConversionSeedFinder") << "update to " << h1.globalPosition() << endl;
00461 
00462   if ( state1.isValid() ) {
00463     TrajectoryStateOnSurface updatedState1 = theUpdator_.update(state1,  *m1.recHit() );
00464 
00465     if ( updatedState1.isValid() ) {
00466       TrajectoryStateOnSurface state2 = thePropagatorWithMaterial_.propagate(*updatedState1.freeTrajectoryState(),  m2.recHit()->det()->surface());
00467 
00468       if ( state2.isValid() ) {
00469 
00470         TrajectoryStateOnSurface updatedState2 = theUpdator_.update(state2, *m2.recHit() );
00471         TrajectoryMeasurement meas1(state1, updatedState1,  m1.recHit()  , m1.estimate(), m1.layer());
00472         TrajectoryMeasurement meas2(state2, updatedState2,  m2.recHit()  , m2.estimate(), m2.layer());
00473         
00474         edm::OwnVector<TrackingRecHit> myHits;
00475         myHits.push_back(meas1.recHit()->hit()->clone());
00476         myHits.push_back(meas2.recHit()->hit()->clone());
00477 
00478         if ( nSeedsPerBC_ >= maxNumberOfOutInSeedsPerBC_ ) return;
00479    
00480         TrajectoryStateTransform tsTransform;
00481         PTrajectoryStateOnDet* ptsod= tsTransform.persistentState(state2, meas2.recHit()->hit()->geographicalId().rawId()  );
00482 
00483         LogDebug("OutInConversionSeedFinder") << "OutInConversionSeedFinder::createSeed new seed  from state " << state2.globalPosition()  <<  "\n";
00484         LogDebug("OutInConversionSeedFinder") << "OutInConversionSeedFinder::createSeed new seed  ptsod " <<  ptsod->parameters().position() << " R " << ptsod->parameters().position().perp() << " phi " << ptsod->parameters().position().phi() << " eta " << ptsod->parameters().position().eta() << "\n" ;
00485         
00486 
00487 
00488         theSeeds_.push_back(TrajectorySeed( *ptsod, myHits, oppositeToMomentum ));
00489         nSeedsPerBC_++;
00490  
00491         delete ptsod;  
00492         
00493 
00494       }
00495     }
00496   }
00497 
00498 
00499 
00500 
00501 
00502 }

FreeTrajectoryState OutInConversionSeedFinder::createSeedFTS ( const TrajectoryMeasurement m1,
const TrajectoryMeasurement m2 
) const [private]

Definition at line 508 of file OutInConversionSeedFinder.cc.

References TrajectoryStateOnSurface::charge(), funct::cos(), fixPointRadius(), m, PV3DBase< T, PVType, FrameType >::perp(), PV3DBase< T, PVType, FrameType >::phi(), phi, TrajectoryMeasurement::predictedState(), funct::sin(), ConversionSeedFinder::theMF_, ConversionSeedFinder::theSCenergy_, ConversionSeedFinder::theSCPosition_, and PV3DBase< T, PVType, FrameType >::theta().

Referenced by createSeed().

00509                                                                                                      {
00510 
00511   //std::cout  << "OutInConversionSeedFinder::createSeedFTS " << "\n";
00512 
00513   GlobalPoint xmeas = fixPointRadius(m1);
00514   GlobalPoint xvert = fixPointRadius(m2);
00515 
00516 
00517   float pt = theSCenergy_ * sin(theSCPosition_.theta());
00518   float pz = theSCenergy_ * cos(theSCPosition_.theta());
00519 
00520 
00521 
00522   // doesn't work at all for endcap, where r is badly measured
00523   //float dphidr = (p1.phi()-p2.phi())/(p1.perp()-p2.perp());
00524   //int charge = (dphidr > 0.) ? -1 : 1;
00525   int charge = m2.predictedState().charge();
00526 
00527   double BInTesla = theMF_->inTesla(xmeas).z();
00528   GlobalVector xdiff = xmeas -xvert;
00529  
00530   double phi= xdiff.phi();
00531   double pxOld = pt*cos(phi);
00532   double pyOld = pt*sin(phi);
00533   double RadCurv = 100*pt/(BInTesla*0.29979);
00534   double alpha = asin(0.5*xdiff.perp()/RadCurv);
00535   float ca = cos(charge*alpha);
00536   float sa = sin(charge*alpha);
00537   double pxNew =   ca*pxOld + sa*pyOld;
00538   double pyNew =  -sa*pxOld + ca*pyOld;
00539   GlobalVector pNew(pxNew, pyNew, pz);
00540 
00541   GlobalTrajectoryParameters gp(xmeas, pNew, charge, &(*theMF_) );
00542 
00543   AlgebraicSymMatrix55 m = AlgebraicMatrixID();
00544   m(0,0) = 0.05; m(1,1) = 0.02 ; m(2,2) = 0.007 ;
00545   m(3,3) = 10. ; m(4,4) = 10. ;
00546   return FreeTrajectoryState(gp, CurvilinearTrajectoryError(m));
00547 
00548 
00549 }

void OutInConversionSeedFinder::fillClusterSeeds ( const reco::CaloClusterPtr bc  )  const [private]

negative charge state

positive charge state

Definition at line 174 of file OutInConversionSeedFinder.cc.

References makeTrackState(), edm::second(), startSeed(), and theFirstMeasurements_.

Referenced by makeSeeds().

00174                                                                                    {
00175 
00176   
00177   theFirstMeasurements_.clear();
00178   FreeTrajectoryState fts;  
00179 
00181   if ( makeTrackState(-1).second ) {
00182     fts = makeTrackState(-1).first;
00183     startSeed(fts);
00184   }
00186 
00187   if ( makeTrackState(1).second ) {
00188     fts = makeTrackState(1).first;
00189     startSeed(fts);
00190   }
00191 
00192 }

GlobalPoint OutInConversionSeedFinder::fixPointRadius ( const TrajectoryMeasurement m1  )  const [private]

Definition at line 554 of file OutInConversionSeedFinder.cc.

References GeomDetEnumerators::barrel, funct::cos(), TrajectoryMeasurement::layer(), DetLayer::location(), p1, p2, PV3DBase< T, PVType, FrameType >::phi(), phi, r, TrajectoryMeasurement::recHit(), funct::sin(), funct::tan(), ConversionSeedFinder::theSCPosition_, theta, PV3DBase< T, PVType, FrameType >::theta(), PV3DBase< T, PVType, FrameType >::z(), and z.

Referenced by createSeedFTS().

00554                                                                                             {
00555   GlobalPoint p1 = m1.recHit()->globalPosition();
00556   GlobalPoint p2;
00557   if(m1.layer()->location() == GeomDetEnumerators::barrel) {
00558     p2 = p1;
00559   } else {
00560     float z = p1.z();
00561     float phi = p1.phi();
00562     float theta = theSCPosition_.theta();
00563     float r = p1.z() * tan(theta);
00564     p2 = GlobalPoint(r*cos(phi), r*sin(phi), z);
00565     // LogDebug("OutInConversionSeedFinder") << "fixing point radius " << p2 << " from " << p1 << endl;
00566   }
00567   return p2;
00568 }

MeasurementEstimator * OutInConversionSeedFinder::makeEstimator ( const DetLayer layer,
float  dphi 
) const [private]

Definition at line 347 of file OutInConversionSeedFinder.cc.

References GeomDetEnumerators::barrel, GeomDetEnumerators::endcap, BoundDisk::innerRadius(), DetLayer::location(), LogDebug, BoundDisk::outerRadius(), PV3DBase< T, PVType, FrameType >::perp(), GloballyPositioned< T >::position(), r, Cylinder::radius(), ForwardDetLayer::specificSurface(), BarrelDetLayer::specificSurface(), ForwardDetLayer::surface(), ConversionSeedFinder::theBCPosition_, PV3DBase< T, PVType, FrameType >::z(), and z.

Referenced by startSeed().

00347                                                                                                         {
00348  
00349   //std::cout  << "OutInConversionSeedFinder::makeEstimator  " << "\n";
00350 
00351   MeasurementEstimator * newEstimator=0;
00352 
00353   if (layer->location() == GeomDetEnumerators::barrel ) {
00354     
00355     const BarrelDetLayer * barrelLayer = dynamic_cast<const BarrelDetLayer*>(layer);
00356     LogDebug("OutInConversionSeedFinder") << "OutInConversionSeedFinder::makeEstimator Barrel  r = " << barrelLayer->specificSurface().radius() << " " << "\n";        
00357     float r = barrelLayer->specificSurface().radius();
00358     float zrange = 15.* (1.-r/theBCPosition_.perp());
00359     newEstimator = new ConversionBarrelEstimator(-dphi, dphi, -zrange, zrange);
00360   }
00361 
00362 
00363 
00364   if (layer->location() == GeomDetEnumerators::endcap ) {   
00365    
00366     const ForwardDetLayer * forwardLayer = dynamic_cast<const ForwardDetLayer*>(layer);
00367     LogDebug("OutInConversionSeedFinder") << "OutInConversionSeedFinder::makeEstimator Endcap r = " << forwardLayer->specificSurface().innerRadius() << " R " << forwardLayer->specificSurface().outerRadius()  <<  " Z " << forwardLayer->specificSurface().position().z() << "\n";  
00368     
00369     float zc = fabs(theBCPosition_.z());
00370     float z =  fabs(forwardLayer->surface().position().z());
00371     
00372     float rrange = 15. * theBCPosition_.perp() * (zc - z) / (zc*zc - 15.*zc);
00373     newEstimator = new ConversionForwardEstimator(-dphi, dphi, rrange);
00374   }
00375 
00376 
00377 
00378 
00379   return newEstimator;
00380 }

void OutInConversionSeedFinder::makeSeeds ( const reco::CaloClusterPtr aBC  )  const [virtual]

Definition at line 145 of file OutInConversionSeedFinder.cc.

References dPhi(), PV3DBase< T, PVType, FrameType >::eta(), fillClusterSeeds(), ConversionSeedFinder::findLayers(), nSeedsPerBC_, PV3DBase< T, PVType, FrameType >::phi(), ConversionSeedFinder::theBCEnergy_, ConversionSeedFinder::theBCPosition_, ConversionSeedFinder::theSCPosition_, and ConversionSeedFinder::theSeeds_.

00145                                                                                   {
00146 
00147   theSeeds_.clear();
00148 
00149   findLayers();
00150 
00151   float  theSCPhi=theSCPosition_.phi();
00152   float  theSCEta=theSCPosition_.eta();
00153 
00154   nSeedsPerBC_=0;
00155 
00156   theBCEnergy_=aBC->energy();
00157   theBCPosition_ = GlobalPoint(aBC->position().x(), aBC->position().y(), aBC->position().z() ) ;
00158   float theBcEta=  theBCPosition_.eta();
00159   float theBcPhi=  theBCPosition_.phi();
00160   float  dPhi= theBcPhi-theSCPhi;
00161 
00162   if ( theBCEnergy_ < 1.5 ) return;
00163 
00164   if (  fabs(theBcEta-theSCEta) < 0.015  && fabs(theBcPhi-theSCPhi) < 0.25 ) {
00165     fillClusterSeeds( aBC);
00166   }
00167 
00168 }

void OutInConversionSeedFinder::makeSeeds ( const edm::Handle< edm::View< reco::CaloCluster > > &  allBc  )  const [virtual]

Implements ConversionSeedFinder.

Definition at line 52 of file OutInConversionSeedFinder.cc.

References dPhi(), PV3DBase< T, PVType, FrameType >::eta(), fillClusterSeeds(), ConversionSeedFinder::findLayers(), i, LogDebug, nSeedsPerBC_, PV3DBase< T, PVType, FrameType >::phi(), ConversionSeedFinder::theBCEnergy_, ConversionSeedFinder::theBCPosition_, ConversionSeedFinder::theSCPosition_, and ConversionSeedFinder::theSeeds_.

Referenced by ConversionTrackCandidateProducer::buildCollections(), and SoftConversionTrackCandidateProducer::buildCollections().

00052                                                                                                        {
00053 
00054   //  std::cout  << "  OutInConversionSeedFinder::makeSeeds() " << "\n";
00055   theSeeds_.clear();
00056 
00057 
00058   // debug  
00059   //  std::cout << "  OutInConversionSeedFinder::makeSeeds() SC position " << theSCPosition_.x() << " " << theSCPosition_.y() << " " << theSCPosition_.z() << "\n";
00060   // std::cout << " SC eta  " <<  theSCPosition_.eta() <<  " SC phi  " <<  theSCPosition_.phi() << "\n";  
00061   // std::cout << "  OutInConversionSeedFinder::makeSeeds() SC energy " << theSCenergy_  << "\n";  
00062   //
00063 
00064   findLayers();
00065 
00066   
00067   //  std::cout  << " Check Calo cluster collection size " << allBC->size() << "\n";
00068   
00069   float  theSCPhi=theSCPosition_.phi();
00070   float  theSCEta=theSCPosition_.eta();
00071 
00072   
00073 
00074   //  Loop over the Calo Clusters  in the event looking for seeds 
00075   reco::CaloClusterCollection::const_iterator bcItr;
00076   LogDebug("OutInConversionSeedFinder") << "  OutInConversionSeedFinder::makeSeeds() All BC in the event " << "\n";
00077   for (unsigned i = 0; i < allBC->size(); ++i ) {
00078   
00079     //for(bcItr = allBC.begin(); bcItr != allBC.end(); bcItr++) {
00080     nSeedsPerBC_=0;
00081 
00082     theBCEnergy_=allBC->ptrAt(i)->energy();
00083     theBCPosition_ = GlobalPoint(allBC->ptrAt(i)->position().x(), allBC->ptrAt(i)->position().y(), allBC->ptrAt(i)->position().z() ) ;
00084     float theBcEta=  theBCPosition_.eta();
00085     float theBcPhi=  theBCPosition_.phi();
00086     float  dPhi= theBcPhi-theSCPhi;
00087 
00088     //    std::cout << "  OutInConversionSeedFinder::makeSeeds() BC eta  " << theBcEta << " phi " <<  theBcPhi << " BC energy " << theBCEnergy_ << " dPhi " << fabs(theBcPhi-theSCPhi) << " dEta " <<  fabs(theBcEta-theSCEta) << "\n";
00089     
00090     if ( theBCEnergy_ < 1.5 ) continue;
00091 
00092     LogDebug("OutInConversionSeedFinder") << "  OutInConversionSeedFinder::makeSeeds() Passing the >=1.5 GeV cut  BC eta  " << theBcEta << " phi " <<  theBcPhi << " BC energy " << theBCEnergy_ << "\n";
00093 
00094     if (  fabs(theBcEta-theSCEta) < 0.015  && fabs(theBcPhi-theSCPhi) < 0.25 ) { 
00095       LogDebug("OutInConversionSeedFinder") << "  OutInConversionSeedFinder::makeSeeds() in et and phi range passed to the analysis " << "\n";
00096       fillClusterSeeds( allBC->ptrAt(i)  );
00097     }
00098     
00099 
00100   }
00101 
00102 
00103   //  std::cout << "Built vector of seeds of size  " << theSeeds_.size() <<  "\n" ;
00104   
00106   /*
00107   int nSeed=0;
00108   for ( std::vector<TrajectorySeed>::const_iterator iSeed= theSeeds_.begin(); iSeed != theSeeds_.end(); ++iSeed) {
00109     nSeed++;
00110     PTrajectoryStateOnDet  ptsod=iSeed->startingState();
00111     LogDebug("OutInConversionSeedFinder") << nSeed << ")  Direction " << iSeed->direction() << " Num of hits " << iSeed->nHits() <<  " starting state position " << ptsod.parameters().position() << " R " << ptsod.parameters().position().perp() << " phi " << ptsod.parameters().position().phi() << " eta " << ptsod.parameters().position().eta() << "\n" ;
00112     
00113     
00114     DetId tmpId = DetId( iSeed->startingState().detId());
00115     const GeomDet* tmpDet  = this->getMeasurementTracker()->geomTracker()->idToDet( tmpId );
00116     GlobalVector gv = tmpDet->surface().toGlobal( iSeed->startingState().parameters().momentum() );
00117     
00118     LogDebug("OutInConversionSeedFinder") << "seed perp,phi,eta : " 
00119                                           << gv.perp() << " , " 
00120                                           << gv.phi() << " , " 
00121                                           << gv.eta() << "\n" ; ;
00122     
00123 
00124 
00125 
00126     TrajectorySeed::range hitRange = iSeed->recHits();
00127     for (TrajectorySeed::const_iterator ihit = hitRange.first; ihit != hitRange.second; ihit++) {
00128    
00129       if ( ihit->isValid() ) {
00130 
00131         LogDebug("OutInConversionSeedFinder") << " Valid hit global position " << this->getMeasurementTracker()->geomTracker()->idToDet((ihit)->geographicalId())->surface().toGlobal((ihit)->localPosition()) << " R " << this->getMeasurementTracker()->geomTracker()->idToDet((ihit)->geographicalId())->surface().toGlobal((ihit)->localPosition()).perp() << " phi " << this->getMeasurementTracker()->geomTracker()->idToDet((ihit)->geographicalId())->surface().toGlobal((ihit)->localPosition()).phi() << " eta " << this->getMeasurementTracker()->geomTracker()->idToDet((ihit)->geographicalId())->surface().toGlobal((ihit)->localPosition()).eta() <<    "\n" ;
00132 
00133       }
00134     }
00135   } 
00136   
00137   */
00138 
00139   
00140   
00141 }

std::pair< FreeTrajectoryState, bool > OutInConversionSeedFinder::makeTrackState ( int  charge  )  const [private]

Definition at line 196 of file OutInConversionSeedFinder.cc.

References PixelRecoUtilities::curvature(), d, LogDebug, m, PV3DBase< T, PVType, FrameType >::perp(), dttmaxenums::R, r, HLT_VtxMuL3::result, rho, funct::sqrt(), ConversionSeedFinder::theBCEnergy_, ConversionSeedFinder::theBCPosition_, ConversionSeedFinder::theMF_, PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

Referenced by fillClusterSeeds().

00196                                                                                               {
00197 
00198   std::pair<FreeTrajectoryState,bool> result;
00199   result.second=false;
00200  
00201 
00202   //std::cout << "  OutInConversionSeedFinder:makeTrackState " << "\n";
00203 
00204 
00205   //  Old GlobalPoint gpOrigine(theBCPosition_.x()*0.3, theBCPosition_.y()*0.3, theBCPosition_.z()*0.3) ;
00206 
00207   GlobalPoint gpOrigine(0.,0.,0.);
00208   GlobalVector gvBcRadius = theBCPosition_ - gpOrigine ;
00209   HepPoint3D radiusBc(gvBcRadius.x(),gvBcRadius.y(),gvBcRadius.z()) ;
00210   HepPoint3D momentumWithoutCurvature = radiusBc.unit() * theBCEnergy_ ;
00211 
00212   // compute momentum direction at calo
00213   double curvature = theMF_->inTesla(theBCPosition_).z() * c_light * 1.e-3 / momentumWithoutCurvature.perp() ;
00214   curvature /= 100. ; // in cm-1 !!
00215 
00216   LogDebug("OutInConversionSeedFinder") << "OutInConversionSeedFinder::makeTrackState gpOrigine " << gpOrigine.x() << " " <<  gpOrigine.y() << " " <<  gpOrigine.z() << " momentumWithoutCurvature " << momentumWithoutCurvature.mag() << " curvature " << curvature << "\n";
00217 
00218   // define rotation angle
00219   float R = theBCPosition_.perp();
00220   float r = gpOrigine.perp();
00221   float rho = 1./curvature;
00222   // from the formula for the intersection of two circles
00223   // turns out to be about 2/3 of the deflection of the old formula
00224   float d = sqrt(r*r+rho*rho);
00225   float u = rho + rho/d/d*(R*R-rho*rho) - r/d/d*sqrt((R*R-r*r+2*rho*R)*(R*R-r*r+2*rho*R));
00226   //float u = rho + rho/d/d*(R*R-rho*rho) ;
00227   if ( u <=R )   result.second=true;
00228 
00229   double sinAlpha = 0.5*u/R;
00230   if ( sinAlpha>(1.-10*DBL_EPSILON) )  sinAlpha = 1.-10*DBL_EPSILON;
00231   else if ( sinAlpha<-(1.-10*DBL_EPSILON) )  sinAlpha = -(1.-10*DBL_EPSILON);
00232   
00233   double newdphi = charge * asin( sinAlpha) ;
00234 
00235   LogDebug("OutInConversionSeedFinder") << "OutInConversionSeedFinder::makeTrackState charge " << charge << " R " << R << " u/R " << u/R << " asin(0.5*u/R) " << asin(sinAlpha) << "\n";
00236 
00237   HepTransform3D rotation =  HepRotate3D(newdphi, HepVector3D(0., 0. ,1.));
00238 
00239 
00240   HepPoint3D momentumInTracker = momentumWithoutCurvature.transform(rotation) ;
00241   LogDebug("OutInConversionSeedFinder") << "OutInConversionSeedFinder::makeTrackState  R " << R << " r " << r << " rho " << rho  << " d " << d  << " u " << u << " newdphi " << newdphi << " momentumInTracker " <<  momentumInTracker << "\n";
00242 
00243   HepPoint3D hepStartingPoint(gpOrigine.x(), gpOrigine.y(), gpOrigine.z()) ;
00244 
00245   LogDebug("OutInConversionSeedFinder") << "OutInConversionSeedFinder::makeTrackState hepStartingPoint " << hepStartingPoint << "\n";
00246 
00247   hepStartingPoint.transform(rotation);
00248 
00249   GlobalPoint startingPoint(hepStartingPoint.x(), hepStartingPoint.y(), hepStartingPoint.z());
00250 
00251   LogDebug("OutInConversionSeedFinder") << "OutInConversionSeedFinder::makeTrackState startingPoint " << startingPoint << " calo position " << theBCPosition_ << "\n";
00252   GlobalVector gvTracker(momentumInTracker.x(), momentumInTracker.y(), momentumInTracker.z());
00253   GlobalTrajectoryParameters gtp(startingPoint, gvTracker, charge, &(*theMF_) );
00254   // error matrix
00255   AlgebraicSymMatrix55 m = AlgebraicMatrixID();
00256   m(0,0) = 0.1; m(1,1) = 0.1 ; m(2,2) = 0.1 ;
00257   m(3,3) = 0.1 ; m(4,4) = 0.1;
00258   
00259   //std::cout << "OutInConversionSeedFinder::makeTrackState " <<  FreeTrajectoryState(gtp, CurvilinearTrajectoryError(m) ) << "\n";
00260    
00261   result.first= FreeTrajectoryState(gtp, CurvilinearTrajectoryError(m) ) ;
00262   return result;
00263 
00264 }

void OutInConversionSeedFinder::startSeed ( const FreeTrajectoryState fts  )  const [private]

Definition at line 267 of file OutInConversionSeedFinder.cc.

References alongMomentum, FreeTrajectoryState::charge(), completeSeed(), i, int, ConversionSeedFinder::layerList(), LogDebug, m1, makeEstimator(), oppositeToMomentum, Propagator::propagationDirection(), TrajectoryMeasurement::recHit(), GeometricSearchDet::surface(), theFirstMeasurements_, ConversionSeedFinder::theMF_, and ConversionSeedFinder::trackStateFromClusters().

Referenced by fillClusterSeeds().

00267                                                                                {
00268 
00269 
00270   //  std::cout << "OutInConversionSeedFinder::startSeed layer list " << this->layerList().size() <<  "\n";
00271   //std::cout << "OutInConversionSeedFinder::startSeed  fts " << fts <<  "\n";  
00272 
00273   std::vector<const DetLayer*> myLayers=layerList();
00274   if ( myLayers.size() > 3 ) {
00275     
00276     for(unsigned int ilayer = myLayers.size()-1; ilayer >= myLayers.size()-2; --ilayer) {
00277       const DetLayer * layer = myLayers[ilayer];
00278       
00279       
00280       // allow the z of the hit to be within a straight line from a vertex
00281       // of +-15 cm to the cluster
00282       //      float dphi = 0.015;
00283       float dphi = 0.030;
00284 
00285       MeasurementEstimator * newEstimator = makeEstimator(layer, dphi);
00286 
00287 
00288       PropagatorWithMaterial thePropagatorWithMaterial_ (alongMomentum, 0.000511, &(*theMF_) );
00289       // thePropagatorWithMaterial_.setPropagationDirection(alongMomentum);
00290      
00291       //      std::cout << "OutInSeedFinder::startSeed propagationDirection  " << int(thePropagatorWithMaterial_.propagationDirection() ) << "\n";       
00292       
00293       TSOS tsos(fts, layer->surface() );
00294       
00295       LogDebug("OutInConversionSeedFinder") << "OutInSeedFinder::startSeed  after  TSOS tsos(fts, layer->surface() ) " << "\n";
00296       
00297       LayerMeasurements theLayerMeasurements_(this->getMeasurementTracker() );
00298       theFirstMeasurements_ = theLayerMeasurements_.measurements( *layer, tsos, thePropagatorWithMaterial_, *newEstimator);
00299       
00300       //std::cout << "OutInSeedFinder::startSeed  after  theFirstMeasurements_   " << theFirstMeasurements_.size() <<  "\n";
00301       
00302       if(theFirstMeasurements_.size() > 1) // always a dummy returned, too
00303         LogDebug("OutInConversionSeedFinder") <<  " Found " << theFirstMeasurements_.size()-1 << " 1st hits in seed" << "\n";
00304       
00305       delete newEstimator;
00306       
00307       LogDebug("OutInConversionSeedFinder") << "OutInSeedFinder::startSeed Layer " << ilayer << " theFirstMeasurements_.size " << theFirstMeasurements_.size() << "\n";
00308       
00309       for(unsigned int i = 0; i < theFirstMeasurements_.size(); ++i) {
00310         TrajectoryMeasurement m1 = theFirstMeasurements_[i];
00311         if(m1.recHit()->isValid()) {
00312           
00313           // update the fts to start from this point.  much better than starting from
00314           // extrapolated point along the line
00315           GlobalPoint hitPoint = m1.recHit()->globalPosition();
00316           LogDebug("OutInConversionSeedFinder")  << " Valid hit at R  " <<   m1.recHit()->globalPosition().perp() << " Z " <<  m1.recHit()->globalPosition().z() << " eta " << m1.recHit()->globalPosition().eta() << " phi " << m1.recHit()->globalPosition().phi()  << " xyz " <<  m1.recHit()->globalPosition() << "\n";
00317 
00318           
00319           FreeTrajectoryState newfts = trackStateFromClusters(fts.charge(), hitPoint, alongMomentum, 0.8);
00320           LogDebug("OutInConversionSeedFinder") << "OutInConversionSeedFinder::startSeed  newfts " << newfts << "\n";
00321            
00322           PropagatorWithMaterial thePropagatorWithMaterial_ (oppositeToMomentum, 0.000511, &(*theMF_) );
00323 
00324 
00325  
00326           LogDebug("OutInConversionSeedFinder") << "OutInConversionSeedFinder::startSeed propagationDirection  after switching " << int(thePropagatorWithMaterial_.propagationDirection() ) << "\n";        
00327 
00328        
00329           completeSeed(m1, newfts, &thePropagatorWithMaterial_, ilayer-1);
00330           // skip a layer, if you haven't already skipped the first layer
00331           if(ilayer == myLayers.size()-1) {
00332             completeSeed(m1, newfts, &thePropagatorWithMaterial_, ilayer-2);
00333           }
00334         }
00335       }
00336       
00337     } // loop over layers
00338   }
00339 
00340 
00341 
00342   
00343 }


Member Data Documentation

edm::ParameterSet OutInConversionSeedFinder::conf_ [private]

Reimplemented from ConversionSeedFinder.

Definition at line 57 of file OutInConversionSeedFinder.h.

int OutInConversionSeedFinder::maxNumberOfOutInSeedsPerBC_ [private]

Definition at line 83 of file OutInConversionSeedFinder.h.

Referenced by createSeed(), and OutInConversionSeedFinder().

int OutInConversionSeedFinder::nSeedsPerBC_ [mutable, private]

Definition at line 82 of file OutInConversionSeedFinder.h.

Referenced by createSeed(), and makeSeeds().

float OutInConversionSeedFinder::the2ndHitdphi_ [private]

Definition at line 78 of file OutInConversionSeedFinder.h.

Referenced by completeSeed(), and OutInConversionSeedFinder().

float OutInConversionSeedFinder::the2ndHitdzConst_ [private]

Definition at line 79 of file OutInConversionSeedFinder.h.

Referenced by completeSeed(), and OutInConversionSeedFinder().

float OutInConversionSeedFinder::the2ndHitdznSigma_ [private]

Definition at line 80 of file OutInConversionSeedFinder.h.

Referenced by completeSeed(), and OutInConversionSeedFinder().

std::vector<TrajectoryMeasurement> OutInConversionSeedFinder::theFirstMeasurements_ [mutable, private]

Definition at line 81 of file OutInConversionSeedFinder.h.

Referenced by fillClusterSeeds(), and startSeed().


The documentation for this class was generated from the following files:
Generated on Tue Jun 9 18:29:26 2009 for CMSSW by  doxygen 1.5.4