CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
List of all members | Public Member Functions | Private Attributes | Static Private Attributes
RoadSearchCloudMakerAlgorithm Class Reference

#include <RoadSearchCloudMakerAlgorithm.h>

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. More...
 
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, 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.

103  : conf_(conf) {
105  recHitVectorClass.use_rphiRecHits(conf_.getParameter<bool>("UseRphiRecHits"));
106  recHitVectorClass.use_stereoRecHits(conf_.getParameter<bool>("UseStereoRecHits"));
107 
108 
109  theRPhiRoadSize = conf_.getParameter<double>("RPhiRoadSize");
110  theZPhiRoadSize = conf_.getParameter<double>("ZPhiRoadSize");
111  UsePixels = conf_.getParameter<bool>("UsePixelsinRS");
112  NoFieldCosmic = conf_.getParameter<bool>("StraightLineNoBeamSpotCloud");
113  theMinimumHalfRoad = conf_.getParameter<double>("MinimumHalfRoad");
114 
115  maxDetHitsInCloudPerDetId = conf_.getParameter<unsigned int>("MaxDetHitsInCloudPerDetId");
116  minFractionOfUsedLayersPerCloud = conf_.getParameter<double>("MinimalFractionOfUsedLayersPerCloud");
117  maxFractionOfMissedLayersPerCloud = conf_.getParameter<double>("MaximalFractionOfMissedLayersPerCloud");
118  maxFractionOfConsecutiveMissedLayersPerCloud = conf_.getParameter<double>("MaximalFractionOfConsecutiveMissedLayersPerCloud");
119  increaseMaxNumberOfConsecutiveMissedLayersPerCloud = conf_.getParameter<unsigned int>("IncreaseMaxNumberOfConsecutiveMissedLayersPerCloud");
120  increaseMaxNumberOfMissedLayersPerCloud = conf_.getParameter<unsigned int>("IncreaseMaxNumberOfMissedLayersPerCloud");
121 
122  doCleaning_ = conf.getParameter<bool>("DoCloudCleaning");
123  mergingFraction_ = conf.getParameter<double>("MergingFraction");
124  maxRecHitsInCloud_ = (unsigned int)conf.getParameter<int>("MaxRecHitsInCloud");
125  scalefactorRoadSeedWindow_ = conf.getParameter<double>("scalefactorRoadSeedWindow");
126 
127  roadsLabel_ = conf.getParameter<std::string>("RoadsLabel");
128 
129 }
T getParameter(std::string const &) const
void use_rphiRecHits(bool input)
Definition: DetHitAccess.h:45
void use_stereoRecHits(bool input)
Definition: DetHitAccess.h:46
void setMode(accessMode input)
Definition: DetHitAccess.h:44
RoadSearchCloudMakerAlgorithm::~RoadSearchCloudMakerAlgorithm ( )

Definition at line 131 of file RoadSearchCloudMakerAlgorithm.cc.

131  {
132 
133 }

Member Function Documentation

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

Definition at line 1007 of file RoadSearchCloudMakerAlgorithm.cc.

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

Referenced by FillRecHitsIntoCloudGeneral().

1008  {
1009 
1010  double deltaX = -999.;
1011  // just get the x coord of intersection of two line segments
1012  // check if intersection lies inside segments
1013  double det12 = inner1.x()*outer1.y() - inner1.y()*outer1.x();
1014  double det34 = inner2.x()*outer2.y() - inner2.y()*outer2.x();
1015 
1016  double xinter = (det12*(inner2.x()-outer2.x()) - det34*(inner1.x()-outer1.x()))/
1017  ((inner1.x()-outer1.x())*(inner2.y()-outer2.y()) -
1018  (inner2.x()-outer2.x())*(inner1.y()-outer1.y()));
1019 
1020  bool inter = true;
1021  if (inner1.x() < outer1.x()){
1022  if ((xinter<inner1.x()) || (xinter>outer1.x())) inter = false;
1023  }
1024  else{
1025  if ((xinter>inner1.x()) || (xinter<outer1.x())) inter = false;
1026  }
1027 
1028  if (inner2.x() < outer2.x()){
1029  if ((xinter<inner2.x()) || (xinter>outer2.x())) inter = false;
1030  }
1031  else{
1032  if ((xinter>inner2.x()) || (xinter<outer2.x())) inter = false;
1033  }
1034 
1035  if (inter){
1036  deltaX = 0;
1037  }
1038  else{
1039  deltaX = min(fabs(inner1.x()-inner2.x()),fabs(outer1.x()-outer2.x()));
1040  }
1041  return deltaX;
1042 
1043 }
#define min(a, b)
Definition: mlp_lapack.h:161
int inter
double RoadSearchCloudMakerAlgorithm::CheckZPhiIntersection ( double  iPhi1,
double  iZ1,
double  oPhi1,
double  oZ1,
double  iPhi2,
double  iZ2,
double  oPhi2,
double  oZ2 
)

Definition at line 1045 of file RoadSearchCloudMakerAlgorithm.cc.

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

Referenced by FillRecHitsIntoCloudGeneral().

1046  {
1047 
1048  // Have to make sure all are in the same hemisphere
1049  if ((iPhi1 > Geom::pi() || oPhi1 > Geom::pi() || iPhi2 > Geom::pi() || oPhi2 > Geom::pi()) &&
1050  (iPhi1 < Geom::pi() || oPhi1 < Geom::pi() || iPhi2 < Geom::pi() || oPhi2 < Geom::pi())){
1051  iPhi1 = map_phi2(iPhi1); oPhi1 = map_phi2(oPhi1);
1052  iPhi2 = map_phi2(iPhi2); oPhi2 = map_phi2(oPhi2);
1053  }
1054 
1055  double deltaPhi = -999.;
1056  // just get the x coord of intersection of two line segments
1057  // check if intersection lies inside segments
1058  double det12 = iZ1*oPhi1 - iPhi1*oZ1;
1059  double det34 = iZ2*oPhi2 - iPhi2*oZ2;
1060 
1061  double xinter = (det12*(iZ2-oZ2) - det34*(iZ1-oZ1))/
1062  ((iZ1-oZ1)*(iPhi2-oPhi2) -
1063  (iZ2-oZ2)*(iPhi1-oPhi1));
1064 
1065  bool inter = true;
1066  if (iZ1 < oZ1){
1067  if ((xinter<iZ1) || (xinter>oZ1)) inter = false;
1068  }
1069  else{
1070  if ((xinter>iZ1) || (xinter<oZ1)) inter = false;
1071  }
1072 
1073  if (iZ2 < oZ2){
1074  if ((xinter<iZ2) || (xinter>oZ2)) inter = false;
1075  }
1076  else{
1077  if ((xinter>iZ2) || (xinter<oZ2)) inter = false;
1078  }
1079 
1080  if (inter){
1081  deltaPhi = 0;
1082  }
1083  else{
1084  deltaPhi = min(fabs(iPhi2-iPhi1),fabs(oPhi2-oPhi1));
1085  }
1086  return deltaPhi;
1087 
1088 }
#define min(a, b)
Definition: mlp_lapack.h:161
int inter
double pi()
Definition: Pi.h:31
RoadSearchCloudCollection RoadSearchCloudMakerAlgorithm::Clean ( RoadSearchCloudCollection rawColl)

Definition at line 1124 of file RoadSearchCloudMakerAlgorithm.cc.

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

Referenced by run().

