CMS 3D CMS Logo

HDetIdAssociator Class Reference

#include <Calibration/Tools/interface/DetIdAssociator.h>

Inheritance diagram for HDetIdAssociator:

HCaloDetIdAssociator HEcalDetIdAssociator HHcalDetIdAssociator

List of all members.

Public Member Functions

virtual std::set< DetIdgetCrossedDetIds (const std::set< DetId > &, const std::vector< GlobalPoint > &trajectory)
virtual std::set< DetIdgetDetIdsCloseToAPoint (const GlobalPoint &point, const double dR=0)
virtual std::set< DetIdgetDetIdsCloseToAPoint (const GlobalPoint &, const int idR=0)
virtual std::set< DetIdgetDetIdsInACone (const std::set< DetId > &, const std::vector< GlobalPoint > &trajectory, const double)
virtual std::set< DetIdgetMaxEDetId (const std::set< DetId > &, edm::Handle< HBHERecHitCollection > recHits)
virtual std::set< DetIdgetMaxEDetId (const std::set< DetId > &, edm::Handle< CaloTowerCollection > caloTowers)
virtual std::vector< GlobalPointgetTrajectory (const FreeTrajectoryState &, const std::vector< GlobalPoint > &)
 HDetIdAssociator (const int nPhi, const int nEta, const double etaBinSize)
 HDetIdAssociator ()
virtual int iEta (const GlobalPoint &)
virtual int iPhi (const GlobalPoint &)
virtual void setPropagator (Propagator *ptr)
virtual ~HDetIdAssociator ()

Protected Member Functions

virtual void buildMap ()
virtual void check_setup ()
virtual std::set< DetIdgetASetOfValidDetIds ()=0
virtual std::vector< GlobalPointgetDetIdPoints (const DetId &)=0
virtual GlobalPoint getPosition (const DetId &)=0
virtual bool insideElement (const GlobalPoint &, const DetId &)=0
virtual bool nearElement (const GlobalPoint &point, const DetId &id, const double distance)

Protected Attributes

const double etaBinSize_
PropagatorivProp_
const int nEta_
const int nPhi_
std::vector< std::vector
< std::set< DetId > > > * 
theMap_


Detailed Description

Definition at line 30 of file DetIdAssociator.h.


Constructor & Destructor Documentation

HDetIdAssociator::HDetIdAssociator (  )  [inline]

Definition at line 32 of file DetIdAssociator.h.

00032 :theMap_(0),nPhi_(0),nEta_(0),etaBinSize_(0),ivProp_(0){};

HDetIdAssociator::HDetIdAssociator ( const int  nPhi,
const int  nEta,
const double  etaBinSize 
) [inline]

Definition at line 33 of file DetIdAssociator.h.

00034      :theMap_(0),nPhi_(nPhi),nEta_(nEta),etaBinSize_(etaBinSize),ivProp_(0){};

virtual HDetIdAssociator::~HDetIdAssociator (  )  [inline, virtual]

Definition at line 36 of file DetIdAssociator.h.

00036 {};


Member Function Documentation

void HDetIdAssociator::buildMap (  )  [protected, virtual]

Definition at line 250 of file DetIdAssociator.cc.

References check_setup(), PV3DBase< T, PVType, FrameType >::eta(), etaBinSize_, gen_hydjet_hard_muon_trigger_cfg::etaMax, gen_hydjet_hard_muon_trigger_cfg::etaMin, getASetOfValidDetIds(), getPosition(), iEta(), iPhi(), LogTrace, nEta_, nPhi_, std::swap(), and theMap_.

Referenced by getDetIdsCloseToAPoint().

