CMS 3D CMS Logo

RoadSearchCloudMakerAlgorithm Class Reference

#include <RecoTracker/RoadSearchCloudMaker/interface/RoadSearchCloudMakerAlgorithm.h>

List of all members.

Public Member Functions

double CheckXYIntersection (LocalPoint &ip1, LocalPoint &op1, LocalPoint &ip2, LocalPoint &op2)
double CheckZPhiIntersection (double iPhi1, double iZ1, double oPhi1, double oZ1, double iPhi2, double iZ2, double oPhi2, double oZ2)
RoadSearchCloudCollection Clean (RoadSearchCloudCollection *rawColl)
SiStripMatchedRecHit2DCorrectMatchedHit (const TrackingRecHit *originalRH, const GluedGeomDet *gluedDet, const TrackerGeometry *tracker, const SiStripRecHitMatcher *theHitMatcher, double k0, double phi0)
unsigned int FillPixRecHitsIntoCloud (DetId id, const SiPixelRecHitCollection *inputRecHits, double d0, double phi0, double k0, Roads::type roadType, double ringPhi, const TrackerGeometry *tracker, RoadSearchCloud &cloud)
unsigned int FillRecHitsIntoCloud (DetId id, const SiStripRecHit2DCollection *inputRecHits, double d0, double phi0, double k0, Roads::type roadType, double ringPhi, const TrackerGeometry *tracker, RoadSearchCloud &cloud)
unsigned int FillRecHitsIntoCloudGeneral (DetId id, double d0, double phi0, double k0, double phi1, double k1, Roads::type roadType, double ringPhi, const TrackerGeometry *tracker, const SiStripRecHitMatcher *theHitMatcher, RoadSearchCloud &cloud)
bool isBarrelSensor (DetId id)
bool isSingleLayer (DetId id)
void makecircle (double x1_cs, double y1_cs, double x2_cs, double y2_cs, double x3_cs, double y3_cs)
double map_phi (double phi)
double map_phi2 (double phi)
double phiFromExtrapolation (double d0, double phi0, double k0, double ringRadius, Roads::type roadType)
double phiMax (Roads::type roadType, double phi0, double k0)
 RoadSearchCloudMakerAlgorithm (const edm::ParameterSet &conf)
void run (edm::Handle< RoadSearchSeedCollection > input, const SiStripRecHit2DCollection *rphiRecHits, const SiStripRecHit2DCollection *stereoRecHits, const SiStripMatchedRecHit2DCollection *matchedRecHits, const SiPixelRecHitCollection *pixRecHits, const edm::EventSetup &es, RoadSearchCloudCollection &output)
 Runs the algorithm.
double ZPhiDeltaPhi (double phi1, double phi2, double phiExpect)
 ~RoadSearchCloudMakerAlgorithm ()

Private Attributes

edm::ParameterSet conf_
double d0h
bool doCleaning_
unsigned int increaseMaxNumberOfConsecutiveMissedLayersPerCloud
unsigned int increaseMaxNumberOfMissedLayersPerCloud
unsigned int maxDetHitsInCloudPerDetId
double maxFractionOfConsecutiveMissedLayersPerCloud
double maxFractionOfMissedLayersPerCloud
unsigned int maxRecHitsInCloud_
double mergingFraction_
double minFractionOfUsedLayersPerCloud
bool NoFieldCosmic
double omegah
std::ostringstream output_
double phi0h
DetHitAccess recHitVectorClass
std::string roadsLabel_
double rphicsq
int rphinhits
double scalefactorRoadSeedWindow_
double theMinimumHalfRoad
const SiPixelRecHitCollection thePixRecHits
double theRPhiRoadSize
double theZPhiRoadSize
bool UsePixels

Static Private Attributes

static double epsilon = 0.000000001


Detailed Description

Definition at line 82 of file RoadSearchCloudMakerAlgorithm.h.


Constructor & Destructor Documentation

RoadSearchCloudMakerAlgorithm::RoadSearchCloudMakerAlgorithm ( const edm::ParameterSet conf  ) 

Definition at line 103 of file RoadSearchCloudMakerAlgorithm.cc.

References conf_, doCleaning_, edm::ParameterSet::getParameter(), increaseMaxNumberOfConsecutiveMissedLayersPerCloud, increaseMaxNumberOfMissedLayersPerCloud, int, maxDetHitsInCloudPerDetId, maxFractionOfConsecutiveMissedLayersPerCloud, maxFractionOfMissedLayersPerCloud, maxRecHitsInCloud_, mergingFraction_, minFractionOfUsedLayersPerCloud, NoFieldCosmic, recHitVectorClass, roadsLabel_, scalefactorRoadSeedWindow_, DetHitAccess::setMode(), DetHitAccess::standard, theMinimumHalfRoad, theRPhiRoadSize, theZPhiRoadSize, DetHitAccess::use_rphiRecHits(), DetHitAccess::use_stereoRecHits(), and UsePixels.

00103                                                                                         : conf_(conf) { 
00104   recHitVectorClass.setMode(DetHitAccess::standard);    
00105   recHitVectorClass.use_rphiRecHits(conf_.getParameter<bool>("UseRphiRecHits"));
00106   recHitVectorClass.use_stereoRecHits(conf_.getParameter<bool>("UseStereoRecHits"));
00107   
00108   
00109   theRPhiRoadSize =  conf_.getParameter<double>("RPhiRoadSize");
00110   theZPhiRoadSize =  conf_.getParameter<double>("ZPhiRoadSize");
00111   UsePixels = conf_.getParameter<bool>("UsePixelsinRS");
00112   NoFieldCosmic = conf_.getParameter<bool>("StraightLineNoBeamSpotCloud");
00113   theMinimumHalfRoad = conf_.getParameter<double>("MinimumHalfRoad");
00114   
00115   maxDetHitsInCloudPerDetId = conf_.getParameter<unsigned int>("MaxDetHitsInCloudPerDetId");
00116   minFractionOfUsedLayersPerCloud = conf_.getParameter<double>("MinimalFractionOfUsedLayersPerCloud");
00117   maxFractionOfMissedLayersPerCloud = conf_.getParameter<double>("MaximalFractionOfMissedLayersPerCloud");
00118   maxFractionOfConsecutiveMissedLayersPerCloud = conf_.getParameter<double>("MaximalFractionOfConsecutiveMissedLayersPerCloud");
00119   increaseMaxNumberOfConsecutiveMissedLayersPerCloud = conf_.getParameter<unsigned int>("IncreaseMaxNumberOfConsecutiveMissedLayersPerCloud");
00120   increaseMaxNumberOfMissedLayersPerCloud = conf_.getParameter<unsigned int>("IncreaseMaxNumberOfMissedLayersPerCloud");
00121   
00122   doCleaning_ = conf.getParameter<bool>("DoCloudCleaning");
00123   mergingFraction_ = conf.getParameter<double>("MergingFraction");
00124   maxRecHitsInCloud_ = (unsigned int)conf.getParameter<int>("MaxRecHitsInCloud");
00125   scalefactorRoadSeedWindow_ = conf.getParameter<double>("scalefactorRoadSeedWindow");
00126   
00127   roadsLabel_ = conf.getParameter<std::string>("RoadsLabel");
00128 
00129 }

RoadSearchCloudMakerAlgorithm::~RoadSearchCloudMakerAlgorithm (  ) 

Definition at line 131 of file RoadSearchCloudMakerAlgorithm.cc.

00131                                                               {
00132 
00133 }


Member Function Documentation

double RoadSearchCloudMakerAlgorithm::CheckXYIntersection ( LocalPoint ip1,
LocalPoint op1,
LocalPoint ip2,
LocalPoint op2 
)

Definition at line 1011 of file RoadSearchCloudMakerAlgorithm.cc.

References min, PV3DBase< T, PVType, FrameType >::x(), and PV3DBase< T, PVType, FrameType >::y().

Referenced by FillRecHitsIntoCloudGeneral().

01012                                                                                                {
01013 
01014   double deltaX = -999.;
01015   // just get the x coord of intersection of two line segments
01016   // check if intersection lies inside segments
01017   double det12 = inner1.x()*outer1.y() - inner1.y()*outer1.x();
01018   double det34 = inner2.x()*outer2.y() - inner2.y()*outer2.x();
01019 
01020   double xinter = (det12*(inner2.x()-outer2.x()) - det34*(inner1.x()-outer1.x()))/
01021     ((inner1.x()-outer1.x())*(inner2.y()-outer2.y()) - 
01022      (inner2.x()-outer2.x())*(inner1.y()-outer1.y()));
01023 
01024   bool inter = true;
01025   if (inner1.x() < outer1.x()){
01026     if ((xinter<inner1.x()) || (xinter>outer1.x())) inter = false;
01027   }
01028   else{
01029     if ((xinter>inner1.x()) || (xinter<outer1.x())) inter = false;
01030   }
01031 
01032   if (inner2.x() < outer2.x()){
01033     if ((xinter<inner2.x()) || (xinter>outer2.x())) inter = false;
01034   }
01035   else{
01036     if ((xinter>inner2.x()) || (xinter<outer2.x())) inter = false;
01037   }
01038 
01039   if (inter){
01040     deltaX = 0;
01041   }
01042   else{
01043     deltaX = min(fabs(inner1.x()-inner2.x()),fabs(outer1.x()-outer2.x()));
01044   }
01045   return deltaX;
01046 
01047 }

double RoadSearchCloudMakerAlgorithm::CheckZPhiIntersection ( double  iPhi1,
double  iZ1,
double  oPhi1,
double  oZ1,
double  iPhi2,
double  iZ2,
double  oPhi2,
double  oZ2 
)

Definition at line 1049 of file RoadSearchCloudMakerAlgorithm.cc.

References deltaPhi(), map_phi2(), min, and Geom::pi().

Referenced by FillRecHitsIntoCloudGeneral().

