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 Member Functions | Private Attributes
JetCoreClusterSplitter Class Reference
Inheritance diagram for JetCoreClusterSplitter:
edm::stream::EDProducer<> edm::stream::EDProducerBase edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

 JetCoreClusterSplitter (const edm::ParameterSet &iConfig)
 
void produce (edm::Event &iEvent, const edm::EventSetup &iSetup)
 
 ~JetCoreClusterSplitter ()
 
- Public Member Functions inherited from edm::stream::EDProducer<>
 EDProducer ()=default
 
- Public Member Functions inherited from edm::stream::EDProducerBase
 EDProducerBase ()
 
ModuleDescription const & moduleDescription () const
 
virtual ~EDProducerBase ()
 
- Public Member Functions inherited from edm::ProducerBase
 ProducerBase ()
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription
const &)> 
registrationCallback () const
 used by the fwk to register list of products More...
 
virtual ~ProducerBase ()
 
- Public Member Functions inherited from edm::EDConsumerBase
 EDConsumerBase ()
 
ProductHolderIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductHolderIndexAndSkipBit > &) const
 
std::vector
< ProductHolderIndexAndSkipBit >
const & 
itemsToGetFromEvent () const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesDependentUpon (const std::string &iProcessName, std::vector< const char * > &oModuleLabels) const
 
bool registeredToConsume (ProductHolderIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
void updateLookup (BranchType iBranchType, ProductHolderIndexHelper const &)
 
virtual ~EDConsumerBase ()
 

Private Member Functions

std::pair< float, float > closestClusters (const std::vector< float > &distanceMap)
 
std::multimap< float, int > distScore (const std::vector< std::vector< float > > &distanceMap)
 
std::vector< SiPixelClusterfittingSplit (const SiPixelCluster &aCluster, float expectedADC, int sizeY, int sizeX, float jetZOverRho, unsigned int nSplitted)
 
std::multimap< float, int > secondDistDiffScore (const std::vector< std::vector< float > > &distanceMap)
 
std::multimap< float, int > secondDistScore (const std::vector< std::vector< float > > &distanceMap)
 
bool split (const SiPixelCluster &aCluster, edmNew::DetSetVector< SiPixelCluster >::FastFiller &filler, float expectedADC, int sizeY, int sizeX, float jetZOverRho)
 

Private Attributes

double centralMIPCharge_
 
double chargeFracMin_
 
double chargePerUnit_
 
edm::EDGetTokenT< edm::View
< reco::Candidate > > 
cores_
 
double deltaR_
 
double forceXError_
 
double forceYError_
 
double fractionalWidth_
 
edm::EDGetTokenT
< edmNew::DetSetVector
< SiPixelCluster > > 
pixelClusters_
 
std::string pixelCPE_
 
double ptMin_
 
bool verbose
 
edm::EDGetTokenT
< reco::VertexCollection
vertices_
 

Additional Inherited Members

- Public Types inherited from edm::stream::EDProducer<>
typedef CacheContexts< T...> CacheTypes
 
typedef CacheTypes::GlobalCache GlobalCache
 
typedef AbilityChecker< T...> HasAbility
 
typedef
CacheTypes::LuminosityBlockCache 
LuminosityBlockCache
 
typedef
LuminosityBlockContextT
< LuminosityBlockCache,
RunCache, GlobalCache
LuminosityBlockContext
 
typedef
CacheTypes::LuminosityBlockSummaryCache 
LuminosityBlockSummaryCache
 
typedef CacheTypes::RunCache RunCache
 
typedef RunContextT< RunCache,
GlobalCache
RunContext
 
typedef CacheTypes::RunSummaryCache RunSummaryCache
 
- Public Types inherited from edm::stream::EDProducerBase
typedef EDProducerAdaptorBase ModuleType
 
- Public Types inherited from edm::ProducerBase
typedef
ProductRegistryHelper::TypeLabelList 
TypeLabelList
 
- Static Public Member Functions inherited from edm::stream::EDProducerBase
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &descriptions)
 
