12 std::list<PFBlockRef>& hcalBlockRefs,
13 std::list<PFBlockRef>& ecalBlockRefs)
24 std::vector<bool> active(elements.
size(),
true );
25 vector<unsigned> mainecal_index;
26 for(
unsigned iEle=0; iEle<elements.
size(); iEle++) {
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++) {
45 std::multimap<double, unsigned> ecalElems;
50 typedef std::multimap<double, unsigned>::iterator IE;
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) {
58 ECALGSF_index =
index;
62 std::multimap<double, unsigned> Brems;
67 typedef std::multimap<double, unsigned>::iterator IB;
69 vector< pair<double, unsigned> > ecalindexforbrem;
70 vector<unsigned> brem_index;
71 for(IB iee = Brems.begin(); iee != Brems.end(); ++iee ) {
73 unsigned index = iee->second;
75 std::multimap<double, unsigned> ecalBrems;
79 typedef std::multimap<double, unsigned>::iterator IEB;
80 float chi2BremFinal = 1000;
81 unsigned ECALBREM_index = 1000;
83 for(IEB ieb = ecalBrems.begin(); ieb != ecalBrems.end(); ++ieb ) {
87 if (ieb->second != ECALGSF_index) {
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;
97 if (ECALBREM_index != 1000){
98 ecalindexforbrem.push_back(make_pair(chi2BremFinal,ECALBREM_index));
100 brem_index.push_back(index);
103 for (
unsigned ie=0;ie<mainecal_index.size();ie++){
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;
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];
123 if (chi2best < 1000) {
124 FinalBremECALIndex.insert(make_pair(final_brem,final_ecal));
132 bool ElectronId =
false;
142 if (chi2GSFFinal < 1000) {
144 active[iEle] =
false;
145 active[ECALGSF_index] =
false;
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;
160 vector<pair< bool, vector<unsigned int> > > associate;
162 for(
unsigned iEle=0; iEle<elements.
size(); iEle++) {
164 if (active[iEle] ==
true) {
165 vector<unsigned> assoel(0);
166 associate.push_back(make_pair(active[iEle],assoel));
168 if (active[iEle] ==
false){
171 vector<unsigned> assoel(0);
175 assoel.push_back(ECALGSF_index);
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);
181 associate.push_back(make_pair(active[iEle],assoel));
186 vector<unsigned> assoel(0);
188 assoel.push_back(GSF_index);
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);
197 associate.push_back(make_pair(active[iEle],assoel));
203 if (iEle == ECALGSF_index) {
206 vector<unsigned> assoel(0);
207 assoel.push_back(GSF_index);
208 associate.push_back(make_pair(active[iEle],assoel));
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) {
214 vector<unsigned> assoel(0);
215 assoel.push_back(index_brem);
216 associate.push_back(make_pair(active[iEle],assoel));
std::map< unsigned int, Link > LinkData
const edm::OwnVector< reco::PFBlockElement > & elements() const
const LinkData & linkData() const
U second(std::pair< T, U > const &p)
virtual void processBlock(const reco::PFBlockRef &blockref, std::list< reco::PFBlockRef > &hcalBlockRefs, std::list< reco::PFBlockRef > &ecalBlockRefs)
std::vector< LinkConnSpec >::const_iterator IT
block
Formating index page's pieces.
void associatedElements(unsigned i, const LinkData &linkData, std::multimap< double, unsigned > &sortedAssociates, reco::PFBlockElement::Type type=PFBlockElement::NONE, LinkTest test=LINKTEST_RECHIT) const