01050                                                                                                                {
01051   
01052   // Have to make sure all are in the same hemisphere
01053   if ((iPhi1 > Geom::pi() || oPhi1 > Geom::pi() || iPhi2 > Geom::pi() || oPhi2 > Geom::pi()) &&
01054       (iPhi1 < Geom::pi() || oPhi1 < Geom::pi() || iPhi2 < Geom::pi() || oPhi2 < Geom::pi())){
01055     iPhi1 = map_phi2(iPhi1);  oPhi1 = map_phi2(oPhi1);
01056     iPhi2 = map_phi2(iPhi2);  oPhi2 = map_phi2(oPhi2);
01057   }
01058 
01059   double deltaPhi = -999.;
01060   // just get the x coord of intersection of two line segments
01061   // check if intersection lies inside segments
01062   double det12 = iZ1*oPhi1 - iPhi1*oZ1;
01063   double det34 = iZ2*oPhi2 - iPhi2*oZ2;
01064 
01065   double xinter = (det12*(iZ2-oZ2) - det34*(iZ1-oZ1))/
01066     ((iZ1-oZ1)*(iPhi2-oPhi2) - 
01067      (iZ2-oZ2)*(iPhi1-oPhi1));
01068 
01069   bool inter = true;
01070   if (iZ1 < oZ1){
01071     if ((xinter<iZ1) || (xinter>oZ1)) inter = false;
01072   }
01073   else{
01074     if ((xinter>iZ1) || (xinter<oZ1)) inter = false;
01075   }
01076 
01077   if (iZ2 < oZ2){
01078     if ((xinter<iZ2) || (xinter>oZ2)) inter = false;
01079   }
01080   else{
01081     if ((xinter>iZ2) || (xinter<oZ2)) inter = false;
01082   }
01083 
01084   if (inter){
01085     deltaPhi = 0;
01086   }
01087   else{
01088     deltaPhi = min(fabs(iPhi2-iPhi1),fabs(oPhi2-oPhi1));
01089   }
01090   return deltaPhi;
01091 
01092 }

RoadSearchCloudCollection RoadSearchCloudMakerAlgorithm::Clean ( RoadSearchCloudCollection rawColl  ) 

Definition at line 1128 of file RoadSearchCloudMakerAlgorithm.cc.

References RoadSearchCloud::addHit(), RoadSearchCloud::begin_hits(), RoadSearchCloud::end_hits(), i, k, LogDebug, maxRecHitsInCloud_, mergingFraction_, output(), and RoadSearchCloud::size().

Referenced by run().

01128                                                                                                         {
01129   
01130   RoadSearchCloudCollection output;
01131   
01132   //
01133   //  no raw clouds - nothing to try merging
01134   //
01135 
01136   if ( inputCollection->empty() ){
01137     LogDebug("RoadSearch") << "Found " << output.size() << " clean clouds.";
01138     return output;  
01139   }
01140   
01141   //
01142   //  1 raw cloud - nothing to try merging, but one cloud to duplicate
01143   //
01144   
01145   if ( 1==inputCollection->size() ){
01146     output = *inputCollection;
01147 //     RoadSearchCloud *temp = inputCollection->begin()->clone();
01148 //     output.push_back(*temp);
01149 //     delete temp;
01150     LogDebug("RoadSearch") << "Found " << output.size() << " clean clouds.";
01151     return output;
01152   }  
01153   
01154   //
01155   //  got > 1 raw cloud - something to try merging
01156   //
01157   std::vector<bool> already_gone(inputCollection->size());
01158   for (unsigned int i=0; i<inputCollection->size(); ++i) {
01159     already_gone[i] = false; 
01160   }
01161   
01162   int raw_cloud_ctr=0;
01163   // loop over clouds
01164   for ( RoadSearchCloudCollection::const_iterator raw_cloud = inputCollection->begin(); raw_cloud != inputCollection->end(); ++raw_cloud) {
01165     ++raw_cloud_ctr;
01166     
01167     if (already_gone[raw_cloud_ctr-1])continue;
01168     
01169     // produce output cloud where other clouds are merged in
01170     // create temp pointer for clone which will be deleted afterwards
01171 //     RoadSearchCloud *temp_lone_cloud = raw_cloud->clone();
01172 //     RoadSearchCloud lone_cloud = *temp_lone_cloud;
01173     RoadSearchCloud lone_cloud = *raw_cloud;
01174 
01175     int second_cloud_ctr=raw_cloud_ctr;
01176     for ( RoadSearchCloudCollection::const_iterator second_cloud = raw_cloud+1; second_cloud != inputCollection->end(); ++second_cloud) {
01177       second_cloud_ctr++;
01178       
01179       std::vector<const TrackingRecHit*> unshared_hits;
01180       
01181       if ( already_gone[second_cloud_ctr-1] )continue;
01182       
01183       for ( RoadSearchCloud::RecHitVector::const_iterator second_cloud_hit = second_cloud->begin_hits();
01184             second_cloud_hit != second_cloud->end_hits();
01185             ++ second_cloud_hit ) {
01186         bool is_shared = false;
01187         for ( RoadSearchCloud::RecHitVector::const_iterator lone_cloud_hit = lone_cloud.begin_hits();
01188               lone_cloud_hit != lone_cloud.end_hits();
01189               ++ lone_cloud_hit ) {
01190           
01191           if ((*lone_cloud_hit)->geographicalId() == (*second_cloud_hit)->geographicalId())
01192             if ((*lone_cloud_hit)->localPosition().x() == (*second_cloud_hit)->localPosition().x())
01193               if ((*lone_cloud_hit)->localPosition().y() == (*second_cloud_hit)->localPosition().y())
01194                 {is_shared=true; break;}
01195         }
01196         if (!is_shared)  unshared_hits.push_back(*second_cloud_hit);
01197           
01198         if ( ((float(unshared_hits.size())/float(lone_cloud.size())) > 
01199               ((float(second_cloud->size())/float(lone_cloud.size()))-mergingFraction_)) &&
01200              ((float(unshared_hits.size())/float(second_cloud->size())) > (1-mergingFraction_))){
01201           // You'll never merge these clouds..... Could quit now!
01202           break;
01203         }
01204           
01205         if (lone_cloud.size()+unshared_hits.size() > maxRecHitsInCloud_) {
01206           break;
01207         }
01208           
01209       }
01210         
01211       double f_lone_shared=double(second_cloud->size()-unshared_hits.size())/double(lone_cloud.size());
01212       double f_second_shared=double(second_cloud->size()-unshared_hits.size())/double(second_cloud->size());
01213       
01214       if ( ( (static_cast<unsigned int>(f_lone_shared*1E9) > static_cast<unsigned int>(mergingFraction_*1E9))||(static_cast<unsigned int>(f_second_shared*1E9) > static_cast<unsigned int>(mergingFraction_*1E9)) ) 
01215            && (lone_cloud.size()+unshared_hits.size() <= maxRecHitsInCloud_) ){
01216         
01217         LogDebug("RoadSearch") << " Merge CloudA: " << raw_cloud_ctr << " with  CloudB: " << second_cloud_ctr 
01218                                << " Shared fractions are " << f_lone_shared << " and " << f_second_shared;
01219           
01220         //
01221         //  got a cloud to merge
01222         //
01223         for (unsigned int k=0; k<unshared_hits.size(); ++k) {
01224           lone_cloud.addHit(unshared_hits[k]);
01225         }
01226           
01227         already_gone[second_cloud_ctr-1]=true;
01228         
01229       }//end got a cloud to merge
01230       
01231     }//interate over all second clouds
01232       
01233     output.push_back(lone_cloud);
01234     
01235   }//iterate over all raw clouds
01236   
01237   LogDebug("RoadSearch") << "Found " << output.size() << " clean clouds.";
01238   
01239   return output;
01240 }

SiStripMatchedRecHit2D * RoadSearchCloudMakerAlgorithm::CorrectMatchedHit ( const TrackingRecHit originalRH,
const GluedGeomDet gluedDet,
const TrackerGeometry tracker,
const SiStripRecHitMatcher theHitMatcher,
double  k0,
double  phi0 
)

Definition at line 1242 of file RoadSearchCloudMakerAlgorithm.cc.

References funct::cos(), GenMuonPlsPt100GeV_cfg::cout, lat::endl(), TrackingRecHit::geographicalId(), TrackerGeometry::idToDet(), BaseSiTrackerRecHit2DLocalPos::localPosition(), map_phi2(), SiStripRecHitMatcher::match(), GluedGeomDet::monoDet(), SiStripMatchedRecHit2D::monoHit(), PV3DBase< T, PVType, FrameType >::perp(), funct::sin(), GeomDet::surface(), Surface::toGlobal(), toLocal(), and PV3DBase< T, PVType, FrameType >::z().

Referenced by FillRecHitsIntoCloudGeneral().

01246                                                                                                  {
01247  
01248           const SiStripMatchedRecHit2D *theRH = dynamic_cast<const SiStripMatchedRecHit2D*>(originalHit);
01249           if (theRH == 0) {
01250             std::cout<<" Could not cast original hit" << std::endl;
01251           }
01252           if (theRH != 0){
01253             const GeomDet *recHitGeomDet = tracker->idToDet(theRH->geographicalId());
01254             const GluedGeomDet *theGluedDet = dynamic_cast<const GluedGeomDet*>(recHitGeomDet);
01255              
01256             const GeomDetUnit* theMonoDet = theGluedDet->monoDet();
01257             const SiStripRecHit2D* theMonoHit   = theRH->monoHit();
01258             GlobalPoint monoRHpos = (theMonoDet->surface()).toGlobal(theMonoHit->localPosition());
01259              
01260             GlobalPoint gcenterofstrip=(theMonoDet->surface()).toGlobal(theMonoHit->localPosition());
01261              
01262             float gtrackangle_xy = map_phi2(phi0 + 2.0*asin(0.5*gcenterofstrip.perp()*k0));
01263             float rzangle = atan2(gcenterofstrip.perp(),gcenterofstrip.z());
01264  
01265             GlobalVector gtrackangle2(cos(gtrackangle_xy)*sin(rzangle),
01266                                       sin(gtrackangle_xy)*sin(rzangle),
01267                                       cos(rzangle));
01268             LocalVector trackdirection2=((tracker->idToDet(theRH->geographicalId()))->surface()).toLocal(gtrackangle2);
01269             GlobalVector gdir = theMonoDet->surface().toGlobal(trackdirection2);
01270  
01271             SiStripMatchedRecHit2D* theCorrectedHit = theHitMatcher->match(theRH,theGluedDet,trackdirection2);
01272             if (theCorrectedHit!=0) return theCorrectedHit;
01273           }
01274  
01275           return 0;
01276 }

unsigned int RoadSearchCloudMakerAlgorithm::FillPixRecHitsIntoCloud ( DetId  id,
const SiPixelRecHitCollection inputRecHits,
double  d0,
double  phi0,
double  k0,
Roads::type  roadType,
double  ringPhi,
const TrackerGeometry tracker,
RoadSearchCloud cloud 
)

Definition at line 805 of file RoadSearchCloudMakerAlgorithm.cc.