1124  {
1125 
1127 
1128  //
1129  // no raw clouds - nothing to try merging
1130  //
1131 
1132  if ( inputCollection->empty() ){
1133  LogDebug("RoadSearch") << "Found " << output.size() << " clean clouds.";
1134  return output;
1135  }
1136 
1137  //
1138  // 1 raw cloud - nothing to try merging, but one cloud to duplicate
1139  //
1140 
1141  if ( 1==inputCollection->size() ){
1142  output = *inputCollection;
1143 // RoadSearchCloud *temp = inputCollection->begin()->clone();
1144 // output.push_back(*temp);
1145 // delete temp;
1146  LogDebug("RoadSearch") << "Found " << output.size() << " clean clouds.";
1147  return output;
1148  }
1149 
1150  //
1151  // got > 1 raw cloud - something to try merging
1152  //
1153  std::vector<bool> already_gone(inputCollection->size());
1154  for (unsigned int i=0; i<inputCollection->size(); ++i) {
1155  already_gone[i] = false;
1156  }
1157 
1158  int raw_cloud_ctr=0;
1159  // loop over clouds
1160  for ( RoadSearchCloudCollection::const_iterator raw_cloud = inputCollection->begin(); raw_cloud != inputCollection->end(); ++raw_cloud) {
1161  ++raw_cloud_ctr;
1162 
1163  if (already_gone[raw_cloud_ctr-1])continue;
1164 
1165  // produce output cloud where other clouds are merged in
1166  // create temp pointer for clone which will be deleted afterwards
1167 // RoadSearchCloud *temp_lone_cloud = raw_cloud->clone();
1168 // RoadSearchCloud lone_cloud = *temp_lone_cloud;
1169  RoadSearchCloud lone_cloud = *raw_cloud;
1170 
1171  int second_cloud_ctr=raw_cloud_ctr;
1172  for ( RoadSearchCloudCollection::const_iterator second_cloud = raw_cloud+1; second_cloud != inputCollection->end(); ++second_cloud) {
1173  second_cloud_ctr++;
1174 
1175  std::vector<const TrackingRecHit*> unshared_hits;
1176 
1177  if ( already_gone[second_cloud_ctr-1] )continue;
1178 
1179  for ( RoadSearchCloud::RecHitVector::const_iterator second_cloud_hit = second_cloud->begin_hits();
1180  second_cloud_hit != second_cloud->end_hits();
1181  ++ second_cloud_hit ) {
1182  bool is_shared = false;
1183  for ( RoadSearchCloud::RecHitVector::const_iterator lone_cloud_hit = lone_cloud.begin_hits();
1184  lone_cloud_hit != lone_cloud.end_hits();
1185  ++ lone_cloud_hit ) {
1186 
1187  if ((*lone_cloud_hit)->geographicalId() == (*second_cloud_hit)->geographicalId())
1188  if ((*lone_cloud_hit)->localPosition().x() == (*second_cloud_hit)->localPosition().x())
1189  if ((*lone_cloud_hit)->localPosition().y() == (*second_cloud_hit)->localPosition().y())
1190  {is_shared=true; break;}
1191  }
1192  if (!is_shared) unshared_hits.push_back(*second_cloud_hit);
1193 
1194  if ( ((float(unshared_hits.size())/float(lone_cloud.size())) >
1195  ((float(second_cloud->size())/float(lone_cloud.size()))-mergingFraction_)) &&
1196  ((float(unshared_hits.size())/float(second_cloud->size())) > (1-mergingFraction_))){
1197  // You'll never merge these clouds..... Could quit now!
1198  break;
1199  }
1200 
1201  if (lone_cloud.size()+unshared_hits.size() > maxRecHitsInCloud_) {
1202  break;
1203  }
1204 
1205  }
1206 
1207  double f_lone_shared=double(second_cloud->size()-unshared_hits.size())/double(lone_cloud.size());
1208  double f_second_shared=double(second_cloud->size()-unshared_hits.size())/double(second_cloud->size());
1209 
1210  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)) )
1211  && (lone_cloud.size()+unshared_hits.size() <= maxRecHitsInCloud_) ){
1212 
1213  LogDebug("RoadSearch") << " Merge CloudA: " << raw_cloud_ctr << " with CloudB: " << second_cloud_ctr
1214  << " Shared fractions are " << f_lone_shared << " and " << f_second_shared;
1215 
1216  //
1217  // got a cloud to merge
1218  //
1219  for (unsigned int k=0; k<unshared_hits.size(); ++k) {
1220  lone_cloud.addHit(unshared_hits[k]);
1221  }
1222 
1223  already_gone[second_cloud_ctr-1]=true;
1224 
1225  }//end got a cloud to merge
1226 
1227  }//interate over all second clouds
1228 
1229  output.push_back(lone_cloud);
1230 
1231  }//iterate over all raw clouds
1232 
1233  LogDebug("RoadSearch") << "Found " << output.size() << " clean clouds.";
1234 
1235  return output;
1236 }
#define LogDebug(id)
int i
Definition: DBlmapReader.cc:9
unsigned int size() const
RecHitVector::const_iterator begin_hits() const
void addHit(const TrackingRecHit *input)
int k[5][pyjets_maxn]
RecHitVector::const_iterator end_hits() const
std::vector< RoadSearchCloud > RoadSearchCloudCollection
SiStripMatchedRecHit2D * RoadSearchCloudMakerAlgorithm::CorrectMatchedHit ( const TrackingRecHit originalRH,
const GluedGeomDet gluedDet,
const TrackerGeometry tracker,
const SiStripRecHitMatcher theHitMatcher,
double  k0,
double  phi0 
)

Definition at line 1238 of file RoadSearchCloudMakerAlgorithm.cc.

References funct::cos(), gather_cfg::cout, TrackingRecHit::geographicalId(), TrackerGeometry::idToDet(), reco::ParticleMasses::k0, BaseTrackerRecHit::localPosition(), map_phi2(), SiStripRecHitMatcher::match(), GluedGeomDet::monoDet(), SiStripMatchedRecHit2D::monoHit(), PV3DBase< T, PVType, FrameType >::perp(), funct::sin(), GeomDet::surface(), toLocal(), and PV3DBase< T, PVType, FrameType >::z().

Referenced by FillRecHitsIntoCloudGeneral().

1242  {
1243  // VI January 2012
1244  // this is not supported anymore w/o cpe
1245 
1246  const SiStripMatchedRecHit2D *theRH = dynamic_cast<const SiStripMatchedRecHit2D*>(originalHit);
1247  if (theRH == 0) {
1248  std::cout<<" Could not cast original hit" << std::endl;
1249  }
1250  if (theRH != 0){
1251  const GeomDet *recHitGeomDet = tracker->idToDet(theRH->geographicalId());
1252  const GluedGeomDet *theGluedDet = dynamic_cast<const GluedGeomDet*>(recHitGeomDet);
1253 
1254  const GeomDetUnit* theMonoDet = theGluedDet->monoDet();
1255  const SiStripRecHit2D theMonoHit = theRH->monoHit();
1256  //GlobalPoint monoRHpos = (theMonoDet->surface()).toGlobal(theMonoHit.localPosition());
1257 
1258  GlobalPoint gcenterofstrip=(theMonoDet->surface()).toGlobal(theMonoHit.localPosition());
1259 
1260  float gtrackangle_xy = map_phi2(phi0 + 2.0*asin(0.5*gcenterofstrip.perp()*k0));
1261  float rzangle = atan2(gcenterofstrip.perp(),gcenterofstrip.z());
1262 
1263  GlobalVector gtrackangle2(cos(gtrackangle_xy)*sin(rzangle),
1264  sin(gtrackangle_xy)*sin(rzangle),
1265  cos(rzangle));
1266  LocalVector trackdirection2=((tracker->idToDet(theRH->geographicalId()))->surface()).toLocal(gtrackangle2);
1267  //GlobalVector gdir = theMonoDet->surface().toGlobal(trackdirection2);
1268 
1269  SiStripMatchedRecHit2D* theCorrectedHit = theHitMatcher->match(theRH,theGluedDet,trackdirection2);
1270  if (theCorrectedHit!=0) return theCorrectedHit;
1271  }
1272 
1273  return 0;
1274 }
T perp() const
Definition: PV3DBase.h:71
const GeomDetUnit * monoDet() const
Definition: GluedGeomDet.h:20
SiStripMatchedRecHit2D * match(const SiStripRecHit2D *monoRH, const SiStripRecHit2D *stereoRH, const GluedGeomDet *gluedDet, LocalVector trackdirection) const
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
LocalVector toLocal(const reco::Track::Vector &v, const Surface &s)
T z() const
Definition: PV3DBase.h:63
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
virtual const GeomDet * idToDet(DetId) const
virtual LocalPoint localPosition() const
SiStripRecHit2D monoHit() const
const BoundPlane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:35
tuple cout
Definition: gather_cfg.py:121
DetId geographicalId() const
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 798 of file RoadSearchCloudMakerAlgorithm.cc.

References abs, RoadSearchCloud::addHit(), edmNew::DetSet< T >::begin(), edmNew::DetSet< T >::end(), edmNew::DetSetVector< T >::end(), edmNew::DetSetVector< T >::find(), TrackingRecHit::geographicalId(), TrackerGeometry::idToDet(), TrackerGeometry::idToDetUnit(), isBarrelSensor(), BaseTrackerRecHit::localPosition(), map_phi(), phi, PV3DBase< T, PVType, FrameType >::phi(), phiFromExtrapolation(), phiMax(), Roads::RPhi, mathSSE::sqrt(), GeomDet::surface(), GeomDet::toGlobal(), Surface::toGlobal(), PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

