CMS 3D CMS Logo

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
PFClusterAlgo.h
Go to the documentation of this file.
1 #ifndef RecoParticleFlow_PFClusterProducer_PFClusterAlgo_h
2 #define RecoParticleFlow_PFClusterProducer_PFClusterAlgo_h
3 
9 
10 #include <string>
11 #include <vector>
12 #include <map>
13 #include <set>
14 
15 #include <memory>
16 
17 class TFile;
18 class TH2F;
19 
21 
32 
33  public:
34 
36  PFClusterAlgo();
37 
39  virtual ~PFClusterAlgo() {;}
40 
42  // void init(const std::map<unsigned, reco::PFRecHit* >& rechits );
43 
45  void enableDebugging(bool debug) { debug_ = debug;}
46 
47 
49 
52  void doClustering( const reco::PFRecHitCollection& rechits, const std::vector<bool> & mask );
53 
55  void doClustering( const PFRecHitHandle& rechitsHandle );
56  void doClustering( const PFRecHitHandle& rechitsHandle, const std::vector<bool> & mask );
57 
59 
63 
67 
70  void setS4S1CleanBarrel(const std::vector<double>& coeffs) {minS4S1Barrel_ = coeffs;}
71 
75 
79 
83 
86  void setS4S1CleanEndcap(const std::vector<double>& coeffs) {minS4S1Endcap_ = coeffs;}
87 
91 
93  void setHistos(TFile* file, TH2F* hB, TH2F* hE) {file_=file; hBNeighbour = hB; hENeighbour = hE;}
94 
96  void setNNeighbours(int n) { nNeighbours_ = n;}
97 
99  void setPosCalcP1( double p1 ) { posCalcP1_ = p1; }
100 
103 
105  void setShowerSigma( double sigma ) { showerSigma_ = sigma;}
106 
108  void setUseCornerCells( bool usecornercells ) { useCornerCells_ = usecornercells;}
109 
111  void setCleanRBXandHPDs( bool cleanRBXandHPDs) { cleanRBXandHPDs_ = cleanRBXandHPDs; }
112 
114 
116  double threshBarrel() const {return threshBarrel_;}
117 
119  double threshSeedBarrel() const {return threshSeedBarrel_;}
120 
121 
123  double threshEndcap() const {return threshEndcap_;}
124 
126  double threshSeedEndcap() const {return threshSeedEndcap_;}
127 
128 
130  int nNeighbours() const { return nNeighbours_;}
131 
133  double posCalcP1() const { return posCalcP1_; }
134 
136  int posCalcNCrystal() const {return posCalcNCrystal_;}
137 
139  double showerSigma() const { return showerSigma_ ;}
140 
142  void write();
144 
145 
146 
148  const reco::PFRecHit& rechit(unsigned i,
150 
152  bool masked(unsigned rhi) const;
153 
154  enum Color {
155  NONE=0,
158  };
159 
161  unsigned color(unsigned rhi) const;
162 
164  bool isSeed(unsigned rhi) const;
165 
167  std::auto_ptr< std::vector< reco::PFCluster > >& clusters()
168  {return pfClusters_;}
169 
171  std::auto_ptr< std::vector< reco::PFRecHit > >& rechitsCleaned()
172  {return pfRecHitsCleaned_;}
173 
176 
177  enum Parameter { THRESH,
185  };
186 
187 
190  double parameter( Parameter paramtype, PFLayer::Layer layer, unsigned iCoeff = 0, int iring0=0) const;
191 
192 
193  enum SeedState {
195  NO=0,
196  YES=1,
198  };
199 
200 
201  friend std::ostream& operator<<(std::ostream& out,const PFClusterAlgo& algo);
202 
203  typedef std::map<unsigned, unsigned >::const_iterator IDH;
204  typedef std::multimap<double, unsigned >::iterator EH;
205 
206 
207  private:
210 
213 
216 
219 
221  void buildTopoCluster( std::vector< unsigned >& cluster, unsigned rhi,
223 
225  void buildPFClusters( const std::vector< unsigned >& cluster,
227 
230  reco::PFCluster& clusterwodepthcor,
231  bool depcor = true,
232  int posCalcNCrystal=0);
233 
237  unsigned rhi );
238 
240  void paint( unsigned rhi, unsigned color=1 );
241 
243  std::pair<double,double> dCrack(double phi, double eta);
244 
245 
247 
249  std::set<unsigned> idUsedRecHits_;
250 
252  std::multimap<double, unsigned, std::greater<double> > eRecHits_;
253 
256  std::vector< bool > mask_;
257 
259  std::vector< unsigned > color_;
260 
262  std::vector< SeedState > seedStates_;
263 
265  std::vector< bool > usedInTopo_;
266 
268  std::vector< unsigned > seeds_;
269 
271  std::vector< std::vector< unsigned > > topoClusters_;
272 
274  // std::vector< reco::PFCluster > allClusters_;
275 
277  std::auto_ptr< std::vector<reco::PFCluster> > pfClusters_;
278 
280  std::auto_ptr< std::vector<reco::PFRecHit> > pfRecHitsCleaned_;
281 
285 
289 
293 
297 
300  std::vector<double> minS4S1Barrel_;
301 
305 
308  std::vector<double> minS4S1Endcap_;
309 
313 
316 
319 
321  double posCalcP1_;
322 
324  double showerSigma_;
325 
328 
331 
333  bool debug_;
334 
335 
337  static unsigned prodNum_;
338 
339  // Histograms
340  TH2F* hBNeighbour;
341  TH2F* hENeighbour;
342  TFile* file_;
343 
344 };
345 
346 #endif
friend std::ostream & operator<<(std::ostream &out, const PFClusterAlgo &algo)
double posCalcP1() const
get p1 for position calculation
void setThreshCleanBarrel(double thresh)
set barrel clean threshold
Definition: PFClusterAlgo.h:69
void cleanRBXAndHPD(const reco::PFRecHitCollection &rechits)
Clean HCAL readout box noise and HPD discharge.
int i
Definition: DBlmapReader.cc:9
edm::Handle< reco::PFRecHitCollection > PFRecHitHandle
Definition: PFClusterAlgo.h:48
void setThreshDoubleSpikeEndcap(double thresh)
set endcap thresholds for double spike cleaning
Definition: PFClusterAlgo.h:89
std::multimap< double, unsigned >::iterator EH
int posCalcNCrystal_
number of crystals for position calculation
double showerSigma() const
get shower sigma
double threshEndcap_
endcap threshold
void setShowerSigma(double sigma)
set shower sigma for
double threshDoubleSpikeBarrel_
Barrel double-spike cleaning.
double threshBarrel() const
getters -------------------------------------------------——
void setPosCalcP1(double p1)
set p1 for position calculation
Definition: PFClusterAlgo.h:99
Particle flow cluster, see clustering algorithm in PFClusterAlgo.
Definition: PFCluster.h:42
void doClustering(const reco::PFRecHitCollection &rechits)
perform clustering
std::vector< unsigned > color_
color, for all rechits
void setPosCalcNCrystal(int n)
set number of crystals for position calculation (-1 all,5, or 9)
PFRecHitHandle rechitsHandle_
void setThreshSeedBarrel(double thresh)
set barrel seed threshold
Definition: PFClusterAlgo.h:65
void setS6S2DoubleSpikeEndcap(double cut)
Definition: PFClusterAlgo.h:90
std::pair< double, double > dCrack(double phi, double eta)
distance to a crack in the ECAL barrel in eta and phi direction
bool isSeed(unsigned rhi) const
const reco::PFRecHit & rechit(unsigned i, const reco::PFRecHitCollection &rechits)
double threshDoubleSpikeEndcap_
Endcap double-spike cleaning.
double threshPtEndcap_
TH2F * hENeighbour
std::vector< PFRecHit > PFRecHitCollection
collection of PFRecHit objects
Definition: PFRecHitFwd.h:9
std::multimap< double, unsigned, std::greater< double > > eRecHits_
indices to rechits, sorted by decreasing E (not E_T)
std::vector< double > minS4S1Barrel_
double threshPtSeedEndcap_
void setThreshBarrel(double thresh)
setters -------------------------------------------------——
Definition: PFClusterAlgo.h:61
double threshPtSeedBarrel_
T eta() const
std::map< unsigned, unsigned >::const_iterator IDH
std::vector< SeedState > seedStates_
seed state, for all rechits
void setUseCornerCells(bool usecornercells)
activate use of cells with a common corner to build topo-clusters
std::vector< std::vector< unsigned > > topoClusters_
sets of cells having one common side, and energy over threshold
std::auto_ptr< std::vector< reco::PFRecHit > > pfRecHitsCleaned_
particle flow rechits cleaned
std::vector< bool > usedInTopo_
used in topo cluster? for all rechits
void setThreshPtSeedBarrel(double thresh)
Definition: PFClusterAlgo.h:66
double threshSeedBarrel_
barrel seed threshold
std::set< unsigned > idUsedRecHits_
ids of rechits used in seed search
void setThreshSeedEndcap(double thresh)
set endcap seed threshold
Definition: PFClusterAlgo.h:81
Algorithm for particle flow clustering.
Definition: PFClusterAlgo.h:31
bool masked(unsigned rhi) const
std::vector< unsigned > seeds_
vector of indices for seeds.
void doClusteringWorker(const reco::PFRecHitCollection &rechits)
perform clustering
TH2F * hBNeighbour
int posCalcNCrystal() const
get number of crystals for position calculation (-1 all,5, or 9)
Particle flow rechit (rechit + geometry and topology information). See clustering algorithm in PFClus...
Definition: PFRecHit.h:31
std::vector< bool > mask_
bool cleanRBXandHPDs_
option to clean HCAL RBX&#39;s and HPD&#39;s
std::auto_ptr< std::vector< reco::PFRecHit > > & rechitsCleaned()
void setNNeighbours(int n)
set number of neighbours for
Definition: PFClusterAlgo.h:96
double threshEndcap() const
get endcap threshold
void buildTopoClusters(const reco::PFRecHitCollection &rechits)
build topoclusters around seeds
void setS4S1CleanBarrel(const std::vector< double > &coeffs)
Definition: PFClusterAlgo.h:70
void setThreshPtSeedEndcap(double thresh)
Definition: PFClusterAlgo.h:82
void setThreshPtEndcap(double thresh)
Definition: PFClusterAlgo.h:78
std::vector< double > minS4S1Endcap_
void setThreshEndcap(double thresh)
set endcap threshold
Definition: PFClusterAlgo.h:77
void findSeeds(const reco::PFRecHitCollection &rechits)
look for seeds
PFClusterAlgo()
constructor
void setThreshDoubleSpikeBarrel(double thresh)
set endcap thresholds for double spike cleaning
Definition: PFClusterAlgo.h:73
tuple out
Definition: dbtoconf.py:99
Layer
layer definition
Definition: PFLayer.h:31
double threshCleanBarrel_
Barrel cleaning threshold and S4/S1 smallest fractiom.
bool debug_
debugging on/off
virtual ~PFClusterAlgo()
destructor
Definition: PFClusterAlgo.h:39
int nNeighbours_
number of neighbours
reco::PFRecHitRef createRecHitRef(const reco::PFRecHitCollection &rechits, unsigned rhi)
void buildTopoCluster(std::vector< unsigned > &cluster, unsigned rhi, const reco::PFRecHitCollection &rechits)
build a topocluster (recursive)
double minS6S2DoubleSpikeEndcap_
void write()
write histos
double showerSigma_
sigma of shower (cm)
void paint(unsigned rhi, unsigned color=1)
paint a rechit with a color.
double parameter(Parameter paramtype, PFLayer::Layer layer, unsigned iCoeff=0, int iring0=0) const
double threshSeedBarrel() const
get barrel seed threshold
void setThreshPtBarrel(double thresh)
Definition: PFClusterAlgo.h:62
std::auto_ptr< std::vector< reco::PFCluster > > & clusters()
double p1[4]
Definition: TauolaWrapper.h:89
void setCleanRBXandHPDs(bool cleanRBXandHPDs)
Activate cleaning of HCAL RBX&#39;s and HPD&#39;s.
double threshBarrel_
barrel threshold
bool useCornerCells_
option to use cells with a common corner to build topo-clusters
void setS6S2DoubleSpikeBarrel(double cut)
Definition: PFClusterAlgo.h:74
static unsigned prodNum_
product number
void enableDebugging(bool debug)
set hits on which clustering will be performed
Definition: PFClusterAlgo.h:45
void setS4S1CleanEndcap(const std::vector< double > &coeffs)
Definition: PFClusterAlgo.h:86
void calculateClusterPosition(reco::PFCluster &cluster, reco::PFCluster &clusterwodepthcor, bool depcor=true, int posCalcNCrystal=0)
calculate position of a cluster
double threshSeedEndcap_
endcap seed threshold
std::auto_ptr< std::vector< reco::PFCluster > > pfClusters_
all clusters
LimitAlgo * algo
Definition: Combine.cc:60
double threshPtBarrel_
void setThreshCleanEndcap(double thresh)
set endcap clean threshold
Definition: PFClusterAlgo.h:85
#define debug
Definition: MEtoEDMFormat.h:34
void setHistos(TFile *file, TH2F *hB, TH2F *hE)
set endcap clean threshold
Definition: PFClusterAlgo.h:93
void buildPFClusters(const std::vector< unsigned > &cluster, const reco::PFRecHitCollection &rechits)
build PFClusters from a topocluster
unsigned color(unsigned rhi) const
double minS6S2DoubleSpikeBarrel_
double threshCleanEndcap_
Endcap cleaning threshold and S4/S1 smallest fractiom.
double posCalcP1_
parameter for position calculation
double threshSeedEndcap() const
get endcap seed threshold
int nNeighbours() const
get number of neighbours for
Definition: DDAxes.h:10