- Protected Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Detailed Description

Definition at line 32 of file JetCoreClusterSplitter.cc.

Constructor & Destructor Documentation

JetCoreClusterSplitter::JetCoreClusterSplitter ( const edm::ParameterSet iConfig)

Definition at line 63 of file JetCoreClusterSplitter.cc.

63  :
64  verbose(iConfig.getParameter<bool>("verbose")),
65  pixelCPE_(iConfig.getParameter<std::string>("pixelCPE")),
66  ptMin_(iConfig.getParameter<double>("ptMin")),
67  deltaR_(iConfig.getParameter<double>("deltaRmax")),
68  chargeFracMin_(iConfig.getParameter<double>("chargeFractionMin")),
70  vertices_( consumes<reco::VertexCollection> (iConfig.getParameter<edm::InputTag>("vertices"))),
72  forceXError_(iConfig.getParameter<double>("forceXError")),
73  forceYError_(iConfig.getParameter<double>("forceYError")),
74  fractionalWidth_(iConfig.getParameter<double>("fractionalWidth")),
75  chargePerUnit_(iConfig.getParameter<double>("chargePerUnit")),
76  centralMIPCharge_(iConfig.getParameter<double>("centralMIPCharge"))
77 
78 {
79  produces< edmNew::DetSetVector<SiPixelCluster> >();
80 }
T getParameter(std::string const &) const
edm::EDGetTokenT< edmNew::DetSetVector< SiPixelCluster > > pixelClusters_
edm::EDGetTokenT< reco::VertexCollection > vertices_
edm::EDGetTokenT< edm::View< reco::Candidate > > cores_
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
JetCoreClusterSplitter::~JetCoreClusterSplitter ( )

Definition at line 84 of file JetCoreClusterSplitter.cc.

85 {
86 }

Member Function Documentation

std::pair< float, float > JetCoreClusterSplitter::closestClusters ( const std::vector< float > &  distanceMap)
private

Definition at line 196 of file JetCoreClusterSplitter.cc.

References i.

Referenced by distScore(), secondDistDiffScore(), and secondDistScore().

197 {
198 
199  float minDist=9e99;
200  float secondMinDist=9e99;
201  for(unsigned int i = 0; i < distanceMap.size(); i++)
202  {
203  float dist=distanceMap[i];
204  if(dist < minDist) {
205  secondMinDist=minDist;
206  minDist=dist;
207  } else if(dist < secondMinDist) {
208  secondMinDist=dist;
209  }
210  }
211  return std::pair<float,float>(minDist,secondMinDist);
212 }
int i
Definition: DBlmapReader.cc:9
std::multimap< float, int > JetCoreClusterSplitter::distScore ( const std::vector< std::vector< float > > &  distanceMap)
private

Definition at line 236 of file JetCoreClusterSplitter.cc.

References closestClusters(), and j.

237 {
238  std::multimap<float,int> scores;
239  for(unsigned int j = 0; j < distanceMap.size(); j++)
240  {
241  std::pair<float,float> d = closestClusters(distanceMap[j]);
242  scores.insert(std::pair<float,int>(-d.first,j));
243  }
244  return scores;
245 }
int j
Definition: DBlmapReader.cc:9
std::pair< float, float > closestClusters(const std::vector< float > &distanceMap)
std::vector< SiPixelCluster > JetCoreClusterSplitter::fittingSplit ( const SiPixelCluster aCluster,
float  expectedADC,
int  sizeY,
int  sizeX,
float  jetZOverRho,
unsigned int  nSplitted 
)
private

Definition at line 247 of file JetCoreClusterSplitter.cc.