00251 {
00252 // modified version: take only detector central position
00253    check_setup();
00254    LogTrace("HDetIdAssociator")<<"building map" << "\n";
00255    if(theMap_) delete theMap_;
00256    theMap_ = new std::vector<std::vector<std::set<DetId> > >(nEta_,nPhi_);
00257    int numberOfDetIdsOutsideEtaRange = 0;
00258    int numberOfDetIdsActive = 0;
00259    std::set<DetId> validIds = getASetOfValidDetIds();
00260    for (std::set<DetId>::const_iterator id_itr = validIds.begin(); id_itr!=validIds.end(); id_itr++) {   
00261 //      std::vector<GlobalPoint> points = getDetIdPoints(*id_itr);
00262       GlobalPoint point = getPosition(*id_itr);
00263 // reject fake DetIds (eta=0 - what are they anyway???)
00264       if(point.eta()==0)continue;
00265 
00266       int ieta = iEta(point);
00267       int iphi = iPhi(point);
00268       int etaMax(-1);
00269       int etaMin(nEta_);
00270       int phiMax(-1);
00271       int phiMin(nPhi_);
00272       if ( iphi >= nPhi_ ) iphi = iphi % nPhi_;
00273       assert (iphi>=0);
00274       if ( etaMin > ieta) etaMin = ieta;
00275       if ( etaMax < ieta) etaMax = ieta;
00276       if ( phiMin > iphi) phiMin = iphi;
00277       if ( phiMax < iphi) phiMax = iphi;
00278 // for abs(eta)>1.8 one tower covers two phi segments
00279       if ((ieta>54||ieta<15) && iphi%2==0) phiMax++;
00280       if ((ieta>54||ieta<15) && iphi%2==1) phiMin--;
00281 
00282       if (etaMax<0||phiMax<0||etaMin>=nEta_||phiMin>=nPhi_) {
00283          LogTrace("HDetIdAssociator")<<"Out of range: DetId:" << id_itr->rawId() <<
00284            "\n\teta (min,max): " << etaMin << "," << etaMax <<
00285            "\n\tphi (min,max): " << phiMin << "," << phiMax <<
00286            "\nTower id: " << id_itr->rawId() << "\n";
00287          numberOfDetIdsOutsideEtaRange++;
00288          continue;
00289       }
00290           
00291       if (phiMax-phiMin > phiMin+nPhi_-phiMax){
00292          phiMin += nPhi_;
00293          std::swap(phiMin,phiMax);
00294       }
00295       for(int ieta = etaMin; ieta <= etaMax; ieta++)
00296         for(int iphi = phiMin; iphi <= phiMax; iphi++)
00297           (*theMap_)[ieta][iphi%nPhi_].insert(*id_itr);
00298       numberOfDetIdsActive++;
00299    }
00300    LogTrace("HDetIdAssociator") << "Number of elements outside the allowed range ( |eta|>"<<
00301      nEta_/2*etaBinSize_ << "): " << numberOfDetIdsOutsideEtaRange << "\n";
00302    LogTrace("HDetIdAssociator") << "Number of active DetId's mapped: " << 
00303      numberOfDetIdsActive << "\n";
00304 }

virtual void HDetIdAssociator::check_setup (  )  [inline, protected, virtual]

Reimplemented in HCaloDetIdAssociator.

Definition at line 70 of file DetIdAssociator.h.

References etaBinSize_, Exception, ivProp_, nEta_, and nPhi_.

Referenced by buildMap(), HCaloDetIdAssociator::check_setup(), getCrossedDetIds(), getDetIdsCloseToAPoint(), getDetIdsInACone(), getMaxEDetId(), and getTrajectory().

00071      {
00072         if (nEta_==0) throw cms::Exception("FatalError") << "Number of eta bins is not set.\n";
00073         if (nPhi_==0) throw cms::Exception("FatalError") << "Number of phi bins is not set.\n";
00074         if (ivProp_==0) throw cms::Exception("FatalError") << "Track propagator is not defined\n";
00075         if (etaBinSize_==0) throw cms::Exception("FatalError") << "Eta bin size is not set.\n";
00076      }

virtual std::set<DetId> HDetIdAssociator::getASetOfValidDetIds (  )  [protected, pure virtual]

Implemented in HCaloDetIdAssociator, HEcalDetIdAssociator, and HHcalDetIdAssociator.

Referenced by buildMap().

std::set< DetId > HDetIdAssociator::getCrossedDetIds ( const std::set< DetId > &  inset,
const std::vector< GlobalPoint > &  trajectory 
) [virtual]

Definition at line 352 of file DetIdAssociator.cc.

References check_setup(), and insideElement().

