CMS 3D CMS Logo

List of all members | Public Member Functions | Protected Member Functions
PFAlgoTestBenchElectrons Class Reference

Particle Flow Algorithm test bench for the electron team. More...

#include <PFAlgoTestBenchElectrons.h>

Inheritance diagram for PFAlgoTestBenchElectrons:
PFAlgo

Public Member Functions

 PFAlgoTestBenchElectrons ()
 constructor More...
 
virtual ~PFAlgoTestBenchElectrons ()
 destructor More...
 
- Public Member Functions inherited from PFAlgo
void checkCleaning (const reco::PFRecHitCollection &cleanedHF)
 Check HF Cleaning. More...
 
PFMuonAlgogetPFMuonAlgo ()
 
 PFAlgo ()
 constructor More...
 
const std::unique_ptr< reco::PFCandidateCollection > & pfCandidates () const
 
void reconstructParticles (const reco::PFBlockHandle &blockHandle)
 
virtual void reconstructParticles (const reco::PFBlockCollection &blocks)
 reconstruct particles More...
 
void setAlgo (int algo)
 
void setCandConnectorParameters (const edm::ParameterSet &iCfgCandConnector)
 
void setCandConnectorParameters (bool bCorrect, bool bCalibPrimary, double dptRel_PrimaryTrack, double dptRel_MergedTrack, double ptErrorSecondary, const std::vector< double > &nuclCalibFactors)
 
void setDebug (bool debug)
 
void setDisplacedVerticesParameters (bool rejectTracks_Bad, bool rejectTracks_Step45, bool usePFNuclearInteractions, bool usePFConversions, bool usePFDecays, double dptRel_DispVtx)
 
void setEGammaCollections (const edm::View< reco::PFCandidate > &pfEgammaCandidates, const edm::ValueMap< reco::GsfElectronRef > &valueMapGedElectrons, const edm::ValueMap< reco::PhotonRef > &valueMapGedPhotons)
 
void setEGammaParameters (bool use_EGammaFilters, std::string ele_iso_path_mvaWeightFile, double ele_iso_pt, double ele_iso_mva_barrel, double ele_iso_mva_endcap, double ele_iso_combIso_barrel, double ele_iso_combIso_endcap, double ele_noniso_mva, unsigned int ele_missinghits, bool useProtectionsForJetMET, const edm::ParameterSet &ele_protectionsForJetMET, double ph_MinEt, double ph_combIso, double ph_HoE, double ph_sietaieta_eb, double ph_sietaieta_ee, const edm::ParameterSet &ph_protectionsForJetMET)
 
void setEGElectronCollection (const reco::GsfElectronCollection &egelectrons)
 
void setElectronExtraRef (const edm::OrphanHandle< reco::PFCandidateElectronExtraCollection > &extrah)
 
void setHOTag (bool ho)
 
void setMuonHandle (const edm::Handle< reco::MuonCollection > &)
 
void setParameters (double nSigmaECAL, double nSigmaHCAL, const boost::shared_ptr< PFEnergyCalibration > &calibration, const boost::shared_ptr< PFEnergyCalibrationHF > &thepfEnergyCalibrationHF)
 
void setPFEleParameters (double mvaEleCut, std::string mvaWeightFileEleID, bool usePFElectrons, const boost::shared_ptr< PFSCEnergyCalibration > &thePFSCEnergyCalibration, const boost::shared_ptr< PFEnergyCalibration > &thePFEnergyCalibration, double sumEtEcalIsoForEgammaSC_barrel, double sumEtEcalIsoForEgammaSC_endcap, double coneEcalIsoForEgammaSC, double sumPtTrackIsoForEgammaSC_barrel, double sumPtTrackIsoForEgammaSC_endcap, unsigned int nTrackIsoForEgammaSC, double coneTrackIsoForEgammaSC, bool applyCrackCorrections=false, bool usePFSCEleCalib=true, bool useEGElectrons=false, bool useEGammaSupercluster=true)
 
void setPFMuonAlgo (PFMuonAlgo *algo)
 
void setPFMuonAndFakeParameters (const edm::ParameterSet &pset)
 
void setPFPhotonParameters (bool usePFPhoton, std::string mvaWeightFileConvID, double mvaConvCut, bool useReg, std::string X0_Map, const boost::shared_ptr< PFEnergyCalibration > &thePFEnergyCalibration, double sumPtTrackIsoForPhoton, double sumPtTrackIsoSlopeForPhoton)
 