800  {
801 
802 
803  unsigned int usedRecHits = 0;
804 
805  // Get Geometry
806  //const PixelTopology *topology = dynamic_cast<const PixelTopology*>(&(tracker->idToDetUnit(id)->topology()));
807 
808 
809  // retrieve vector<SiPixelRecHit> for id
810  // loop over SiPixelRecHit
811  // check if compatible with cloud, fill into cloud
812 
813  SiPixelRecHitCollection::const_iterator recHitMatch = inputRecHits->find(id);
814  if (recHitMatch == inputRecHits->end()) return usedRecHits;
815 
816  const SiPixelRecHitCollection::DetSet recHitRange = *recHitMatch;
817 
818  for ( SiPixelRecHitCollection::DetSet::const_iterator recHitIterator = recHitRange.begin();
819  recHitIterator != recHitRange.end(); ++recHitIterator) {
820 
821  const SiPixelRecHit * recHit = &(*recHitIterator);
822 
823  if ( roadType == Roads::RPhi ) {
824 
825  if ( isBarrelSensor(id) ) {
826  // Barrel Pixel, RoadType RPHI
827 
828  GlobalPoint ghit = tracker->idToDet(recHit->geographicalId())->surface().toGlobal(recHit->localPosition());
829  double hitRadius = sqrt(ghit.x()*ghit.x()+ghit.y()*ghit.y());
830  double hitphi = map_phi(ghit.phi());
831  double phi = phiFromExtrapolation(d0,phi0,k0,hitRadius,roadType);
832 
833  if ( std::abs(hitphi-phi) < phiMax(roadType,phi0,k0) ) {
834  cloud.addHit(recHit);
835  ++usedRecHits;
836  }
837  }
838  else {
839 
840  // Forward Pixel,roadtype RPHI
841 
842  // Get Local Hit Position of the Pixel Hit
843  LocalPoint hit = recHit->localPosition();
844 
845  // Get Phi of hit position
846  double hitphi = map_phi(tracker->idToDetUnit(id)->surface().toGlobal(hit).phi());
847 
848  // Get Global Hit position
849  GlobalPoint ghit = tracker->idToDet(recHit->geographicalId())->surface().toGlobal(recHit->localPosition());
850 
851  // Get Hit Radis
852  double hitRadius = sqrt(ghit.x()*ghit.x()+ghit.y()*ghit.y());
853 
854  // Get Phi from extrapolation
855  double phi = phiFromExtrapolation(d0,phi0,k0,hitRadius,roadType);
856 
857  if ( std::abs(hitphi-phi) < phiMax(roadType,phi0,k0) ) {
858  cloud.addHit(recHit);
859  ++usedRecHits;
860  }
861  }
862  }
863 
864  else {
865 
866  GlobalPoint ghit = tracker->idToDet(recHit->geographicalId())->surface().toGlobal(recHit->localPosition());
867 
868  double phi = phiFromExtrapolation(d0,phi0,k0,ghit.z(),roadType);
869  if ( (phi - phiMax(roadType,phi0,k0)) < ringPhi && (phi + phiMax(roadType,phi0,k0))>ringPhi ) {
870  cloud.addHit(recHit);
871  ++usedRecHits;
872  }
873  }
874 
875  }
876 
877  return usedRecHits;
878 }
GlobalPoint toGlobal(const Point2DBase< Scalar, LocalTag > lp) const
Definition: Surface.h:78
boost::transform_iterator< IterHelp, const_IdIter > const_iterator
GlobalPoint toGlobal(const Local2DPoint &lp) const
Conversion to the global R.F. from the R.F. of the GeomDet.
Definition: GeomDet.h:47
Geom::Phi< T > phi() const
Definition: PV3DBase.h:68
double phiMax(Roads::type roadType, double phi0, double k0)
T y() const
Definition: PV3DBase.h:62
#define abs(x)
Definition: mlp_lapack.h:159
const_iterator find(id_type i) const
double phiFromExtrapolation(double d0, double phi0, double k0, double ringRadius, Roads::type roadType)
void addHit(const TrackingRecHit *input)
T sqrt(T t)
Definition: SSEVec.h:46
T z() const
Definition: PV3DBase.h:63
const_iterator end() const
virtual const GeomDet * idToDet(DetId) const
virtual LocalPoint localPosition() const
virtual const GeomDetUnit * idToDetUnit(DetId) const
Return the pointer to the GeomDetUnit corresponding to a given DetId.
iterator end()
Definition: DetSetNew.h:59
const BoundPlane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:35
DetId geographicalId() const
T x() const
Definition: PV3DBase.h:61
Our base class.
Definition: SiPixelRecHit.h:22
Definition: DDAxes.h:10
iterator begin()
Definition: DetSetNew.h:56
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 492 of file RoadSearchCloudMakerAlgorithm.cc.

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

Referenced by run().