References funct::abs(), RoadSearchCloud::addHit(), TrackingRecHit::geographicalId(), edm::RangeMap< ID, C, P >::get(), TrackerGeometry::idToDet(), TrackerGeometry::idToDetUnit(), isBarrelSensor(), BaseSiTrackerRecHit2DLocalPos::localPosition(), map_phi(), PV3DBase< T, PVType, FrameType >::phi(), phi, phiFromExtrapolation(), phiMax(), Roads::RPhi, funct::sqrt(), GeomDet::surface(), Surface::toGlobal(), GeomDet::toGlobal(), PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

00807                                                                                                                             {
00808   
00809   
00810   unsigned int usedRecHits = 0;
00811   
00812   // Get Geometry
00813   //const RectangularPixelTopology *topology = dynamic_cast<const RectangularPixelTopology*>(&(tracker->idToDetUnit(id)->topology()));
00814   
00815   
00816   // retrieve vector<SiPixelRecHit> for id
00817   // loop over SiPixelRecHit
00818   // check if compatible with cloud, fill into cloud
00819   
00820   const SiPixelRecHitCollection::range recHitRange = inputRecHits->get(id);
00821   
00822   for ( SiPixelRecHitCollection::const_iterator recHitIterator = recHitRange.first; 
00823         recHitIterator != recHitRange.second; ++recHitIterator) {
00824     
00825     const SiPixelRecHit * recHit = &(*recHitIterator);
00826     
00827     if ( roadType == Roads::RPhi ) {
00828       
00829       if ( isBarrelSensor(id) ) {
00830         // Barrel Pixel, RoadType RPHI
00831         
00832         GlobalPoint ghit = tracker->idToDet(recHit->geographicalId())->surface().toGlobal(recHit->localPosition());
00833         double hitRadius = sqrt(ghit.x()*ghit.x()+ghit.y()*ghit.y());
00834         double hitphi = map_phi(ghit.phi());
00835         double phi = phiFromExtrapolation(d0,phi0,k0,hitRadius,roadType);
00836         
00837         if ( std::abs(hitphi-phi) < phiMax(roadType,phi0,k0) ) {
00838           cloud.addHit(recHit);
00839           ++usedRecHits;
00840         }
00841       } 
00842       else {
00843         
00844         // Forward Pixel,roadtype RPHI
00845         
00846         // Get Local Hit Position of the Pixel Hit
00847         LocalPoint hit = recHit->localPosition();
00848         
00849         // Get Phi of hit position 
00850         double hitphi = map_phi(tracker->idToDetUnit(id)->surface().toGlobal(hit).phi());
00851         
00852         // Get Global Hit position
00853         GlobalPoint ghit = tracker->idToDet(recHit->geographicalId())->surface().toGlobal(recHit->localPosition());
00854         
00855         // Get Hit Radis
00856         double hitRadius = sqrt(ghit.x()*ghit.x()+ghit.y()*ghit.y());
00857         
00858         // Get Phi from extrapolation
00859         double phi = phiFromExtrapolation(d0,phi0,k0,hitRadius,roadType);
00860         
00861         if ( std::abs(hitphi-phi) < phiMax(roadType,phi0,k0) ) {
00862           cloud.addHit(recHit);
00863           ++usedRecHits;
00864         }       
00865       }
00866     } 
00867     
00868     else {
00869       
00870       GlobalPoint ghit = tracker->idToDet(recHit->geographicalId())->surface().toGlobal(recHit->localPosition());
00871       
00872       double  phi = phiFromExtrapolation(d0,phi0,k0,ghit.z(),roadType);
00873       if ( (phi - phiMax(roadType,phi0,k0)) < ringPhi && (phi + phiMax(roadType,phi0,k0))>ringPhi ) {
00874         cloud.addHit(recHit);
00875         ++usedRecHits;
00876       }
00877     }
00878     
00879   }
00880   
00881   return usedRecHits;
00882 }

unsigned int RoadSearchCloudMakerAlgorithm::FillRecHitsIntoCloud ( DetId  id,
const SiStripRecHit2DCollection inputRecHits,
double  d0,
double  phi0,
double  k0,
Roads::type  roadType,
double  ringPhi,
const TrackerGeometry tracker,
RoadSearchCloud cloud 
)

unsigned int RoadSearchCloudMakerAlgorithm::FillRecHitsIntoCloudGeneral ( DetId  id,
double  d0,
double  phi0,
double  k0,
double  phi1,
double  k1,
Roads::type  roadType,
double  ringPhi,
const TrackerGeometry tracker,
const SiStripRecHitMatcher theHitMatcher,
RoadSearchCloud cloud 
)

Definition at line 497 of file RoadSearchCloudMakerAlgorithm.cc.

References funct::abs(), RoadSearchCloud::addHit(), CheckXYIntersection(), CheckZPhiIntersection(), CorrectMatchedHit(), funct::cos(), deltaPhi(), TrackingRecHit::geographicalId(), DetHitAccess::getHitVector(), TrackerGeometry::idToDet(), TrackerGeometry::idToDetUnit(), isBarrelSensor(), isSingleLayer(), BaseSiTrackerRecHit2DLocalPos::localPosition(), StripTopology::localStripLength(), LogDebug, map_phi(), map_phi2(), maxDetHitsInCloudPerDetId, maxRecHitsInCloud_, PV3DBase< T, PVType, FrameType >::perp(), PV3DBase< T, PVType, FrameType >::phi(), phi, phiFromExtrapolation(), phiMax(), PixelSubdetector::PixelBarrel, PixelSubdetector::PixelEndcap, recHitVectorClass, Roads::RPhi, funct::sin(), RoadSearchCloud::size(), funct::sqrt(), StripTopology::strip(), StripTopology::stripAngle(), GeomDet::surface(), funct::tan(), StripSubdetector::TEC, StripSubdetector::TIB, StripSubdetector::TID, StripSubdetector::TOB, Surface::toGlobal(), GeomDet::toGlobal(), GloballyPositioned< T >::toLocal(), GeomDetUnit::topology(), UsePixels, PV3DBase< T, PVType, FrameType >::x(), x, PV3DBase< T, PVType, FrameType >::y(), y, PV3DBase< T, PVType, FrameType >::z(), z, and ZPhiDeltaPhi().

Referenced by run().

