CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Private Member Functions | Private Attributes | Friends
PFBlockAlgo Class Reference

Particle Flow Algorithm. More...

#include <PFBlockAlgo.h>

Public Types

typedef std::vector< std::unique_ptr< reco::PFBlockElement > > ElementList
 
typedef std::array< std::pair< unsigned int, unsigned int >, reco::PFBlockElement::kNBETypesElementRanges
 
typedef reco::PFBlockCollection::const_iterator IBC
 
typedef ElementList::iterator IE
 define these in *Fwd files in DataFormats/ParticleFlowReco? More...
 
typedef ElementList::const_iterator IEC
 
typedef std::unique_ptr< BlockElementImporterBaseImporterPtr
 
typedef std::unique_ptr< KDTreeLinkerBaseKDTreePtr
 
typedef std::unique_ptr< BlockElementLinkerBaseLinkTestPtr
 

Public Member Functions

const std::unique_ptr< reco::PFBlockCollection > & blocks () const
 
void buildElements (const edm::Event &)
 
void findBlocks ()
 build blocks More...
 
 PFBlockAlgo ()
 
void setDebug (bool debug)
 sets debug printout flag More...
 
void setImporters (const std::vector< edm::ParameterSet > &, edm::ConsumesCollector &)
 
void setLinkers (const std::vector< edm::ParameterSet > &)
 
std::unique_ptr< reco::PFBlockCollectiontransferBlocks ()
 
void updateEventSetup (const edm::EventSetup &)
 
 ~PFBlockAlgo ()
 

Private Member Functions

void link (const reco::PFBlockElement *el1, const reco::PFBlockElement *el2, PFBlockLink::Type &linktype, reco::PFBlock::LinkTest &linktest, double &dist) const
 check whether 2 elements are linked. Returns distance and linktype More...
 
bool linkPrefilter (const reco::PFBlockElement *last, const reco::PFBlockElement *next) const
 Avoid to check links when not useful. More...
 
void packLinks (reco::PFBlock &block, const std::unordered_map< std::pair< unsigned int, unsigned int >, PFBlockLink > &links) const
 

Private Attributes

std::vector< ElementList::value_type::pointer > bare_elements_
 
std::unique_ptr< reco::PFBlockCollectionblocks_
 
bool debug_
 if true, debug printouts activated More...
 
ElementList elements_
 
const std::unordered_map< std::string, reco::PFBlockElement::TypeelementTypes_
 
std::vector< ImporterPtrimporters_
 
std::vector< KDTreePtrkdtrees_
 
std::vector< LinkTestPtrlinkTests_
 
unsigned int linkTestSquare_ [reco::PFBlockElement::kNBETypes][reco::PFBlockElement::kNBETypes]
 
ElementRanges ranges_
 
bool useHO_
 

Friends

std::ostream & operator<< (std::ostream &, const PFBlockAlgo &)
 

Detailed Description

Particle Flow Algorithm.

Author
Colin Bernet (rewrite/refactor by L. Gray)
Date
January 2006 (April 2014)

Definition at line 91 of file PFBlockAlgo.h.

Member Typedef Documentation

typedef std::vector<std::unique_ptr<reco::PFBlockElement> > PFBlockAlgo::ElementList

Definition at line 95 of file PFBlockAlgo.h.

typedef std::array<std::pair<unsigned int,unsigned int>,reco::PFBlockElement::kNBETypes> PFBlockAlgo::ElementRanges

Definition at line 104 of file PFBlockAlgo.h.

typedef reco::PFBlockCollection::const_iterator PFBlockAlgo::IBC

Definition at line 102 of file PFBlockAlgo.h.

typedef ElementList::iterator PFBlockAlgo::IE

define these in *Fwd files in DataFormats/ParticleFlowReco?

Definition at line 100 of file PFBlockAlgo.h.

typedef ElementList::const_iterator PFBlockAlgo::IEC

Definition at line 101 of file PFBlockAlgo.h.

Definition at line 96 of file PFBlockAlgo.h.

typedef std::unique_ptr<KDTreeLinkerBase> PFBlockAlgo::KDTreePtr

Definition at line 98 of file PFBlockAlgo.h.

Definition at line 97 of file PFBlockAlgo.h.

Constructor & Destructor Documentation

PFBlockAlgo::PFBlockAlgo ( )

Definition at line 67 of file PFBlockAlgo.cc.