Referenced by HTrackAssociator::fillEcal().

00354 {
00355    check_setup();
00356    std::set<DetId> outset;
00357    for(std::set<DetId>::const_iterator id_iter = inset.begin(); id_iter != inset.end(); id_iter++)
00358      for(std::vector<GlobalPoint>::const_iterator point_iter = trajectory.begin(); point_iter != trajectory.end(); point_iter++)
00359        if (insideElement(*point_iter, *id_iter))  outset.insert(*id_iter);
00360    return outset;
00361 }

virtual std::vector<GlobalPoint> HDetIdAssociator::getDetIdPoints ( const DetId  )  [protected, pure virtual]

Implemented in HCaloDetIdAssociator.

virtual std::set<DetId> HDetIdAssociator::getDetIdsCloseToAPoint ( const GlobalPoint point,
const double  dR = 0 
) [inline, virtual]

Definition at line 44 of file DetIdAssociator.h.

References etaBinSize_, getDetIdsCloseToAPoint(), int, and nPhi_.

00046      {
00047         int etaIdR = int(dR/etaBinSize_); 
00048         int phiIdR = int(dR/(2*3.1416)*nPhi_);
00049         if (etaIdR>phiIdR)
00050           return getDetIdsCloseToAPoint(point, 1+etaIdR);
00051         else
00052           return getDetIdsCloseToAPoint(point, 1+phiIdR);
00053      }

std::set< DetId > HDetIdAssociator::getDetIdsCloseToAPoint ( const GlobalPoint direction,
const int  idR = 0 
) [virtual]

Definition at line 144 of file DetIdAssociator.cc.

References begin, buildMap(), check_setup(), end, PV3DBase< T, PVType, FrameType >::eta(), i, iEta(), iPhi(), j, LogTrace, nEta_, nPhi_, PV3DBase< T, PVType, FrameType >::phi(), and theMap_.

Referenced by HTrackAssociator::fillCaloTowers(), HTrackAssociator::fillEcal(), HTrackAssociator::fillHcal(), HTrackAssociator::fillHcalTowers(), and getDetIdsCloseToAPoint().

00146 {
00147    std::set<DetId> set;
00148    check_setup();
00149    int nDets=0;
00150    if (! theMap_) buildMap();
00151    LogTrace("MatchPoint") << "point (eta,phi): " << direction.eta() << "," << direction.phi() << "\n";
00152    int ieta = iEta(direction);
00153    int iphi = iPhi(direction);
00154 
00155    LogTrace("MatchPoint") << "(ieta,iphi): " << ieta << "," << iphi << "\n";
00156    
00157    if (ieta>=0 && ieta<nEta_ && iphi>=0 && iphi<nPhi_){
00158       set = (*theMap_)[ieta][iphi];
00159       nDets++;
00160       if (idR>0){
00161           LogTrace("MatchPoint") << "Add neighbors (ieta,iphi): " << ieta << "," << iphi << "\n";
00162          //add neighbors
00163          int maxIEta = ieta+idR;
00164          int minIEta = ieta-idR;
00165          if(maxIEta>=nEta_) maxIEta = nEta_-1;
00166          if(minIEta<0) minIEta = 0;
00167          int maxIPhi = iphi+idR;
00168          int minIPhi = iphi-idR;
00169          if(minIPhi<0) {
00170             minIPhi+=nPhi_;
00171             maxIPhi+=nPhi_;
00172          }
00173          LogTrace("MatchPoint") << "\tieta (min,max): " << minIEta << "," << maxIEta<< "\n";
00174          LogTrace("MatchPoint") << "\tiphi (min,max): " << minIPhi << "," << maxIPhi<< "\n";
00175          for (int i=minIEta;i<=maxIEta;i++)
00176            for (int j=minIPhi;j<=maxIPhi;j++) {
00177               if( i==ieta && j==iphi) continue; // already in the set
00178               set.insert((*theMap_)[i][j%nPhi_].begin(),(*theMap_)[i][j%nPhi_].end());
00179               nDets++;
00180            }
00181       }
00182    }
00183 //     if(set.size() > 0) {
00184 //   if (ieta+idR<55 && ieta-idR>14 && set.size() != (2*idR+1)*(2*idR+1)){
00185 //       std::cout<<" RRRA: "<<set.size()<<" DetIds in region "<<ieta<<" "<<iphi<<std::endl;
00186 //       for( std::set<DetId>::const_iterator itr=set.begin(); itr!=set.end(); itr++) {
00187 //         GlobalPoint point = getPosition(*itr);
00188 //         std::cout << "DetId: " <<itr->rawId() <<" (eta,phi): " << point.eta() << "," << point.phi()<<" "<<iEta(point)<<" "<<iPhi(point)<<std::endl;
00189 //       }
00190 //     }
00191 //     else {
00192 //       std::cout <<" HDetIdAssociator::getDetIdsCloseToAPoint::There are strange days "<<std::endl; 
00193 //     }  
00194    return set;
00195 }