References funct::abs(), ecalMGPA::adc(), SiPixelCluster::add(), centralMIPCharge_, chargePerUnit_, GetRecoTauVFromDQM_MC_cff::cl, gather_cfg::cout, alignCSCRings::e, create_public_lumi_plots::exp, forceXError_, forceYError_, fractionalWidth_, i, j, roll_playback::k, convertSQLitetoXML_cfg::output, SiPixelCluster::pixels(), secondDistScore(), SiPixelCluster::setSplitClusterErrorX(), SiPixelCluster::setSplitClusterErrorY(), mathSSE::sqrt(), x, and detailsBasic3DVector::y.

Referenced by split().

248 {
249  std::vector<SiPixelCluster> output;
250 
251  unsigned int meanExp = nSplitted;
252  if(meanExp<=1) {
253  output.push_back(aCluster);
254  return output;
255  }
256 
257  std::vector<float> clx(meanExp);
258  std::vector<float> cly(meanExp);
259  std::vector<float> cls(meanExp);
260  std::vector<float> oldclx(meanExp);
261  std::vector<float> oldcly(meanExp);
262  std::vector<SiPixelCluster::Pixel> originalpixels = aCluster.pixels();
263  std::vector<SiPixelCluster::Pixel> pixels;
264  for(unsigned int j = 0; j < originalpixels.size(); j++)
265  {
266  int sub=originalpixels[j].adc/chargePerUnit_*expectedADC/centralMIPCharge_;
267  if(sub < 1) sub=1;
268  int perDiv=originalpixels[j].adc/sub;
269  if(verbose) std::cout << "Splitting " << j << " in [ " << pixels.size() << " , " << pixels.size()+sub << " ] "<< std::endl;
270  for(int k=0;k<sub;k++)
271  {
272  if(k==sub-1) perDiv = originalpixels[j].adc - perDiv*k;
273  pixels.push_back(SiPixelCluster::Pixel(originalpixels[j].x,originalpixels[j].y,perDiv));
274  }
275  }
276  std::vector<int> clusterForPixel(pixels.size());
277  //initial values
278  for(unsigned int j = 0; j < meanExp; j++)
279  {
280  oldclx[j]=-999;
281  oldcly[j]=-999;
282  clx[j]=originalpixels[0].x+j;
283  cly[j]=originalpixels[0].y+j;
284  cls[j]=0;
285  }
286  bool stop=false;
287  int remainingSteps=100;
288  while(!stop && remainingSteps > 0){
289  remainingSteps--;
290  //Compute all distances
291  std::vector<std::vector<float> > distanceMapX( pixels.size(), std::vector<float>(meanExp));
292  std::vector<std::vector<float> > distanceMapY( pixels.size(), std::vector<float>(meanExp));
293  std::vector<std::vector<float> > distanceMap( pixels.size(), std::vector<float>(meanExp));
294  for(unsigned int j = 0; j < pixels.size(); j++)
295  {
296  if(verbose) std::cout << "pixel pos " << j << " " << pixels[j].x << " " << pixels[j].y << std::endl;
297  for(unsigned int i = 0; i < meanExp; i++)
298  {
299  distanceMapX[j][i]=1.*pixels[j].x-clx[i];
300  distanceMapY[j][i]=1.*pixels[j].y-cly[i];
301  float dist=0;
302  // float sizeX=2;
303  if(std::abs(distanceMapX[j][i])>sizeX/2.)
304  {
305  dist+=(std::abs(distanceMapX[j][i])-sizeX/2.+1)*(std::abs(distanceMapX[j][i])-sizeX/2.+1);
306  } else {
307  dist+=distanceMapX[j][i]/sizeX*2*distanceMapX[j][i]/sizeX*2;
308  }
309  // dist+=1.*distanceMapX[j][i]*distanceMapX[j][i];
310 
311  if(std::abs(distanceMapY[j][i])>sizeY/2.)
312  {
313  dist+=1.*(std::abs(distanceMapY[j][i])-sizeY/2.+1.)*(std::abs(distanceMapY[j][i])-sizeY/2.+1.);
314  } else {
315  dist+=1.*distanceMapY[j][i]/sizeY*2.*distanceMapY[j][i]/sizeY*2.;
316  }
317  distanceMap[j][i]=sqrt(dist);
318  if(verbose) std::cout << "Cluster " << i << " Pixel " << j << " distances: " << distanceMapX[j][i] << " " << distanceMapY[j][i] << " " << distanceMap[j][i] << std::endl;
319 
320  }
321 
322  }
323  //Compute scores for sequential addition
324  std::multimap<float,int> scores;
325  //Using different rankings to improve convergence (as Giulio proposed)
326 // if(remainingSteps > 70){
327  scores=secondDistScore(distanceMap);
328 // } else { //if(remainingSteps > 40 ) {
329 // scores=secondDistDiffScore(distanceMap);
330 // } else {
331 // scores = distScore(distanceMap);
332 // }
333 
334 
335  //Iterate starting from the ones with furthest second best clusters, i.e. easy choices
336  std::vector<float> weightOfPixel(pixels.size());
337  for(std::multimap<float,int>::iterator it=scores.begin(); it!=scores.end(); it++)
338  {
339  int j=it->second;
340  if(verbose) std::cout << "Pixel " << j << " with score " << it->first << std::endl;
341  //find cluster that is both close and has some charge still to assign
342  float maxEst=0;
343  int cl=-1;
344  for(unsigned int i = 0; i < meanExp; i++)
345  {
346 // float nsig=(cls[i]*cls[i]-expectedADC*expectedADC)/2./(expectedADC*0.2); //20% uncertainty? realistic from Landau?
347  float nsig=(cls[i]-expectedADC)/(expectedADC*fractionalWidth_); //20% uncertainty? realistic from Landau?
348  float clQest=1./(1.+exp(nsig))+1e-6; //1./(1.+exp(x*x-3*3))
349  float clDest=1./(distanceMap[j][i]+0.05);
350 
351  if(verbose) std::cout <<" Q: " << clQest << " D: " << clDest << " " << distanceMap[j][i] << std::endl;
352  float est=clQest*clDest;
353  if(est> maxEst) {
354  cl=i;
355  maxEst=est;
356  }
357  }
358  cls[cl]+=pixels[j].adc;
359  clusterForPixel[j]=cl;
360  weightOfPixel[j]=maxEst;
361  if(verbose) std::cout << "Pixel j weight " << weightOfPixel[j] << " " << j << std::endl;
362  }
363  //Recompute cluster centers
364  stop=true;
365  for(unsigned int i = 0; i < meanExp; i++){
366  if(std::abs(clx[i]-oldclx[i]) > 0.01) stop = false; //still moving
367  if(std::abs(cly[i]-oldcly[i]) > 0.01) stop = false;
368  oldclx[i]=clx[i]; oldcly[i]=cly[i]; clx[i]=0; cly[i]=0; cls[i]=1e-99;
369  }
370  for(unsigned int j = 0; j < pixels.size(); j++)
371  {
372  if(clusterForPixel[j]<0) continue;
373  if(verbose) std::cout << "x " << pixels[j].x <<" * " << pixels[j].adc << " * " << weightOfPixel[j]<<std::endl;
374  clx[clusterForPixel[j]]+=pixels[j].x*pixels[j].adc;
375  cly[clusterForPixel[j]]+=pixels[j].y*pixels[j].adc;
376  cls[clusterForPixel[j]]+=pixels[j].adc;
377  // std::cout << "update cluster " << clusterForPixel[j] << " x,y " << clx[clusterForPixel[j]] << " " << cly[clusterForPixel[j]] << "weight x,y " << cls[clusterForPixel[j]] << " " << clx[clusterForPixel[j]]/cls[clusterForPixel[j]] << " " << cly[clusterForPixel[j]]/cls[clusterForPixel[j]] <<std::endl;
378 
379  }
380  for(unsigned int i = 0; i < meanExp; i++){
381  if(cls[i]!=0){
382  clx[i]/=cls[i];
383  cly[i]/=cls[i];
384  }
385  if(verbose) std::cout << "Center for cluster " << i << " x,y " << clx[i] << " " << cly[i] << std::endl;
386  cls[i]=0;
387  }
388 
389 
390  }
391  if(verbose) std::cout << "maxstep " << remainingSteps << std::endl;
392  //accumulate pixel with same cl
393  std::vector<std::vector<SiPixelCluster::Pixel> > pixelsForCl(meanExp);
394  for(int cl=0;cl<(int)meanExp;cl++){
395  for(unsigned int j = 0; j < pixels.size(); j++) {
396  if(clusterForPixel[j]==cl and pixels[j].adc!=0) { //for each pixel of cluster cl find the other pixels with same x,y and accumulate+reset their adc
397  for(unsigned int k = j+1; k < pixels.size(); k++)
398  {
399  if(pixels[k].adc!=0 and pixels[k].x==pixels[j].x and pixels[k].y==pixels[j].y)
400  {
401  pixels[j].adc+=pixels[k].adc;
402  pixels[k].adc=0;
403  }
404  }
405  pixelsForCl[cl].push_back(pixels[j]);
406  }
407  }
408  }
409 
410  // std::vector<std::vector<std::vector<SiPixelCluster::PixelPos *> > > pixelMap(meanExp,std::vector<std::vector<SiPixelCluster::PixelPos *> >(512,std::vector<SiPixelCluster::Pixel *>(512,0)));
411 
412 
413 
414  for(int cl=0;cl<(int)meanExp;cl++){
415  SiPixelCluster * cluster=0;
416  if(verbose) std::cout << "Pixels of cl " << cl << " " ;
417  for(unsigned int j = 0; j < pixelsForCl[cl].size(); j++) {
418  if(verbose) std::cout << pixelsForCl[cl][j].x<<","<<pixelsForCl[cl][j].y<<"|";
419  if(cluster){
420 
421  SiPixelCluster::PixelPos newpix(pixelsForCl[cl][j].x,pixelsForCl[cl][j].y);
422  cluster->add( newpix, pixelsForCl[cl][j].adc);
423  }
424  else
425  {
426  SiPixelCluster::PixelPos newpix(pixelsForCl[cl][j].x,pixelsForCl[cl][j].y);
427  cluster = new SiPixelCluster( newpix,pixelsForCl[cl][j].adc ); // create protocluster
428  }
429  }
430  if(verbose) std::cout << std::endl;
431  if(cluster){
434  output.push_back(*cluster);
435  delete cluster;
436  }
437  }
438  // if(verbose) std::cout << "Weights" << std::endl;
439  // if(verbose) print(theWeights,aCluster,1);
440  // if(verbose) std::cout << "Unused charge" << std::endl;
441  // if(verbose) print(theBufferResidual,aCluster);
442 
443  return output;
444 }
int adc(sample_type sample)
get the ADC sample (12 bits)
int i
Definition: DBlmapReader.cc:9
void setSplitClusterErrorY(float erry)
T sqrt(T t)
Definition: SSEVec.h:48
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
int j
Definition: DBlmapReader.cc:9
void add(const PixelPos &pix, int adc)
void setSplitClusterErrorX(float errx)
Pixel cluster – collection of neighboring pixels above threshold.
tuple cout
Definition: gather_cfg.py:121
Definition: DDAxes.h:10
std::multimap< float, int > secondDistScore(const std::vector< std::vector< float > > &distanceMap)
const std::vector< Pixel > pixels() const
void JetCoreClusterSplitter::produce ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
virtual

