Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rewrite and Improvements for PFRecHit and PFCluster Producers #2730

Merged
merged 61 commits into from Mar 14, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
61 commits
Select commit Hold shift + click to select a range
92a7f62
Adding new hits
bachtis Feb 16, 2014
e44523d
cleaning old code
bachtis Feb 16, 2014
df5ebb9
Changed RecHit
bachtis Feb 17, 2014
9cf2615
Removing stuff
bachtis Feb 17, 2014
75b8cd7
fixing also the hash
bachtis Feb 17, 2014
d25da46
Added forgotten file
bachtis Feb 18, 2014
fc9de23
Caching the 4 and 8 neighbours"
bachtis Feb 18, 2014
b2230ac
skeleton of PFClusterProducer Refactorization
lgray Feb 10, 2014
999200a
implement original PF topo cluster algorithm in new framework
lgray Feb 11, 2014
ae36912
Cleaner plugin and old PFlow cluster skeleton
lgray Feb 11, 2014
f6e4099
Finish implementation of old pf clusterizer
lgray Feb 12, 2014
911da7b
implement spike and double spike cleaning module
lgray Feb 12, 2014
6d24111
regular PF cluster position calculator
lgray Feb 12, 2014
b0b0892
ECAL position calc with depth correction
lgray Feb 13, 2014
8207ba7
complete implementation of new PF cluster scheme
lgray Feb 13, 2014
cf271d6
functions and gives equivalent results to old clustering on electron …
lgray Feb 13, 2014
5053675
agrees with PFClusterAlgo to 1e-5 tolerance.
lgray Feb 14, 2014
5af3b83
clean up python config, add in energy corrector plugin
lgray Feb 16, 2014
e851a4a
add aprticle flow clusters for PS, generate full ECAL PFCluster seque…
lgray Feb 16, 2014
5c1654d
RBX and HPD cleaner
lgray Feb 17, 2014
579e081
add remaining calorimeter clusterizers, all agree well
lgray Feb 17, 2014
2663420
normalize fraction calculations to rechit thresholds.
lgray Feb 20, 2014
2a36df7
Clean up naming conventions to make them more meaningful
lgray Feb 20, 2014
2737513
make numerical protection strength configurable, sync shower sigma fo…
lgray Feb 24, 2014
cda746a
switch to vdt math library remove modules not used
lgray Feb 24, 2014
f781c35
further speed optimizations
lgray Feb 24, 2014
36db2f1
properly fill the CaloCluster hitsAndFractions vector
lgray Feb 24, 2014
2f85b20
made memory access better
bachtis Feb 28, 2014
c2f83e1
Adding ECAL 3D
bachtis Feb 28, 2014
7394309
Added 3D ECAL Clustering
bachtis Mar 3, 2014
01f762b
adding cfg files for ECAL 3D
bachtis Mar 3, 2014
abc7673
adding timing clusterizer in py
bachtis Mar 3, 2014
be97867
speed up from not having to call PFLayer 8 billion times
lgray Feb 28, 2014
cb25ecf
improve PF RecHit producer timing, massive gains for larger rechit co…
lgray Feb 28, 2014
6d82908
updates to cluster comparator
lgray Feb 28, 2014
b6be100
factor config into each cluster type
lgray Mar 3, 2014
f5ceff0
rejigger locations of plugin defs
lgray Mar 3, 2014
1708511
remove PFRootEvent... for now...
lgray Mar 3, 2014
54d4555
update HLT config for FAMOS and dual navigators
lgray Mar 3, 2014
5973f2c
expand use of local max seed finder to > 2D
lgray Mar 4, 2014
b5ce95b
naming cleanup
lgray Mar 4, 2014
cabb6df
apply binary search to NavigatorWithTime
lgray Mar 4, 2014
81f6c36
add plots to cluster comparator
lgray Mar 5, 2014
e8284ba
Adding better timing info
bachtis Mar 4, 2014
25b191b
Caluculating time average using time resolution
bachtis Mar 5, 2014
e1b4a20
put time and layer in the appropriate place
lgray Mar 5, 2014
ea7faa4
add in iorule to make PFRecHit backwards compatible -- NOTE the read-…
lgray Mar 6, 2014
a70aa7a
remove deprecated parameters from configuration
lgray Mar 7, 2014
0bf0fcf
only use PS adjusted radiation length when we are under the PS (which…
lgray Mar 7, 2014
5074cbd
factorize python config for confDB
lgray Mar 11, 2014
523a30d
use empty parameter sets to indicate components not run in PFClusterP…
lgray Mar 11, 2014
9b63170
PF migration (2730) in HLT via ConfDB
Martin-Grunewald Mar 11, 2014
a3d73b5
Fix InputTags of PF RecHit modules
Martin-Grunewald Mar 11, 2014
f161dc6
More InputTag fixes
Martin-Grunewald Mar 11, 2014
166c993
Reorder PF modules
Martin-Grunewald Mar 11, 2014
9adf54d
More reordering
Martin-Grunewald Mar 11, 2014
a91b469
Fixes
bachtis Mar 9, 2014
547583e
Making a PFCluster with timing cut sequence
bachtis Mar 11, 2014
17e91d7
implemented comments from code review
lgray Mar 12, 2014
b5355a6
Adding HCAL Severity Cut in HO
bachtis Mar 12, 2014
14f8a81
fix
bachtis Mar 12, 2014
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
41 changes: 35 additions & 6 deletions DataFormats/ParticleFlowReco/interface/PFCluster.h
Expand Up @@ -9,10 +9,12 @@
#include "Rtypes.h"

#include "DataFormats/ParticleFlowReco/interface/PFRecHitFraction.h"
#include "DataFormats/ParticleFlowReco/interface/PFRecHit.h"
#include "DataFormats/ParticleFlowReco/interface/PFLayer.h"

#include <iostream>
#include <vector>
#include <algorithm>
#if !defined(__CINT__) && !defined(__MAKECINT__) && !defined(__REFLEX__)
#include <atomic>
#endif
Expand Down Expand Up @@ -48,30 +50,38 @@ namespace reco {
typedef std::vector<std::pair<CaloClusterPtr::key_type,edm::Ptr<PFCluster> > > EEtoPSAssociation;
typedef ROOT::Math::PositionVector3D<ROOT::Math::CylindricalEta3D<Double32_t> > REPPoint;

PFCluster() : CaloCluster(CaloCluster::particleFlow), color_(1) {}
PFCluster() : CaloCluster(CaloCluster::particleFlow), layer_(PFLayer::NONE), color_(1) {}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

time_ is not initialized. all basic types should be

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, will send a commit in a moment (it is a new variable in the PF Clusters).
Thanks for catching it.


/// constructor
PFCluster(PFLayer::Layer layer, double energy,
double x, double y, double z );

/// resets clusters parameters
void reset();

/// reset only hits and fractions
void resetHitsAndFractions();

/// add a given fraction of the rechit
void addRecHitFraction( const reco::PFRecHitFraction& frac);

/// vector of rechit fractions
const std::vector< reco::PFRecHitFraction >& recHitFractions() const
{ return rechits_; }
{ return rechits_; }

/// set layer
void setLayer( PFLayer::Layer layer);

/// cluster layer, see PFLayer.h in this directory
PFLayer::Layer layer() const;
PFLayer::Layer layer() const;

/// cluster energy
double energy() const {return energy_;}

/// cluster time
double time() const {return time_;}

void setTime(double time) {time_ = time;}

/// cluster position: rho, eta, phi
const REPPoint& positionREP() const {return posrep_;}
Expand Down Expand Up @@ -136,13 +146,35 @@ namespace reco {
double vy() const { return vertex().y(); }
double vz() const { return vertex().z(); }

#if !defined(__CINT__) && !defined(__MAKECINT__) && !defined(__REFLEX__)
template<typename pruner>
void pruneUsing(pruner prune) {
hitsAndFractions_.clear();
std::vector<reco::PFRecHitFraction>::iterator iter =
std::stable_partition(rechits_.begin(),rechits_.end(),prune);
rechits_.erase(iter,rechits_.end());
hitsAndFractions_.reserve(rechits_.size());
for( const auto& hitfrac : rechits_ ) {
hitsAndFractions_.emplace_back(hitfrac.recHitRef()->detId(),
hitfrac.fraction());
}
}
#endif

private:

/// vector of rechit fractions (transient)
std::vector< reco::PFRecHitFraction > rechits_;

/// cluster position: rho, eta, phi (transient)
REPPoint posrep_;

///Michalis :Add timing information
double time_;

/// transient layer
PFLayer::Layer layer_;

#if !defined(__CINT__) && !defined(__MAKECINT__) && !defined(__REFLEX__)
/// \todo move to PFClusterTools
static std::atomic<int> depthCorMode_;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any chance this could be moved as the comment says? Would help aleviate threading concerns.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, you mean the std::atomic stuff. I am pretty sure none of those variables are used any more.

Expand All @@ -159,7 +191,6 @@ namespace reco {
/// \todo move to PFClusterTools
static std::atomic<double> depthCorBp_;
#else

/// \todo move to PFClusterTools
static int depthCorMode_;

Expand All @@ -180,8 +211,6 @@ namespace reco {

/// color (transient)
int color_;

friend class ::PFClusterAlgo;
};
}

Expand Down
155 changes: 55 additions & 100 deletions DataFormats/ParticleFlowReco/interface/PFRecHit.h
Expand Up @@ -9,16 +9,18 @@
#include "DataFormats/Math/interface/Point3D.h"
#include "Rtypes.h"
#include "DataFormats/Math/interface/Vector3D.h"
// #include "DataFormats/DetId/interface/DetId.h"
#include "Math/GenVector/PositionVector3D.h"

#include "DataFormats/ParticleFlowReco/interface/PFLayer.h"
#include "DataFormats/ParticleFlowReco/interface/PFRecHitFwd.h"

//C decide what is the default rechit index.
//C maybe 0 ? -> compression
//C then the position is index-1.
//C provide a helper class to access the rechit.

#include "DataFormats/CaloRecHit/interface/CaloRecHit.h"
#include "DataFormats/Common/interface/RefToBase.h"


namespace reco {

Expand All @@ -27,19 +29,20 @@ namespace reco {

\author Colin Bernet
\date July 2006

Feb 2014 [Michalis: 8 years later!Modifying the class to be able to generalize the neighbours for 3D calorimeters ]
*/
class PFRecHit {

public:

enum {
NONE=0
};

typedef ROOT::Math::PositionVector3D<ROOT::Math::CylindricalEta3D<Double32_t> > REPPoint;

typedef std::vector<REPPoint> REPPointVector;


enum {
NONE=0
};
/// default constructor. Sets energy and position to zero
PFRecHit();

Expand All @@ -63,38 +66,31 @@ namespace reco {
/// destructor
virtual ~PFRecHit();


/// NICHOLAS JIN
/// Zeros the energy

void setEnergy( double energy) { energy_ = energy; }

/// calculates rho eta phi position once and for all
void calculatePositionREP();

//C neighbours must be initialized correctly !!
/* void setNeighbours( const std::vector< unsigned >& neighbours ); */
void add4Neighbour( unsigned index );
void add8Neighbour( unsigned index );
void setEnergyUp( double eUp) { energyUp_ = eUp; }
void setRescale( double factor) { rescale_ = factor; }

void addNeighbour(short x,short y, short z,const PFRecHitRef&);
void setTime( double time) { time_ = time; }
void clearNeighbours() {
neighbours4_.clear();
neighbours8_.clear();
neighbours4_.reserve(4);
neighbours8_.reserve(8);
neighbours_.clear();
}


const PFRecHitRefVector& neighbours4() const {
return neighbours4_;
}
const PFRecHitRefVector& neighbours8() const {
return neighbours8_;
}

const PFRecHitRefVector& neighbours() const {
return neighbours_;
}

const std::vector<unsigned short>& neighbourInfos() {
return neighbourInfos_;
}

/// \brief search for pointers to neighbours, using neighbours' DetId.
///
/// pointers to neighbours are not persistent, in contrary to the DetId's
/// of the neighbours. This function searches a map of rechits
/// for the DetId's stored in neighboursIds4_ and neighboursIds8_.
/// The corresponding pointers are stored in neighbours4_ and neighbours8_.
// void findPtrsToNeighbours( const std::map<unsigned, reco::PFRecHit* >& allhits );

void setNWCorner( double posx, double posy, double posz );
void setSWCorner( double posx, double posy, double posz );
Expand All @@ -110,14 +106,9 @@ namespace reco {
/// rechit energy
double energy() const { return energy_; }

/// rescaling factor (obsolete)
double rescale() const { return rescale_; }

/// timing for cleaned hits
double time() const { return rescale_; }

/// For HF hits: rechit energy (and neighbour's) in the other HF layer
double energyUp() const { return energyUp_; }
double time() const { return time_; }

/// rechit momentum transverse to the beam, squared.
double pt2() const { return energy_ * energy_ *
Expand All @@ -127,21 +118,12 @@ namespace reco {
position_.Y()*position_.Y() +
position_.Z()*position_.Z()) ; }

//C remove cause I want to be able to run on const rechits
/// \return seed state (-1:unknown, 0:no, 1 yes)
// int seedState() const { return seedState_; }

/// is seed ?
// bool isSeed() const { return (seedState_>0) ? true : false; }

/// set seed status
// void youAreSeed(int seedstate=1) {seedState_ = seedstate;}

/// rechit cell centre x, y, z
const math::XYZPoint& position() const { return position_; }

/// rechit cell centre rho, eta, phi. call calculatePositionREP before !
const REPPoint& positionREP() const;
const REPPoint& positionREP() const { return positionrep_; }


/// rechit cell axis x, y, z
const math::XYZVector& getAxisXYZ() const { return axisxyz_; }
Expand All @@ -150,36 +132,7 @@ namespace reco {
const std::vector< math::XYZPoint >& getCornersXYZ() const
{ return cornersxyz_; }

/// rechit corners
const REPPointVector& getCornersREP() const
{ return cornersrep_; }

const std::vector< unsigned >& neighbours4() const
{return neighbours4_;}

const std::vector< unsigned >& neighbours8() const
{return neighbours8_;}

const std::vector< unsigned >& neighboursIds4() const
{return neighboursIds4_;}

const std::vector< unsigned >& neighboursIds8() const
{return neighboursIds8_;}

/* const std::vector< unsigned >& getNeighboursIds4() const */
/* {return neighboursIds4_;} */

/* const std::vector< unsigned >& getNeighboursIds8() const */
/* {return neighboursIds8_;} */

/// is rechit 'id' a direct neighbour of this ?
/// id is the rechit index ! not the detId
bool isNeighbour4(unsigned id) const;

/// is rechit 'id' a neighbour of this ?
/// id is the rechit index ! not the detId
bool isNeighbour8(unsigned id) const;

const std::vector<REPPoint>& getCornersREP() const { return cornersrep_; }

void size(double& deta, double& dphi) const;

Expand All @@ -198,54 +151,56 @@ namespace reco {
friend std::ostream& operator<<(std::ostream& out,
const reco::PFRecHit& hit);

const edm::RefToBase<CaloRecHit>& originalRecHit() const {
return originalRecHit_;
}

template<typename T>
void setOriginalRecHit(const T& rh) {
originalRecHit_ = edm::RefToBase<CaloRecHit>(rh);
}

private:

// original rechit
edm::RefToBase<CaloRecHit> originalRecHit_;

///C cell detid - should be detid or index in collection ?
unsigned detId_;

/// rechit layer
PFLayer::Layer layer_;
PFLayer::Layer layer_;

/// rechit energy
double energy_;

/// Internal rescaling factor of the energy (1. = default, 0 = killed channels, x = rescaled)
double rescale_;

/// For HF hits : hit energy in the other layer (EM for HAD, and HAD for EM)
double energyUp_;
/// time
double time_;

/// is this a seed ? (-1:unknown, 0:no, 1 yes) (transient)
// int seedState_;

/// rechit cell centre: x, y, z
math::XYZPoint position_;

/// rechit cell centre: rho, eta, phi (transient)
REPPoint posrep_;
REPPoint positionrep_;

/// rechit cell axisxyz
math::XYZVector axisxyz_;

/// rechit cell corners
std::vector< math::XYZPoint > cornersxyz_;
REPPointVector cornersrep_;

/// rechit cell corners rho/eta/phi
std::vector< REPPoint > cornersrep_;

/// indices to existing neighbours (1 common side)
std::vector< unsigned > neighbours4_;

/// indices to existing neighbours (1 common side or diagonal)
std::vector< unsigned > neighbours8_;
PFRecHitRefVector neighbours_;
std::vector< unsigned short > neighbourInfos_;

/// detids of existing neighbours (1 common side)
std::vector< unsigned > neighboursIds4_;
//Caching the neighbours4/8 per request of Lindsey
PFRecHitRefVector neighbours4_;
PFRecHitRefVector neighbours8_;

/// detids of existing neighbours (1 common side or diagonal)
std::vector< unsigned > neighboursIds8_;

/// number of neighbours
static const unsigned nNeighbours_;

/// number of corners
static const unsigned nCorners_;

Expand Down
3 changes: 3 additions & 0 deletions DataFormats/ParticleFlowReco/interface/PFRecHitFwd.h
Expand Up @@ -22,6 +22,9 @@ namespace reco {

/// iterator over a vector of references to PFRecHit objects
typedef PFRecHitRefVector::iterator basicRecHit_iterator;

/// ref to base vector for dealing with views
typedef edm::RefToBaseVector<reco::PFRecHit> PFRecHitBaseRefVector;
}

#endif