495  {
496 
497  unsigned int usedRecHits = 0;
498 
499  bool double_ring_layer = !isSingleLayer(id);
500 
501  std::vector<TrackingRecHit*> recHitVector = recHitVectorClass.getHitVector(&id);
502 
503  for ( std::vector<TrackingRecHit*>::const_iterator recHitIterator = recHitVector.begin(); recHitIterator != recHitVector.end(); ++recHitIterator) {
504 
505  if ( (unsigned int)id.subdetId() == StripSubdetector::TIB
506  || (unsigned int)id.subdetId() == StripSubdetector::TOB
507  || (unsigned int)id.subdetId() == StripSubdetector::TID
508  || (unsigned int)id.subdetId() == StripSubdetector::TEC ) {
509 
510  const SiStripRecHit2D *recHit = (SiStripRecHit2D*)(*recHitIterator);
511  DetId hitId = recHit->geographicalId();
512 
513  LogDebug("RoadSearch") << " Testing hit at (x/y/z): "
514  << tracker->idToDet(recHit->geographicalId())->surface().toGlobal(recHit->localPosition()).x() << " / "
515  << tracker->idToDet(recHit->geographicalId())->surface().toGlobal(recHit->localPosition()).y() << " / "
516  << tracker->idToDet(recHit->geographicalId())->surface().toGlobal(recHit->localPosition()).z();
517 
518  if ( roadType == Roads::RPhi ) {
519  if (double_ring_layer && isSingleLayer(hitId)) {
520  //
521  // This is where the barrel stereoRecHits end up for Roads::RPhi
522  //
523 
524  // Adjust matched hit for track angle
525 
526  const GluedGeomDet *theGluedDet = dynamic_cast<const GluedGeomDet*>(tracker->idToDet(hitId));
527 
528  SiStripMatchedRecHit2D* theCorrectedHit = CorrectMatchedHit(*recHitIterator,theGluedDet,
529  tracker, theHitMatcher,
530  k0, phi0);
531  if (theCorrectedHit != 0){
532 
533  GlobalPoint ghit = tracker->idToDet(theCorrectedHit->geographicalId())->surface().toGlobal(theCorrectedHit->localPosition());
534  double hitRadius = sqrt(ghit.x()*ghit.x()+ghit.y()*ghit.y());
535  double hitphi = map_phi(ghit.phi());
536  double phi = phiFromExtrapolation(d0,phi0,k0,hitRadius,roadType);
537 
538  float dp = (hitphi-phi);
539  float dx = hitRadius*tan(dp);
540 
541  LogDebug("RoadSearch") << " Hit phi = " << hitphi << " expected phi = " << phi
542  <<" dx = " << dx << " for dxMax = " << phiMax(roadType,phi0,k0);
543 
544  // switch cut to dx instead of dphi
545  if ( std::abs(dx) < phiMax(roadType,phi0,k0) ) {
546  if ((usedRecHits < maxDetHitsInCloudPerDetId) && (cloud.size() < maxRecHitsInCloud_)) {
547  cloud.addHit(recHit);
548  ++usedRecHits;
549  }
550  }
551  delete theCorrectedHit;
552  }
553  } else { // Single layer hits here
554  if ( isBarrelSensor(hitId) ) {
555  //
556  // This is where the barrel rphiRecHits end up for Roads::RPhi
557  //
558  GlobalPoint ghit = tracker->idToDet(recHit->geographicalId())->surface().toGlobal(recHit->localPosition());
559  double hitRadius = sqrt(ghit.x()*ghit.x()+ghit.y()*ghit.y());
560  double hitphi = map_phi(ghit.phi());
561  double phi = phiFromExtrapolation(d0,phi0,k0,hitRadius,roadType);
562 
563  float dp = (hitphi-phi);
564  float dx = hitRadius*tan(dp);
565  LogDebug("RoadSearch") << " Hit phi = " << hitphi << " expected phi = " << phi
566  <<" dx = " << dx << " for dxMax = " << phiMax(roadType,phi0,k0);
567  // switch cut to dx instead of dphi
568  if ( std::abs(dx) < phiMax(roadType,phi0,k0) ) {
569  if ((usedRecHits < maxDetHitsInCloudPerDetId) && (cloud.size() < maxRecHitsInCloud_)) {
570  cloud.addHit(recHit);
571  ++usedRecHits;
572  }
573  }
574  }
575  else {
576 
577  LocalPoint hit = recHit->localPosition();
578  const StripTopology *topology = dynamic_cast<const StripTopology*>(&(tracker->idToDetUnit(hitId)->topology()));
579  double stripAngle = topology->stripAngle(topology->strip(hit));
580  double stripLength = topology->localStripLength(hit);
581 
582  LocalPoint innerHitLocal(hit.x()+stripLength/2*std::sin(stripAngle),hit.y()-stripLength/2*std::cos(stripAngle),0);
583  LocalPoint outerHitLocal(hit.x()-stripLength/2*std::sin(stripAngle),hit.y()+stripLength/2*std::cos(stripAngle),0);
584 
585  double innerRadius = tracker->idToDetUnit(hitId)->surface().toGlobal(innerHitLocal).perp();
586  double outerRadius = tracker->idToDetUnit(hitId)->surface().toGlobal(outerHitLocal).perp();
587  double innerExtrapolatedPhi = phiFromExtrapolation(d0,phi0,k0,innerRadius,roadType);
588  double outerExtrapolatedPhi = phiFromExtrapolation(d0,phi0,k0,outerRadius,roadType);
589 
590  GlobalPoint innerHitGlobal =tracker->idToDetUnit(hitId)->surface().toGlobal(innerHitLocal);
591  GlobalPoint outerHitGlobal =tracker->idToDetUnit(hitId)->surface().toGlobal(outerHitLocal);
592 
593  GlobalPoint innerRoadGlobal(GlobalPoint::Cylindrical(innerRadius,innerExtrapolatedPhi,
594  tracker->idToDetUnit(hitId)->surface().toGlobal(hit).z()));
595  GlobalPoint outerRoadGlobal(GlobalPoint::Cylindrical(outerRadius,outerExtrapolatedPhi,
596  tracker->idToDetUnit(hitId)->surface().toGlobal(hit).z()));
597 
598  LocalPoint innerRoadLocal = tracker->idToDetUnit(hitId)->surface().toLocal(innerRoadGlobal);
599  LocalPoint outerRoadLocal = tracker->idToDetUnit(hitId)->surface().toLocal(outerRoadGlobal);
600 
601  double dxinter = CheckXYIntersection(innerHitLocal, outerHitLocal,
602  innerRoadLocal, outerRoadLocal);
603 
604  LogDebug("RoadSearch") << " Hit phi inner = " << innerHitGlobal.phi() << " and outer = " << outerHitGlobal.phi()
605  << " expected inner phi = " << innerExtrapolatedPhi
606  << " and outer phi = " << outerExtrapolatedPhi
607  <<" dx = " << dxinter << " for dxMax = " << phiMax(roadType,phi0,k0);
608 
609  if ( fabs(dxinter) < phiMax(roadType,phi0,k0)) {
610  //
611  // This is where the disk rphiRecHits end up for Roads::ZPhi
612  //
613  if ((usedRecHits < maxDetHitsInCloudPerDetId) && (cloud.size() < maxRecHitsInCloud_)) {
614  cloud.addHit(recHit);
615  ++usedRecHits;
616  }
617  }
618  //else
619  //std::cout<< " ===>>> HIT FAILS !!! " << std::endl;
620  }
621  }
622  } else {
623  //
624  // roadType == Roads::ZPhi
625  //
626  if (double_ring_layer && isSingleLayer(hitId)) {
627 
628  // Adjust matched hit for track angle
629 
630  //const SiStripMatchedRecHit2D *theRH = dynamic_cast<SiStripMatchedRecHit2D*>(*recHitIterator);
631  const GluedGeomDet *theGluedDet = dynamic_cast<const GluedGeomDet*>(tracker->idToDet(hitId));
632 
633  SiStripMatchedRecHit2D* theCorrectedHit = CorrectMatchedHit(*recHitIterator,theGluedDet,
634  tracker, theHitMatcher,
635  k1, phi1);
636  if (theCorrectedHit != 0){
637 
638  GlobalPoint ghit = tracker->idToDet(theCorrectedHit->geographicalId())->surface().toGlobal(theCorrectedHit->localPosition());
639  double hitphi = map_phi(ghit.phi());
640  double hitZ = ghit.z();
641  double phi = phiFromExtrapolation(d0,phi0,k0,hitZ,roadType);
642 
643  float dp = hitphi-phi;
644  float dx = hitZ*tan(dp);
645 
646  //
647  // This is where the disk stereoRecHits end up for Roads::ZPhi
648  //
649  if ( std::abs(dx) < phiMax(roadType,phi0,k1)) {
650  if ((usedRecHits < maxDetHitsInCloudPerDetId) && (cloud.size() < maxRecHitsInCloud_)) {
651  cloud.addHit(recHit);
652  ++usedRecHits;
653  }
654  }
655  delete theCorrectedHit;
656  }
657  } else { // Single layer hits here
658  if ( isBarrelSensor(hitId) ) {
659  //
660  // This is where the barrel (???) rphiRecHits end up for Roads::ZPhi
661  //
662  LocalPoint hit = recHit->localPosition();
663  const StripTopology *topology = dynamic_cast<const StripTopology*>(&(tracker->idToDetUnit(hitId)->topology()));
664  double stripAngle = topology->stripAngle(topology->strip(hit));
665  double stripLength = topology->localStripLength(hit);
666 
667  //if (stripAngle!=0) std::cout<<"HEY, WE FOUND A HIT ON A STEREO MODULE!!!" << std::endl;
668  // new method
669  LocalPoint innerHitLocal(hit.x()+stripLength/2*std::sin(stripAngle),hit.y()-stripLength/2*std::cos(stripAngle),0);
670  LocalPoint outerHitLocal(hit.x()-stripLength/2*std::sin(stripAngle),hit.y()+stripLength/2*std::cos(stripAngle),0);
671  double innerHitPhi = map_phi(tracker->idToDetUnit(hitId)->surface().toGlobal(innerHitLocal).phi());
672  double outerHitPhi = map_phi(tracker->idToDetUnit(hitId)->surface().toGlobal(outerHitLocal).phi());
673  double innerHitZ = tracker->idToDetUnit(hitId)->surface().toGlobal(innerHitLocal).z();
674  double outerHitZ = tracker->idToDetUnit(hitId)->surface().toGlobal(outerHitLocal).z();
675  double innerExtrapolatedPhi = phiFromExtrapolation(d0,phi0,k0,innerHitZ,roadType);
676  double outerExtrapolatedPhi = phiFromExtrapolation(d0,phi0,k0,outerHitZ,roadType);
677 
678  double midPointZ = 0.5*(innerHitZ+outerHitZ);
679 
680  double dPhiInter = CheckZPhiIntersection(innerHitPhi, innerHitZ, outerHitPhi, outerHitZ,
681  innerExtrapolatedPhi, innerHitZ,
682  outerExtrapolatedPhi, outerHitZ);
683 
684  double dX = midPointZ*tan(dPhiInter);
685 
686  if (std::abs(dX) < 1.5*phiMax(roadType,phi0,k1)) {
687  if ((usedRecHits < maxDetHitsInCloudPerDetId) && (cloud.size() < maxRecHitsInCloud_)) {
688  cloud.addHit(recHit);
689  ++usedRecHits;
690  }
691  }
692 
693  } else {
694 
695  //
696  // This is where the disk rphiRecHits end up for Roads::ZPhi
697  //
698  LocalPoint hit = recHit->localPosition();
699  const StripTopology *topology = dynamic_cast<const StripTopology*>(&(tracker->idToDetUnit(hitId)->topology()));
700  double stripAngle = topology->stripAngle(topology->strip(hit));
701  double stripLength = topology->localStripLength(hit);
702  // new method
703  double hitZ = tracker->idToDetUnit(hitId)->surface().toGlobal(hit).z();
704  double extrapolatedPhi = phiFromExtrapolation(d0,phi0,k0,hitZ,roadType);
705 
706  LocalPoint innerHitLocal(hit.x()+stripLength/2*std::sin(stripAngle),hit.y()-stripLength/2*std::cos(stripAngle),0);
707  LocalPoint outerHitLocal(hit.x()-stripLength/2*std::sin(stripAngle),hit.y()+stripLength/2*std::cos(stripAngle),0);
708 
709  double innerHitPhi = map_phi(tracker->idToDetUnit(hitId)->surface().toGlobal(innerHitLocal).phi());
710  double outerHitPhi = map_phi(tracker->idToDetUnit(hitId)->surface().toGlobal(outerHitLocal).phi());
711  //double innerZ = tracker->idToDetUnit(hitId)->surface().toGlobal(innerHitLocal).z();
712  //double outerZ = tracker->idToDetUnit(hitId)->surface().toGlobal(outerHitLocal).z();
713  //if (innerZ != outerZ) std::cout<<"HEY!!! innerZ = " << innerZ << " != outerZ = " << outerZ << std::endl;
714 
715  double deltaPhi = ZPhiDeltaPhi(innerHitPhi,outerHitPhi,extrapolatedPhi);
716  double deltaX = hitZ*tan(deltaPhi);
717  if (std::abs(deltaX) < phiMax(roadType,phi0,k1)){
718  if ((usedRecHits < maxDetHitsInCloudPerDetId) && (cloud.size() < maxRecHitsInCloud_)) {
719  cloud.addHit(recHit);
720  ++usedRecHits;
721  }
722  }
723  }
724  }
725  }
726  } else if ( (unsigned int)id.subdetId() == PixelSubdetector::PixelBarrel
727  || (unsigned int)id.subdetId() == PixelSubdetector::PixelEndcap) {
728  if ( UsePixels ) {
729 
730  const SiPixelRecHit *recHit = (SiPixelRecHit*)(*recHitIterator);
731 
732  if ( roadType == Roads::RPhi ) {
733 
734  if ( isBarrelSensor(id) ) {
735  // Barrel Pixel, RoadType RPHI
736 
737  GlobalPoint ghit = tracker->idToDet(recHit->geographicalId())->surface().toGlobal(recHit->localPosition());
738  double hitRadius = sqrt(ghit.x()*ghit.x()+ghit.y()*ghit.y());
739  double hitphi = map_phi(ghit.phi());
740  double phi = phiFromExtrapolation(d0,phi0,k0,hitRadius,roadType);
741 
742  float dp = hitphi-phi;
743  float dx = hitRadius*tan(dp);
744 
745  // switch cut to dx instead of dphi
746  if ( std::abs(dx) < phiMax(roadType,phi0,k0) ) {
747  cloud.addHit(recHit);
748  ++usedRecHits;
749  }
750  } else {
751 
752  // Forward Pixel,roadtype RPHI
753 
754  // Get Local Hit Position of the Pixel Hit
755  LocalPoint hit = recHit->localPosition();
756 
757  // Get Phi of hit position
758  double hitphi = map_phi(tracker->idToDetUnit(id)->surface().toGlobal(hit).phi());
759 
760  // Get Global Hit position
761  GlobalPoint ghit = tracker->idToDet(recHit->geographicalId())->surface().toGlobal(recHit->localPosition());
762 
763  // Get Hit Radis
764  double hitRadius = sqrt(ghit.x()*ghit.x()+ghit.y()*ghit.y());
765 
766  // Get Phi from extrapolation
767  double phi = phiFromExtrapolation(d0,phi0,k0,hitRadius,roadType);
768 
769  if ( std::abs(hitphi-phi) < phiMax(roadType,phi0,k0) ) {
770  cloud.addHit(recHit);
771  ++usedRecHits;
772  }
773  }
774  } else {
775 
776  GlobalPoint ghit = tracker->idToDet(recHit->geographicalId())->surface().toGlobal(recHit->localPosition());
777  double phi = phiFromExtrapolation(d0,phi0,k0,ghit.z(),roadType);
778  double hitphi = map_phi(ghit.phi());
779  double dphi = map_phi2(hitphi-phi);
780  float dx = ghit.z()*tan(dphi);
781 
782  if ( std::abs(dx) < 0.25 ) {
783  cloud.addHit(recHit);
784  ++usedRecHits;
785  }
786  }
787  }
788  } else {
789  edm::LogError("RoadSearch") << "recHitVector from general hit access function contains unknown detector id: " << (unsigned int)id.subdetId() << " rawId: " << id.rawId();
790  }
791 
792  } //for loop over all recHits
793 
794 
795  return usedRecHits;
796 }
#define LogDebug(id)
GlobalPoint toGlobal(const Point2DBase< Scalar, LocalTag > lp) const
Definition: Surface.h:78
T perp() const
Definition: PV3DBase.h:71
virtual float stripAngle(float strip) const =0
unsigned int size() const
SiStripMatchedRecHit2D * CorrectMatchedHit(const TrackingRecHit *originalRH, const GluedGeomDet *gluedDet, const TrackerGeometry *tracker, const SiStripRecHitMatcher *theHitMatcher, double k0, double phi0)
GlobalPoint toGlobal(const Local2DPoint &lp) const
Conversion to the global R.F. from the R.F. of the GeomDet.
Definition: GeomDet.h:47
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
Geom::Phi< T > phi() const
Definition: PV3DBase.h:68
double phiMax(Roads::type roadType, double phi0, double k0)
T y() const
Definition: PV3DBase.h:62
#define abs(x)
Definition: mlp_lapack.h:159
double double double z
virtual float strip(const LocalPoint &) const =0
double CheckZPhiIntersection(double iPhi1, double iZ1, double oPhi1, double oZ1, double iPhi2, double iZ2, double oPhi2, double oZ2)
virtual const Topology & topology() const =0
double CheckXYIntersection(LocalPoint &ip1, LocalPoint &op1, LocalPoint &ip2, LocalPoint &op2)
double phiFromExtrapolation(double d0, double phi0, double k0, double ringRadius, Roads::type roadType)
void addHit(const TrackingRecHit *input)
T sqrt(T t)
Definition: SSEVec.h:46
LocalPoint toLocal(const GlobalPoint &gp) const
T z() const
Definition: PV3DBase.h:63
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
Tan< T >::type tan(const T &t)
Definition: Tan.h:22
double ZPhiDeltaPhi(double phi1, double phi2, double phiExpect)
std::vector< TrackingRecHit * > getHitVector(const DetId *detid)
Definition: DetHitAccess.cc:55
virtual const GeomDet * idToDet(DetId) const
Definition: DetId.h:20
virtual LocalPoint localPosition() const
virtual const GeomDetUnit * idToDetUnit(DetId) const
Return the pointer to the GeomDetUnit corresponding to a given DetId.
const BoundPlane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:35
virtual float localStripLength(const LocalPoint &aLP) const =0
DetId geographicalId() const
x
Definition: VDTMath.h:216
T x() const
Definition: PV3DBase.h:61
Our base class.
Definition: SiPixelRecHit.h:22
Definition: DDAxes.h:10
bool RoadSearchCloudMakerAlgorithm::isBarrelSensor ( DetId  id)