std::set< DetId > HDetIdAssociator::getDetIdsInACone ( const std::set< DetId > &  inset,
const std::vector< GlobalPoint > &  trajectory,
const   double 
) [virtual]

Definition at line 307 of file DetIdAssociator.cc.

References begin, check_setup(), end, getPosition(), i, iEta(), iPhi(), j, nearElement(), nEta_, nPhi_, size, and theMap_.

Referenced by HTrackAssociator::fillCaloTowers(), HTrackAssociator::fillEcal(), HTrackAssociator::fillHcal(), and HTrackAssociator::fillHcalTowers().

00310 {
00311 // modified version: if dR<0, returns 3x3 towers around the input one (Michal)
00312    check_setup();
00313    std::set<DetId> outset;
00314   
00315    if(dR>=0) {
00316      for(std::set<DetId>::const_iterator id_iter = inset.begin(); id_iter != inset.end(); id_iter++)
00317        for(std::vector<GlobalPoint>::const_iterator point_iter = trajectory.begin(); point_iter != trajectory.end(); point_iter++)
00318          if (nearElement(*point_iter,*id_iter,dR)) outset.insert(*id_iter);
00319    }
00320    else {
00321      if (inset.size()!=1) return outset;
00322      std::set<DetId>::const_iterator id_inp = inset.begin();
00323      int ieta;
00324      int iphi;
00325      GlobalPoint point = getPosition(*id_inp);
00326      ieta = iEta(point);
00327      iphi = iPhi(point);
00328      for (int i=ieta-1;i<=ieta+1;i++) {
00329        for (int j=iphi-1;j<=iphi+1;j++) {
00330 //         if( i==ieta && j==iphi) continue;
00331          if( i<0 || i>=nEta_) continue;
00332          int j2fill = j%nPhi_;
00333          if(j2fill<0) j2fill+=nPhi_;
00334          if((*theMap_)[i][j2fill].size()==0)continue;
00335          outset.insert((*theMap_)[i][j2fill].begin(),(*theMap_)[i][j2fill].end());
00336        }
00337      }
00338    }
00339 
00340 //   if (outset.size() > 0) {
00341 //     std::cout<<" RRRA: DetIds in cone:"<<std::endl;
00342 //     for( std::set<DetId>::const_iterator itr=outset.begin(); itr!=outset.end(); itr++) {
00343 //       GlobalPoint point = getPosition(*itr);
00344 //       std::cout << "DetId: " <<itr->rawId() <<" (eta,phi): " << point.eta() << "," << point.phi()<<std::endl;
00345 //     }
00346 //   }
00347 
00348    return outset;
00349 }

virtual std::set<DetId> HDetIdAssociator::getMaxEDetId ( const std::set< DetId > &  ,
edm::Handle< HBHERecHitCollection recHits 
) [virtual]

std::set< DetId > HDetIdAssociator::getMaxEDetId ( const std::set< DetId > &  inset,
edm::Handle< CaloTowerCollection caloTowers 
) [virtual]

Definition at line 364 of file DetIdAssociator.cc.

References check_setup(), and id.

Referenced by HTrackAssociator::fillCaloTowers(), HTrackAssociator::fillHcal(), and HTrackAssociator::fillHcalTowers().