00500                                                                                                 {
00501   
00502   unsigned int usedRecHits = 0;
00503   
00504   bool double_ring_layer = !isSingleLayer(id);
00505   
00506   std::vector<TrackingRecHit*> recHitVector = recHitVectorClass.getHitVector(&id);
00507   
00508   for ( std::vector<TrackingRecHit*>::const_iterator recHitIterator = recHitVector.begin(); recHitIterator != recHitVector.end(); ++recHitIterator) {
00509     
00510     if (      (unsigned int)id.subdetId() == StripSubdetector::TIB 
00511               || (unsigned int)id.subdetId() == StripSubdetector::TOB 
00512               || (unsigned int)id.subdetId() == StripSubdetector::TID 
00513               || (unsigned int)id.subdetId() == StripSubdetector::TEC ) {
00514       
00515       const SiStripRecHit2D *recHit = (SiStripRecHit2D*)(*recHitIterator);
00516       DetId hitId = recHit->geographicalId();
00517 
00518       GlobalPoint ghit = tracker->idToDet(recHit->geographicalId())->surface().toGlobal(recHit->localPosition());
00519       //LogDebug("RoadSearch") << "    Testing hit at (x/y/z): " << ghit.x() << " / " << ghit.y() << " / " << ghit.z();
00520       LogDebug("RoadSearch") << "    Testing hit at (x/y/z): " 
00521                              << tracker->idToDet(recHit->geographicalId())->surface().toGlobal(recHit->localPosition()).x() << " / " 
00522                              << tracker->idToDet(recHit->geographicalId())->surface().toGlobal(recHit->localPosition()).y() << " / " 
00523                              << tracker->idToDet(recHit->geographicalId())->surface().toGlobal(recHit->localPosition()).z();
00524 
00525       if ( roadType == Roads::RPhi ) {
00526         if (double_ring_layer && isSingleLayer(hitId)) {
00527           //
00528           //  This is where the barrel stereoRecHits end up for Roads::RPhi
00529           //
00530           
00531           // Adjust matched hit for track angle
00532 
00533           const GluedGeomDet *theGluedDet = dynamic_cast<const GluedGeomDet*>(tracker->idToDet(hitId));
00534 
00535           SiStripMatchedRecHit2D* theCorrectedHit = CorrectMatchedHit(*recHitIterator,theGluedDet,
00536                                                                         tracker, theHitMatcher,
00537                                                                         k0, phi0);
00538           if (theCorrectedHit != 0){
00539 
00540             GlobalPoint ghit = tracker->idToDet(theCorrectedHit->geographicalId())->surface().toGlobal(theCorrectedHit->localPosition());
00541             double hitRadius = sqrt(ghit.x()*ghit.x()+ghit.y()*ghit.y());
00542             double hitphi = map_phi(ghit.phi());
00543             double phi = phiFromExtrapolation(d0,phi0,k0,hitRadius,roadType);
00544             
00545             float dp = (hitphi-phi);
00546             float dx = hitRadius*tan(dp);
00547             
00548             LogDebug("RoadSearch") << "   Hit phi = " << hitphi << " expected phi = " << phi
00549                                        <<"  dx = " << dx << " for dxMax = " << phiMax(roadType,phi0,k0);
00550 
00551             // switch cut to dx instead of dphi
00552             if ( std::abs(dx) < phiMax(roadType,phi0,k0) ) {
00553               if ((usedRecHits < maxDetHitsInCloudPerDetId) && (cloud.size() < maxRecHitsInCloud_)) {
00554                 cloud.addHit(recHit);
00555                 ++usedRecHits;
00556               }
00557             }
00558             delete theCorrectedHit;
00559           }
00560         } else { // Single layer hits here
00561           if ( isBarrelSensor(hitId) ) {
00562             //
00563             //  This is where the barrel rphiRecHits end up for Roads::RPhi
00564             //
00565             GlobalPoint ghit = tracker->idToDet(recHit->geographicalId())->surface().toGlobal(recHit->localPosition());
00566             double hitRadius = sqrt(ghit.x()*ghit.x()+ghit.y()*ghit.y());
00567             double hitphi = map_phi(ghit.phi());
00568             double phi = phiFromExtrapolation(d0,phi0,k0,hitRadius,roadType);
00569               
00570             float dp = (hitphi-phi);
00571             float dx = hitRadius*tan(dp);
00572             LogDebug("RoadSearch") << "   Hit phi = " << hitphi << " expected phi = " << phi
00573                                        <<"  dx = " << dx << " for dxMax = " << phiMax(roadType,phi0,k0);
00574             // switch cut to dx instead of dphi
00575             if ( std::abs(dx) < phiMax(roadType,phi0,k0) ) {
00576               if ((usedRecHits < maxDetHitsInCloudPerDetId) && (cloud.size() < maxRecHitsInCloud_)) {
00577                 cloud.addHit(recHit);
00578                 ++usedRecHits;
00579               }
00580             }
00581           } 
00582           else {
00583 
00584             LocalPoint hit = recHit->localPosition();
00585             const StripTopology *topology = dynamic_cast<const StripTopology*>(&(tracker->idToDetUnit(hitId)->topology()));
00586             double stripAngle = topology->stripAngle(topology->strip(hit));
00587             double stripLength = topology->localStripLength(hit);
00588 
00589             LocalPoint innerHitLocal(hit.x()+stripLength/2*std::sin(stripAngle),hit.y()-stripLength/2*std::cos(stripAngle),0);
00590             LocalPoint outerHitLocal(hit.x()-stripLength/2*std::sin(stripAngle),hit.y()+stripLength/2*std::cos(stripAngle),0);
00591 
00592             double innerRadius = tracker->idToDetUnit(hitId)->surface().toGlobal(innerHitLocal).perp(); 
00593             double outerRadius = tracker->idToDetUnit(hitId)->surface().toGlobal(outerHitLocal).perp();
00594             double innerExtrapolatedPhi = phiFromExtrapolation(d0,phi0,k0,innerRadius,roadType);
00595             double outerExtrapolatedPhi = phiFromExtrapolation(d0,phi0,k0,outerRadius,roadType);
00596 
00597             GlobalPoint innerHitGlobal =tracker->idToDetUnit(hitId)->surface().toGlobal(innerHitLocal); 
00598             GlobalPoint outerHitGlobal =tracker->idToDetUnit(hitId)->surface().toGlobal(outerHitLocal); 
00599 
00600             GlobalPoint innerRoadGlobal(GlobalPoint::Cylindrical(innerRadius,innerExtrapolatedPhi,
00601                                                                  tracker->idToDetUnit(hitId)->surface().toGlobal(hit).z()));
00602             GlobalPoint outerRoadGlobal(GlobalPoint::Cylindrical(outerRadius,outerExtrapolatedPhi,
00603                                                                  tracker->idToDetUnit(hitId)->surface().toGlobal(hit).z()));
00604 
00605             LocalPoint innerRoadLocal = tracker->idToDetUnit(hitId)->surface().toLocal(innerRoadGlobal);
00606             LocalPoint outerRoadLocal = tracker->idToDetUnit(hitId)->surface().toLocal(outerRoadGlobal);
00607 
00608             double dxinter = CheckXYIntersection(innerHitLocal, outerHitLocal, 
00609                                                innerRoadLocal, outerRoadLocal);
00610 
00611             LogDebug("RoadSearch") << " Hit phi inner = " << innerHitGlobal.phi() << " and outer = " << outerHitGlobal.phi()
00612                                    << " expected inner phi = " << innerExtrapolatedPhi
00613                                    << " and outer phi = "      << outerExtrapolatedPhi
00614                                    <<"  dx = " << dxinter << " for dxMax = " << phiMax(roadType,phi0,k0);
00615 
00616             if ( fabs(dxinter) < phiMax(roadType,phi0,k0)) {
00617               //
00618               //  This is where the disk rphiRecHits end up for Roads::ZPhi
00619               //
00620               if ((usedRecHits < maxDetHitsInCloudPerDetId) && (cloud.size() < maxRecHitsInCloud_)) {
00621                 cloud.addHit(recHit);
00622                 ++usedRecHits;
00623               }
00624             }
00625             //else
00626               //std::cout<< " ===>>> HIT FAILS !!! " << std::endl;
00627           }
00628         } 
00629       } else {
00630         //
00631         // roadType == Roads::ZPhi
00632         //
00633         if (double_ring_layer && isSingleLayer(hitId)) {
00634 
00635           // Adjust matched hit for track angle
00636 
00637           //const SiStripMatchedRecHit2D *theRH = dynamic_cast<SiStripMatchedRecHit2D*>(*recHitIterator);
00638           const GluedGeomDet *theGluedDet = dynamic_cast<const GluedGeomDet*>(tracker->idToDet(hitId));
00639 
00640           SiStripMatchedRecHit2D* theCorrectedHit = CorrectMatchedHit(*recHitIterator,theGluedDet,
00641                                                                         tracker, theHitMatcher,
00642                                                                         k1, phi1);
00643           if (theCorrectedHit != 0){
00644 
00645             GlobalPoint ghit = tracker->idToDet(theCorrectedHit->geographicalId())->surface().toGlobal(theCorrectedHit->localPosition());
00646             double hitphi = map_phi(ghit.phi());
00647             double hitZ = ghit.z();
00648             double phi = phiFromExtrapolation(d0,phi0,k0,hitZ,roadType);
00649             
00650             float dp = hitphi-phi;
00651             float dx = hitZ*tan(dp);
00652               
00653             //
00654             //  This is where the disk stereoRecHits end up for Roads::ZPhi
00655             //
00656             if ( std::abs(dx) < phiMax(roadType,phi0,k1)) {
00657               if ((usedRecHits < maxDetHitsInCloudPerDetId) && (cloud.size() < maxRecHitsInCloud_)) {
00658                 cloud.addHit(recHit);
00659                 ++usedRecHits;
00660               }
00661             }
00662             delete theCorrectedHit;
00663           }
00664         } else { // Single layer hits here
00665           if ( isBarrelSensor(hitId) ) {
00666             //
00667             //  This is where the barrel (???) rphiRecHits end up for Roads::ZPhi
00668             //
00669             LocalPoint hit = recHit->localPosition();
00670             const StripTopology *topology = dynamic_cast<const StripTopology*>(&(tracker->idToDetUnit(hitId)->topology()));
00671             double stripAngle = topology->stripAngle(topology->strip(hit));
00672             double stripLength = topology->localStripLength(hit);
00673 
00674             //if (stripAngle!=0) std::cout<<"HEY, WE FOUND A HIT ON A STEREO MODULE!!!" << std::endl;
00675             // new method
00676             LocalPoint innerHitLocal(hit.x()+stripLength/2*std::sin(stripAngle),hit.y()-stripLength/2*std::cos(stripAngle),0);
00677             LocalPoint outerHitLocal(hit.x()-stripLength/2*std::sin(stripAngle),hit.y()+stripLength/2*std::cos(stripAngle),0);
00678             double innerHitPhi = map_phi(tracker->idToDetUnit(hitId)->surface().toGlobal(innerHitLocal).phi()); 
00679             double outerHitPhi = map_phi(tracker->idToDetUnit(hitId)->surface().toGlobal(outerHitLocal).phi());
00680             double innerHitZ = tracker->idToDetUnit(hitId)->surface().toGlobal(innerHitLocal).z(); 
00681             double outerHitZ = tracker->idToDetUnit(hitId)->surface().toGlobal(outerHitLocal).z();
00682             double innerExtrapolatedPhi = phiFromExtrapolation(d0,phi0,k0,innerHitZ,roadType);
00683             double outerExtrapolatedPhi = phiFromExtrapolation(d0,phi0,k0,outerHitZ,roadType);
00684 
00685             double midPointZ = 0.5*(innerHitZ+outerHitZ);
00686 
00687             double dPhiInter = CheckZPhiIntersection(innerHitPhi, innerHitZ, outerHitPhi, outerHitZ, 
00688                                                    innerExtrapolatedPhi, innerHitZ,
00689                                                    outerExtrapolatedPhi, outerHitZ);
00690 
00691             double dX = midPointZ*tan(dPhiInter);
00692 
00693             if (std::abs(dX) < 1.5*phiMax(roadType,phi0,k1)) {
00694               if ((usedRecHits < maxDetHitsInCloudPerDetId) && (cloud.size() < maxRecHitsInCloud_)) {
00695                 cloud.addHit(recHit);
00696                 ++usedRecHits;
00697               }
00698             }
00699 
00700           } else {
00701 
00702             //
00703             //  This is where the disk rphiRecHits end up for Roads::ZPhi
00704             //
00705             LocalPoint hit = recHit->localPosition();
00706             const StripTopology *topology = dynamic_cast<const StripTopology*>(&(tracker->idToDetUnit(hitId)->topology()));
00707             double stripAngle = topology->stripAngle(topology->strip(hit));
00708             double stripLength = topology->localStripLength(hit);
00709             // new method
00710             double hitZ = tracker->idToDetUnit(hitId)->surface().toGlobal(hit).z(); 
00711             double extrapolatedPhi = phiFromExtrapolation(d0,phi0,k0,hitZ,roadType);
00712 
00713             LocalPoint innerHitLocal(hit.x()+stripLength/2*std::sin(stripAngle),hit.y()-stripLength/2*std::cos(stripAngle),0);
00714             LocalPoint outerHitLocal(hit.x()-stripLength/2*std::sin(stripAngle),hit.y()+stripLength/2*std::cos(stripAngle),0);
00715 
00716             double innerHitPhi = map_phi(tracker->idToDetUnit(hitId)->surface().toGlobal(innerHitLocal).phi()); 
00717             double outerHitPhi = map_phi(tracker->idToDetUnit(hitId)->surface().toGlobal(outerHitLocal).phi());
00718             //double innerZ = tracker->idToDetUnit(hitId)->surface().toGlobal(innerHitLocal).z(); 
00719             //double outerZ = tracker->idToDetUnit(hitId)->surface().toGlobal(outerHitLocal).z();
00720             //if (innerZ != outerZ)  std::cout<<"HEY!!! innerZ = " << innerZ << " != outerZ = " << outerZ << std::endl;
00721 
00722             double deltaPhi = ZPhiDeltaPhi(innerHitPhi,outerHitPhi,extrapolatedPhi);
00723             double deltaX   =  hitZ*tan(deltaPhi);
00724             if (std::abs(deltaX) < phiMax(roadType,phi0,k1)){
00725               if ((usedRecHits < maxDetHitsInCloudPerDetId) && (cloud.size() < maxRecHitsInCloud_)) {
00726                 cloud.addHit(recHit);
00727                 ++usedRecHits;
00728               }
00729             }
00730           }
00731         } 
00732       }
00733     } else if ( (unsigned int)id.subdetId() == PixelSubdetector::PixelBarrel 
00734                 || (unsigned int)id.subdetId() == PixelSubdetector::PixelEndcap) {
00735       if ( UsePixels ) {
00736         
00737         const SiPixelRecHit *recHit = (SiPixelRecHit*)(*recHitIterator);
00738         
00739         if ( roadType == Roads::RPhi ) {
00740           
00741           if ( isBarrelSensor(id) ) {
00742             // Barrel Pixel, RoadType RPHI
00743             
00744             GlobalPoint ghit = tracker->idToDet(recHit->geographicalId())->surface().toGlobal(recHit->localPosition());
00745             double hitRadius = sqrt(ghit.x()*ghit.x()+ghit.y()*ghit.y());
00746             double hitphi = map_phi(ghit.phi());
00747             double phi = phiFromExtrapolation(d0,phi0,k0,hitRadius,roadType);
00748             
00749             float dp = hitphi-phi;
00750             float dx = hitRadius*tan(dp);
00751             
00752             // switch cut to dx instead of dphi
00753             if ( std::abs(dx) < phiMax(roadType,phi0,k0) ) {
00754               cloud.addHit(recHit);
00755               ++usedRecHits;
00756             }
00757           } else {
00758               
00759             // Forward Pixel,roadtype RPHI
00760               
00761             // Get Local Hit Position of the Pixel Hit
00762             LocalPoint hit = recHit->localPosition();
00763               
00764             // Get Phi of hit position 
00765             double hitphi = map_phi(tracker->idToDetUnit(id)->surface().toGlobal(hit).phi());
00766               
00767             // Get Global Hit position
00768             GlobalPoint ghit = tracker->idToDet(recHit->geographicalId())->surface().toGlobal(recHit->localPosition());
00769               
00770             // Get Hit Radis
00771             double hitRadius = sqrt(ghit.x()*ghit.x()+ghit.y()*ghit.y());
00772               
00773             // Get Phi from extrapolation
00774             double phi = phiFromExtrapolation(d0,phi0,k0,hitRadius,roadType);
00775               
00776             if ( std::abs(hitphi-phi) < phiMax(roadType,phi0,k0) ) {
00777               cloud.addHit(recHit);
00778               ++usedRecHits;
00779             }   
00780           }
00781         } else {
00782             
00783           GlobalPoint ghit = tracker->idToDet(recHit->geographicalId())->surface().toGlobal(recHit->localPosition());            
00784           double  phi = phiFromExtrapolation(d0,phi0,k0,ghit.z(),roadType);            
00785           double hitphi = map_phi(ghit.phi());
00786           double dphi = map_phi2(hitphi-phi);
00787           float dx = ghit.z()*tan(dphi);
00788             
00789           if ( std::abs(dx) < 0.25 ) {
00790             cloud.addHit(recHit);
00791             ++usedRecHits;
00792           }
00793         }
00794       }
00795     } else {
00796       edm::LogError("RoadSearch") << "recHitVector from general hit access function contains unknown detector id: " << (unsigned int)id.subdetId() << " rawId: " << id.rawId();
00797     }
00798     
00799   } //for loop over all recHits
00800   
00801   
00802   return usedRecHits;
00803 }