Implements edm::stream::EDProducerBase.

Definition at line 90 of file JetCoreClusterSplitter.cc.

References edmNew::DetSetVector< T >::begin(), EnergyCorrector::c, centralMIPCharge_, SiPixelCluster::charge(), chargeFracMin_, cores_, gather_cfg::cout, deltaR(), deltaR_, edmNew::DetSetVector< T >::end(), first, geometry, edm::EventSetup::get(), edm::Event::getByToken(), edmNew::DetSetVector< T >::id(), metsig::jet, reco::Candidate::momentum(), convertSQLitetoXML_cfg::output, pixelClusters_, pixelCPE_, createTree::pp, ptMin_, edm::Event::put(), MetAnalyzer::pv(), reco::Candidate::px(), reco::Candidate::py(), reco::Candidate::pz(), SiPixelCluster::setSplitClusterErrorX(), SiPixelCluster::setSplitClusterErrorY(), SiPixelCluster::sizeX(), SiPixelCluster::sizeY(), split(), mathSSE::sqrt(), GeomDet::surface(), Surface::toGlobal(), vertices_, and PV3DBase< T, PVType, FrameType >::z().

91 {
92  using namespace edm;
95 
97  iEvent.getByToken(pixelClusters_, inputPixelClusters);
98 
100  iEvent.getByToken(vertices_, vertices);
101  const reco::Vertex & pv = (*vertices)[0];
102 
104  iEvent.getByToken(cores_, cores);
105 
108  iSetup.get<TkPixelCPERecord>().get(pixelCPE_ , pe );
109  pp = pe.product();
110 
111  std::auto_ptr<edmNew::DetSetVector<SiPixelCluster> > output(new edmNew::DetSetVector<SiPixelCluster>());
112 
113  edmNew::DetSetVector<SiPixelCluster>::const_iterator detIt=inputPixelClusters->begin();
114  for(;detIt!=inputPixelClusters->end();detIt++)
115  {
117  const edmNew::DetSet<SiPixelCluster> & detset= *detIt;
118  const GeomDet *det = geometry->idToDet( detset.id() );
119  for(edmNew::DetSet<SiPixelCluster>::const_iterator cluster=detset.begin(); cluster!=detset.end(); cluster++)
120  {
121  const SiPixelCluster & aCluster = *cluster;
122  bool hasBeenSplit = false;
123  bool shouldBeSplit = false;
124  GlobalPoint cPos = det->surface().toGlobal(pp->localParametersV( aCluster,( *geometry->idToDetUnit(detIt->id())))[0].first) ;
125  GlobalPoint ppv(pv.position().x(),pv.position().y(),pv.position().z());
126  GlobalVector clusterDir = cPos -ppv;
127  for(unsigned int ji = 0; ji < cores->size() ; ji++)
128  {
129  if((*cores)[ji].pt() > ptMin_)
130  {
131  const reco::Candidate & jet = (*cores)[ji];
132  GlobalVector jetDir(jet.px(),jet.py(),jet.pz());
133  if(Geom::deltaR(jetDir,clusterDir) < deltaR_) {
134  // check if the cluster has to be splitted
135 
136  bool isEndCap = (fabs(cPos.z())>30); //FIXME: check detID instead!
137  float jetZOverRho = jet.momentum().Z()/jet.momentum().Rho();
138  if(isEndCap) jetZOverRho=jet.momentum().Rho()/jet.momentum().Z();
139  float expSizeY=fabs(sqrt(1.3*1.3+1.9*1.9*jetZOverRho*jetZOverRho));
140  if(expSizeY<1) expSizeY=1.;
141  float expSizeX=1.5;
142  if(isEndCap) {expSizeX=expSizeY; expSizeY = 1.5;} // in endcap col/rows are switched
143  float expCharge=sqrt(1.08+jetZOverRho*jetZOverRho)*centralMIPCharge_;
144 
145  if(aCluster.charge() > expCharge*chargeFracMin_ && (aCluster.sizeX() > expSizeX+1 || aCluster.sizeY() > expSizeY+1) )
146  {
147  shouldBeSplit=true;
148  if(verbose) std::cout << "Trying to split: charge and deltaR " <<aCluster.charge() << " " << Geom::deltaR(jetDir,clusterDir)
149  << " size x y"<< aCluster.sizeX() << " " << aCluster.sizeY()<< " detid " << detIt->id() << std::endl;
150  if(verbose)std::cout << "jetZOverRho="<< jetZOverRho << std::endl;
151 
152  if(split(aCluster,filler,expCharge,expSizeY,expSizeX,jetZOverRho))
153  {
154  hasBeenSplit=true;
155  }
156  }
157 
158  }
159 
160  }
161  }
162  if(!hasBeenSplit)
163  {
164  SiPixelCluster c=aCluster;
165  if(shouldBeSplit) {
166  //blowup the error if we failed to split a splittable cluster (does it ever happen)
167  c.setSplitClusterErrorX(c.sizeX()*100./3.); //this is not really blowing up .. TODO: tune
168  c.setSplitClusterErrorY(c.sizeY()*150./3.);
169  }
170  filler.push_back(c);
171  }
172 
173  }
174  }
175  iEvent.put(output);
176 }
GlobalPoint toGlobal(const Point2DBase< Scalar, LocalTag > lp) const
Definition: Surface.h:114
float charge() const
boost::transform_iterator< IterHelp, const_IdIter > const_iterator
const_iterator end(bool update=false) const
void setSplitClusterErrorY(float erry)
tuple pp
Definition: createTree.py:15
edm::EDGetTokenT< edmNew::DetSetVector< SiPixelCluster > > pixelClusters_
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:446
virtual double pz() const =0
z coordinate of momentum vector
bool split(const SiPixelCluster &aCluster, edmNew::DetSetVector< SiPixelCluster >::FastFiller &filler, float expectedADC, int sizeY, int sizeX, float jetZOverRho)
data_type const * const_iterator
Definition: DetSetNew.h:30
edm::EDGetTokenT< reco::VertexCollection > vertices_
id_type id(size_t cell) const
const Plane & surface() const
The nominal surface of the GeomDet.
Definition: GeomDet.h:40
edm::EDGetTokenT< edm::View< reco::Candidate > > cores_
virtual Vector momentum() const =0
spatial momentum vector
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
Definition: Event.h:113
T sqrt(T t)
Definition: SSEVec.h:48
T z() const
Definition: PV3DBase.h:64
virtual double py() const =0
y coordinate of momentum vector
bool first
Definition: L1TdeRCT.cc:75
virtual double px() const =0
x coordinate of momentum vector
double deltaR(double eta1, double eta2, double phi1, double phi2)
Definition: TreeUtility.cc:17
void setSplitClusterErrorX(float errx)
const T & get() const
Definition: EventSetup.h:55
int sizeY() const
ESHandle< TrackerGeometry > geometry
Pixel cluster – collection of neighboring pixels above threshold.
tuple cout
Definition: gather_cfg.py:121
int sizeX() const
const_iterator begin(bool update=false) const
std::multimap< float, int > JetCoreClusterSplitter::secondDistDiffScore ( const std::vector< std::vector< float > > &  distanceMap)
private

