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 
51  void doClustering( const reco::PFRecHitCollection& rechits );
52 
54  void doClustering( const PFRecHitHandle& rechitsHandle );
55 
57 
61 
65 
68  void setS4S1CleanBarrel(const std::vector<double>& coeffs) {minS4S1Barrel_ = coeffs;}
69 
73 
77 
81 
84  void setS4S1CleanEndcap(const std::vector<double>& coeffs) {minS4S1Endcap_ = coeffs;}
85 
89 
91  void setHistos(TFile* file, TH2F* hB, TH2F* hE) {file_=file; hBNeighbour = hB; hENeighbour = hE;}
92 
94  void setNNeighbours(int n) { nNeighbours_ = n;}
95 
97  void setPosCalcP1( double p1 ) { posCalcP1_ = p1; }
98 
101 
103  void setShowerSigma( double sigma ) { showerSigma_ = sigma;}
104 
106  void setUseCornerCells( bool usecornercells ) { useCornerCells_ = usecornercells;}
107 
110 
112  void setMask( const std::vector<bool>& mask );
113 
115 
117  double threshBarrel() const {return threshBarrel_;}
118 
120  double threshSeedBarrel() const {return threshSeedBarrel_;}
121 
122 
124  double threshEndcap() const {return threshEndcap_;}
125 
127  double threshSeedEndcap() const {return threshSeedEndcap_;}
128 
129 
131  int nNeighbours() const { return nNeighbours_;}
132 
134  double posCalcP1() const { return posCalcP1_; }
135 
137  int posCalcNCrystal() const {return posCalcNCrystal_;}
138 
140  double showerSigma() const { return showerSigma_ ;}
141 
143  void write();
145 
146 
147 
149  const reco::PFRecHit& rechit(unsigned i,
150  const reco::PFRecHitCollection& rechits );
151 
153  bool masked(unsigned rhi) const;
154 
155  enum Color {
156  NONE=0,
159  };
160 
162  unsigned color(unsigned rhi) const;
163 
165  bool isSeed(unsigned rhi) const;
166 
168  std::auto_ptr< std::vector< reco::PFCluster > >& clusters()
169  {return pfClusters_;}
170 
172  std::auto_ptr< std::vector< reco::PFRecHit > >& rechitsCleaned()
173  {return pfRecHitsCleaned_;}
174 
177 
178  enum Parameter { THRESH,
186  };
187 
188 
191  double parameter( Parameter paramtype, PFLayer::Layer layer, unsigned iCoeff = 0) const;
192 
193 
194  enum SeedState {
196  NO=0,
197  YES=1,
199  };
200 
201 
202  friend std::ostream& operator<<(std::ostream& out,const PFClusterAlgo& algo);
203 
204  typedef std::map<unsigned, unsigned >::const_iterator IDH;
205  typedef std::multimap<double, unsigned >::iterator EH;
206 
207 
208  private:
209 
211  void cleanRBXAndHPD( const reco::PFRecHitCollection& rechits );
212 
214  void findSeeds( const reco::PFRecHitCollection& rechits );
215 
217  void buildTopoClusters( const reco::PFRecHitCollection& rechits );
218 
220  void buildTopoCluster( std::vector< unsigned >& cluster, unsigned rhi,
221  const reco::PFRecHitCollection& rechits );
222 
224  void buildPFClusters( const std::vector< unsigned >& cluster,
225  const reco::PFRecHitCollection& rechits );
226 
229  reco::PFCluster& clusterwodepthcor,
230  bool depcor = true,
231  int posCalcNCrystal=0);
232 
236  unsigned rhi );
237 
239  void paint( unsigned rhi, unsigned color=1 );
240 
242  std::pair<double,double> dCrack(double phi, double eta);
243 
244 
246 
248  std::set<unsigned> idUsedRecHits_;
249 
251  std::multimap<double, unsigned, std::greater<double> > eRecHits_;
252 
255  std::vector< bool > mask_;
256 
258  std::vector< unsigned > color_;
259 
261  std::vector< SeedState > seedStates_;
262 
264  std::vector< bool > usedInTopo_;
265 
267  std::vector< unsigned > seeds_;
268 
270  std::vector< std::vector< unsigned > > topoClusters_;
271 
273  // std::vector< reco::PFCluster > allClusters_;
274 
276  std::auto_ptr< std::vector<reco::PFCluster> > pfClusters_;
277 
279  std::auto_ptr< std::vector<reco::PFRecHit> > pfRecHitsCleaned_;
280 
284 
288 
292 
296 
299  std::vector<double> minS4S1Barrel_;
300 
304 
307  std::vector<double> minS4S1Endcap_;
308 
312 
315 
318 
320  double posCalcP1_;
321 
323  double showerSigma_;
324 
327 
330 
332  bool debug_;
333 
334 
336  static unsigned prodNum_;
337 
338  // Histograms
339  TH2F* hBNeighbour;
340  TH2F* hENeighbour;
341  TFile* file_;
342 
343 };
344 
345 #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:67
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:87
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:97
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:63
list file
Definition: dbtoweb.py:253
void setS6S2DoubleSpikeEndcap(double cut)
Definition: PFClusterAlgo.h:88
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:59
double threshPtSeedBarrel_
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
T eta() const
std::vector< bool > usedInTopo_
used in topo cluster? for all rechits
void setThreshPtSeedBarrel(double thresh)
Definition: PFClusterAlgo.h:64
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:79
Algorithm for particle flow clustering.
Definition: PFClusterAlgo.h:31
bool masked(unsigned rhi) const
std::vector< unsigned > seeds_
vector of indices for seeds.
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:94
void setMask(const std::vector< bool > &mask)
set rechit mask
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:68
void setThreshPtSeedEndcap(double thresh)
Definition: PFClusterAlgo.h:80
void setThreshPtEndcap(double thresh)
Definition: PFClusterAlgo.h:76
std::vector< double > minS4S1Endcap_
void setThreshEndcap(double thresh)
set endcap threshold
Definition: PFClusterAlgo.h:75
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:71
tuple out
Definition: dbtoconf.py:99
Layer
layer definition
Definition: PFLayer.h:31
double threshCleanBarrel_
Barrel cleaning threshold and S4/S1 smallest fractiom.
tuple cut
Definition: align_tpl.py:88
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 threshSeedBarrel() const
get barrel seed threshold
void setThreshPtBarrel(double thresh)
Definition: PFClusterAlgo.h:60
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:72
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:84
void calculateClusterPosition(reco::PFCluster &cluster, reco::PFCluster &clusterwodepthcor, bool depcor=true, int posCalcNCrystal=0)
calculate position of a cluster
double parameter(Parameter paramtype, PFLayer::Layer layer, unsigned iCoeff=0) const
double threshSeedEndcap_
endcap seed threshold
std::auto_ptr< std::vector< reco::PFCluster > > pfClusters_
all clusters
double threshPtBarrel_
void setThreshCleanEndcap(double thresh)
set endcap clean threshold
Definition: PFClusterAlgo.h:83
#define debug
Definition: MEtoEDMFormat.h:34
void setHistos(TFile *file, TH2F *hB, TH2F *hE)
set endcap clean threshold
Definition: PFClusterAlgo.h:91
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