void setPFPhotonRegWeights (const GBRForest *LCorrForestEB, const GBRForest *LCorrForestEE, const GBRForest *GCorrForestBarrel, const GBRForest *GCorrForestEndcapHr9, const GBRForest *GCorrForestEndcapLr9, const GBRForest *PFEcalResolution)
 
void setPFVertexParameters (bool useVertex, const reco::VertexCollection *primaryVertices)
 
void setPhotonExtraRef (const edm::OrphanHandle< reco::PFCandidatePhotonExtraCollection > &pf_extrah)
 
void setPostHFCleaningParameters (bool postHFCleaning, double minHFCleaningPt, double minSignificance, double maxSignificance, double minSignificanceReduction, double maxDeltaPhiPt, double minDeltaMet)
 
boost::shared_ptr< PFEnergyCalibrationthePFEnergyCalibration ()
 return the pointer to the calibration function More...
 
std::unique_ptr< reco::PFCandidateCollectiontransferCandidates ()
 
std::unique_ptr< reco::PFCandidateCollectiontransferCleanedCandidates ()
 
std::unique_ptr< reco::PFCandidateCollectiontransferElectronCandidates ()
 
std::unique_ptr< reco::PFCandidateElectronExtraCollectiontransferElectronExtra ()
 
std::unique_ptr< reco::PFCandidatePhotonExtraCollectiontransferPhotonExtra ()
 
virtual ~PFAlgo ()
 destructor More...
 

Protected Member Functions

virtual void processBlock (const reco::PFBlockRef &blockref, std::list< reco::PFBlockRef > &hcalBlockRefs, std::list< reco::PFBlockRef > &ecalBlockRefs)
 
- Protected Member Functions inherited from PFAlgo
void associatePSClusters (unsigned iEcal, reco::PFBlockElement::Type psElementType, const reco::PFBlock &block, const edm::OwnVector< reco::PFBlockElement > &elements, const reco::PFBlock::LinkData &linkData, std::vector< bool > &active, std::vector< double > &psEne)
 Associate PS clusters to a given ECAL cluster, and return their energy. More...
 
bool isFromSecInt (const reco::PFBlockElement &eTrack, std::string order) const
 
double neutralHadronEnergyResolution (double clusterEnergy, double clusterEta) const
 todo: use PFClusterTools for this More...
 
double nSigmaHCAL (double clusterEnergy, double clusterEta) const
 
void postCleaning ()
 
unsigned reconstructCluster (const reco::PFCluster &cluster, double particleEnergy, bool useDirection=false, double particleX=0., double particleY=0., double particleZ=0.)
 
unsigned reconstructTrack (const reco::PFBlockElement &elt, bool allowLoose=false)
 

Additional Inherited Members

- Protected Attributes inherited from PFAlgo
std::unique_ptr< reco::PFCandidateCollectionpfCandidates_
 
std::unique_ptr< reco::PFCandidateCollectionpfCleanedCandidates_
 
std::unique_ptr< reco::PFCandidateCollectionpfElectronCandidates_
 the unfiltered electron collection More...
 
reco::PFCandidateElectronExtraCollection pfElectronExtra_
 the unfiltered electron collection More...
 
std::unique_ptr< reco::PFCandidateCollectionpfPhotonCandidates_
 the unfiltered photon collection More...
 
reco::PFCandidatePhotonExtraCollection pfPhotonExtra_
 the extra photon collection More...
 

Detailed Description

Particle Flow Algorithm test bench for the electron team.

Author
Florian Beaudette, Daniele Benedetti, Michele Pioppi
Date
January 2006

Definition at line 18 of file PFAlgoTestBenchElectrons.h.

Constructor & Destructor Documentation

PFAlgoTestBenchElectrons::PFAlgoTestBenchElectrons ( )
inline

constructor

Definition at line 23 of file PFAlgoTestBenchElectrons.h.

23 {}
virtual PFAlgoTestBenchElectrons::~PFAlgoTestBenchElectrons ( )
inlinevirtual

destructor

Definition at line 26 of file PFAlgoTestBenchElectrons.h.

References processBlock().

26 {}

Member Function Documentation

void PFAlgoTestBenchElectrons::processBlock ( const reco::PFBlockRef blockref,
std::list< reco::PFBlockRef > &  hcalBlockRefs,
std::list< reco::PFBlockRef > &  ecalBlockRefs 
)
protectedvirtual

process one block. can be reimplemented in more sophisticated algorithms

Reimplemented from PFAlgo.

Definition at line 11 of file PFAlgoTestBenchElectrons.cc.