References ECAL, HCAL, hcaldqm::constants::HO, and INIT_ENTRY.

67  :
69  debug_(false),
70  elementTypes_( {
71  INIT_ENTRY(PFBlockElement::TRACK),
72  INIT_ENTRY(PFBlockElement::PS1),
73  INIT_ENTRY(PFBlockElement::PS2),
76  INIT_ENTRY(PFBlockElement::GSF),
77  INIT_ENTRY(PFBlockElement::BREM),
78  INIT_ENTRY(PFBlockElement::HFEM),
79  INIT_ENTRY(PFBlockElement::HFHAD),
80  INIT_ENTRY(PFBlockElement::SC),
82  INIT_ENTRY(PFBlockElement::HGCAL)
83  } ) {}
std::unique_ptr< reco::PFBlockCollection > blocks_
Definition: PFBlockAlgo.h:155
#define INIT_ENTRY(name)
Definition: PFBlockAlgo.cc:17
const std::unordered_map< std::string, reco::PFBlockElement::Type > elementTypes_
Definition: PFBlockAlgo.h:171
std::vector< PFBlock > PFBlockCollection
collection of PFBlock objects
Definition: PFBlockFwd.h:11
bool debug_
if true, debug printouts activated
Definition: PFBlockAlgo.h:163
PFBlockAlgo::~PFBlockAlgo ( )

Definition at line 145 of file PFBlockAlgo.cc.

References gather_cfg::cout, debug_, and elements_.

145  {
146 
147 #ifdef PFLOW_DEBUG
148  if(debug_)
149  cout<<"~PFBlockAlgo - number of remaining elements: "
150  <<elements_.size()<<endl;
151 #endif
152 }
ElementList elements_
Definition: PFBlockAlgo.h:158
bool debug_
if true, debug printouts activated
Definition: PFBlockAlgo.h:163

Member Function Documentation

const std::unique_ptr< reco::PFBlockCollection >& PFBlockAlgo::blocks ( ) const
inline
Returns
collection of blocks

Definition at line 129 of file PFBlockAlgo.h.

Referenced by operator<<().

130  {return blocks_;}
std::unique_ptr< reco::PFBlockCollection > blocks_
Definition: PFBlockAlgo.h:155
void PFBlockAlgo::buildElements ( const edm::Event evt)

Definition at line 335 of file PFBlockAlgo.cc.

References a, b, bare_elements_, elements_, mps_fire::i, importers_, kdtrees_, and ranges_.

335  {
336  // import block elements as defined in python configuration
337  ranges_.fill(std::make_pair(0,0));
338  elements_.clear();
339  for( const auto& importer : importers_ ) {
340  importer->importToBlock(evt,elements_);
341  }
342 
343  std::sort(elements_.begin(),elements_.end(),
344  [](const auto& a, const auto& b) { return a->type() < b->type(); } );
345 
346  bare_elements_.resize(elements_.size());
347  for( unsigned i = 0; i < elements_.size(); ++i ) {
348  bare_elements_[i] = elements_[i].get();
349  }
350 
351  // list is now partitioned, so mark the boundaries so we can efficiently skip chunks
352  unsigned current_type = ( !elements_.empty() ? elements_[0]->type() : 0 );
353  unsigned last_type = ( !elements_.empty() ? elements_.back()->type() : 0 );
354  ranges_[current_type].first = 0;
355  ranges_[last_type].second = elements_.size()-1;
356  for( size_t i = 0; i < elements_.size(); ++i ) {
357  const auto the_type = elements_[i]->type();
358  if( the_type != current_type ) {
359  ranges_[the_type].first = i;
360  ranges_[current_type].second = i-1;
361  current_type = the_type;
362  }
363  }
364  // -------------- Loop over block elements ---------------------
365 
366  // Here we provide to all KDTree linkers the collections to link.
367  // Glowinski & Gouzevitch
368 
369  for (ElementList::iterator it = elements_.begin();
370  it != elements_.end(); ++it) {
371  for( const auto& kdtree : kdtrees_ ) {
372  if( (*it)->type() == kdtree->targetType() ) {
373  kdtree->insertTargetElt(it->get());
374  }
375  if( (*it)->type() == kdtree->fieldType() ) {
376  kdtree->insertFieldClusterElt(it->get());
377  }
378  }
379  }
380  //std::cout << "(new) imported: " << elements_.size() << " elements!" << std::endl;
381 }
ElementList elements_
Definition: PFBlockAlgo.h:158
std::vector< KDTreePtr > kdtrees_
Definition: PFBlockAlgo.h:175
ElementRanges ranges_
Definition: PFBlockAlgo.h:160
double b
Definition: hdecay.h:120
double a
Definition: hdecay.h:121
std::vector< ElementList::value_type::pointer > bare_elements_
Definition: PFBlockAlgo.h:159
std::vector< ImporterPtr > importers_
Definition: PFBlockAlgo.h:168
void PFBlockAlgo::findBlocks ( )

