CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
ShallowTools.cc
Go to the documentation of this file.
2 
8 #include "boost/foreach.hpp"
9 
10 
11 namespace shallow {
12 
15  CLUSTERMAP clustermap;
17  iEvent.getByToken(cluster_token, clusters);
18 
19  unsigned int clusterindex = 0;
20  BOOST_FOREACH(const edmNew::DetSet<SiStripCluster>& ds, *clusters)
21  BOOST_FOREACH(const SiStripCluster& cluster, ds)
22  clustermap.insert( std::make_pair( std::make_pair(ds.detId(),cluster.firstStrip()),
23  clusterindex++));
24  return clustermap;
25 }
26 
27 int
30  it = tracks->begin(),
31  end = tracks->end();
32  //Compare addresses
33  for(; it!=end; it++) { if (&(*it)==track) { return it - tracks->begin(); } }
34  return -2;
35 }
36 
38 drift( const StripGeomDetUnit* stripDet, const MagneticField& magfield, const SiStripLorentzAngle& lorentzAngle ) {
39  LocalVector lbfield=( stripDet->surface()).toLocal( magfield.inTesla(stripDet->surface().position()));
40  float tanLorentzAnglePerTesla = lorentzAngle.getLorentzAngle(stripDet->geographicalId());
41  float driftz = stripDet->specificSurface().bounds().thickness();
42  float driftx =-tanLorentzAnglePerTesla * lbfield.y() * driftz;
43  float drifty = tanLorentzAnglePerTesla * lbfield.x() * driftz;
44  return LocalVector(driftx,drifty,driftz);
45 }
46 
47 }
Local3DVector LocalVector
Definition: LocalVector.h:12
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:462
int findTrackIndex(const edm::Handle< edm::View< reco::Track > > &h, const reco::Track *t)
Definition: ShallowTools.cc:28
virtual GlobalVector inTesla(const GlobalPoint &gp) const =0
Field value ad specified global point, in Tesla.
LocalVector drift(const StripGeomDetUnit *, const MagneticField &, const SiStripLorentzAngle &)
Definition: ShallowTools.cc:38
tuple magfield
Definition: HLT_ES_cff.py:2311
T y() const
Definition: PV3DBase.h:63
const Bounds & bounds() const
Definition: Surface.h:120
uint16_t firstStrip() const
LocalVector toLocal(const reco::Track::Vector &v, const Surface &s)
const Plane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:40
virtual float thickness() const =0
int iEvent
Definition: GenABIO.cc:230
float getLorentzAngle(const uint32_t &) const
DetId geographicalId() const
The label of this GeomDet.
Definition: GeomDet.h:77
#define end
Definition: vmac.h:37
tuple tracks
Definition: testEve_cfg.py:39
id_type detId() const
Definition: DetSetNew.h:84
CLUSTERMAP make_cluster_map(const edm::Event &, const edm::EDGetTokenT< edmNew::DetSetVector< SiStripCluster > > &)
Definition: ShallowTools.cc:14
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
Definition: View.h:81
std::map< std::pair< uint32_t, uint16_t >, unsigned int > CLUSTERMAP
Definition: ShallowTools.h:19
T x() const
Definition: PV3DBase.h:62
const PositionType & position() const
const Plane & specificSurface() const
Same as surface(), kept for backward compatibility.
Definition: GeomDet.h:43