99 m_maxDeltaPhi = iConfig.
getParameter<
double>(
"maxDeltaPhi");
100 m_clusterLength = iConfig.
getParameter<
double>(
"clusterLength");
101 produces<reco::VertexCollection>();
110 using namespace reco;
124 if(it->pt() > 40 && fabs(it->eta()) < 1.6)
128 selectedJets.push_back(*ca);
146 float lengthBmodule=6.66;
147 std::vector<float> zProjections;
148 for(CaloJetCollection::const_iterator jit = selectedJets.begin() ; jit != selectedJets.end() ; jit++)
155 float jetZOverRho = jit->momentum().Z()/jit->momentum().Rho();
156 int minSizeY = fabs(2.*jetZOverRho)-1;
157 int maxSizeY = fabs(2.*jetZOverRho)+2;
158 if( fabs(jit->eta()) > 1.6)
165 DetId id = it->detId();
168 float zmodule = modulepos.
z() - ((modulepos.
x()-
beamSpot->x0())*px+(modulepos.
y()-
beamSpot->y0())*py)/pt * pz/
pt;
169 if ((fabs(
deltaPhi(jit->momentum().Phi(),modulepos.
phi()))< m_maxDeltaPhi*2)&&(fabs(zmodule)<(m_maxZ+lengthBmodule/2))){
171 for(
size_t j = 0 ;
j < detset.
size() ;
j ++)
174 if(aCluster.
sizeX() < m_maxSizeX && aCluster.
sizeY() >= minSizeY && aCluster.
sizeY() <= maxSizeY) {
175 Point3DBase<float, GlobalTag> v = trackerGeometry->idToDet(
id)->surface().toGlobal(
pp->localParametersV( aCluster,( *trackerGeometry->idToDetUnit(
id)))[0].first) ;
177 if(fabs(
deltaPhi(jit->momentum().Phi(),v_bs.phi())) < m_maxDeltaPhi)
182 zProjections.push_back(z);
191 std::sort(zProjections.begin(),zProjections.end());
193 std::vector<float>::iterator itCenter = zProjections.begin();
194 std::vector<float>::iterator itLeftSide = zProjections.begin();
195 std::vector<float>::iterator itRightSide = zProjections.begin();
196 std::vector<int> counts;
197 float zCluster = m_clusterLength/2.0;
199 std::vector<float>::iterator left,right;
200 for(;itCenter!=zProjections.end(); itCenter++)
203 while(itLeftSide != zProjections.end() && (*itCenter - *itLeftSide) > zCluster ) itLeftSide++;
204 while(itRightSide != zProjections.end() && (*itRightSide - *itCenter) < zCluster ) itRightSide++;
206 int n= itRightSide-itLeftSide;
224 if(zProjections.size() > 0)
226 res=*(left+(right-left)/2);
229 e(0, 0) = 0.0015 * 0.0015;
230 e(1, 1) = 0.0015 * 0.0015;
235 pOut->push_back(thePV);
242 e(0, 0) = 0.0015 * 0.0015;
243 e(1, 1) = 0.0015 * 0.0015;
248 pOut->push_back(thePV);
T getParameter(std::string const &) const
boost::indirect_iterator< typename seq_t::const_iterator > const_iterator
boost::transform_iterator< IterHelp, const_IdIter > const_iterator
Jets made from CaloTowers.
edm::EDGetTokenT< edm::View< reco::Jet > > m_jets
bool getByToken(EDGetToken token, Handle< PROD > &result) const
#define DEFINE_FWK_MODULE(type)
Geom::Phi< T > phi() const
math::Error< dimension >::type Error
covariance error matrix (3x3)
std::vector< Vertex > VertexCollection
collection of Vertex objects
virtual void produce(edm::Event &, const edm::EventSetup &) override
edm::EDGetTokenT< SiPixelClusterCollectionNew > m_clusters
const T & max(const T &a, const T &b)
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
math::XYZPoint Point
point in the space
FastPrimaryVertexProducer(const edm::ParameterSet &)
edm::EDGetTokenT< reco::BeamSpot > m_beamSpot
Pixel cluster – collection of neighboring pixels above threshold.
std::vector< CaloJet > CaloJetCollection
collection of CaloJet objects