Definition at line 909 of file RoadSearchCloudMakerAlgorithm.cc.

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

Referenced by FillPixRecHitsIntoCloud(), and FillRecHitsIntoCloudGeneral().

909  {
910 
911  if ( (unsigned int)id.subdetId() == StripSubdetector::TIB ) {
912  return true;
913  } else if ( (unsigned int)id.subdetId() == StripSubdetector::TOB ) {
914  return true;
915  } else if ( (unsigned int)id.subdetId() == PixelSubdetector::PixelBarrel ) {
916  return true;
917  } else {
918  return false;
919  }
920 
921 }
bool RoadSearchCloudMakerAlgorithm::isSingleLayer ( DetId  id)

Definition at line 880 of file RoadSearchCloudMakerAlgorithm.cc.

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

Referenced by FillRecHitsIntoCloudGeneral().

880  {
881 
882  if ( (unsigned int)id.subdetId() == StripSubdetector::TIB ) {
883  TIBDetId tibid(id.rawId());
884  if ( !tibid.glued() ) {
885  return true;
886  }
887  } else if ( (unsigned int)id.subdetId() == StripSubdetector::TOB ) {
888  TOBDetId tobid(id.rawId());
889  if ( !tobid.glued() ) {
890  return true;
891  }
892  } else if ( (unsigned int)id.subdetId() == StripSubdetector::TID ) {
893  TIDDetId tidid(id.rawId());
894  if ( !tidid.glued() ) {
895  return true;
896  }
897  } else if ( (unsigned int)id.subdetId() == StripSubdetector::TEC ) {
898  TECDetId tecid(id.rawId());
899  if ( !tecid.glued() ) {
900  return true;
901  }
902  } else {
903  return false;
904  }
905 
906  return false;
907 }
void RoadSearchCloudMakerAlgorithm::makecircle ( double  x1_cs,
double  y1_cs,
double  x2_cs,
double  y2_cs,
double  x3_cs,
double  y3_cs 
)

Definition at line 980 of file RoadSearchCloudMakerAlgorithm.cc.

References d0h, epsilon, python.connectstrParser::f1, python.connectstrParser::f2, python.connectstrParser::f3, Geom::halfPi(), omegah, phi0h, rho, and mathSSE::sqrt().

Referenced by run().

981  {
982  double x1t=x1-x3; double y1t=y1-y3; double r1s=x1t*x1t+y1t*y1t;
983  double x2t=x2-x3; double y2t=y2-y3; double r2s=x2t*x2t+y2t*y2t;
984  double rho=x1t*y2t-x2t*y1t;
985  double xc, yc, rc, fac;
988  fac=sqrt(x1t*x1t+y1t*y1t);
989  xc=x2+y1t*rc/fac;
990  yc=y2-x1t*rc/fac;
991  }else{
992  fac=0.5/rho;
993  xc=fac*(r1s*y2t-r2s*y1t);
994  yc=fac*(r2s*x1t-r1s*x2t);
995  rc=sqrt(xc*xc+yc*yc); xc+=x3; yc+=y3;
996  }
997  double s3=0.0;
998  double f1=x1*yc-y1*xc; double f2=x2*yc-y2*xc;
999  double f3=x3*yc-y3*xc;
1000  if ((f1<0.0)&&(f2<0.0)&&(f3<=0.0))s3=1.0;
1001  if ((f1>0.0)&&(f2>0.0)&&(f3>=0.0))s3=-1.0;
1002  d0h=-s3*(sqrt(xc*xc+yc*yc)-rc);
1003  phi0h=atan2(yc,xc)+s3*Geom::halfPi();
1004  omegah=-s3/rc;
1005 }
Definition: DDAxes.h:10
T sqrt(T t)
Definition: SSEVec.h:46
double halfPi()
Definition: Pi.h:33
double RoadSearchCloudMakerAlgorithm::map_phi ( double  phi)

Definition at line 135 of file RoadSearchCloudMakerAlgorithm.cc.

References phi, query::result, and Geom::twoPi().

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

135  {
136  // map phi to [0,2pi]
137  double result = phi;
138  if ( result < -1.0*Geom::twoPi()) result = result + Geom::twoPi();
139  if ( result < 0) result = Geom::twoPi() + result;
140  if ( result > Geom::twoPi()) result = result - Geom::twoPi();
141  return result;
142 }
tuple result
Definition: query.py:137
double twoPi()
Definition: Pi.h:32
Definition: DDAxes.h:10
double RoadSearchCloudMakerAlgorithm::map_phi2 ( double  phi)