00366 {
00367 // returns the most energetic tower in the NxN box (Michal)
00368    check_setup();
00369    std::set<DetId> outset;
00370    std::set<DetId>::const_iterator id_max = inset.begin();
00371    double Ehadmax=0;
00372 
00373    for(std::set<DetId>::const_iterator id_iter = inset.begin(); id_iter != inset.end(); id_iter++) {
00374      DetId id(*id_iter);
00375 //     GlobalPoint point = getPosition(*id_iter);
00376 //     int ieta = iEta(point);
00377 //     int iphi = iPhi(point);
00378      CaloTowerCollection::const_iterator tower = (*caloTowers).find(id);
00379      if(tower != (*caloTowers).end() && tower->hadEnergy()>Ehadmax) {
00380        id_max = id_iter;
00381        Ehadmax = tower->hadEnergy();
00382      }
00383    }
00384 
00385    if (Ehadmax > 0) outset.insert(*id_max);
00386 
00387 //   if (outset.size() > 0) {
00388 //     std::cout<<" RRRA: Most energetic DetId:"<<std::endl;
00389 //     for( std::set<DetId>::const_iterator itr=outset.begin(); itr!=outset.end(); itr++) {
00390 //       GlobalPoint point = getPosition(*itr);
00391 //       std::cout << "DetId: " <<itr->rawId() <<" (eta,phi): " << point.eta() << "," << point.phi()<<std::endl;
00392 //     }
00393 //   }
00394 
00395    return outset;
00396 }

virtual GlobalPoint HDetIdAssociator::getPosition ( const DetId  )  [protected, pure virtual]

Implemented in HCaloDetIdAssociator.

Referenced by buildMap(), getDetIdsInACone(), and nearElement().

std::vector< GlobalPoint > HDetIdAssociator::getTrajectory ( const FreeTrajectoryState ftsStart,
const std::vector< GlobalPoint > &  surfaces 
) [virtual]

Definition at line 26 of file DetIdAssociator.cc.

References funct::abs(), check_setup(), PV3DBase< T, PVType, FrameType >::eta(), TrajectoryStateOnSurface::freeState(), TrajectoryStateOnSurface::globalPosition(), TrajectoryStateOnSurface::isValid(), ivProp_, LogTrace, PV3DBase< T, PVType, FrameType >::mag(), FreeTrajectoryState::momentum(), PV3DBase< T, PVType, FrameType >::perp(), PV3DBase< T, PVType, FrameType >::phi(), FreeTrajectoryState::position(), Propagator::propagate(), PV3DBase< T, PVType, FrameType >::x(), PV3DBase< T, PVType, FrameType >::y(), and PV3DBase< T, PVType, FrameType >::z().

Referenced by HTrackAssociator::fillCaloTowers(), HTrackAssociator::fillEcal(), HTrackAssociator::fillHcal(), and HTrackAssociator::fillHcalTowers().