build blocks

Definition at line 154 of file PFBlockAlgo.cc.

References bare_elements_, blocks_, elements_, mps_fire::i, kdtrees_, crabWrapper::key, relativeConstraints::keys, linkPrefilter(), linkTests_, linkTestSquare_, min(), PFBlockLink::NONE, p1, p2, packLinks(), and ranges_.

154  {
155  // Glowinski & Gouzevitch
156  for( const auto& kdtree : kdtrees_ ) {
157  kdtree->process();
158  }
159  // !Glowinski & Gouzevitch
160  // the blocks have not been passed to the event, and need to be cleared
161  if( blocks_.get() ) blocks_->clear();
162  else blocks_.reset( new reco::PFBlockCollection );
163  blocks_->reserve(elements_.size());
164 
165  QuickUnion qu(bare_elements_.size());
166  const auto elem_size = bare_elements_.size();
167  for( unsigned i = 0; i < elem_size; ++i ) {
168  for( unsigned j = 0; j < elem_size; ++j ) {
169  if( qu.connected(i,j) || j == i ) continue;
170  if( !linkTests_[linkTestSquare_[bare_elements_[i]->type()][bare_elements_[j]->type()]] ) {
171  j = ranges_[bare_elements_[j]->type()].second;
172  continue;
173  }
174  auto p1(bare_elements_[i]), p2(bare_elements_[j]);
175  const PFBlockElement::Type type1 = p1->type();
176  const PFBlockElement::Type type2 = p2->type();
177  const unsigned index = linkTestSquare_[type1][type2];
178  if( linkTests_[index]->linkPrefilter(p1,p2) ) {
179  const double dist = linkTests_[index]->testLink(p1,p2);
180  // compute linking info if it is possible
181  if( dist > -0.5 ) {
182  qu.unite(i,j);
183  }
184  }
185  }
186  }
187 
188  std::unordered_multimap<unsigned,unsigned> blocksmap(elements_.size());
189  std::vector<unsigned> keys;
190  keys.reserve(elements_.size());
191  for( unsigned i = 0; i < elements_.size(); ++i ) {
192  unsigned key = i;
193  while( key != qu.find(key) ) key = qu.find(key); // make sure we always find the root node...
194  auto pos = std::lower_bound(keys.begin(),keys.end(),key);
195  if( pos == keys.end() || *pos != key ) {
196  keys.insert(pos,key);
197  }
198  blocksmap.emplace(key,i);
199  }
200 
202  PFBlock::LinkTest linktest = PFBlock::LINKTEST_RECHIT;
203  for( auto key : keys ) {
204  blocks_->push_back( reco::PFBlock() );
205  auto range = blocksmap.equal_range(key);
206  auto& the_block = blocks_->back();
207  ElementList::value_type::pointer p1(bare_elements_[range.first->second]);
208  the_block.addElement(p1);
209  const unsigned block_size = blocksmap.count(key) + 1;
210  //reserve up to 1M or 8MB; pay rehash cost for more
211  std::unordered_map<std::pair<unsigned int,unsigned int>, PFBlockLink > links(min(1000000u,block_size*block_size));
212  auto itr = range.first;
213  ++itr;
214  for( ; itr != range.second; ++itr ) {
215  ElementList::value_type::pointer p2(bare_elements_[itr->second]);
216  const PFBlockElement::Type type1 = p1->type();
217  const PFBlockElement::Type type2 = p2->type();
218  the_block.addElement(p2);
219  linktest = PFBlock::LINKTEST_RECHIT; //rechit by default
220  linktype = static_cast<PFBlockLink::Type>(1<<(type1-1)|1<<(type2-1));
221  const unsigned index = linkTestSquare_[type1][type2];
222  if( nullptr != linkTests_[index] ) {
223  const double dist = linkTests_[index]->testLink(p1,p2);
224  links.emplace( std::make_pair(p1->index(), p2->index()) ,
225  PFBlockLink( linktype, linktest, dist,
226  p1->index(), p2->index() ) );
227  }
228  }
229  packLinks( the_block, links );
230  }
231 
232  bare_elements_.clear();
233  elements_.clear();
234 }
std::unique_ptr< reco::PFBlockCollection > blocks_
Definition: PFBlockAlgo.h:155
type
Definition: HCALResponse.h:21
ElementList elements_
Definition: PFBlockAlgo.h:158
std::vector< KDTreePtr > kdtrees_
Definition: PFBlockAlgo.h:175
T min(T a, T b)
Definition: MathUtil.h:58
std::vector< PFBlock > PFBlockCollection
collection of PFBlock objects
Definition: PFBlockFwd.h:11
double p2[4]
Definition: TauolaWrapper.h:90
ElementRanges ranges_
Definition: PFBlockAlgo.h:160
void packLinks(reco::PFBlock &block, const std::unordered_map< std::pair< unsigned int, unsigned int >, PFBlockLink > &links) const
Definition: PFBlockAlgo.cc:237
unsigned int linkTestSquare_[reco::PFBlockElement::kNBETypes][reco::PFBlockElement::kNBETypes]
Definition: PFBlockAlgo.h:173
bool linkPrefilter(const reco::PFBlockElement *last, const reco::PFBlockElement *next) const
Avoid to check links when not useful.
Definition: PFBlockAlgo.cc:294
double p1[4]
Definition: TauolaWrapper.h:89
std::vector< ElementList::value_type::pointer > bare_elements_
Definition: PFBlockAlgo.h:159
std::vector< LinkTestPtr > linkTests_
Definition: PFBlockAlgo.h:172
Block of elements.
Definition: PFBlock.h:30
void PFBlockAlgo::link ( const reco::PFBlockElement el1,
const reco::PFBlockElement el2,
PFBlockLink::Type linktype,
reco::PFBlock::LinkTest linktest,
double &  dist 
) const
inlineprivate