Definition at line 144 of file RoadSearchCloudMakerAlgorithm.cc.

References phi, Geom::pi(), query::result, and Geom::twoPi().

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

144  {
145  // map phi to [-pi,pi]
146  double result = phi;
147  if ( result < 1.0*Geom::pi() ) result = result + Geom::twoPi();
148  if ( result >= Geom::pi()) result = result - Geom::twoPi();
149  return result;
150 }
tuple result
Definition: query.py:137
double pi()
Definition: Pi.h:31
double twoPi()
Definition: Pi.h:32
Definition: DDAxes.h:10
double RoadSearchCloudMakerAlgorithm::phiFromExtrapolation ( double  d0,
double  phi0,
double  k0,
double  ringRadius,
Roads::type  roadType 
)

Definition at line 923 of file RoadSearchCloudMakerAlgorithm.cc.

References funct::cos(), reco::ParticleMasses::k0, prof2calltree::l, map_phi(), Roads::RPhi, funct::sin(), and mathSSE::sqrt().

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

923  {
924 
925  double ringPhi = -99.;
926  if ( roadType == Roads::RPhi ) {
927  double omega=k0, rl=ringRadius;
928  double sp0=sin(phi0); double cp0=cos(phi0);
929  if (fabs(omega)>0.000005){
930  double xc=-sp0*(d0+1.0/omega);
931  double yc=cp0*(d0+1.0/omega);
932  double rh=fabs(1.0/omega);
933  double bbb=fabs(d0+1.0/omega);
934  double sss=0.5*(rl+rh+bbb);
935  double ddd=sqrt((sss-bbb)*(sss-rh)/(sss*(sss-rl)));
936  double phil1=2.0*atan(ddd);
937  double phit=phi0+phil1; if (omega<0.0)phit=phi0-phil1;
938  double xh=xc+sin(phit)/omega;
939  double yh=yc-cos(phit)/omega;
940  double phih=atan2(yh,xh);
941  ringPhi = map_phi(phih);
942  }
943  else {
944  double cee = rl*rl - d0*d0 -0.25*omega*omega - omega*d0;
945  if (cee<0.0){return ringPhi;}
946  double l = sqrt(cee);
947  double xh=-sp0*d0+l*cp0-0.5*l*l*omega*sp0;
948  double yh= cp0*d0+l*sp0+0.5*l*l*omega*cp0;
949  double phih=atan2(yh,xh);
950  ringPhi = map_phi(phih);
951  }
952  }
953  else {
954  ringPhi = map_phi(phi0 + k0 * ringRadius);
955  }
956 
957  return ringPhi;
958 }
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
T sqrt(T t)
Definition: SSEVec.h:46
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
double RoadSearchCloudMakerAlgorithm::phiMax ( Roads::type  roadType,
double  phi0,
double  k0 
)

Definition at line 960 of file RoadSearchCloudMakerAlgorithm.cc.

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

Referenced by FillPixRecHitsIntoCloud(), and FillRecHitsIntoCloudGeneral().

961  {
962 
963  double dphi;
964  if ( roadType == Roads::RPhi ) {
965  // switch cut to dx instead of dphi
966  // Still call this dphi, but will now be dx
967  dphi = theRPhiRoadSize + 0.15*82.0*fabs(k0);
968  }
969  else if ( roadType == Roads::ZPhi ) {
970  dphi = theZPhiRoadSize + 0.4*82.0*fabs(k0);
971  }
972  else {
973  edm::LogWarning("RoadSearch") << "Bad roadType: "<< roadType;
974  dphi = theZPhiRoadSize;
975  }
976  return dphi;
977 
978 }
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 abs, alpha, begin, Clean(), funct::cos(), cond::rpcobgas::detid, doCleaning_, relativeConstraints::empty, PV3DBase< T, PVType, FrameType >::eta(), FillRecHitsIntoCloudGeneral(), TrackingRecHit::geographicalId(), edm::EventSetup::get(), increaseMaxNumberOfConsecutiveMissedLayersPerCloud, increaseMaxNumberOfMissedLayersPerCloud, 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::Handle< T >::product(), edm::ESHandle< class >::product(), recHitVectorClass, relativeConstraints::ring, RoadMapESSource_cfi::roads, roadsLabel_, Roads::RPhi, DetHitAccess::setCollections(), DetHitAccess::setMode(), funct::sin(), RoadSearchCloud::size(), mathSSE::sqrt(), DetHitAccess::standard, groupFilesInBlocks::temp, theMinimumHalfRoad, patCandidatesForDimuonsSequences_cff::tracker, PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

Referenced by RoadSearchCloudMaker::produce().