Definition at line 214 of file JetCoreClusterSplitter.cc.

References closestClusters(), and j.

215 {
216  std::multimap<float,int> scores;
217  for(unsigned int j = 0; j < distanceMap.size(); j++)
218  {
219  std::pair<float,float> d = closestClusters(distanceMap[j]);
220  scores.insert(std::pair<float,int>(d.second-d.first,j));
221  }
222  return scores;
223 }
int j
Definition: DBlmapReader.cc:9
std::pair< float, float > closestClusters(const std::vector< float > &distanceMap)
std::multimap< float, int > JetCoreClusterSplitter::secondDistScore ( const std::vector< std::vector< float > > &  distanceMap)
private

Definition at line 225 of file JetCoreClusterSplitter.cc.

References closestClusters(), and j.

Referenced by fittingSplit().

226 {
227  std::multimap<float,int> scores;
228  for(unsigned int j = 0; j < distanceMap.size(); j++)
229  {
230  std::pair<float,float> d = closestClusters(distanceMap[j]);
231  scores.insert(std::pair<float,int>(-d.second,j));
232  }
233  return scores;
234 }
int j
Definition: DBlmapReader.cc:9
std::pair< float, float > closestClusters(const std::vector< float > &distanceMap)
bool JetCoreClusterSplitter::split ( const SiPixelCluster aCluster,
edmNew::DetSetVector< SiPixelCluster >::FastFiller &  filler,
float  expectedADC,
int  sizeY,
int  sizeX,
float  jetZOverRho 
)
private