check whether 2 elements are linked. Returns distance and linktype

Definition at line 305 of file PFBlockAlgo.cc.

References constexpr, gather_cfg::cout, debug_, reco::PFBlockElement::kNBETypes, linkTests_, SiStripPI::max, min(), and reco::PFBlockElement::type().

Referenced by packLinks().

309  {
310  constexpr unsigned rowsize = reco::PFBlockElement::kNBETypes;
311  dist=-1.0;
312  linktest = PFBlock::LINKTEST_RECHIT; //rechit by default
313  const PFBlockElement::Type type1 = el1->type();
314  const PFBlockElement::Type type2 = el2->type();
315  linktype = static_cast<PFBlockLink::Type>(1<<(type1-1)|1<<(type2-1));
316  const unsigned index = rowsize*std::max(type1,type2) + std::min(type1,type2);
317  if(debug_ ) {
318  std::cout << " PFBlockAlgo links type1 " << type1
319  << " type2 " << type2 << std::endl;
320  }
321 
322  // index is always checked in the preFilter above, no need to check here
323  dist = linkTests_[index]->testLink(el1,el2);
324 }
Type type() const
#define constexpr
T min(T a, T b)
Definition: MathUtil.h:58
bool debug_
if true, debug printouts activated
Definition: PFBlockAlgo.h:163
std::vector< LinkTestPtr > linkTests_
Definition: PFBlockAlgo.h:172
bool PFBlockAlgo::linkPrefilter ( const reco::PFBlockElement last,
const reco::PFBlockElement next 
) const
inlineprivate

Avoid to check links when not useful.

Definition at line 294 of file PFBlockAlgo.cc.

References constexpr, reco::PFBlockElement::kNBETypes, plotBeamSpotDB::last, linkTests_, SiStripPI::max, min(), GetRecoTauVFromDQM_MC_cff::next, and mps_fire::result.

Referenced by findBlocks().

295  {
296  constexpr unsigned rowsize = reco::PFBlockElement::kNBETypes;
297  const PFBlockElement::Type type1 = (last)->type();
298  const PFBlockElement::Type type2 = (next)->type();
299  const unsigned index = rowsize*std::max(type1,type2) + std::min(type1,type2);
300  bool result = linkTests_[index]->linkPrefilter(last,next);
301  return result;
302 }
type
Definition: HCALResponse.h:21
#define constexpr
T min(T a, T b)
Definition: MathUtil.h:58
std::vector< LinkTestPtr > linkTests_
Definition: PFBlockAlgo.h:172
void PFBlockAlgo::packLinks ( reco::PFBlock block,
const std::unordered_map< std::pair< unsigned int, unsigned int >, PFBlockLink > &  links 
) const
private