159 {
160  // intermediate arrays for storing clouds for cleaning
161  const int nphibin = 24;
162  const int netabin = 24;
163  RoadSearchCloudCollection CloudArray[nphibin][netabin];
164 
165  // get roads
167  es.get<RoadMapRecord>().get(roadsLabel_, roads);
168 
169  // get RoadSearchSeed collection
170  const RoadSearchSeedCollection* inputSeeds = input.product();
171 
172  // set collections for general hit access method
173  recHitVectorClass.setCollections(rphiRecHits,stereoRecHits,matchedRecHits,pixRecHits);
175 
176  // get tracker geometry
178  es.get<TrackerDigiGeometryRecord>().get(tracker);
179 
180  // get hit matcher
181  SiStripRecHitMatcher* theHitMatcher = new SiStripRecHitMatcher(3.0);
182 
183  edm::LogInfo("RoadSearch") << "Found " << inputSeeds->size() << " input seeds.";
184  // loop over seeds
185  for ( RoadSearchSeedCollection::const_iterator seed = inputSeeds->begin(); seed != inputSeeds->end(); ++seed) {
186 
187  const Roads::RoadSeed *roadSeed = seed->getSeed();
188 
189  if ( roadSeed == 0 ) {
190  edm::LogWarning("RoadSearch") << "RoadSeed could not be resolved from RoadSearchSeed hits, discard seed!";
191  } else {
192 
193  Roads::type roadType = roads->getRoadType(roadSeed);
194  if (NoFieldCosmic) roadType = Roads::RPhi;
195 
196  // fixme: from here on, calculate with 1st and 3rd seed hit (inner and outer of initial circle)
197  // fixme: adapt to new seed structure
198 
199  // get global positions of the hits, calculate before Road lookup to be used
200  const TrackingRecHit* innerSeedRingHit = (*(seed->begin()));
201  const TrackingRecHit* outerSeedRingHit = (*(seed->end() - 1));
202 
203  GlobalPoint innerSeedHitGlobalPosition = tracker->idToDet(innerSeedRingHit->geographicalId())->surface().toGlobal(innerSeedRingHit->localPosition());
204  GlobalPoint outerSeedHitGlobalPosition = tracker->idToDet(outerSeedRingHit->geographicalId())->surface().toGlobal(outerSeedRingHit->localPosition());
205 
206  LogDebug("RoadSearch") << "Seed # " <<seed-inputSeeds->begin() << " inner hit (x/y/z): "
207  << innerSeedHitGlobalPosition.x() << " / "
208  << innerSeedHitGlobalPosition.y() << " / "
209  << innerSeedHitGlobalPosition.z();
210  LogDebug("RoadSearch") << "Seed # " <<seed-inputSeeds->begin() << " outer hit (x/y/z): "
211  << outerSeedHitGlobalPosition.x() << " / "
212  << outerSeedHitGlobalPosition.y() << " / "
213  << outerSeedHitGlobalPosition.z();
214 
215  LogDebug("RoadSearch") << "Seed # " <<seed-inputSeeds->begin() << " inner hit (r/phi): "
216  << innerSeedHitGlobalPosition.perp() << " / "
217  << innerSeedHitGlobalPosition.phi();
218  LogDebug("RoadSearch") << "Seed # " <<seed-inputSeeds->begin() << " outer hit (r/phi): "
219  << outerSeedHitGlobalPosition.perp() << " / "
220  << outerSeedHitGlobalPosition.phi();
221 
222 
223  // extrapolation parameters, phio: [0,2pi]
224  double d0 = 0.0;
225  double phi0 = -99.;
226  double k0 = -99999999.99;
227 
228  double phi1 = -99.;
229  double k1 = -99999999.99;
230  // get bins of eta and phi of outer seed hit;
231 
232  double outer_phi = map_phi(outerSeedHitGlobalPosition.phi());
233  double outer_eta = outerSeedHitGlobalPosition.eta();
234 
235  int phibin = (int)(nphibin*(outer_phi/(2*Geom::pi())));
236  int etabin = (int)(netabin*(outer_eta+3.0)/6.0);
237 
238  // calculate phi0 and k0 dependent on RoadType
239  if ( roadType == Roads::RPhi ) {
240  double dr = outerSeedHitGlobalPosition.perp() - innerSeedHitGlobalPosition.perp();
241  const double dr_min = 1; // cm
242  if ( dr < dr_min ) {
243  edm::LogWarning("RoadSearch") << "RPhi road: seed Hits distance smaller than 1 cm, do not consider this seed.";
244  } else {
245  // calculate r-phi extrapolation: phi = phi0 + asin(k0 r)
246  double det = innerSeedHitGlobalPosition.x() * outerSeedHitGlobalPosition.y() - innerSeedHitGlobalPosition.y() * outerSeedHitGlobalPosition.x();
247  if ( det == 0 ) {
248  edm::LogWarning("RoadSearch") << "RPhi road: 'det' == 0, do not consider this seed.";
249  } else {
250  double x0=0.0; double y0=0.0;
251  double innerx=innerSeedHitGlobalPosition.x();
252  double innery=innerSeedHitGlobalPosition.y();
253  double outerx=outerSeedHitGlobalPosition.x();
254  double outery=outerSeedHitGlobalPosition.y();
255 
256  if (NoFieldCosmic){
257  phi0=atan2(outery-innery,outerx-innerx);
258  double alpha=atan2(innery,innerx);
259  double d1=sqrt(innerx*innerx+innery*innery);
260  d0=d1*sin(alpha-phi0); x0=-d0*sin(phi0); y0=d0*cos(phi0); k0=0.0;
261  }else{
262  makecircle(innerx,innery,outerx,outery,x0,y0);
263  phi0 = phi0h;
264  k0 = omegah;
265  }
266  LogDebug("RoadSearch") << "Seed # " <<seed-inputSeeds->begin() << " trajectory parameters: d0 = "<< d0 << " phi0 = " << phi0;
267  }
268  }
269  } else {
270  double dz = outerSeedHitGlobalPosition.z() - innerSeedHitGlobalPosition.z();
271  const double dz_min = 1.e-6; // cm;
272  if ( std::abs(dz) < dz_min ) {
273  edm::LogWarning("RoadSearch") << "ZPhi road: seed Hits are less than .01 microns away in z, do not consider this seed.";
274  } else {
275  // calculate z-phi extrapolation: phi = phi0 + k0 z
276  k0 = map_phi2(outerSeedHitGlobalPosition.phi() - innerSeedHitGlobalPosition.phi()) / dz;
277  phi0 = map_phi(innerSeedHitGlobalPosition.phi() - k0 * innerSeedHitGlobalPosition.z());
278 
279  // get approx pt for use in correcting matched hits
280  makecircle(innerSeedHitGlobalPosition.x(),innerSeedHitGlobalPosition.y(),
281  outerSeedHitGlobalPosition.x(),outerSeedHitGlobalPosition.y(),
282  0.0,0.0); // x0,y0 = 0.0 for now
283  phi1 = phi0h;
284  k1 = omegah;
285  }
286  }
287 
288  // continue if valid extrapolation parameters have been found
289  if ( (phi0 != -99.) && (k0 != -99999999.99) ) {
290  const Roads::RoadSet *roadSet = seed->getSet();
291 
292  // create cloud
293  RoadSearchCloud cloud;
294 
295  bool firstHitFound = false;
296  unsigned int layerCounter = 0;
297  unsigned int usedLayers = 0;
298  unsigned int missedLayers = 0;
299  unsigned int consecutiveMissedLayers = 0;
300 
301  unsigned int totalLayers = roadSet->size();
302 
303  // caluclate minNumberOfUsedLayersPerCloud, maxNumberOfMissedLayersPerCloud and maxNumberOfConsecutiveMissedLayersPerCloud
304  // by rounding to integer minFractionOfUsedLayersPerCloud. maxFractionOfMissedLayersPerCloud and maxFractionOfConsecutiveMissedLayersPerCloud
305  unsigned int minNumberOfUsedLayersPerCloud = static_cast<unsigned int>(totalLayers * minFractionOfUsedLayersPerCloud + 0.5);
306  if (minNumberOfUsedLayersPerCloud < 3) minNumberOfUsedLayersPerCloud = 3;
307  unsigned int maxNumberOfMissedLayersPerCloud = static_cast<unsigned int>(totalLayers * maxFractionOfMissedLayersPerCloud + 0.5);
308  unsigned int maxNumberOfConsecutiveMissedLayersPerCloud = static_cast<unsigned int>(totalLayers * maxFractionOfConsecutiveMissedLayersPerCloud + 0.5);
309 
310  // increase consecutive layer cuts between 0.9 and 1.5
311  if (std::abs(outer_eta) > 0.9 && std::abs(outer_eta) < 1.5) {
312  maxNumberOfConsecutiveMissedLayersPerCloud += increaseMaxNumberOfConsecutiveMissedLayersPerCloud;
313  maxNumberOfMissedLayersPerCloud += increaseMaxNumberOfMissedLayersPerCloud;
314  }
315 
316  for ( Roads::RoadSet::const_iterator roadSetVector = roadSet->begin();
317  roadSetVector != roadSet->end();
318  ++roadSetVector ) {
319 
320  ++layerCounter;
321  unsigned int usedHitsInThisLayer = 0;
322  bool intersectsLayer = false;
323 
324  for ( std::vector<const Ring*>::const_iterator ring = roadSetVector->begin(); ring != roadSetVector->end(); ++ring ) {
325 
326  // calculate phi-range for lookup of DetId's in Rings of RoadSet
327  // calculate phi at radius of Ring using extrapolation, Ring radius average of Ring.rmin() and Ring.rmax()
328  double ringRadius = (*ring)->getrmin() + ((*ring)->getrmax()-(*ring)->getrmin())/2;
329  double ringZ = (*ring)->getzmin() + ((*ring)->getzmax()-(*ring)->getzmin())/2;
330  double ringPhi = 0.0;
331  if ( roadType == Roads::RPhi ) {
332  ringPhi = phiFromExtrapolation(d0,phi0,k0,ringRadius,roadType);
333  } else {
334  ringPhi = phiFromExtrapolation(d0,phi0,k0,ringZ,roadType);
335  }
336  if (ringPhi == -99) continue;
337  intersectsLayer = true;
338 
339  LogDebug("RoadSearch") << "Seed # " <<seed-inputSeeds->begin() << " testing ring at R = " << ringRadius
340  << " Z = " << ringZ << " ringPhi = " << ringPhi;
341 
342  int nDetIds = (*ring)->getNumDetIds();
343  double theHalfRoad = theMinimumHalfRoad*(2.0*Geom::pi())/((double)nDetIds);
344  // calculate range in phi around ringPhi
345  double upperPhiRangeBorder = map_phi2(ringPhi + theHalfRoad);
346  double lowerPhiRangeBorder = map_phi2(ringPhi - theHalfRoad);
347 
348  if ( lowerPhiRangeBorder <= upperPhiRangeBorder ) {
349 
350  for ( Ring::const_iterator detid = (*ring)->lower_bound(lowerPhiRangeBorder); detid != (*ring)->upper_bound(upperPhiRangeBorder); ++detid) {
351  usedHitsInThisLayer += FillRecHitsIntoCloudGeneral(detid->second,d0,phi0,k0,phi1,k1,roadType,ringPhi,
352  tracker.product(),theHitMatcher,cloud);
353  }
354 
355  } else {
356  for ( Ring::const_iterator detid = (*ring)->lower_bound(lowerPhiRangeBorder); detid != (*ring)->end(); ++detid) {
357  usedHitsInThisLayer += FillRecHitsIntoCloudGeneral(detid->second,d0,phi0,k0,phi1,k1,roadType,ringPhi,
358  tracker.product(),theHitMatcher,cloud);
359  }
360 
361  for ( Ring::const_iterator detid = (*ring)->begin(); detid != (*ring)->upper_bound(upperPhiRangeBorder); ++detid) {
362  usedHitsInThisLayer += FillRecHitsIntoCloudGeneral(detid->second,d0,phi0,k0,phi1,k1,roadType,ringPhi,
363  tracker.product(),theHitMatcher,cloud);
364  }
365  }
366  LogDebug("RoadSearch") << "Seed # " <<seed-inputSeeds->begin() << " now has " << usedHitsInThisLayer << " hits in ring at R = " << ringRadius
367  << " Z = " << ringZ << " ringPhi = " << ringPhi;
368  }
369 
370  if ( !firstHitFound ) {
371  if ( usedHitsInThisLayer > 0 ) {
372 
373  firstHitFound = true;
374 
375  // reset totalLayers according to first layer with hit
376  totalLayers = roadSet->size() - layerCounter + 1;
377 
378  // re-caluclate minNumberOfUsedLayersPerCloud, maxNumberOfMissedLayersPerCloud and maxNumberOfConsecutiveMissedLayersPerCloud
379  // by rounding to integer minFractionOfUsedLayersPerCloud. maxFractionOfMissedLayersPerCloud and maxFractionOfConsecutiveMissedLayersPerCloud
380  minNumberOfUsedLayersPerCloud = static_cast<unsigned int>(totalLayers * minFractionOfUsedLayersPerCloud + 0.5);
381  if (minNumberOfUsedLayersPerCloud < 3) minNumberOfUsedLayersPerCloud = 3;
382  maxNumberOfMissedLayersPerCloud = static_cast<unsigned int>(totalLayers * maxFractionOfMissedLayersPerCloud + 0.5);
383  maxNumberOfConsecutiveMissedLayersPerCloud = static_cast<unsigned int>(totalLayers * maxFractionOfConsecutiveMissedLayersPerCloud + 0.5);
384 
385  // increase consecutive layer cuts between 0.9 and 1.5
386  if (std::abs(outer_eta) > 0.9 && std::abs(outer_eta) < 1.5) {
387  maxNumberOfConsecutiveMissedLayersPerCloud += increaseMaxNumberOfConsecutiveMissedLayersPerCloud;
388  maxNumberOfMissedLayersPerCloud += increaseMaxNumberOfMissedLayersPerCloud;
389  }
390 
391  ++usedLayers;
392  consecutiveMissedLayers = 0;
393 
394  }
395  } else {
396  if (intersectsLayer){
397  if ( usedHitsInThisLayer > 0 ) {
398  ++usedLayers;
399  consecutiveMissedLayers = 0;
400  } else {
401  ++ missedLayers;
402  ++consecutiveMissedLayers;
403  }
404  }
405  LogDebug("RoadSearch") << "Seed # "<<seed-inputSeeds->begin() << " Layer info: "
406  << " totalLayers: " << totalLayers
407  << " usedLayers: " << usedLayers
408  << " missedLayers: " << missedLayers
409  << " consecutiveMissedLayers: " << consecutiveMissedLayers;
410 
411  // break condition, hole larger than maxNumberOfConsecutiveMissedLayersPerCloud
412  if ( consecutiveMissedLayers > maxNumberOfConsecutiveMissedLayersPerCloud ) {
413  LogDebug("RoadSearch") << "BREAK: seed # "<<seed-inputSeeds->begin()
414  << " More than " << maxNumberOfConsecutiveMissedLayersPerCloud << " missed consecutive layers!";
415  break;
416  }
417 
418  // break condition, already missed too many layers
419  if ( missedLayers > maxNumberOfMissedLayersPerCloud ) {
420  LogDebug("RoadSearch") << "BREAK: seed # "<<seed-inputSeeds->begin()
421  << " More than " << maxNumberOfMissedLayersPerCloud << " missed layers!";
422  break;
423  }
424 
425  // break condition, cannot satisfy minimal number of used layers
426  if ( totalLayers-missedLayers < minNumberOfUsedLayersPerCloud ) {
427  LogDebug("RoadSearch") << "BREAK: seed # "<<seed-inputSeeds->begin()
428  << " Cannot satisfy at least " << minNumberOfUsedLayersPerCloud << " used layers!";
429  break;
430  }
431  }
432 
433  }
434 
435  if ( consecutiveMissedLayers <= maxNumberOfConsecutiveMissedLayersPerCloud ) {
436  if ( usedLayers >= minNumberOfUsedLayersPerCloud ) {
437  if ( missedLayers <= maxNumberOfMissedLayersPerCloud ) {
438 
439  CloudArray[phibin][etabin].push_back(cloud);
440 
441  if ( roadType == Roads::RPhi ){
442  LogDebug("RoadSearch") << "This r-phi seed # "<<seed-inputSeeds->begin()
443  <<" yields a cloud with " <<cloud.size() <<" hits on " << usedLayers << " layers out of " << totalLayers;
444  } else {
445  LogDebug("RoadSearch") << "This z-phi seed # "<<seed-inputSeeds->begin()
446  <<" yields a cloud with " <<cloud.size() <<" hits on " << usedLayers << " layers out of " << totalLayers;
447  }
448  } else {
449  LogDebug("RoadSearch") << "Missed layers: " << missedLayers << " More than " << maxNumberOfMissedLayersPerCloud << " missed layers!";
450  if ( roadType == Roads::RPhi ){
451  LogDebug("RoadSearch") << "This r-phi seed # "<<seed-inputSeeds->begin() <<" yields no clouds";
452  } else {
453  LogDebug("RoadSearch") << "This z-phi seed # "<<seed-inputSeeds->begin() <<" yields no clouds";
454  }
455  }
456  }
457  else {
458  LogDebug("RoadSearch") << "Seed # "<<seed-inputSeeds->begin() <<" fails: used layers = " << usedLayers << " < " << minNumberOfUsedLayersPerCloud;
459  }
460  }
461  else {
462  LogDebug("RoadSearch") << "Seed # "<<seed-inputSeeds->begin() <<" fails: consecutive missed layers = " << consecutiveMissedLayers << " > " << maxNumberOfConsecutiveMissedLayersPerCloud;
463  }
464  }
465  }
466  }
467 
468  // Loop for initial cleaning
469  for (int iphi=0; iphi<nphibin; ++iphi){
470  for (int ieta=0; ieta<netabin; ++ieta){
471  if (!CloudArray[iphi][ieta].empty()) {
472  if (doCleaning_){
473  RoadSearchCloudCollection temp = Clean(&CloudArray[iphi][ieta]);
474  for ( RoadSearchCloudCollection::const_iterator ic = temp.begin(); ic!=temp.end(); ++ic)
475  output.push_back(*ic);
476  }
477  else
478  for ( RoadSearchCloudCollection::const_iterator ic = CloudArray[iphi][ieta].begin();
479  ic!=CloudArray[iphi][ieta].end(); ++ic)
480  output.push_back(*ic);
481  }
482  }
483  }
484 
485  delete theHitMatcher;
486  edm::LogInfo("RoadSearch") << "Found " << output.size() << " clouds.";
487  for ( RoadSearchCloudCollection::const_iterator ic = output.begin(); ic!=output.end(); ++ic)
488  edm::LogInfo("RoadSearch") << " Cloud " << ic-output.begin()<< " has " << ic->size() << " hits.";
489 
490 }
#define LogDebug(id)
float alpha
Definition: AMPTWrapper.h:95
T perp() const
Definition: PV3DBase.h:71
const int netabin
void setCollections(const SiStripRecHit2DCollection *rphiRecHits, const SiStripRecHit2DCollection *stereoRecHits, const SiStripMatchedRecHit2DCollection *matchedRecHits, const SiPixelRecHitCollection *pixelRecHits)
Definition: DetHitAccess.cc:42
unsigned int size() const
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
Geom::Phi< T > phi() const
Definition: PV3DBase.h:68
T y() const
Definition: PV3DBase.h:62
#define abs(x)
Definition: mlp_lapack.h:159
RoadSearchCloudCollection Clean(RoadSearchCloudCollection *rawColl)
std::vector< RoadSearchSeed > RoadSearchSeedCollection
std::vector< std::vector< const Ring * > > RoadSet
Definition: Roads.h:39
void makecircle(double x1_cs, double y1_cs, double x2_cs, double y2_cs, double x3_cs, double y3_cs)
double phiFromExtrapolation(double d0, double phi0, double k0, double ringRadius, Roads::type roadType)
T sqrt(T t)
Definition: SSEVec.h:46
T z() const
Definition: PV3DBase.h:63
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
std::pair< std::vector< const Ring * >, std::vector< const Ring * > > RoadSeed
Definition: Roads.h:38
type
Definition: Roads.h:45
void setMode(accessMode input)
Definition: DetHitAccess.h:44
const T & get() const
Definition: EventSetup.h:55
T const * product() const
Definition: ESHandle.h:62
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)
T const * product() const
Definition: Handle.h:74
T eta() const
Definition: PV3DBase.h:75
#define begin
Definition: vmac.h:31
double pi()
Definition: Pi.h:31
perl if(1 lt scalar(@::datatypes))
Definition: edlooper.cc:31
DetIdMap::const_iterator const_iterator
Definition: Ring.h:37
DetId geographicalId() const
T x() const
Definition: PV3DBase.h:61
virtual LocalPoint localPosition() const =0
std::vector< RoadSearchCloud > RoadSearchCloudCollection
double RoadSearchCloudMakerAlgorithm::ZPhiDeltaPhi ( double  phi1,
double  phi2,
double  phiExpect 
)