Definition at line 181 of file JetCoreClusterSplitter.cc.

References SiPixelCluster::charge(), fittingSplit(), i, and edmNew::DetSetVector< T >::FastFiller::push_back().

Referenced by produce().

182 {
183  //This function should test several configuration of splitting, and then return the one with best chi2
184 
185  std::vector<SiPixelCluster> sp=fittingSplit(aCluster,expectedADC,sizeY,sizeX,jetZOverRho,floor(aCluster.charge() / expectedADC +0.5));
186 
187  //for the config with best chi2
188  for(unsigned int i = 0; i < sp.size();i++ )
189  {
190  filler.push_back(sp[i]);
191  }
192 
193  return (sp.size() > 0);
194 }
int i
Definition: DBlmapReader.cc:9
float charge() const
void push_back(data_type const &d)
std::vector< SiPixelCluster > fittingSplit(const SiPixelCluster &aCluster, float expectedADC, int sizeY, int sizeX, float jetZOverRho, unsigned int nSplitted)

Member Data Documentation

double JetCoreClusterSplitter::centralMIPCharge_
private

Definition at line 59 of file JetCoreClusterSplitter.cc.

Referenced by fittingSplit(), and produce().

double JetCoreClusterSplitter::chargeFracMin_
private

Definition at line 51 of file JetCoreClusterSplitter.cc.