compute missing links in the blocks (the recursive procedure does not build all links)

Definition at line 237 of file PFBlockAlgo.cc.

References reco::PFBlock::bookLinkData(), constexpr, gather_cfg::cout, debug_, reco::PFBlock::elements(), reco::PFBlockElement::kNBETypes, link(), reco::PFBlock::linkData(), linkTests_, PFBlockLink::NONE, reco::PFBlock::setLink(), and edm::OwnVector< T, P >::size().

Referenced by findBlocks().

238  {
239  constexpr unsigned rowsize = reco::PFBlockElement::kNBETypes;
240 
242 
243  block.bookLinkData();
244  unsigned elsize = els.size();
245  //First Loop: update all link data
246  for( unsigned i1=0; i1<elsize; ++i1 ) {
247  for( unsigned i2=0; i2<i1; ++i2 ) {
248 
249  // no reflexive link
250  //if( i1==i2 ) continue;
251 
252  double dist = -1;
253 
254  bool linked = false;
255  PFBlock::LinkTest linktest
256  = PFBlock::LINKTEST_RECHIT;
257 
258  // are these elements already linked ?
259  // this can be optimized
260  const auto link_itr = links.find(std::make_pair(i2,i1));
261  if( link_itr != links.end() ) {
262  dist = link_itr->second.dist();
263  linktest = link_itr->second.test();
264  linked = true;
265  }
266 
267  if(!linked) {
268  const PFBlockElement::Type type1 = els[i1].type();
269  const PFBlockElement::Type type2 = els[i2].type();
270  const auto minmax = std::minmax(type1,type2);
271  const unsigned index = rowsize*minmax.second + minmax.first;
273  bool bTestLink = ( nullptr == linkTests_[index] ? false : linkTests_[index]->linkPrefilter(&(els[i1]),&(els[i2])) );
274  if (bTestLink) link( & els[i1], & els[i2], linktype, linktest, dist);
275  }
276 
277  //loading link data according to link test used: RECHIT
278  //block.setLink( i1, i2, chi2, block.linkData() );
279 #ifdef PFLOW_DEBUG
280  if( debug_ )
281  cout << "Setting link between elements " << i1 << " and " << i2
282  << " of dist =" << dist << " computed from link test "
283  << linktest << endl;
284 #endif
285  block.setLink( i1, i2, dist, block.linkData(), linktest );
286  }
287  }
288 
289 }
size_type size() const
Definition: OwnVector.h:264
const edm::OwnVector< reco::PFBlockElement > & elements() const
Definition: PFBlock.h:107
const LinkData & linkData() const
Definition: PFBlock.h:112
#define constexpr
void setLink(unsigned i1, unsigned i2, double dist, LinkData &linkData, LinkTest test=LINKTEST_RECHIT) const
Definition: PFBlock.cc:26
void link(const reco::PFBlockElement *el1, const reco::PFBlockElement *el2, PFBlockLink::Type &linktype, reco::PFBlock::LinkTest &linktest, double &dist) const
check whether 2 elements are linked. Returns distance and linktype
Definition: PFBlockAlgo.cc:305
void bookLinkData()
Definition: PFBlock.cc:20
bool debug_
if true, debug printouts activated
Definition: PFBlockAlgo.h:163
std::vector< LinkTestPtr > linkTests_
Definition: PFBlockAlgo.h:172
void PFBlockAlgo::setDebug ( bool  debug)
inline

sets debug printout flag

Definition at line 125 of file PFBlockAlgo.h.

References debug.

125 {debug_ = debug;}
#define debug
Definition: HDRShower.cc:19
bool debug_
if true, debug printouts activated
Definition: PFBlockAlgo.h:163
void PFBlockAlgo::setImporters ( const std::vector< edm::ParameterSet > &  confs,
edm::ConsumesCollector sumes 
)

Definition at line 133 of file PFBlockAlgo.cc.

References reco::get(), Reconstruction_hiPF_cff::importerName, importers_, and AlCaHLTBitMon_QueryRunRegistry::string.