bool RoadSearchCloudMakerAlgorithm::isBarrelSensor ( DetId  id  ) 

Definition at line 913 of file RoadSearchCloudMakerAlgorithm.cc.

References PixelSubdetector::PixelBarrel, StripSubdetector::TIB, and StripSubdetector::TOB.

Referenced by FillPixRecHitsIntoCloud(), and FillRecHitsIntoCloudGeneral().

00913                                                            {
00914   
00915   if ( (unsigned int)id.subdetId() == StripSubdetector::TIB ) {
00916     return true;
00917   } else if ( (unsigned int)id.subdetId() == StripSubdetector::TOB ) {
00918     return true;
00919   } else if ( (unsigned int)id.subdetId() == PixelSubdetector::PixelBarrel ) {
00920     return true;
00921   } else {
00922     return false;
00923   }
00924   
00925 }

bool RoadSearchCloudMakerAlgorithm::isSingleLayer ( DetId  id  ) 

Definition at line 884 of file RoadSearchCloudMakerAlgorithm.cc.

References SiStripDetId::glued(), StripSubdetector::TEC, StripSubdetector::TIB, StripSubdetector::TID, and StripSubdetector::TOB.

Referenced by FillRecHitsIntoCloudGeneral().

00884                                                           {
00885   
00886   if ( (unsigned int)id.subdetId() == StripSubdetector::TIB ) {
00887     TIBDetId tibid(id.rawId()); 
00888     if ( !tibid.glued() ) {
00889       return true;
00890     }
00891   } else if ( (unsigned int)id.subdetId() == StripSubdetector::TOB ) {
00892     TOBDetId tobid(id.rawId()); 
00893     if ( !tobid.glued() ) {
00894       return true;
00895     }
00896   } else if ( (unsigned int)id.subdetId() == StripSubdetector::TID ) {
00897     TIDDetId tidid(id.rawId()); 
00898     if ( !tidid.glued() ) {
00899       return true;
00900     }
00901   } else if ( (unsigned int)id.subdetId() == StripSubdetector::TEC ) {
00902     TECDetId tecid(id.rawId()); 
00903     if ( !tecid.glued() ) {
00904       return true;
00905     }
00906   } else {
00907     return false;
00908   }
00909   
00910   return false;
00911 }

void RoadSearchCloudMakerAlgorithm::makecircle ( double  x1_cs,
double  y1_cs,
double  x2_cs,
double  y2_cs,
double  x3_cs,
double  y3_cs 
)

Definition at line 984 of file RoadSearchCloudMakerAlgorithm.cc.

References d0h, epsilon, f1, f2, Geom::halfPi(), omegah, phi0h, rho, s3, and funct::sqrt().

Referenced by run().

00985                                                                                          {
00986   double x1t=x1-x3; double y1t=y1-y3; double r1s=x1t*x1t+y1t*y1t;
00987   double x2t=x2-x3; double y2t=y2-y3; double r2s=x2t*x2t+y2t*y2t;
00988   double rho=x1t*y2t-x2t*y1t;
00989   double xc, yc, rc, fac;
00990   if (fabs(rho)<RoadSearchCloudMakerAlgorithm::epsilon){
00991     rc=1.0/(RoadSearchCloudMakerAlgorithm::epsilon);
00992     fac=sqrt(x1t*x1t+y1t*y1t);
00993     xc=x2+y1t*rc/fac;
00994     yc=y2-x1t*rc/fac;
00995   }else{
00996     fac=0.5/rho;
00997     xc=fac*(r1s*y2t-r2s*y1t);
00998     yc=fac*(r2s*x1t-r1s*x2t); 
00999     rc=sqrt(xc*xc+yc*yc); xc+=x3; yc+=y3;
01000   }
01001   double s3=0.0;
01002   double f1=x1*yc-y1*xc; double f2=x2*yc-y2*xc; 
01003   double f3=x3*yc-y3*xc;
01004   if ((f1<0.0)&&(f2<0.0)&&(f3<=0.0))s3=1.0;
01005   if ((f1>0.0)&&(f2>0.0)&&(f3>=0.0))s3=-1.0;
01006   d0h=-s3*(sqrt(xc*xc+yc*yc)-rc);
01007   phi0h=atan2(yc,xc)+s3*Geom::halfPi();
01008   omegah=-s3/rc;
01009 }

double RoadSearchCloudMakerAlgorithm::map_phi ( double  phi  ) 

Definition at line 135 of file RoadSearchCloudMakerAlgorithm.cc.

References HLT_VtxMuL3::result, and Geom::twoPi().

Referenced by FillPixRecHitsIntoCloud(), FillRecHitsIntoCloudGeneral(), phiFromExtrapolation(), and run().

00135                                                         {
00136   // map phi to [0,2pi]
00137   double result = phi;
00138   if ( result < -1.0*Geom::twoPi()) result = result + Geom::twoPi();
00139   if ( result < 0)                 result = Geom::twoPi() + result;
00140   if ( result > Geom::twoPi())     result = result - Geom::twoPi();
00141   return result;
00142 }

double RoadSearchCloudMakerAlgorithm::map_phi2 ( double  phi  ) 

Definition at line 144 of file RoadSearchCloudMakerAlgorithm.cc.

References Geom::pi(), HLT_VtxMuL3::result, and Geom::twoPi().

Referenced by CheckZPhiIntersection(), CorrectMatchedHit(), FillRecHitsIntoCloudGeneral(), run(), and ZPhiDeltaPhi().

00144                                                          {
00145   // map phi to [-pi,pi]
00146   double result = phi;
00147   if ( result < 1.0*Geom::pi() ) result = result + Geom::twoPi();
00148   if ( result >= Geom::pi())  result = result - Geom::twoPi();
00149   return result;
00150 }

double RoadSearchCloudMakerAlgorithm::phiFromExtrapolation ( double  d0,
double  phi0,
double  k0,
double  ringRadius,
Roads::type  roadType 
)

Definition at line 927 of file RoadSearchCloudMakerAlgorithm.cc.

References funct::cos(), edm::es::l(), map_phi(), Roads::RPhi, funct::sin(), and funct::sqrt().

Referenced by FillPixRecHitsIntoCloud(), FillRecHitsIntoCloudGeneral(), and run().

00927                                                                                                                                    {
00928   
00929   double ringPhi = -99.;
00930   if ( roadType == Roads::RPhi ) {
00931     double omega=k0, rl=ringRadius;
00932     double sp0=sin(phi0); double cp0=cos(phi0);  
00933     if (fabs(omega)>0.000005){
00934       double xc=-sp0*(d0+1.0/omega);    
00935       double yc=cp0*(d0+1.0/omega);
00936       double rh=fabs(1.0/omega);
00937       double bbb=fabs(d0+1.0/omega);
00938       double sss=0.5*(rl+rh+bbb);
00939       double ddd=sqrt((sss-bbb)*(sss-rh)/(sss*(sss-rl)));
00940       double phil1=2.0*atan(ddd);
00941       double phit=phi0+phil1; if (omega<0.0)phit=phi0-phil1;
00942       double xh=xc+sin(phit)/omega;
00943       double yh=yc-cos(phit)/omega;
00944       double phih=atan2(yh,xh);
00945       ringPhi = map_phi(phih);
00946     }
00947     else {
00948       double cee = rl*rl - d0*d0 -0.25*omega*omega - omega*d0;
00949       if (cee<0.0){return ringPhi;}
00950       double l = sqrt(cee);
00951       double xh=-sp0*d0+l*cp0-0.5*l*l*omega*sp0;
00952       double yh= cp0*d0+l*sp0+0.5*l*l*omega*cp0;
00953       double phih=atan2(yh,xh);
00954       ringPhi = map_phi(phih);     
00955     }
00956   } 
00957   else {
00958     ringPhi = map_phi(phi0 + k0 * ringRadius);
00959   }
00960   
00961   return ringPhi;
00962 }