00028 {
00029    check_setup();
00030    std::vector<GlobalPoint> trajectory;
00031    TrajectoryStateOnSurface tSOSDest;
00032    FreeTrajectoryState ftsCurrent = ftsStart;
00033 
00034    for(std::vector<GlobalPoint>::const_iterator surface_iter = surfaces.begin(); 
00035        surface_iter != surfaces.end(); surface_iter++) {
00036       // this stuff is some weird pointer, which destroy itself
00037       Cylinder *cylinder = new Cylinder(Surface::PositionType(0,0,0),
00038                                         Surface::RotationType(), 
00039                                         double (surface_iter->perp()) );
00040       Plane *forwardEndcap = new Plane(Surface::PositionType(0,0,surface_iter->z()),
00041                                        Surface::RotationType());
00042       Plane *backwardEndcap = new Plane(Surface::PositionType(0,0,-surface_iter->z()),
00043                                         Surface::RotationType());
00044 
00045       
00046       LogTrace("StartingPoint")<< "Propagate from "<< "\n"
00047         << "\tx: " << ftsStart.position().x()<< "\n"
00048         << "\ty: " << ftsStart.position().y()<< "\n"
00049         << "\tz: " << ftsStart.position().z()<< "\n"
00050         << "\tmomentum eta: " << ftsStart.momentum().eta()<< "\n"
00051         << "\tmomentum phi: " << ftsStart.momentum().phi()<< "\n"
00052         << "\tmomentum: " << ftsStart.momentum().mag()<< "\n";
00053      
00054          float tanTheta = ftsCurrent.momentum().perp()/ftsCurrent.momentum().z();
00055          float corner = surface_iter->perp()/surface_iter->z();
00056 /*
00057       std::cout<<"Propagate from "<< "\n"
00058         << "\tx: " << ftsCurrent.position().x()<< "\n"
00059         << "\ty: " << ftsCurrent.position().y()<< "\n"
00060         << "\tz: " << ftsCurrent.position().z()<< "\n"
00061         << "\tz: " << ftsCurrent.position().perp()<< "\n"
00062         << "\tz: " << tanTheta<<" "<< corner <<"\n"
00063         << "\tmomentum eta: " << ftsCurrent.momentum().eta()<< "\n"
00064         << "\tmomentum phi: " << ftsCurrent.momentum().phi()<< "\n"
00065         << "\tmomentum: " << ftsCurrent.momentum().mag()<<std::endl;
00066 */ 
00067       // First propage the track to the cylinder if |eta|<1, othewise to the encap
00068       // and correct depending on the result
00069       int ibar = 0;
00070       if (fabs(tanTheta) > corner)
00071         {
00072                    tSOSDest = ivProp_->propagate(ftsCurrent, *cylinder); 
00073  //                  std::cout<<" Propagate to cylinder "<<std::endl;
00074         }
00075       else if(tanTheta > 0.)
00076         {tSOSDest = ivProp_->propagate(ftsCurrent, *forwardEndcap); ibar=1; }
00077       else
00078         {tSOSDest = ivProp_->propagate(ftsCurrent, *backwardEndcap); ibar=-1; }
00079 
00080 //       std::cout<<" Trajectory valid? "<<tSOSDest.isValid()<<" First propagation in "<<ibar<<std::endl;
00081 
00082       if(! tSOSDest.isValid() )
00083       {
00084 // barrel
00085        if(ibar = 0){ 
00086            if (tanTheta < 0 ) tSOSDest = ivProp_->propagate( ftsCurrent,*forwardEndcap);
00087            if (tanTheta >= 0 ) tSOSDest = ivProp_->propagate( ftsCurrent,*backwardEndcap);
00088        }
00089          else
00090          {
00091                 tSOSDest = ivProp_->propagate(ftsCurrent, *cylinder);
00092          }
00093       } else
00094           {
00095 // missed target
00096             if(abs(ibar) > 0)
00097             {
00098               if(tSOSDest.globalPosition().perp() > surface_iter->perp())
00099               {
00100                 tSOSDest = ivProp_->propagate(ftsCurrent, *cylinder);
00101               }           
00102             }
00103               else
00104               {
00105                 if (tanTheta < 0 ) tSOSDest = ivProp_->propagate( ftsCurrent,*forwardEndcap);
00106                 if (tanTheta >= 0 ) tSOSDest = ivProp_->propagate( ftsCurrent,*backwardEndcap);
00107               }
00108           }
00109 
00110 
00111       // If missed the target, propagate to again
00112 //      if ((!tSOSDest.isValid()) && point.perp() > surface_iter->perp())
00113 //      {tSOSDest = ivProp_->propagate(ftsCurrent, *cylinder);std::cout<<" Propagate again 1 "<<std::endl;}
00114 //         std::cout<<" Track is ok after repropagation to cylinder or not? "<<tSOSDest.isValid()<<std::endl;
00115 //      if ((!tSOSDest.isValid()) && ftsStart.momentum().eta()>0. && fabs(ftsStart.momentum().eta())>1.) 
00116 //      {tSOSDest = ivProp_->propagate(ftsStart, *forwardEndcap);std::cout<<" Propagate again 2 "<<std::endl;}
00117 //       std::cout<<" Track is ok after repropagation forward or not? "<<tSOSDest.isValid()<<std::endl;
00118 //      if ((!tSOSDest.isValid()) && ftsStart.momentum().eta()<0.&&fabs(ftsStart.momentum().eta())>1.) 
00119 //      {tSOSDest = ivProp_->propagate(ftsStart, *backwardEndcap);std::cout<<" Propagate again 3 "<<std::endl;}
00120 //       std::cout<<" Track is after repropagation backward ok or not? "<<tSOSDest.isValid()<<std::endl; 
00121 
00122 
00123       if (! tSOSDest.isValid()) return trajectory;
00124       
00125 //      std::cout<<" Propagate reach something"<<std::endl; 
00126       LogTrace("SuccessfullPropagation") << "Great, I reached something." << "\n"
00127         << "\tx: " << tSOSDest.freeState()->position().x() << "\n"
00128         << "\ty: " << tSOSDest.freeState()->position().y() << "\n"
00129         << "\tz: " << tSOSDest.freeState()->position().z() << "\n"
00130         << "\teta: " << tSOSDest.freeState()->position().eta() << "\n"
00131         << "\tphi: " << tSOSDest.freeState()->position().phi() << "\n";
00132 
00133 //      std::cout<<" The position of trajectory "<<tSOSDest.freeState()->position().perp()<<" "<<tSOSDest.freeState()->position().z()<<std::endl;  
00134 
00135       GlobalPoint point = tSOSDest.freeState()->position(); 
00136       point = tSOSDest.freeState()->position();
00137       ftsCurrent = *tSOSDest.freeState();
00138       trajectory.push_back(point);
00139    }
00140    return trajectory;
00141 }