Definition at line 1091 of file RoadSearchCloudMakerAlgorithm.cc.

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

Referenced by FillRecHitsIntoCloudGeneral().

1091  {
1092 
1093  double deltaPhi = -999.;
1094 
1095  double dPhiHits = map_phi2(hitPhi1-hitPhi2);
1096  double dPhi1 = map_phi2(hitPhi1-predictedPhi);
1097  double dPhi2 = map_phi2(hitPhi2-predictedPhi);
1098 
1099  if (dPhiHits >= 0){ // hitPhi1 >= hitPhi2
1100  if ( (dPhi1>=0.0) && (dPhi2 <= 0.0))
1101  deltaPhi = 0.0;
1102  else{
1103  if (std::abs(dPhi1)<std::abs(dPhi2))
1104  deltaPhi = dPhi1;
1105  else
1106  deltaPhi = dPhi2;
1107  }
1108  }
1109  else { // hitPhi1 < hitPhi2
1110  if ( (dPhi1<=0.0) && (dPhi2 >= 0.0))
1111  deltaPhi = 0.0;
1112  else{
1113  if (std::abs(dPhi1)<std::abs(dPhi2))
1114  deltaPhi = dPhi1;
1115  else
1116  deltaPhi = dPhi2;
1117  }
1118  }
1119 
1120  return deltaPhi;
1121 
1122 }
#define abs(x)
Definition: mlp_lapack.h:159

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
staticprivate
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
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
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
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