Referenced by produce().

double JetCoreClusterSplitter::chargePerUnit_
private

Definition at line 58 of file JetCoreClusterSplitter.cc.

Referenced by fittingSplit().

edm::EDGetTokenT<edm::View<reco::Candidate> > JetCoreClusterSplitter::cores_
private

Definition at line 54 of file JetCoreClusterSplitter.cc.

Referenced by produce().

double JetCoreClusterSplitter::deltaR_
private

Definition at line 50 of file JetCoreClusterSplitter.cc.

Referenced by produce().

double JetCoreClusterSplitter::forceXError_
private

Definition at line 55 of file JetCoreClusterSplitter.cc.

Referenced by fittingSplit().

double JetCoreClusterSplitter::forceYError_
private

Definition at line 56 of file JetCoreClusterSplitter.cc.

Referenced by fittingSplit().

double JetCoreClusterSplitter::fractionalWidth_
private

Definition at line 57 of file JetCoreClusterSplitter.cc.

Referenced by fittingSplit().

edm::EDGetTokenT<edmNew::DetSetVector<SiPixelCluster> > JetCoreClusterSplitter::pixelClusters_
private

Definition at line 52 of file JetCoreClusterSplitter.cc.

Referenced by produce().

std::string JetCoreClusterSplitter::pixelCPE_
private

Definition at line 48 of file JetCoreClusterSplitter.cc.

Referenced by produce().

double JetCoreClusterSplitter::ptMin_
private

Definition at line 49 of file JetCoreClusterSplitter.cc.

Referenced by produce().

bool JetCoreClusterSplitter::verbose
private

Definition at line 47 of file JetCoreClusterSplitter.cc.

edm::EDGetTokenT<reco::VertexCollection> JetCoreClusterSplitter::vertices_
private

Definition at line 53 of file JetCoreClusterSplitter.cc.

Referenced by produce().