int HDetIdAssociator::iEta ( const GlobalPoint point  )  [virtual]

Definition at line 198 of file DetIdAssociator.cc.

References PV3DBase< T, PVType, FrameType >::eta(), etaBinSize_, int, and nEta_.

Referenced by buildMap(), getDetIdsCloseToAPoint(), and getDetIdsInACone().

00199 {
00200 // unequal bin sizes for endcap, following HCAL geometry
00201    int iEta1 = int(point.eta()/etaBinSize_ + nEta_/2);
00202    if (point.eta()>1.827 && point.eta()<=1.830) return iEta1-1;
00203    else if (point.eta()>1.914 && point.eta()<=1.930) return iEta1-1;
00204    else if (point.eta()>2.001 && point.eta()<=2.043) return iEta1-1;
00205    else if (point.eta()>2.088 && point.eta()<=2.172) return iEta1-1;
00206    else if (point.eta()>2.175 && point.eta()<=2.262) return iEta1-1;
00207    else if (point.eta()>2.262 && point.eta()<=2.332) return iEta1-2;
00208    else if (point.eta()>2.332 && point.eta()<=2.349) return iEta1-1;
00209    else if (point.eta()>2.349 && point.eta()<=2.436) return iEta1-2;
00210    else if (point.eta()>2.436 && point.eta()<=2.500) return iEta1-3;
00211    else if (point.eta()>2.500 && point.eta()<=2.523) return iEta1-2;
00212    else if (point.eta()>2.523 && point.eta()<=2.610) return iEta1-3;
00213    else if (point.eta()>2.610 && point.eta()<=2.650) return iEta1-4;
00214    else if (point.eta()>2.650 && point.eta()<=2.697) return iEta1-3;
00215    else if (point.eta()>2.697 && point.eta()<=2.784) return iEta1-4;
00216    else if (point.eta()>2.784 && point.eta()<=2.868) return iEta1-5;
00217    else if (point.eta()>2.868 && point.eta()<=2.871) return iEta1-4;
00218    else if (point.eta()>2.871 && point.eta()<=2.958) return iEta1-5;
00219    else if (point.eta()>2.958) return iEta1-6;
00220    else if (point.eta()<-1.827 && point.eta()>=-1.830) return iEta1+1;
00221    else if (point.eta()<-1.914 && point.eta()>=-1.930) return iEta1+1;
00222    else if (point.eta()<-2.001 && point.eta()>=-2.043) return iEta1+1;
00223    else if (point.eta()<-2.088 && point.eta()>=-2.172) return iEta1+1;
00224    else if (point.eta()<-2.175 && point.eta()>=-2.262) return iEta1+1;
00225    else if (point.eta()<-2.262 && point.eta()>=-2.332) return iEta1+2;
00226    else if (point.eta()<-2.332 && point.eta()>=-2.349) return iEta1+1;
00227    else if (point.eta()<-2.349 && point.eta()>=-2.436) return iEta1+2;
00228    else if (point.eta()<-2.436 && point.eta()>=-2.500) return iEta1+3;
00229    else if (point.eta()<-2.500 && point.eta()>=-2.523) return iEta1+2;
00230    else if (point.eta()<-2.523 && point.eta()>=-2.610) return iEta1+3;
00231    else if (point.eta()<-2.610 && point.eta()>=-2.650) return iEta1+4;
00232    else if (point.eta()<-2.650 && point.eta()>=-2.697) return iEta1+3;
00233    else if (point.eta()<-2.697 && point.eta()>=-2.784) return iEta1+4;
00234    else if (point.eta()<-2.784 && point.eta()>=-2.868) return iEta1+5;
00235    else if (point.eta()<-2.868 && point.eta()>=-2.871) return iEta1+4;
00236    else if (point.eta()<-2.871 && point.eta()>=-2.958) return iEta1+5;
00237    else if (point.eta()<-2.349) return iEta1+6;
00238    else return iEta1;
00239 }

