13 barrelHitsToken_ = consumes<EBRecHitCollection>(barrelHits_);
14 barrelClustersToken_ = consumes<reco::BasicClusterCollection>(barrelClusters_);
18 endcapHitsToken_ = consumes<EERecHitCollection>(endcapHits_);
19 endcapClustersToken_ = consumes<reco::BasicClusterCollection>(endcapClusters_);
21 doSelBarrel_ = iConfig.
getParameter<
bool>(
"doSelBarrel");
26 selePtGamma_ = barrelSelection.
getParameter<
double> (
"selePtGamma");
27 selePtPair_ = barrelSelection.
getParameter<
double> (
"selePtPair");
28 seleS4S9Gamma_ = barrelSelection.
getParameter<
double> (
"seleS4S9Gamma");
29 seleS9S25Gamma_ = barrelSelection.
getParameter<
double> (
"seleS9S25Gamma");
30 seleMinvMaxBarrel_ = barrelSelection.
getParameter<
double> (
"seleMinvMaxBarrel");
31 seleMinvMinBarrel_ = barrelSelection.
getParameter<
double> (
"seleMinvMinBarrel");
32 ptMinForIsolation_ = barrelSelection.
getParameter<
double> (
"ptMinForIsolation");
33 removePi0CandidatesForEta_ = barrelSelection.
getParameter<
bool>(
"removePi0CandidatesForEta");
34 if(removePi0CandidatesForEta_){
35 massLowPi0Cand_ = barrelSelection.
getParameter<
double>(
"massLowPi0Cand");
36 massHighPi0Cand_ = barrelSelection.
getParameter<
double>(
"massHighPi0Cand");
38 seleIso_ = barrelSelection.
getParameter<
double> (
"seleIso");
39 ptMinForIsolation_ = barrelSelection.
getParameter<
double> (
"ptMinForIsolation");
40 seleBeltDR_ = barrelSelection.
getParameter<
double> (
"seleBeltDR");
41 seleBeltDeta_ = barrelSelection.
getParameter<
double> (
"seleBeltDeta");
43 store5x5RecHitEB_ = barrelSelection.
getParameter<
bool> (
"store5x5RecHitEB");
44 BarrelHits_ = barrelSelection.
getParameter<
string > (
"barrelHitCollection");
46 produces< EBRecHitCollection >(BarrelHits_);
51 doSelEndcap_ = iConfig.
getParameter<
bool>(
"doSelEndcap");
56 seleMinvMaxEndCap_ = endcapSelection.
getParameter<
double> (
"seleMinvMaxEndCap");
57 seleMinvMinEndCap_ = endcapSelection.
getParameter<
double> (
"seleMinvMinEndCap");
59 region1_EndCap_ = endcapSelection.
getParameter<
double> (
"region1_EndCap");
60 selePtGammaEndCap_region1_ = endcapSelection.
getParameter<
double> (
"selePtGammaEndCap_region1");
61 selePtPairEndCap_region1_ = endcapSelection.
getParameter<
double> (
"selePtPairEndCap_region1");
63 region2_EndCap_ = endcapSelection.
getParameter<
double> (
"region2_EndCap");
64 selePtGammaEndCap_region2_ = endcapSelection.
getParameter<
double> (
"selePtGammaEndCap_region2");
65 selePtPairEndCap_region2_ = endcapSelection.
getParameter<
double> (
"selePtPairEndCap_region2");
67 selePtGammaEndCap_region3_ = endcapSelection.
getParameter<
double> (
"selePtGammaEndCap_region3");
68 selePtPairEndCap_region3_ = endcapSelection.
getParameter<
double> (
"selePtPairEndCap_region3");
69 selePtPairMaxEndCap_region3_ = endcapSelection.
getParameter<
double> (
"selePtPairMaxEndCap_region3");
72 seleS4S9GammaEndCap_ = endcapSelection.
getParameter<
double> (
"seleS4S9GammaEndCap");
73 seleS9S25GammaEndCap_ = endcapSelection.
getParameter<
double> (
"seleS9S25GammaEndCap");
74 ptMinForIsolationEndCap_ = endcapSelection.
getParameter<
double> (
"ptMinForIsolationEndCap");
75 seleBeltDREndCap_ = endcapSelection.
getParameter<
double> (
"seleBeltDREndCap");
76 seleBeltDetaEndCap_ = endcapSelection.
getParameter<
double> (
"seleBeltDetaEndCap");
77 seleIsoEndCap_ = endcapSelection.
getParameter<
double> (
"seleIsoEndCap");
79 store5x5RecHitEE_ = endcapSelection.
getParameter<
bool> (
"store5x5RecHitEE");
80 EndcapHits_ = endcapSelection.
getParameter<
string > (
"endcapHitCollection");
81 produces< EERecHitCollection >(EndcapHits_);
87 useRecoFlag_ = iConfig.
getParameter<
bool>(
"useRecoFlag");
88 flagLevelRecHitsToUse_ = iConfig.
getParameter<
int>(
"flagLevelRecHitsToUse");
90 useDBStatus_ = iConfig.
getParameter<
bool>(
"useDBStatus");
91 statusLevelRecHitsToUse_ = iConfig.
getParameter<
int>(
"statusLevelRecHitsToUse");
95 preshHitsToken_ = consumes<EBRecHitCollection>(preshHitProducer_);
98 storeRecHitES_ = iConfig.
getParameter<
bool>(
"storeRecHitES");
104 preshNclust_ = preshowerSelection.
getParameter<
int>(
"preshNclust");
106 preshClustECut = preshowerSelection.
getParameter<
double>(
"preshClusterEnergyCut");
108 float preshStripECut = preshowerSelection.
getParameter<
double>(
"preshStripEnergyCut");
109 int preshSeededNst = preshowerSelection.
getParameter<
int>(
"preshSeededNstrip");
111 calib_planeX_ = preshowerSelection.
getParameter<
double>(
"preshCalibPlaneX");
112 calib_planeY_ = preshowerSelection.
getParameter<
double>(
"preshCalibPlaneY");
113 gamma_ = preshowerSelection.
getParameter<
double>(
"preshCalibGamma");
114 mip_ = preshowerSelection.
getParameter<
double>(
"preshCalibMIP");
120 produces< ESRecHitCollection >(ESHits_);
144 desc.
add<
bool>(
"useRecoFlag",
false);
145 desc.
add<
int>(
"flagLevelRecHitsToUse",1);
146 desc.
add<
bool>(
"useDBStatus",
true);
147 desc.
add<
int>(
"statusLevelRecHitsToUse",1);
149 desc.
add<
bool>(
"doSelBarrel",
true);
151 barrelSelection.
add<
double>(
"selePtGamma",1.);
152 barrelSelection.add<
double>(
"selePtPair",2.);
153 barrelSelection.add<
double>(
"seleMinvMaxBarrel",0.22);
154 barrelSelection.add<
double>(
"seleMinvMinBarrel",0.06);
155 barrelSelection.add<
bool>(
"removePi0CandidatesForEta",
false);
156 barrelSelection.add<
double>(
"massLowPi0Cand",0.104);
157 barrelSelection.add<
double>(
"massHighPi0Cand",0.163);
158 barrelSelection.add<
double>(
"seleS4S9Gamma",0.83);
159 barrelSelection.add<
double>(
"seleS9S25Gamma",0.);
160 barrelSelection.add<
double>(
"ptMinForIsolation",1.0);
161 barrelSelection.add<
double>(
"seleIso",0.5);
162 barrelSelection.add<
double>(
"seleBeltDR",0.2);
163 barrelSelection.add<
double>(
"seleBeltDeta",0.05);
164 barrelSelection.add<
bool>(
"store5x5RecHitEB",
false);
165 barrelSelection.add<
std::string>(
"barrelHitCollection",
"pi0EcalRecHitsEB");
168 desc.
add<
bool>(
"doSelEndcap",
true);
170 endcapSelection.
add<
double>(
"seleMinvMaxEndCap",0.3);
171 endcapSelection.add<
double>(
"seleMinvMinEndCap",0.05);
172 endcapSelection.add<
double>(
"region1_EndCap",2.0);
173 endcapSelection.add<
double>(
"selePtGammaEndCap_region1",0.8);
174 endcapSelection.add<
double>(
"selePtPairEndCap_region1",3.0);
175 endcapSelection.add<
double>(
"region2_EndCap",2.5);
176 endcapSelection.add<
double>(
"selePtGammaEndCap_region2",0.5);
177 endcapSelection.add<
double>(
"selePtPairEndCap_region2",2.0);
178 endcapSelection.add<
double>(
"selePtGammaEndCap_region3",0.3);
179 endcapSelection.add<
double>(
"selePtPairEndCap_region3",1.2);
180 endcapSelection.add<
double>(
"selePtPairMaxEndCap_region3",2.5);
181 endcapSelection.add<
double>(
"seleS4S9GammaEndCap",0.9);
182 endcapSelection.add<
double>(
"seleS9S25GammaEndCap",0.);
183 endcapSelection.add<
double>(
"ptMinForIsolationEndCap",0.5);
184 endcapSelection.add<
double>(
"seleIsoEndCap",0.5);
185 endcapSelection.add<
double>(
"seleBeltDREndCap",0.2);
186 endcapSelection.add<
double>(
"seleBeltDetaEndCap",0.05);
187 endcapSelection.add<
bool>(
"store5x5RecHitEE",
false);
188 endcapSelection.add<
std::string>(
"endcapHitCollection",
"pi0EcalRecHitsEE");
191 desc.
add<
bool>(
"storeRecHitES",
true);
193 preshowerSelection.
add<
std::string>(
"ESCollection",
"pi0EcalRecHitsES");
194 preshowerSelection.add<
int>(
"preshNclust",4);
195 preshowerSelection.add<
double>(
"preshClusterEnergyCut",0.0);
196 preshowerSelection.add<
double>(
"preshStripEnergyCut",0.0);
197 preshowerSelection.add<
int>(
"preshSeededNstrip",15);
198 preshowerSelection.add<
double>(
"preshCalibPlaneX",1.0);
199 preshowerSelection.add<
double>(
"preshCalibPlaneY",0.7);
200 preshowerSelection.add<
double>(
"preshCalibGamma",0.024);
201 preshowerSelection.add<
double>(
"preshCalibMIP",9.0E-5);
202 preshowerSelection.add<
std::string>(
"debugLevelES",
"");
205 desc.
add<
int>(
"debugLevel",0);
206 descriptions.
add(
"hltEcalResonanceFilter",desc);
215 std::unique_ptr< EBRecHitCollection > selEBRecHitCollection(
new EBRecHitCollection );
217 std::unique_ptr< EERecHitCollection > selEERecHitCollection(
new EERecHitCollection );
221 vector<DetId> selectedEBDetIds;
222 vector<DetId> selectedEEDetIds;
234 std::unique_ptr<CaloSubdetectorTopology> topology_es;
236 topology_es = std::make_unique<EcalPreshowerTopology>();
238 storeRecHitES_ =
false;
251 iEvent.
getByToken(barrelHitsToken_,barrelRecHitsHandle);
252 if (!barrelRecHitsHandle.
isValid()) {
253 LogDebug(
"") <<
"AlCaEcalResonanceProducer: Error! can't get product barrel hits!" << std::endl;
260 iEvent.
getByToken(barrelClustersToken_,barrelClustersHandle);
261 if (!barrelClustersHandle.
isValid()) {
262 LogDebug(
"") <<
"AlCaEcalResonanceProducer: Error! can't get product barrel clusters!" << std::endl;
265 if(debug_>=1)
LogDebug(
"")<<
" barrel_input_size: run "<<iEvent.
id().
run()<<
" event "<<iEvent.
id().
event()<<
" nhitEB: "<<hitCollection_eb->
size()<<
" nCluster: "<< clusterCollection_eb->size() <<endl;
270 map<int, vector<EcalRecHit> > RecHits5x5_clus;
271 vector<int> indIsoClus;
272 vector<int> indCandClus;
273 vector<int> indClusSelected;
275 doSelection(
EcalBarrel,clusterCollection_eb, hitCollection_eb, channelStatus,topology_eb,
277 indCandClus,indIsoClus, indClusSelected);
281 for(
int ind : indClusSelected){
282 auto it_bc3 = clusterCollection_eb->begin() + ind;
283 const std::vector< std::pair<DetId, float> > &
vid = it_bc3->hitsAndFractions();
284 for (
auto const & idItr : vid){
285 auto hit = hitCollection_eb->
find(idItr.first);
286 if(
hit == hitCollection_eb->
end())
continue;
287 selEBRecHitCollection->push_back(*
hit);
288 selectedEBDetIds.push_back(idItr.first);
293 if( store5x5RecHitEB_ ){
295 for(
int ind : indCandClus){
296 vector<EcalRecHit> v5x5 = RecHits5x5_clus[ind];
297 for(
auto &
n : v5x5){
299 auto itdet =
find(selectedEBDetIds.begin(),selectedEBDetIds.end(),ed);
300 if( itdet == selectedEBDetIds.end()){
301 selectedEBDetIds.push_back(ed);
302 selEBRecHitCollection->push_back(
n);
309 for(
int ind : indIsoClus){
310 auto it =
find(indCandClus.begin(),indCandClus.end(), ind);
311 if( it != indCandClus.end())
continue;
313 auto it_bc3 = clusterCollection_eb->begin() + ind;
314 DetId seedId = it_bc3->seed();
315 std::vector<DetId> clus_v5x5 = topology_eb->
getWindow(seedId,5,5);
316 for( std::vector<DetId>::const_iterator idItr = clus_v5x5.begin(); idItr != clus_v5x5.end(); idItr++){
318 auto rit = hitCollection_eb->
find( ed );
319 if ( rit == hitCollection_eb->
end() )
continue;
320 if( ! checkStatusOfEcalRecHit(channelStatus, *rit) )
continue;
321 auto itdet =
find(selectedEBDetIds.begin(),selectedEBDetIds.end(),ed);
322 if( itdet == selectedEBDetIds.end()){
323 selectedEBDetIds.push_back(ed);
324 selEBRecHitCollection->push_back(*rit);
333 int eb_collsize = selEBRecHitCollection->size();
335 if(debug_>=1)
LogDebug(
"")<<
" barrel_output_size_run "<<iEvent.
id().
run()<<
" event "<<iEvent.
id().
event()<<
" nEBSaved "<<selEBRecHitCollection->size()<<std::endl;
343 iEvent.
getByToken(preshHitsToken_,esRecHitsHandle);
344 if( !esRecHitsHandle.
isValid()){
345 LogDebug(
"") <<
"AlCaEcalResonanceProducer: Error! can't get product esRecHit!" << std::endl;
349 m_esrechit_map.clear();
351 for (iter = esRecHitsHandle->
begin(); iter != esRecHitsHandle->
end(); iter++) {
353 m_esrechit_map.insert(std::make_pair(iter->id(), *iter));
356 m_used_strips.clear();
360 iEvent.
getByToken(endcapHitsToken_,endcapRecHitsHandle);
361 if (!endcapRecHitsHandle.
isValid()) {
362 LogDebug(
"") <<
"AlCaEcalResonanceProducer: Error! can't get product endcap hits!" << std::endl;
366 iEvent.
getByToken(endcapClustersToken_,endcapClustersHandle);
367 if (!endcapClustersHandle.
isValid()) {
368 LogDebug(
"") <<
"AlCaEcalResonanceProducer: Error! can't get product endcap clusters!" << std::endl;
371 if(debug_>=1)
LogDebug(
"")<<
" endcap_input_size: run "<<iEvent.
id().
run()<<
" event "<<iEvent.
id().
event()<<
" nhitEE: "<<hitCollection_ee->
size()<<
" nhitES: "<<hitCollection_es->
size()<<
" nCluster: "<< clusterCollection_ee->size() <<endl;
376 map<int, vector<EcalRecHit> > RecHits5x5_clus;
377 vector<int> indIsoClus;
378 vector<int> indCandClus;
379 vector<int> indClusSelected;
381 doSelection(
EcalEndcap,clusterCollection_ee, hitCollection_ee, channelStatus,topology_ee,
383 indCandClus,indIsoClus, indClusSelected);
386 for(
int ind : indClusSelected){
387 auto it_bc3 = clusterCollection_ee->begin() + ind;
388 const std::vector< std::pair<DetId, float> > &
vid = it_bc3->hitsAndFractions();
389 for (
auto const & idItr : vid){
390 auto hit = hitCollection_ee->
find(idItr.first);
391 if(
hit == hitCollection_ee->
end())
continue;
392 selEERecHitCollection->push_back(*
hit);
393 selectedEEDetIds.push_back(idItr.first);
397 std::set<DetId> used_strips_before = m_used_strips;
398 makeClusterES(it_bc3->x(),it_bc3->y(),it_bc3->z(),geometry_es,topology_es.get());
399 auto ites = m_used_strips.begin();
400 for(; ites != m_used_strips.end(); ++ ites ){
402 auto ites2 =
find(used_strips_before.begin(),used_strips_before.end(),d1);
403 if( (ites2 == used_strips_before.end())){
404 auto itmap = m_esrechit_map.find(d1);
405 selESRecHitCollection->push_back(itmap->second);
412 if( store5x5RecHitEE_ ){
414 for(
int ind : indCandClus){
415 vector<EcalRecHit> v5x5 = RecHits5x5_clus[ind];
416 for(
auto &
n : v5x5){
418 auto itdet =
find(selectedEEDetIds.begin(),selectedEEDetIds.end(),ed);
419 if( itdet == selectedEEDetIds.end()){
420 selectedEEDetIds.push_back(ed);
421 selEERecHitCollection->push_back(
n);
428 for(
int ind : indIsoClus){
429 auto it =
find(indCandClus.begin(),indCandClus.end(), ind);
430 if( it != indCandClus.end())
continue;
432 auto it_bc3 = clusterCollection_ee->begin() + ind;
433 DetId seedId = it_bc3->seed();
434 std::vector<DetId> clus_v5x5 = topology_ee->
getWindow(seedId,5,5);
435 for( std::vector<DetId>::const_iterator idItr = clus_v5x5.begin(); idItr != clus_v5x5.end(); idItr++){
437 auto rit = hitCollection_ee->
find( ed );
438 if ( rit == hitCollection_ee->
end() )
continue;
439 if( ! checkStatusOfEcalRecHit(channelStatus, *rit) )
continue;
440 auto itdet =
find(selectedEEDetIds.begin(),selectedEEDetIds.end(),ed);
441 if( itdet == selectedEEDetIds.end()){
442 selectedEEDetIds.push_back(ed);
443 selEERecHitCollection->push_back(*rit);
455 if(debug_>=1)
LogDebug(
"")<<
" endcap_output_size run "<<iEvent.
id().
run()<<
"_"<<iEvent.
id().
event()<<
" nEESaved "<<selEERecHitCollection->size()<<
" nESSaved: " << selESRecHitCollection->size() <<endl;
459 int ee_collsize = selEERecHitCollection->size();
461 if( eb_collsize < 2 && ee_collsize <2)
return false;
465 iEvent.
put(
std::move(selEBRecHitCollection), BarrelHits_);
468 iEvent.
put(
std::move(selEERecHitCollection), EndcapHits_);
485 map<
int, vector<EcalRecHit> > &RecHits5x5_clus,
486 vector<int> &indCandClus,
487 vector<int> &indIsoClus,
488 vector<int> &indClusSelected
492 vector<int> indClusPi0Candidates;
493 if( detector ==
EcalBarrel && removePi0CandidatesForEta_){
494 for(
auto it_bc = clusterCollection->begin(); it_bc != clusterCollection->end();it_bc++){
495 for(
auto it_bc2 = it_bc + 1 ; it_bc2 != clusterCollection->end();it_bc2++){
496 float m_pair,pt_pair,eta_pair, phi_pair;
497 calcPaircluster(*it_bc,*it_bc2, m_pair, pt_pair,eta_pair,phi_pair);
498 if(m_pair > massLowPi0Cand_ && m_pair < massHighPi0Cand_){
499 int indtmp[2]={
int( it_bc - clusterCollection->begin()),
int( it_bc2 - clusterCollection->begin())};
500 for(
int &
k : indtmp){
501 auto it =
find(indClusPi0Candidates.begin(),indClusPi0Candidates.end(),
k);
502 if( it == indClusPi0Candidates.end()) indClusPi0Candidates.push_back(
k);
513 double m_minCut = seleMinvMinBarrel_;
514 double m_maxCut = seleMinvMaxBarrel_;
515 double ptminforIso = ptMinForIsolation_;
516 double isoCut = seleIso_;
517 double isoBeltdrCut = seleBeltDR_ ;
518 double isoBeltdetaCut = seleBeltDeta_;
519 double s4s9Cut = seleS4S9Gamma_;
520 double s9s25Cut = seleS9S25Gamma_;
521 bool store5x5 = store5x5RecHitEB_;
524 m_minCut = seleMinvMinEndCap_;
525 m_maxCut = seleMinvMaxEndCap_;
526 ptminforIso = ptMinForIsolationEndCap_;
527 isoCut = seleIsoEndCap_;
528 isoBeltdrCut = seleBeltDREndCap_;
529 isoBeltdetaCut = seleBeltDetaEndCap_;
530 s4s9Cut = seleS4S9GammaEndCap_;
531 s9s25Cut = seleS9S25GammaEndCap_ ;
532 store5x5 = store5x5RecHitEE_;
539 map<int,bool> passShowerShape_clus;
541 for(
auto it_bc = clusterCollection->begin(); it_bc != clusterCollection->end();it_bc++){
543 if( detector ==
EcalBarrel && removePi0CandidatesForEta_){
544 auto it =
find(indClusPi0Candidates.begin(),indClusPi0Candidates.end(),
int(it_bc - clusterCollection->begin()) );
545 if( it != indClusPi0Candidates.end())
continue;
548 float en1 = it_bc->energy();
549 float theta1 = 2. * atan(
exp(-it_bc->position().eta()));
550 float pt1 = en1*
sin(theta1);
552 int ind1 =
int( it_bc - clusterCollection->begin() );
553 auto itmap = passShowerShape_clus.find(ind1);
554 if( itmap != passShowerShape_clus.end()){
555 if( itmap->second ==
false){
560 for(
auto it_bc2 = it_bc + 1 ; it_bc2 != clusterCollection->end();it_bc2++){
561 if( detector ==
EcalBarrel && removePi0CandidatesForEta_){
562 auto it =
find(indClusPi0Candidates.begin(),indClusPi0Candidates.end(),
int(it_bc2 - clusterCollection->begin()) );
563 if( it != indClusPi0Candidates.end())
continue;
565 float en2 = it_bc2 ->energy();
566 float theta2 = 2. * atan(
exp(-it_bc2->position().eta()));
567 float pt2 = en2*
sin(theta2);
569 int ind2 =
int( it_bc2 - clusterCollection->begin() );
570 auto itmap = passShowerShape_clus.find(ind2);
571 if( itmap != passShowerShape_clus.end()){
572 if( itmap->second ==
false){
577 float m_pair,pt_pair,eta_pair, phi_pair;
578 calcPaircluster(*it_bc,*it_bc2, m_pair, pt_pair,eta_pair,phi_pair);
582 if( ptmin < selePtGamma_ )
continue;
583 if (pt_pair < selePtPair_ )
continue;
585 float etapair = fabs(eta_pair);
586 if(etapair <= region1_EndCap_){
587 if(ptmin < selePtGammaEndCap_region1_ || pt_pair < selePtPairEndCap_region1_)
continue;
588 }
else if( etapair <= region2_EndCap_){
589 if(ptmin < selePtGammaEndCap_region2_ || pt_pair < selePtPairEndCap_region2_)
continue;
591 if(ptmin < selePtGammaEndCap_region3_ || pt_pair < selePtPairEndCap_region3_)
continue;
592 if(pt_pair > selePtPairMaxEndCap_region3_ )
continue;
599 if( m_pair < m_minCut || m_pair > m_maxCut)
continue;
606 IsoClus.push_back(ind1);
607 IsoClus.push_back(ind2);
610 for(
auto it_bc3 = clusterCollection->begin(); it_bc3 != clusterCollection->end();it_bc3++){
611 if( it_bc3->seed() == it_bc->seed() || it_bc3->seed() == it_bc2->seed())
continue;
612 float drcl = GetDeltaR(eta_pair,it_bc3->eta(),phi_pair,it_bc3->phi());
613 float dretacl = fabs( eta_pair - it_bc3->eta());
614 if( drcl > isoBeltdrCut || dretacl > isoBeltdetaCut )
continue;
615 float pt3 = it_bc3->energy()*
sin(it_bc3->position().theta()) ;
616 if( pt3 < ptminforIso)
continue;
618 int ind3 =
int(it_bc3 - clusterCollection->begin());
619 IsoClus.push_back( ind3);
622 if(Iso/pt_pair > isoCut)
continue;
625 bool failShowerShape =
false;
626 for(
int n=0;
n<2;
n++){
627 int ind = IsoClus[
n];
628 auto it_bc3 = clusterCollection->begin() + ind;
629 auto itmap = passShowerShape_clus.find(ind);
630 if( itmap != passShowerShape_clus.end()){
631 if( itmap->second ==
false){
632 failShowerShape =
true;
636 vector<EcalRecHit> RecHitsCluster_5x5;
638 calcShowerShape(*it_bc3, channelStatus,hitCollection, topology_p,store5x5, RecHitsCluster_5x5, res);
639 float s4s9 = res[1] >0 ? res[0]/ res[1] : -1;
640 float s9s25 = res[2] >0 ? res[1] / res[2] : -1;
641 bool passed = s4s9 > s4s9Cut && s9s25 > s9s25Cut;
642 passShowerShape_clus.insert(pair<int, bool>(ind,passed));
644 failShowerShape =
true;
647 RecHits5x5_clus.insert(pair<
int, vector<EcalRecHit> >(ind,RecHitsCluster_5x5) );
652 if( failShowerShape ==
true)
continue;
656 for(
unsigned int iii=0 ; iii<IsoClus.size() ; iii++){
657 int ind = IsoClus[iii];
660 auto it =
find(indCandClus.begin(),indCandClus.end(), ind);
661 if( it == indCandClus.end()) indCandClus.push_back(ind);
664 auto it =
find(indIsoClus.begin(),indIsoClus.end(), ind);
665 if( it == indIsoClus.end()) indIsoClus.push_back(ind);
669 auto it =
find(indClusSelected.begin(),indClusSelected.end(),ind);
670 if( it != indClusSelected.end())
continue;
671 indClusSelected.push_back(ind);
694 if(neta > 0) neta -= 1;
695 if(nphi > 359) nphi=nphi-360;
698 if(nphi >359 || nphi <0 || neta< -85 || neta > 84)
700 LogError(
"") <<
" unexpected fatal error in HLTEcalResonanceFilter::convxtalid "<< nphi <<
" " << neta <<
" " <<std::endl;
721 if(nphi1>nphi2) mdiff=-mdiff;
730 const std::vector< std::pair<DetId, float> > &
vid = bc.hitsAndFractions();
738 DetId seedId = bc.seed();
740 bool InBarrel =
true;
745 convxtalid(seedy,seedx);
758 std::vector<DetId> clus_v5x5;
759 clus_v5x5 = topology_p->
getWindow(seedId,5,5);
761 for( std::vector<DetId>::const_iterator idItr = clus_v5x5.begin(); idItr != clus_v5x5.end(); idItr++){
763 if( InBarrel ==
true){
768 dx = diff_neta_s(x,seedx);
769 dy = diff_nphi_s(y,seedy);
777 auto rit = recHits->
find( ed );
778 if ( rit == recHits->
end() )
continue;
779 if( ! checkStatusOfEcalRecHit(channelStatus, *rit) )
continue;
781 float energy = (*rit).energy();
784 auto idItrF =
std::find( vid.begin(),vid.end(), std::make_pair(ed,1.0
f));
785 if( idItrF == vid.end()){
786 rechit5x5.push_back(*rit);
789 if(dx <= 0 && dy <=0) e2x2[0] += energy;
790 if(dx >= 0 && dy <=0) e2x2[1] += energy;
791 if(dx <= 0 && dy >=0) e2x2[2] += energy;
792 if(dx >= 0 && dy >=0) e2x2[3] += energy;
801 for (
auto const & idItr : vid){
802 DetId ed = idItr.first;
803 if( InBarrel ==
true){
808 dx = diff_neta_s(x,seedx);
809 dy = diff_nphi_s(y,seedy);
817 auto rit = recHits->
find( ed );
818 if ( rit == recHits->
end() ) {
822 float energy = (*rit).energy();
824 if(dx <= 0 && dy <=0) e2x2[0] += energy;
825 if(dx >= 0 && dy <=0) e2x2[1] += energy;
826 if(dx <= 0 && dy >=0) e2x2[2] += energy;
827 if(dx >= 0 && dy >=0) e2x2[3] += energy;
838 res[0] = *max_element( e2x2,e2x2+4);
851 float theta1 = 2. * atan(
exp(-bc1.eta()));
852 float en1 = bc1.energy();
853 float pt1 = en1 *
sin(theta1);
854 TLorentzVector v1( pt1 *
cos(bc1.phi()),pt1 *
sin(bc1.phi()),en1*
cos(theta1),en1);
856 float theta2 = 2. * atan(
exp(-bc2.eta()));
857 float en2 = bc2.energy();
858 float pt2 = en2 *
sin(theta2);
859 TLorentzVector v2( pt2 *
cos(bc2.phi()),pt2 *
sin(bc2.phi()),en2*
cos(theta2),en2);
861 TLorentzVector
v = v1 + v2;
879 if( flagLevelRecHitsToUse_ ==0){
880 if( flag != 0)
return false;
882 else if( flagLevelRecHitsToUse_ ==1){
883 if( flag !=0 && flag != 4 )
return false;
885 else if( flagLevelRecHitsToUse_ ==2){
886 if( flag !=0 && flag != 4 && flag != 6 && flag != 7)
return false;
891 if ( status > statusLevelRecHitsToUse_ )
return false;
900 float diff = fabs(phi2 - phi1);
902 while (diff >acos(-1)) diff -= 2*acos(-1);
903 while (diff <= -acos(-1)) diff += 2*acos(-1);
912 return sqrt( (eta1-eta2)*(eta1-eta2)
931 for (
int i2=0; i2<preshNclust_; i2++) {
932 reco::PreshowerCluster cl1 = presh_algo_->makeOneCluster(strip1,&m_used_strips,&m_esrechit_map,geometry_es,topology_es);
T getParameter(std::string const &) const
const CaloSubdetectorGeometry * getSubdetectorGeometry(const DetId &id) const
access the subdetector geometry for the given subdetector directly
EventNumber_t event() const
void doSelection(int detector, const reco::BasicClusterCollection *clusterCollection, const EcalRecHitCollection *hitCollection, const EcalChannelStatus &channelStatus, const CaloSubdetectorTopology *topology_p, std::map< int, std::vector< EcalRecHit > > &RecHits5x5_clus, std::vector< int > &indCandClus, std::vector< int > &indIsoClus, std::vector< int > &indClusSelected)
OrphanHandle< PROD > put(std::unique_ptr< PROD > product)
Put a new product.
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
int diff_nphi_s(int, int)
void convxtalid(int &, int &)
Sin< T >::type sin(const T &t)
bool filter(edm::Event &, const edm::EventSetup &) override
constexpr uint32_t rawId() const
get the raw id
std::vector< EcalRecHit >::const_iterator const_iterator
int diff_neta_s(int, int)
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
int iphi() const
get the crystal iphi
static float DeltaPhi(float phi1, float phi2)
bool checkStatusOfEcalRecHit(const EcalChannelStatus &channelStatus, const EcalRecHit &rh)
void makeClusterES(float x, float y, float z, const CaloSubdetectorGeometry *iSubGeom, const CaloSubdetectorTopology *topology_p)
#define DEFINE_FWK_MODULE(type)
void calcPaircluster(const reco::BasicCluster &bc1, const reco::BasicCluster &bc2, float &mpair, float &ptpair, float &etapair, float &phipair)
Cos< T >::type cos(const T &t)
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum) ...
HLTEcalResonanceFilter(const edm::ParameterSet &)
Abs< T >::type abs(const T &t)
int ieta() const
get the crystal ieta
ParameterDescriptionBase * add(U const &iLabel, T const &value)
static float GetDeltaR(float eta1, float eta2, float phi1, float phi2)
const_iterator end() const
virtual std::vector< DetId > getWindow(const DetId &id, const int &northSouthSize, const int &eastWestSize) const
DetId id() const
get the id
T const * product() const
Flags recoFlag() const
DEPRECATED provided for temporary backward compatibility.
void add(std::string const &label, ParameterSetDescription const &psetDescription)
const CaloSubdetectorTopology * getSubdetectorTopology(const DetId &id) const
access the subdetector Topology for the given subdetector directly
std::vector< BasicCluster > BasicClusterCollection
collection of BasicCluster objects
iterator find(key_type k)
void calcShowerShape(const reco::BasicCluster &bc, const EcalChannelStatus &channelStatus, const EcalRecHitCollection *recHits, const CaloSubdetectorTopology *topology_p, bool calc5x5, std::vector< EcalRecHit > &rechit5x5, float res[])
*vegas h *****************************************************used in the default bin number in original ***version of VEGAS is ***a higher bin number might help to derive a more precise ***grade subtle point
const_iterator begin() const
~HLTEcalResonanceFilter() override