double RoadSearchCloudMakerAlgorithm::phiMax ( Roads::type  roadType,
double  phi0,
double  k0 
)

Definition at line 964 of file RoadSearchCloudMakerAlgorithm.cc.

References Roads::RPhi, theRPhiRoadSize, theZPhiRoadSize, and Roads::ZPhi.

Referenced by FillPixRecHitsIntoCloud(), and FillRecHitsIntoCloudGeneral().

00965                                                                      {
00966   
00967   double dphi;
00968   if ( roadType == Roads::RPhi ) {
00969     // switch cut to dx instead of dphi
00970     // Still call this dphi, but will now be dx
00971     dphi = theRPhiRoadSize + 0.15*82.0*fabs(k0);
00972   }
00973   else if ( roadType == Roads::ZPhi ) {
00974     dphi = theZPhiRoadSize + 0.4*82.0*fabs(k0);
00975   }
00976   else {
00977     edm::LogWarning("RoadSearch") << "Bad roadType: "<< roadType;
00978     dphi = theZPhiRoadSize;
00979   }
00980   return dphi;
00981   
00982 }

void RoadSearchCloudMakerAlgorithm::run ( edm::Handle< RoadSearchSeedCollection input,
const SiStripRecHit2DCollection rphiRecHits,
const SiStripRecHit2DCollection stereoRecHits,
const SiStripMatchedRecHit2DCollection matchedRecHits,
const SiPixelRecHitCollection pixRecHits,
const edm::EventSetup es,
RoadSearchCloudCollection output 
)

Runs the algorithm.

Definition at line 152 of file RoadSearchCloudMakerAlgorithm.cc.

References funct::abs(), begin, Clean(), funct::cos(), debug_cff::d0, d1, doCleaning_, empty, PV3DBase< T, PVType, FrameType >::eta(), FillRecHitsIntoCloudGeneral(), TrackingRecHit::geographicalId(), edm::EventSetup::get(), edm::RangeMap< ID, C, P >::ids(), increaseMaxNumberOfConsecutiveMissedLayersPerCloud, increaseMaxNumberOfMissedLayersPerCloud, int, reco::ParticleMasses::k0, TrackingRecHit::localPosition(), LogDebug, makecircle(), map_phi(), map_phi2(), maxFractionOfConsecutiveMissedLayersPerCloud, maxFractionOfMissedLayersPerCloud, minFractionOfUsedLayersPerCloud, netabin, NoFieldCosmic, omegah, PV3DBase< T, PVType, FrameType >::perp(), PV3DBase< T, PVType, FrameType >::phi(), phi0h, phiFromExtrapolation(), Geom::pi(), edm::ESHandle< T >::product(), edm::Handle< T >::product(), recHitVectorClass, RoadMapMakerESProducer_cfi::roads, roadsLabel_, Roads::RPhi, DetHitAccess::setCollections(), DetHitAccess::setMode(), funct::sin(), RoadSearchCloud::size(), funct::sqrt(), DetHitAccess::standard, pyDBSRunClass::temp, theMinimumHalfRoad, PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

Referenced by RoadSearchCloudMaker::produce().