134  {
135  importers_.reserve(confs.size());
136  for( const auto& conf : confs ) {
137  const std::string& importerName =
138  conf.getParameter<std::string>("importerName");
139  BlockElementImporterBase * importer =
140  BlockElementImporterFactory::get()->create(importerName,conf,sumes);
141  importers_.emplace_back(importer);
142  }
143 }
T get(const Candidate &c)
Definition: component.h:55
std::vector< ImporterPtr > importers_
Definition: PFBlockAlgo.h:168
void PFBlockAlgo::setLinkers ( const std::vector< edm::ParameterSet > &  confs)

Definition at line 85 of file PFBlockAlgo.cc.

References constexpr, beamerCreator::create(), elementTypes_, Exception, reco::get(), mps_fire::i, kdtrees_, reco::PFBlockElement::kNBETypes, hltParticleFlowForJets_cfi::linkerName, linkTests_, linkTestSquare_, SiStripPI::max, min(), tablePrinter::prefix, split, AlCaHLTBitMon_QueryRunRegistry::string, and hltParticleFlowForJets_cfi::useKDTree.

85  {
86  constexpr unsigned rowsize = reco::PFBlockElement::kNBETypes;
87  for( unsigned i = 0; i < rowsize; ++i ) {
88  for( unsigned j = 0; j < rowsize; ++j ) {
89 
90  linkTestSquare_[i][j] = 0;
91  }
92  }
93  linkTests_.resize(rowsize*rowsize);
94  const std::string prefix("PFBlockElement::");
95  const std::string pfx_kdtree("KDTree");
96  for( const auto& conf : confs ) {
97  const std::string& linkerName =
98  conf.getParameter<std::string>("linkerName");
99  const std::string& linkTypeStr =
100  conf.getParameter<std::string>("linkType");
101  size_t split = linkTypeStr.find(':');
102  if( split == std::string::npos ) {
103  throw cms::Exception("MalformedLinkType")
104  << "\"" << linkTypeStr << "\" is not a valid link type definition."
105  << " This string should have the form \"linkFrom:linkTo\"";
106  }
107  std::string link1(prefix+linkTypeStr.substr(0,split));
108  std::string link2(prefix+linkTypeStr.substr(split+1,std::string::npos));
109  if( !(elementTypes_.count(link1) && elementTypes_.count(link2) ) ) {
110  throw cms::Exception("InvalidBlockElementType")
111  << "One of \"" << link1 << "\" or \"" << link2
112  << "\" are invalid block element types!";
113  }
114  const PFBlockElement::Type type1 = elementTypes_.at(link1);
115  const PFBlockElement::Type type2 = elementTypes_.at(link2);
116  const unsigned index = rowsize*std::max(type1,type2)+std::min(type1,type2);
117  BlockElementLinkerBase * linker =
118  BlockElementLinkerFactory::get()->create(linkerName,conf);
119  linkTests_[index].reset(linker);
120  linkTestSquare_[type1][type2] = index;
121  linkTestSquare_[type2][type1] = index;
122  // setup KDtree if requested
123  const bool useKDTree = conf.getParameter<bool>("useKDTree");
124  if( useKDTree ) {
125  kdtrees_.emplace_back( KDTreeLinkerFactory::get()->create(pfx_kdtree+
126  linkerName) );
127  kdtrees_.back()->setTargetType(std::min(type1,type2));
128  kdtrees_.back()->setFieldType(std::max(type1,type2));
129  }
130  }
131 }
def create(alignables, pedeDump, additionalData, outputFile, config)
#define constexpr
std::vector< KDTreePtr > kdtrees_
Definition: PFBlockAlgo.h:175
const std::unordered_map< std::string, reco::PFBlockElement::Type > elementTypes_
Definition: PFBlockAlgo.h:171
T min(T a, T b)
Definition: MathUtil.h:58
unsigned int linkTestSquare_[reco::PFBlockElement::kNBETypes][reco::PFBlockElement::kNBETypes]
Definition: PFBlockAlgo.h:173
std::vector< LinkTestPtr > linkTests_
Definition: PFBlockAlgo.h:172
double split
Definition: MVATrainer.cc:139
T get(const Candidate &c)
Definition: component.h:55
std::unique_ptr< reco::PFBlockCollection > PFBlockAlgo::transferBlocks ( )
inline

Definition at line 133 of file PFBlockAlgo.h.

References groupFilesInBlocks::block, plotBeamSpotDB::last, eostools::move(), and GetRecoTauVFromDQM_MC_cff::next.