References reco::PFBlock::associatedElements(), groupFilesInBlocks::block, reco::PFBlockElement::BREM, HiEvtPlane_cfi::chi2, reco::PFBlockElement::ECAL, allElectronIsolations_cfi::elements, reco::PFBlock::elements(), plotBeamSpotDB::first, reco::PFBlockElement::GSF, diffTreeTool::index, reco::PFBlock::linkData(), edm::OwnVector< T, P >::push_back(), edm::second(), edm::OwnVector< T, P >::size(), and funct::true.

Referenced by ~PFAlgoTestBenchElectrons().

14 {
15 
16  //cout<<"electron test bench: process block"
17  // <<(*blockref)<<endl;
18 
19 
20  const reco::PFBlock& block = *blockref;
21  PFBlock::LinkData linkData = block.linkData();
23 
24  std::vector<bool> active(elements.size(), true );
25  vector<unsigned> mainecal_index;
26  for(unsigned iEle=0; iEle<elements.size(); iEle++) {
27  PFBlockElement::Type type = elements[iEle].type();
28  if (type == reco::PFBlockElement::ECAL ) {
29  mainecal_index.push_back(iEle);
30  }
31  }
32 
33  std::map<unsigned, unsigned> FinalBremECALIndex;
34  unsigned ECALGSF_index = 1000;
35  unsigned GSF_index = 1000;
36  for(unsigned iEle=0; iEle<elements.size(); iEle++) {
37 
38 
39  PFBlockElement::Type type = elements[iEle].type();
40 
41  if (type == reco::PFBlockElement::GSF ) {
42  GSF_index = iEle;
43 
44  // linked ECAL clusters
45  std::multimap<double, unsigned> ecalElems;
46  block.associatedElements( iEle, linkData,
47  ecalElems ,
49 
50  typedef std::multimap<double, unsigned>::iterator IE;
51 
52  float chi2GSFFinal = 1000;
53  for(IE ie = ecalElems.begin(); ie != ecalElems.end(); ++ie ) {
54  double chi2 = ie->first;
55  unsigned index = ie->second;
56  if (chi2 < chi2GSFFinal) {
57  chi2GSFFinal = chi2;
58  ECALGSF_index = index;
59  }
60  }
61 
62  std::multimap<double, unsigned> Brems;
63 
64  block.associatedElements( iEle, linkData,
65  Brems ,
67  typedef std::multimap<double, unsigned>::iterator IB;
68 
69  vector< pair<double, unsigned> > ecalindexforbrem;
70  vector<unsigned> brem_index;
71  for(IB iee = Brems.begin(); iee != Brems.end(); ++iee ) {
72 
73  unsigned index = iee->second;
74 
75  std::multimap<double, unsigned> ecalBrems;
76  block.associatedElements( index, linkData,
77  ecalBrems ,
79  typedef std::multimap<double, unsigned>::iterator IEB;
80  float chi2BremFinal = 1000;
81  unsigned ECALBREM_index = 1000;
82 
83  for(IEB ieb = ecalBrems.begin(); ieb != ecalBrems.end(); ++ieb ) {
84  // Two cases: first there is a ecalGSF=brem chi2 < chi2ecalGSF ?
85 
86 
87  if (ieb->second != ECALGSF_index) {
88 
89  double chi2_eb = ieb->first;
90  unsigned index_eb = ieb->second;
91  if (chi2_eb < chi2BremFinal) {
92  chi2BremFinal = chi2_eb;
93  ECALBREM_index = index_eb;
94  }
95  }
96  }
97  if (ECALBREM_index != 1000){
98  ecalindexforbrem.push_back(make_pair(chi2BremFinal,ECALBREM_index));
99  // for each brem (same size that brems)
100  brem_index.push_back(index);
101  }
102  }
103  for (unsigned ie=0;ie<mainecal_index.size();ie++){
104  unsigned c_brem = 0;
105 
106  double chi2best = 1000;
107  unsigned final_ecal = 1000;
108  unsigned final_brem = 1000;
109  if (mainecal_index[ie] != ECALGSF_index) {
110  for (unsigned i2eb = 0; i2eb < ecalindexforbrem.size(); i2eb++ ) {
111  unsigned temp_ecal_index = (ecalindexforbrem[i2eb]).second;
112  double temp_chi2 = (ecalindexforbrem[i2eb]).first;
113 
114  if (temp_ecal_index == mainecal_index[ie] ) {
115  if (temp_chi2 < chi2best ){
116  chi2best = temp_chi2;
117  final_ecal = temp_ecal_index;
118  final_brem = brem_index[c_brem];
119  }
120  }
121  c_brem++;
122  }
123  if (chi2best < 1000) {
124  FinalBremECALIndex.insert(make_pair(final_brem,final_ecal));
125  }
126  }
127 
128  }
129 
130 
131 
132  bool ElectronId = false;
133 
134  // perform electron iD
135  //Start ***************************************
136  ElectronId = true;
137  //End ***************************************
138 
139  // Lock the various elements
140  // NOTE very lose cuts!
141  if (ElectronId) {
142  if (chi2GSFFinal < 1000) {
143 
144  active[iEle] = false; //GSF
145  active[ECALGSF_index] = false; // ECAL associated to GSF
146  // Lock Brem and ECAL associated to brem
147  typedef std::map<unsigned, unsigned>::iterator IT;
148  for (map<unsigned, unsigned>::iterator it = FinalBremECALIndex.begin(); it != FinalBremECALIndex.end(); ++it ) {
149  unsigned index_brem = it->first;
150  unsigned index_ecalbrem = it->second;
151  active[index_brem]=false;
152  active[index_ecalbrem] = false;
153  }
154  }
155  } // End if Electron ID
156  } // End GSF type
157  } // Run on elements
158 
159 
160  vector<pair< bool, vector<unsigned int> > > associate;
161 
162  for(unsigned iEle=0; iEle<elements.size(); iEle++) {
163 
164  if (active[iEle] == true) {
165  vector<unsigned> assoel(0);
166  associate.push_back(make_pair(active[iEle],assoel));
167  }
168  if (active[iEle] == false){
169  PFBlockElement::Type type = elements[iEle].type();
170  if (type == reco::PFBlockElement::GSF) {
171  vector<unsigned> assoel(0);
172  // push back tk track: to be done
173 
174  // push back ecal cluster associate to gsf track
175  assoel.push_back(ECALGSF_index);
176  // push back selected brems
177  for (map<unsigned, unsigned>::iterator it = FinalBremECALIndex.begin(); it != FinalBremECALIndex.end(); ++it ) {
178  unsigned index_brem = it->first;
179  assoel.push_back(index_brem);
180  }
181  associate.push_back(make_pair(active[iEle],assoel));
182  // push back hcal cluster to be done
183  // push back ps cluster to be done
184  }
185  if (type == reco::PFBlockElement::BREM) {
186  vector<unsigned> assoel(0);
187  // push back GSF track
188  assoel.push_back(GSF_index);
189 
190  // push_back ecal clusters associate to the brem
191  for (map<unsigned, unsigned>::iterator it = FinalBremECALIndex.begin(); it != FinalBremECALIndex.end(); ++it ) {
192  if (it->first == iEle) {
193  unsigned index_ecalbrem = it->second;
194  assoel.push_back(index_ecalbrem);
195  }
196  }
197  associate.push_back(make_pair(active[iEle],assoel));
198 
199  // push back hcal cluster to be done
200  // push back ps cluster to be done
201  }
202  if (type == reco::PFBlockElement::ECAL) {
203  if (iEle == ECALGSF_index) {
204  // cluster associate to the gsf track
205  // push back the associate gsf track
206  vector<unsigned> assoel(0);
207  assoel.push_back(GSF_index);
208  associate.push_back(make_pair(active[iEle],assoel));
209  }
210  for (map<unsigned, unsigned>::iterator it = FinalBremECALIndex.begin(); it != FinalBremECALIndex.end(); ++it ) {
211  unsigned index_ecalbrem = it->second;
212  unsigned index_brem = it->first;
213  if (iEle == index_ecalbrem) { // push back the brems associate to ecal
214  vector<unsigned> assoel(0);
215  assoel.push_back(index_brem);
216  associate.push_back(make_pair(active[iEle],assoel));
217  }
218  }
219  }
220  }
221  }
222  // here create the object with the block and associate (and active if needed)
223 
224 } // End loop on Blocks
type
Definition: HCALResponse.h:21
std::map< unsigned int, Link > LinkData
Definition: PFBlock.h:46
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
U second(std::pair< T, U > const &p)
void push_back(D *&d)
Definition: OwnVector.h:290
std::vector< LinkConnSpec >::const_iterator IT
void associatedElements(unsigned i, const LinkData &linkData, std::multimap< double, unsigned > &sortedAssociates, reco::PFBlockElement::Type type=PFBlockElement::NONE, LinkTest test=LINKTEST_RECHIT) const
Definition: PFBlock.cc:75
Block of elements.
Definition: PFBlock.h:30