00159 {  
00160   // intermediate arrays for storing clouds for cleaning
00161   const int nphibin = 24;
00162   const int netabin = 24;
00163   RoadSearchCloudCollection CloudArray[nphibin][netabin];
00164   
00165   // get roads
00166   edm::ESHandle<Roads> roads;
00167   es.get<RoadMapRecord>().get(roadsLabel_, roads);
00168   
00169   // get RoadSearchSeed collection
00170   const RoadSearchSeedCollection* inputSeeds = input.product();
00171   
00172   // load the DetIds of the hits
00173   const std::vector<DetId> availableIDs = rphiRecHits->ids();
00174   const std::vector<DetId> availableIDs2 = stereoRecHits->ids();
00175   const std::vector<DetId> availableIDs3 = pixRecHits->ids();
00176   
00177   // set collections for general hit access method
00178   recHitVectorClass.setCollections(rphiRecHits,stereoRecHits,matchedRecHits,pixRecHits);
00179   recHitVectorClass.setMode(DetHitAccess::standard);
00180   
00181   // get tracker geometry
00182   edm::ESHandle<TrackerGeometry> tracker;
00183   es.get<TrackerDigiGeometryRecord>().get(tracker);
00184   
00185   // get hit matcher
00186   SiStripRecHitMatcher* theHitMatcher = new SiStripRecHitMatcher(3.0);
00187 
00188   edm::LogInfo("RoadSearch") << "Found " << inputSeeds->size() << " input seeds.";   
00189   // loop over seeds
00190   for ( RoadSearchSeedCollection::const_iterator seed = inputSeeds->begin(); seed != inputSeeds->end(); ++seed) {
00191     
00192     const Roads::RoadSeed *roadSeed = seed->getSeed();
00193       
00194     if ( roadSeed == 0 ) {
00195       edm::LogWarning("RoadSearch") << "RoadSeed could not be resolved from RoadSearchSeed hits, discard seed!";
00196     } else {
00197         
00198       Roads::type roadType = roads->getRoadType(roadSeed);
00199       if (NoFieldCosmic) roadType = Roads::RPhi;
00200         
00201       // fixme: from here on, calculate with 1st and 3rd seed hit (inner and outer of initial circle)
00202       // fixme: adapt to new seed structure
00203         
00204       // get global positions of the hits, calculate before Road lookup to be used
00205       const TrackingRecHit* innerSeedRingHit = (*(seed->begin()));
00206       const TrackingRecHit* outerSeedRingHit = (*(seed->end() - 1));
00207         
00208       GlobalPoint innerSeedHitGlobalPosition = tracker->idToDet(innerSeedRingHit->geographicalId())->surface().toGlobal(innerSeedRingHit->localPosition());
00209       GlobalPoint outerSeedHitGlobalPosition = tracker->idToDet(outerSeedRingHit->geographicalId())->surface().toGlobal(outerSeedRingHit->localPosition());
00210  
00211       LogDebug("RoadSearch") << "Seed # " <<seed-inputSeeds->begin() << " inner hit (x/y/z): "
00212                              << innerSeedHitGlobalPosition.x() << " / "
00213                              << innerSeedHitGlobalPosition.y() << " / "
00214                              << innerSeedHitGlobalPosition.z();
00215       LogDebug("RoadSearch") << "Seed # " <<seed-inputSeeds->begin() << " outer hit (x/y/z): "
00216                              << outerSeedHitGlobalPosition.x() << " / "
00217                              << outerSeedHitGlobalPosition.y() << " / "
00218                              << outerSeedHitGlobalPosition.z();
00219       
00220       LogDebug("RoadSearch") << "Seed # " <<seed-inputSeeds->begin() << " inner hit (r/phi): "
00221                              << innerSeedHitGlobalPosition.perp() << " / "
00222                              << innerSeedHitGlobalPosition.phi();
00223       LogDebug("RoadSearch") << "Seed # " <<seed-inputSeeds->begin() << " outer hit (r/phi): "
00224                              << outerSeedHitGlobalPosition.perp() << " / "
00225                              << outerSeedHitGlobalPosition.phi();
00226 
00227 
00228       // extrapolation parameters, phio: [0,2pi]
00229       double d0 = 0.0;
00230       double phi0 = -99.;
00231       double k0   = -99999999.99;
00232       
00233       double phi1 = -99.;
00234       double k1   = -99999999.99;
00235       // get bins of eta and phi of outer seed hit;
00236       
00237       double outer_phi = map_phi(outerSeedHitGlobalPosition.phi());
00238       double outer_eta = outerSeedHitGlobalPosition.eta();
00239       
00240       int phibin = (int)(nphibin*(outer_phi/(2*Geom::pi())));
00241       int etabin = (int)(netabin*(outer_eta+3.0)/6.0);
00242         
00243       // calculate phi0 and k0 dependent on RoadType
00244       if ( roadType == Roads::RPhi ) {
00245         double dr = outerSeedHitGlobalPosition.perp() - innerSeedHitGlobalPosition.perp();
00246         const double dr_min = 1; // cm
00247         if ( dr < dr_min ) {
00248           edm::LogWarning("RoadSearch") << "RPhi road: seed Hits distance smaller than 1 cm, do not consider this seed.";
00249         } else {
00250           // calculate r-phi extrapolation: phi = phi0 + asin(k0 r)
00251           double det = innerSeedHitGlobalPosition.x() * outerSeedHitGlobalPosition.y() - innerSeedHitGlobalPosition.y() * outerSeedHitGlobalPosition.x();
00252           if ( det == 0 ) {
00253             edm::LogWarning("RoadSearch") << "RPhi road: 'det' == 0, do not consider this seed.";
00254           } else {
00255             double x0=0.0; double y0=0.0;
00256             double innerx=innerSeedHitGlobalPosition.x();
00257             double innery=innerSeedHitGlobalPosition.y();
00258             double outerx=outerSeedHitGlobalPosition.x();
00259             double outery=outerSeedHitGlobalPosition.y();
00260 
00261             if (NoFieldCosmic){
00262               phi0=atan2(outery-innery,outerx-innerx);
00263               double alpha=atan2(innery,innerx);
00264               double d1=sqrt(innerx*innerx+innery*innery);
00265               d0=d1*sin(alpha-phi0); x0=-d0*sin(phi0); y0=d0*cos(phi0); k0=0.0;
00266             }else{
00267               makecircle(innerx,innery,outerx,outery,x0,y0);
00268               phi0 = phi0h;
00269               k0 = omegah;
00270             }              
00271             LogDebug("RoadSearch") << "Seed # " <<seed-inputSeeds->begin() << " trajectory parameters: d0 = "<< d0 << " phi0 = " << phi0;
00272           }
00273         }
00274       } else {
00275         double dz = outerSeedHitGlobalPosition.z() - innerSeedHitGlobalPosition.z();
00276         const double dz_min = 1.e-6; // cm;
00277         if ( std::abs(dz) < dz_min ) {
00278           edm::LogWarning("RoadSearch") << "ZPhi road: seed Hits are less than .01 microns away in z, do not consider this seed.";
00279         } else {
00280           // calculate z-phi extrapolation: phi = phi0 + k0 z
00281           k0 = map_phi2(outerSeedHitGlobalPosition.phi() - innerSeedHitGlobalPosition.phi()) / dz;
00282           phi0 =  map_phi(innerSeedHitGlobalPosition.phi() - k0 * innerSeedHitGlobalPosition.z());
00283           
00284           // get approx pt for use in correcting matched hits
00285           makecircle(innerSeedHitGlobalPosition.x(),innerSeedHitGlobalPosition.y(),
00286                      outerSeedHitGlobalPosition.x(),outerSeedHitGlobalPosition.y(),
00287                      0.0,0.0); // x0,y0 = 0.0 for now
00288           phi1 = phi0h;
00289           k1 = omegah;
00290         }
00291       }
00292         
00293       // continue if valid extrapolation parameters have been found
00294       if ( (phi0 != -99.) && (k0 != -99999999.99) ) {
00295         const Roads::RoadSet *roadSet = seed->getSet();
00296 
00297         // create cloud
00298         RoadSearchCloud cloud;
00299           
00300         bool firstHitFound = false;
00301         unsigned int layerCounter = 0;
00302         unsigned int usedLayers = 0;
00303         unsigned int missedLayers = 0;
00304         unsigned int consecutiveMissedLayers = 0;
00305 
00306         unsigned int totalLayers = roadSet->size();
00307 
00308         // caluclate minNumberOfUsedLayersPerCloud, maxNumberOfMissedLayersPerCloud and maxNumberOfConsecutiveMissedLayersPerCloud 
00309         // by rounding to integer minFractionOfUsedLayersPerCloud. maxFractionOfMissedLayersPerCloud and maxFractionOfConsecutiveMissedLayersPerCloud
00310         unsigned int minNumberOfUsedLayersPerCloud = static_cast<unsigned int>(totalLayers * minFractionOfUsedLayersPerCloud + 0.5);
00311         if (minNumberOfUsedLayersPerCloud < 3) minNumberOfUsedLayersPerCloud = 3;
00312         unsigned int maxNumberOfMissedLayersPerCloud = static_cast<unsigned int>(totalLayers * maxFractionOfMissedLayersPerCloud + 0.5);
00313         unsigned int maxNumberOfConsecutiveMissedLayersPerCloud = static_cast<unsigned int>(totalLayers * maxFractionOfConsecutiveMissedLayersPerCloud + 0.5);
00314 
00315         // increase consecutive layer cuts between 0.9 and 1.5
00316         if (std::abs(outer_eta) > 0.9 && std::abs(outer_eta) < 1.5) {
00317           maxNumberOfConsecutiveMissedLayersPerCloud += increaseMaxNumberOfConsecutiveMissedLayersPerCloud;
00318           maxNumberOfMissedLayersPerCloud += increaseMaxNumberOfMissedLayersPerCloud;
00319         }
00320           
00321         for ( Roads::RoadSet::const_iterator roadSetVector = roadSet->begin();
00322               roadSetVector != roadSet->end();
00323               ++roadSetVector ) {
00324             
00325           ++layerCounter;
00326           unsigned int usedHitsInThisLayer = 0;
00327           bool intersectsLayer = false;
00328             
00329           for ( std::vector<const Ring*>::const_iterator ring = roadSetVector->begin(); ring != roadSetVector->end(); ++ring ) {
00330               
00331             // calculate phi-range for lookup of DetId's in Rings of RoadSet
00332             // calculate phi at radius of Ring using extrapolation, Ring radius average of Ring.rmin() and Ring.rmax()
00333             double ringRadius = (*ring)->getrmin() + ((*ring)->getrmax()-(*ring)->getrmin())/2;
00334             double ringZ      = (*ring)->getzmin() + ((*ring)->getzmax()-(*ring)->getzmin())/2;
00335             double ringPhi = 0.0;
00336             if ( roadType == Roads::RPhi ) {
00337               ringPhi = phiFromExtrapolation(d0,phi0,k0,ringRadius,roadType);
00338             } else {
00339               ringPhi = phiFromExtrapolation(d0,phi0,k0,ringZ,roadType);
00340             }
00341             if (ringPhi == -99) continue;
00342             intersectsLayer = true;
00343 
00344             LogDebug("RoadSearch") << "Seed # " <<seed-inputSeeds->begin() << " testing ring at R = " << ringRadius
00345                                    << " Z = " << ringZ << " ringPhi = " << ringPhi;
00346               
00347             int nDetIds = (*ring)->getNumDetIds();
00348             double theHalfRoad = theMinimumHalfRoad*(2.0*Geom::pi())/((double)nDetIds);
00349             // calculate range in phi around ringPhi
00350             double upperPhiRangeBorder = map_phi2(ringPhi + theHalfRoad);
00351             double lowerPhiRangeBorder = map_phi2(ringPhi - theHalfRoad);
00352 
00353             if ( lowerPhiRangeBorder <= upperPhiRangeBorder ) {
00354                 
00355               for ( Ring::const_iterator detid = (*ring)->lower_bound(lowerPhiRangeBorder); detid != (*ring)->upper_bound(upperPhiRangeBorder); ++detid) {
00356                 usedHitsInThisLayer += FillRecHitsIntoCloudGeneral(detid->second,d0,phi0,k0,phi1,k1,roadType,ringPhi,
00357                                                                    tracker.product(),theHitMatcher,cloud);
00358               }
00359                 
00360             } else {
00361               for ( Ring::const_iterator detid = (*ring)->lower_bound(lowerPhiRangeBorder); detid != (*ring)->end(); ++detid) {
00362                 usedHitsInThisLayer += FillRecHitsIntoCloudGeneral(detid->second,d0,phi0,k0,phi1,k1,roadType,ringPhi,
00363                                                                    tracker.product(),theHitMatcher,cloud);
00364               }
00365                 
00366               for ( Ring::const_iterator detid = (*ring)->begin(); detid != (*ring)->upper_bound(upperPhiRangeBorder); ++detid) {
00367                 usedHitsInThisLayer += FillRecHitsIntoCloudGeneral(detid->second,d0,phi0,k0,phi1,k1,roadType,ringPhi,
00368                                                                    tracker.product(),theHitMatcher,cloud);
00369               }
00370             }
00371           LogDebug("RoadSearch") << "Seed # " <<seed-inputSeeds->begin() << " now has " << usedHitsInThisLayer << "  hits in ring at R = " << ringRadius
00372                                  << " Z = " << ringZ << " ringPhi = " << ringPhi;
00373           }
00374             
00375           if ( !firstHitFound ) {
00376             if ( usedHitsInThisLayer > 0 ) {
00377 
00378               firstHitFound = true;
00379 
00380               // reset totalLayers according to first layer with hit
00381               totalLayers = roadSet->size() - layerCounter + 1;
00382 
00383               // re-caluclate minNumberOfUsedLayersPerCloud, maxNumberOfMissedLayersPerCloud and maxNumberOfConsecutiveMissedLayersPerCloud 
00384               // by rounding to integer minFractionOfUsedLayersPerCloud. maxFractionOfMissedLayersPerCloud and maxFractionOfConsecutiveMissedLayersPerCloud
00385               minNumberOfUsedLayersPerCloud = static_cast<unsigned int>(totalLayers * minFractionOfUsedLayersPerCloud + 0.5);
00386               if (minNumberOfUsedLayersPerCloud < 3) minNumberOfUsedLayersPerCloud = 3;
00387               maxNumberOfMissedLayersPerCloud = static_cast<unsigned int>(totalLayers * maxFractionOfMissedLayersPerCloud + 0.5);
00388               maxNumberOfConsecutiveMissedLayersPerCloud = static_cast<unsigned int>(totalLayers * maxFractionOfConsecutiveMissedLayersPerCloud + 0.5);
00389 
00390               // increase consecutive layer cuts between 0.9 and 1.5
00391               if (std::abs(outer_eta) > 0.9 && std::abs(outer_eta) < 1.5) {
00392                 maxNumberOfConsecutiveMissedLayersPerCloud += increaseMaxNumberOfConsecutiveMissedLayersPerCloud;
00393                 maxNumberOfMissedLayersPerCloud += increaseMaxNumberOfMissedLayersPerCloud;
00394               }
00395 
00396               ++usedLayers;
00397               consecutiveMissedLayers = 0;
00398 
00399             }
00400           } else {
00401             if (intersectsLayer){
00402               if ( usedHitsInThisLayer > 0 ) {
00403                 ++usedLayers;
00404                 consecutiveMissedLayers = 0;
00405               } else {
00406                 ++ missedLayers;
00407                 ++consecutiveMissedLayers;
00408               }
00409             }
00410             LogDebug("RoadSearch") << "Seed # "<<seed-inputSeeds->begin() << " Layer info: " 
00411                                    << " totalLayers: " << totalLayers 
00412                                    << " usedLayers: " << usedLayers 
00413                                    << " missedLayers: " << missedLayers
00414                                    << " consecutiveMissedLayers: " << consecutiveMissedLayers;
00415 
00416             // break condition, hole larger than maxNumberOfConsecutiveMissedLayersPerCloud
00417             if ( consecutiveMissedLayers > maxNumberOfConsecutiveMissedLayersPerCloud ) {
00418               LogDebug("RoadSearch") << "BREAK: seed # "<<seed-inputSeeds->begin() 
00419                                      << " More than " << maxNumberOfConsecutiveMissedLayersPerCloud << " missed consecutive layers!";
00420               break;
00421             }
00422 
00423             // break condition, already  missed too many layers
00424             if ( missedLayers > maxNumberOfMissedLayersPerCloud ) {
00425               LogDebug("RoadSearch") << "BREAK: seed # "<<seed-inputSeeds->begin() 
00426                                      << " More than " << maxNumberOfMissedLayersPerCloud << " missed layers!";
00427               break;
00428             }
00429 
00430             // break condition, cannot satisfy minimal number of used layers
00431             if ( totalLayers-missedLayers < minNumberOfUsedLayersPerCloud ) {
00432               LogDebug("RoadSearch") << "BREAK: seed # "<<seed-inputSeeds->begin() 
00433                                      << " Cannot satisfy at least " << minNumberOfUsedLayersPerCloud << " used layers!";
00434               break;
00435             }
00436           }       
00437             
00438         }
00439 
00440         if ( consecutiveMissedLayers <= maxNumberOfConsecutiveMissedLayersPerCloud ) {
00441           if ( usedLayers >= minNumberOfUsedLayersPerCloud ) {
00442             if ( missedLayers <= maxNumberOfMissedLayersPerCloud ) {
00443 
00444               CloudArray[phibin][etabin].push_back(cloud);
00445 
00446               if ( roadType == Roads::RPhi ){ 
00447                 LogDebug("RoadSearch") << "This r-phi seed # "<<seed-inputSeeds->begin()
00448                                        <<" yields a cloud with " <<cloud.size() <<" hits on " << usedLayers << " layers out of " << totalLayers;
00449               } else {
00450                 LogDebug("RoadSearch") << "This z-phi seed # "<<seed-inputSeeds->begin()
00451                                        <<" yields a cloud with " <<cloud.size() <<" hits on " << usedLayers << " layers out of " << totalLayers;
00452               }
00453             } else {
00454               LogDebug("RoadSearch") << "Missed layers: " << missedLayers << " More than " << maxNumberOfMissedLayersPerCloud << " missed layers!";
00455               if ( roadType == Roads::RPhi ){ 
00456                 LogDebug("RoadSearch") << "This r-phi seed # "<<seed-inputSeeds->begin() <<" yields no clouds";
00457               } else {
00458                 LogDebug("RoadSearch") << "This z-phi seed # "<<seed-inputSeeds->begin() <<" yields no clouds";
00459               }
00460             }
00461           }
00462           else {
00463             LogDebug("RoadSearch") << "Seed # "<<seed-inputSeeds->begin() <<" fails: used layers = " << usedLayers << " < " << minNumberOfUsedLayersPerCloud;
00464           }
00465         }
00466         else {
00467           LogDebug("RoadSearch") << "Seed # "<<seed-inputSeeds->begin() <<" fails: consecutive missed layers = " << consecutiveMissedLayers << " > " << maxNumberOfConsecutiveMissedLayersPerCloud;
00468         }
00469       }
00470     }
00471   }
00472   
00473   // Loop for initial cleaning
00474   for (int iphi=0; iphi<nphibin; ++iphi){
00475     for (int ieta=0; ieta<netabin; ++ieta){
00476       if (!CloudArray[iphi][ieta].empty()) {
00477         if (doCleaning_){
00478           RoadSearchCloudCollection temp = Clean(&CloudArray[iphi][ieta]);
00479           for ( RoadSearchCloudCollection::const_iterator ic = temp.begin(); ic!=temp.end(); ++ic)
00480             output.push_back(*ic);
00481         }
00482         else 
00483           for ( RoadSearchCloudCollection::const_iterator ic = CloudArray[iphi][ieta].begin(); 
00484                 ic!=CloudArray[iphi][ieta].end(); ++ic)
00485             output.push_back(*ic);
00486       }
00487     }
00488   }
00489 
00490   delete theHitMatcher;
00491   edm::LogInfo("RoadSearch") << "Found " << output.size() << " clouds."; 
00492   for ( RoadSearchCloudCollection::const_iterator ic = output.begin(); ic!=output.end(); ++ic)
00493     edm::LogInfo("RoadSearch") << "    Cloud " << ic-output.begin()<< " has " << ic->size() << " hits."; 
00494   
00495 }