133 {return std::move(blocks_);}
std::unique_ptr< reco::PFBlockCollection > blocks_
Definition: PFBlockAlgo.h:155
def move(src, dest)
Definition: eostools.py:511
void PFBlockAlgo::updateEventSetup ( const edm::EventSetup es)

Definition at line 326 of file PFBlockAlgo.cc.

References importers_.

326  {
327  for( auto& importer : importers_ ) {
328  importer->updateEventSetup(es);
329  }
330 }
std::vector< ImporterPtr > importers_
Definition: PFBlockAlgo.h:168

Friends And Related Function Documentation

std::ostream& operator<< ( std::ostream &  out,
const PFBlockAlgo a 
)
friend

Definition at line 383 of file PFBlockAlgo.cc.

383  {
384  if(! out) return out;
385 
386  out<<"====== Particle Flow Block Algorithm ======= ";
387  out<<endl;
388  out<<"number of unassociated elements : "<<a.elements_.size()<<endl;
389  out<<endl;
390 
391  for(PFBlockAlgo::IEC ie = a.elements_.begin();
392  ie != a.elements_.end(); ++ie) {
393  out<<"\t"<<**ie <<endl;
394  }
395 
396 
397  // const PFBlockCollection& blocks = a.blocks();
398 
399  const std::unique_ptr< reco::PFBlockCollection >& blocks
400  = a.blocks();
401 
402  if(!blocks.get() ) {
403  out<<"blocks already transfered"<<endl;
404  }
405  else {
406  out<<"number of blocks : "<<blocks->size()<<endl;
407  out<<endl;
408 
409  for(PFBlockAlgo::IBC ib=blocks->begin();
410  ib != blocks->end(); ++ib) {
411  out<<(*ib)<<endl;
412  }
413  }
414 
415  return out;
416 }
ElementList::const_iterator IEC
Definition: PFBlockAlgo.h:101
const std::unique_ptr< reco::PFBlockCollection > & blocks() const
Definition: PFBlockAlgo.h:129
ElementList elements_
Definition: PFBlockAlgo.h:158
reco::PFBlockCollection::const_iterator IBC
Definition: PFBlockAlgo.h:102
ib
Definition: cuy.py:662

Member Data Documentation

std::vector<ElementList::value_type::pointer> PFBlockAlgo::bare_elements_
private

Definition at line 159 of file PFBlockAlgo.h.

Referenced by buildElements(), and findBlocks().

std::unique_ptr< reco::PFBlockCollection > PFBlockAlgo::blocks_
private

Definition at line 155 of file PFBlockAlgo.h.

Referenced by findBlocks().

bool PFBlockAlgo::debug_
private

if true, debug printouts activated

Definition at line 163 of file PFBlockAlgo.h.

Referenced by link(), packLinks(), and ~PFBlockAlgo().

ElementList PFBlockAlgo::elements_
private

Definition at line 158 of file PFBlockAlgo.h.

Referenced by buildElements(), findBlocks(), operator<<(), and ~PFBlockAlgo().

const std::unordered_map<std::string,reco::PFBlockElement::Type> PFBlockAlgo::elementTypes_
private

Definition at line 171 of file PFBlockAlgo.h.

Referenced by setLinkers().

std::vector<ImporterPtr> PFBlockAlgo::importers_
private

Definition at line 168 of file PFBlockAlgo.h.

Referenced by buildElements(), setImporters(), and updateEventSetup().

std::vector<KDTreePtr> PFBlockAlgo::kdtrees_
private

Definition at line 175 of file PFBlockAlgo.h.

Referenced by buildElements(), findBlocks(), and setLinkers().

std::vector<LinkTestPtr> PFBlockAlgo::linkTests_
private

Definition at line 172 of file PFBlockAlgo.h.

Referenced by findBlocks(), link(), linkPrefilter(), packLinks(), and setLinkers().

unsigned int PFBlockAlgo::linkTestSquare_[reco::PFBlockElement::kNBETypes][reco::PFBlockElement::kNBETypes]
private

Definition at line 173 of file PFBlockAlgo.h.

Referenced by findBlocks(), and setLinkers().

ElementRanges PFBlockAlgo::ranges_
private

Definition at line 160 of file PFBlockAlgo.h.

Referenced by buildElements(), and findBlocks().

bool PFBlockAlgo::useHO_
private

Definition at line 166 of file PFBlockAlgo.h.