virtual bool HDetIdAssociator::insideElement ( const GlobalPoint ,
const DetId  
) [protected, pure virtual]

Implemented in HCaloDetIdAssociator.

Referenced by getCrossedDetIds().

int HDetIdAssociator::iPhi ( const GlobalPoint point  )  [virtual]

Definition at line 242 of file DetIdAssociator.cc.

References int, nPhi_, PV3DBase< T, PVType, FrameType >::phi(), and pi.

Referenced by buildMap(), getDetIdsCloseToAPoint(), and getDetIdsInACone().

00243 {
00244    double pi=4*atan(1.);
00245    int iPhi1 = int((double(point.phi())+pi)/(2*pi)*nPhi_);
00246    return iPhi1;
00247 }

virtual bool HDetIdAssociator::nearElement ( const GlobalPoint point,
const DetId id,
const double  distance 
) [inline, protected, virtual]

Definition at line 84 of file DetIdAssociator.h.

References PV3DBase< T, PVType, FrameType >::eta(), getPosition(), PV3DBase< T, PVType, FrameType >::phi(), funct::pow(), and funct::sqrt().

Referenced by getDetIdsInACone().

00085      {
00086         GlobalPoint center = getPosition(id);
00087         return sqrt(pow(point.eta()-center.eta(),2)+pow(point.phi()-center.phi(),2)) < distance;
00088      };

virtual void HDetIdAssociator::setPropagator ( Propagator ptr  )  [inline, virtual]

Definition at line 67 of file DetIdAssociator.h.

References ivProp_.

Referenced by HTrackAssociator::setPropagator().

00067 {       ivProp_ = ptr; };


Member Data Documentation

const double HDetIdAssociator::etaBinSize_ [protected]

Definition at line 93 of file DetIdAssociator.h.

Referenced by buildMap(), check_setup(), getDetIdsCloseToAPoint(), and iEta().

Propagator* HDetIdAssociator::ivProp_ [protected]

Definition at line 94 of file DetIdAssociator.h.

Referenced by check_setup(), getTrajectory(), and setPropagator().

const int HDetIdAssociator::nEta_ [protected]

Definition at line 92 of file DetIdAssociator.h.

Referenced by buildMap(), check_setup(), getDetIdsCloseToAPoint(), getDetIdsInACone(), and iEta().

const int HDetIdAssociator::nPhi_ [protected]

Definition at line 91 of file DetIdAssociator.h.

Referenced by buildMap(), check_setup(), getDetIdsCloseToAPoint(), getDetIdsInACone(), and iPhi().

std::vector<std::vector<std::set<DetId> > >* HDetIdAssociator::theMap_ [protected]

Definition at line 88 of file DetIdAssociator.h.

Referenced by buildMap(), getDetIdsCloseToAPoint(), and getDetIdsInACone().


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