double RoadSearchCloudMakerAlgorithm::ZPhiDeltaPhi ( double  phi1,
double  phi2,
double  phiExpect 
)

Definition at line 1095 of file RoadSearchCloudMakerAlgorithm.cc.

References funct::abs(), deltaPhi(), and map_phi2().

Referenced by FillRecHitsIntoCloudGeneral().

01095                                                                                                      {
01096 
01097   double deltaPhi = -999.;
01098 
01099   double dPhiHits = map_phi2(hitPhi1-hitPhi2);
01100   double dPhi1 = map_phi2(hitPhi1-predictedPhi);
01101   double dPhi2 = map_phi2(hitPhi2-predictedPhi);
01102 
01103   if (dPhiHits >= 0){  // hitPhi1 >= hitPhi2
01104     if ( (dPhi1>=0.0) && (dPhi2 <= 0.0))
01105       deltaPhi = 0.0;
01106     else{
01107       if (std::abs(dPhi1)<std::abs(dPhi2))
01108         deltaPhi = dPhi1;
01109       else
01110         deltaPhi = dPhi2;
01111     }
01112   }
01113   else { // hitPhi1 < hitPhi2
01114     if ( (dPhi1<=0.0) && (dPhi2 >= 0.0))
01115       deltaPhi = 0.0;
01116     else{
01117       if (std::abs(dPhi1)<std::abs(dPhi2))
01118         deltaPhi = dPhi1;
01119       else
01120         deltaPhi = dPhi2;
01121     }
01122   }
01123 
01124   return deltaPhi;
01125 
01126 }


Member Data Documentation

edm::ParameterSet RoadSearchCloudMakerAlgorithm::conf_ [private]

Definition at line 143 of file RoadSearchCloudMakerAlgorithm.h.

Referenced by RoadSearchCloudMakerAlgorithm().

double RoadSearchCloudMakerAlgorithm::d0h [private]

Definition at line 145 of file RoadSearchCloudMakerAlgorithm.h.

Referenced by makecircle().

bool RoadSearchCloudMakerAlgorithm::doCleaning_ [private]

Definition at line 165 of file RoadSearchCloudMakerAlgorithm.h.

Referenced by RoadSearchCloudMakerAlgorithm(), and run().

double RoadSearchCloudMakerAlgorithm::epsilon = 0.000000001 [static, private]

Definition at line 144 of file RoadSearchCloudMakerAlgorithm.h.

Referenced by makecircle().

unsigned int RoadSearchCloudMakerAlgorithm::increaseMaxNumberOfConsecutiveMissedLayersPerCloud [private]

Definition at line 162 of file RoadSearchCloudMakerAlgorithm.h.

Referenced by RoadSearchCloudMakerAlgorithm(), and run().

unsigned int RoadSearchCloudMakerAlgorithm::increaseMaxNumberOfMissedLayersPerCloud [private]

Definition at line 163 of file RoadSearchCloudMakerAlgorithm.h.

Referenced by RoadSearchCloudMakerAlgorithm(), and run().

unsigned int RoadSearchCloudMakerAlgorithm::maxDetHitsInCloudPerDetId [private]

Definition at line 158 of file RoadSearchCloudMakerAlgorithm.h.

Referenced by FillRecHitsIntoCloudGeneral(), and RoadSearchCloudMakerAlgorithm().

double RoadSearchCloudMakerAlgorithm::maxFractionOfConsecutiveMissedLayersPerCloud [private]

Definition at line 161 of file RoadSearchCloudMakerAlgorithm.h.

Referenced by RoadSearchCloudMakerAlgorithm(), and run().

double RoadSearchCloudMakerAlgorithm::maxFractionOfMissedLayersPerCloud [private]

Definition at line 160 of file RoadSearchCloudMakerAlgorithm.h.

Referenced by RoadSearchCloudMakerAlgorithm(), and run().

unsigned int RoadSearchCloudMakerAlgorithm::maxRecHitsInCloud_ [private]

Definition at line 167 of file RoadSearchCloudMakerAlgorithm.h.

Referenced by Clean(), FillRecHitsIntoCloudGeneral(), and RoadSearchCloudMakerAlgorithm().

double RoadSearchCloudMakerAlgorithm::mergingFraction_ [private]

Definition at line 166 of file RoadSearchCloudMakerAlgorithm.h.

Referenced by Clean(), and RoadSearchCloudMakerAlgorithm().

double RoadSearchCloudMakerAlgorithm::minFractionOfUsedLayersPerCloud [private]

Definition at line 159 of file RoadSearchCloudMakerAlgorithm.h.

Referenced by RoadSearchCloudMakerAlgorithm(), and run().

bool RoadSearchCloudMakerAlgorithm::NoFieldCosmic [private]

Definition at line 157 of file RoadSearchCloudMakerAlgorithm.h.

Referenced by RoadSearchCloudMakerAlgorithm(), and run().

double RoadSearchCloudMakerAlgorithm::omegah [private]

Definition at line 145 of file RoadSearchCloudMakerAlgorithm.h.

Referenced by makecircle(), and run().

std::ostringstream RoadSearchCloudMakerAlgorithm::output_ [private]

Definition at line 169 of file RoadSearchCloudMakerAlgorithm.h.

double RoadSearchCloudMakerAlgorithm::phi0h [private]

Definition at line 145 of file RoadSearchCloudMakerAlgorithm.h.

Referenced by makecircle(), and run().

DetHitAccess RoadSearchCloudMakerAlgorithm::recHitVectorClass [private]

Definition at line 151 of file RoadSearchCloudMakerAlgorithm.h.

Referenced by FillRecHitsIntoCloudGeneral(), RoadSearchCloudMakerAlgorithm(), and run().

std::string RoadSearchCloudMakerAlgorithm::roadsLabel_ [private]

Definition at line 172 of file RoadSearchCloudMakerAlgorithm.h.

Referenced by RoadSearchCloudMakerAlgorithm(), and run().

double RoadSearchCloudMakerAlgorithm::rphicsq [private]

Definition at line 146 of file RoadSearchCloudMakerAlgorithm.h.

int RoadSearchCloudMakerAlgorithm::rphinhits [private]

Definition at line 147 of file RoadSearchCloudMakerAlgorithm.h.

double RoadSearchCloudMakerAlgorithm::scalefactorRoadSeedWindow_ [private]

Definition at line 170 of file RoadSearchCloudMakerAlgorithm.h.

Referenced by RoadSearchCloudMakerAlgorithm().

double RoadSearchCloudMakerAlgorithm::theMinimumHalfRoad [private]

Definition at line 155 of file RoadSearchCloudMakerAlgorithm.h.

Referenced by RoadSearchCloudMakerAlgorithm(), and run().

const SiPixelRecHitCollection RoadSearchCloudMakerAlgorithm::thePixRecHits [private]

Definition at line 148 of file RoadSearchCloudMakerAlgorithm.h.

double RoadSearchCloudMakerAlgorithm::theRPhiRoadSize [private]

Definition at line 153 of file RoadSearchCloudMakerAlgorithm.h.

Referenced by phiMax(), and RoadSearchCloudMakerAlgorithm().

double RoadSearchCloudMakerAlgorithm::theZPhiRoadSize [private]

Definition at line 154 of file RoadSearchCloudMakerAlgorithm.h.

Referenced by phiMax(), and RoadSearchCloudMakerAlgorithm().

bool RoadSearchCloudMakerAlgorithm::UsePixels [private]

Definition at line 156 of file RoadSearchCloudMakerAlgorithm.h.

Referenced by FillRecHitsIntoCloudGeneral(), and RoadSearchCloudMakerAlgorithm().


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