CMS 3D CMS Logo

List of all members | Public Member Functions | Static Public Member Functions | Private Member Functions | Static Private Member Functions | Private Attributes
HLTEcalResonanceFilter Class Reference

#include <HLTEcalResonanceFilter.h>

Inheritance diagram for HLTEcalResonanceFilter:
edm::EDFilter edm::ProducerBase edm::EDConsumerBase edm::ProductRegistryHelper

Public Member Functions

bool filter (edm::Event &, const edm::EventSetup &) override
 
 HLTEcalResonanceFilter (const edm::ParameterSet &)
 
 ~HLTEcalResonanceFilter () override
 
- Public Member Functions inherited from edm::EDFilter
 EDFilter ()
 
SerialTaskQueueglobalLuminosityBlocksQueue ()
 
SerialTaskQueueglobalRunsQueue ()
 
ModuleDescription const & moduleDescription () const
 
 ~EDFilter () override
 
- Public Member Functions inherited from edm::ProducerBase
void callWhenNewProductsRegistered (std::function< void(BranchDescription const &)> const &func)
 
std::vector< edm::ProductResolverIndex > const & indiciesForPutProducts (BranchType iBranchType) const
 
 ProducerBase ()
 
std::vector< edm::ProductResolverIndex > const & putTokenIndexToProductResolverIndex () const
 
void registerProducts (ProducerBase *, ProductRegistry *, ModuleDescription const &)
 
std::function< void(BranchDescription const &)> registrationCallback () const
 used by the fwk to register list of products More...
 
void resolvePutIndicies (BranchType iBranchType, ModuleToResolverIndicies const &iIndicies, std::string const &moduleLabel)
 
 ~ProducerBase () noexcept(false) override
 
- Public Member Functions inherited from edm::EDConsumerBase
std::vector< ConsumesInfoconsumesInfo () const
 
void convertCurrentProcessAlias (std::string const &processName)
 Convert "@currentProcess" in InputTag process names to the actual current process name. More...
 
 EDConsumerBase ()
 
 EDConsumerBase (EDConsumerBase const &)=delete
 
 EDConsumerBase (EDConsumerBase &&)=default
 
ESProxyIndex const * esGetTokenIndices (edm::Transition iTrans) const
 
ProductResolverIndexAndSkipBit indexFrom (EDGetToken, BranchType, TypeID const &) const
 
void itemsMayGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
void itemsToGet (BranchType, std::vector< ProductResolverIndexAndSkipBit > &) const
 
std::vector< ProductResolverIndexAndSkipBit > const & itemsToGetFrom (BranchType iType) const
 
void labelsForToken (EDGetToken iToken, Labels &oLabels) const
 
void modulesWhoseProductsAreConsumed (std::vector< ModuleDescription const * > &modules, ProductRegistry const &preg, std::map< std::string, ModuleDescription const * > const &labelsToDesc, std::string const &processName) const
 
EDConsumerBase const & operator= (EDConsumerBase const &)=delete
 
EDConsumerBaseoperator= (EDConsumerBase &&)=default
 
bool registeredToConsume (ProductResolverIndex, bool, BranchType) const
 
bool registeredToConsumeMany (TypeID const &, BranchType) const
 
ProductResolverIndexAndSkipBit uncheckedIndexFrom (EDGetToken) const
 
void updateLookup (BranchType iBranchType, ProductResolverIndexHelper const &, bool iPrefetchMayGet)
 
void updateLookup (eventsetup::ESRecordsToProxyIndices const &)
 
virtual ~EDConsumerBase () noexcept(false)
 

Static Public Member Functions

static void fillDescriptions (edm::ConfigurationDescriptions &descriptions)
 
- Static Public Member Functions inherited from edm::EDFilter
static const std::string & baseType ()
 
static void fillDescriptions (ConfigurationDescriptions &descriptions)
 
static void prevalidate (ConfigurationDescriptions &)
 
static bool wantsGlobalLuminosityBlocks ()
 
static bool wantsGlobalRuns ()
 
static bool wantsStreamLuminosityBlocks ()
 
static bool wantsStreamRuns ()
 

Private Member Functions

void calcPaircluster (const reco::BasicCluster &bc1, const reco::BasicCluster &bc2, float &mpair, float &ptpair, float &etapair, float &phipair)
 
void calcShowerShape (const reco::BasicCluster &bc, const EcalChannelStatus &channelStatus, const EcalRecHitCollection *recHits, const CaloSubdetectorTopology *topology_p, bool calc5x5, std::vector< EcalRecHit > &rechit5x5, float res[])
 
bool checkStatusOfEcalRecHit (const EcalChannelStatus &channelStatus, const EcalRecHit &rh)
 
void convxtalid (int &, int &)
 
int diff_neta_s (int, int)
 
int diff_nphi_s (int, int)
 
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)
 
void makeClusterES (float x, float y, float z, const CaloSubdetectorGeometry *iSubGeom, const CaloSubdetectorTopology *topology_p)
 

Static Private Member Functions

static float DeltaPhi (float phi1, float phi2)
 
static float GetDeltaR (float eta1, float eta2, float phi1, float phi2)
 

Private Attributes

edm::InputTag barrelClusters_
 
edm::EDGetTokenT< reco::BasicClusterCollectionbarrelClustersToken_
 
edm::InputTag barrelHits_
 
std::string BarrelHits_
 output hits More...
 
edm::EDGetTokenT< EBRecHitCollectionbarrelHitsToken_
 
double calib_planeX_
 
double calib_planeY_
 
int debug_
 
bool doSelBarrel_
 for pi0/eta ->gg barrel More...
 
bool doSelEndcap_
 
edm::InputTag endcapClusters_
 
edm::EDGetTokenT< reco::BasicClusterCollectionendcapClustersToken_
 
edm::InputTag endcapHits_
 
std::string EndcapHits_
 
edm::EDGetTokenT< EERecHitCollectionendcapHitsToken_
 
std::string ESHits_
 
double etThresh_
 
int flagLevelRecHitsToUse_
 
double gamma_
 
std::map< DetId, EcalRecHitm_esrechit_map
 
std::set< DetIdm_used_strips
 
double massHighPi0Cand_
 
double massLowPi0Cand_
 
double mip_
 
PreshowerClusterAlgopresh_algo_
 
float preshClustECut
 
edm::InputTag preshHitProducer_
 
edm::EDGetTokenT< ESRecHitCollectionpreshHitsToken_
 
int preshNclust_
 
double ptMinForIsolation_
 
double ptMinForIsolationEndCap_
 
double region1_EndCap_
 
double region2_EndCap_
 
bool removePi0CandidatesForEta_
 
double seleBeltDeta_
 
double seleBeltDetaEndCap_
 
double seleBeltDR_
 
double seleBeltDREndCap_
 
double seleIso_
 
double seleIsoEndCap_
 
double seleMinvMaxBarrel_
 
double seleMinvMaxEndCap_
 
double seleMinvMinBarrel_
 
double seleMinvMinEndCap_
 
double selePtGamma_
 
double selePtGammaEndCap_region1_
 
double selePtGammaEndCap_region2_
 
double selePtGammaEndCap_region3_
 
double selePtPair_
 
double selePtPairEndCap_region1_
 
double selePtPairEndCap_region2_
 
double selePtPairEndCap_region3_
 
double selePtPairMaxEndCap_region3_
 
double seleS4S9Gamma_
 
double seleS4S9GammaEndCap_
 
double seleS9S25Gamma_
 
double seleS9S25GammaEndCap_
 
int statusLevelRecHitsToUse_
 
bool store5x5RecHitEB_
 
bool store5x5RecHitEE_
 
bool storeRecHitES_
 
bool useDBStatus_
 
bool useRecoFlag_
 

Additional Inherited Members

- Public Types inherited from edm::EDFilter
typedef EDFilter ModuleType
 
- Public Types inherited from edm::ProducerBase
using ModuleToResolverIndicies = std::unordered_multimap< std::string, std::tuple< edm::TypeID const *, const char *, edm::ProductResolverIndex >>
 
typedef ProductRegistryHelper::TypeLabelList TypeLabelList
 
- Public Types inherited from edm::EDConsumerBase
typedef ProductLabels Labels
 
- Protected Member Functions inherited from edm::EDConsumerBase
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > consumes (edm::InputTag const &tag)
 
EDGetToken consumes (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken consumes (TypeToGet const &id, edm::InputTag const &tag)
 
ConsumesCollector consumesCollector ()
 Use a ConsumesCollector to gather consumes information from helper functions. More...
 
template<typename ProductType , BranchType B = InEvent>
void consumesMany ()
 
void consumesMany (const TypeToGet &id)
 
template<BranchType B>
void consumesMany (const TypeToGet &id)
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes ()
 
template<typename ESProduct , typename ESRecord , Transition Tr = Transition::Event>
auto esConsumes (ESInputTag const &tag)
 
template<typename ProductType , BranchType B = InEvent>
EDGetTokenT< ProductType > mayConsume (edm::InputTag const &tag)
 
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 
template<BranchType B>
EDGetToken mayConsume (const TypeToGet &id, edm::InputTag const &tag)
 

Detailed Description

Definition at line 74 of file HLTEcalResonanceFilter.h.

Constructor & Destructor Documentation

HLTEcalResonanceFilter::HLTEcalResonanceFilter ( const edm::ParameterSet iConfig)
explicit

for barrel selection

for endcap selection

for storing rechits ES for each selected EE clusters.

Definition at line 9 of file HLTEcalResonanceFilter.cc.

References edm::ParameterSet::getParameter(), and AlCaHLTBitMon_QueryRunRegistry::string.

10 {
11  barrelHits_ = iConfig.getParameter< edm::InputTag > ("barrelHits");
12  barrelClusters_ = iConfig.getParameter< edm::InputTag > ("barrelClusters");
13  barrelHitsToken_ = consumes<EBRecHitCollection>(barrelHits_);
14  barrelClustersToken_ = consumes<reco::BasicClusterCollection>(barrelClusters_);
15 
16  endcapHits_ = iConfig.getParameter< edm::InputTag > ("endcapHits");
17  endcapClusters_ = iConfig.getParameter< edm::InputTag > ("endcapClusters");
18  endcapHitsToken_ = consumes<EERecHitCollection>(endcapHits_);
19  endcapClustersToken_ = consumes<reco::BasicClusterCollection>(endcapClusters_);
20 
21  doSelBarrel_ = iConfig.getParameter<bool>("doSelBarrel");
22  if(doSelBarrel_){
23  edm::ParameterSet barrelSelection = iConfig.getParameter<edm::ParameterSet>( "barrelSelection" );
24 
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");
37  }
38  seleIso_ = barrelSelection.getParameter<double> ("seleIso");
39  ptMinForIsolation_ = barrelSelection.getParameter<double> ("ptMinForIsolation");
40  seleBeltDR_ = barrelSelection.getParameter<double> ("seleBeltDR");
41  seleBeltDeta_ = barrelSelection.getParameter<double> ("seleBeltDeta");
42 
43  store5x5RecHitEB_ = barrelSelection.getParameter<bool> ("store5x5RecHitEB");
44  BarrelHits_ = barrelSelection.getParameter<string > ("barrelHitCollection");
45 
46  produces< EBRecHitCollection >(BarrelHits_);
47 
48  }
49 
50 
51  doSelEndcap_ = iConfig.getParameter<bool>("doSelEndcap");
52  if(doSelEndcap_){
53  edm::ParameterSet endcapSelection = iConfig.getParameter<edm::ParameterSet>( "endcapSelection" );
54 
56  seleMinvMaxEndCap_ = endcapSelection.getParameter<double> ("seleMinvMaxEndCap");
57  seleMinvMinEndCap_ = endcapSelection.getParameter<double> ("seleMinvMinEndCap");
58 
59  region1_EndCap_ = endcapSelection.getParameter<double> ("region1_EndCap");
60  selePtGammaEndCap_region1_ = endcapSelection.getParameter<double> ("selePtGammaEndCap_region1");
61  selePtPairEndCap_region1_ = endcapSelection.getParameter<double> ("selePtPairEndCap_region1");
62 
63  region2_EndCap_ = endcapSelection.getParameter<double> ("region2_EndCap");
64  selePtGammaEndCap_region2_ = endcapSelection.getParameter<double> ("selePtGammaEndCap_region2");
65  selePtPairEndCap_region2_ = endcapSelection.getParameter<double> ("selePtPairEndCap_region2");
66 
67  selePtGammaEndCap_region3_ = endcapSelection.getParameter<double> ("selePtGammaEndCap_region3");
68  selePtPairEndCap_region3_ = endcapSelection.getParameter<double> ("selePtPairEndCap_region3");
69  selePtPairMaxEndCap_region3_ = endcapSelection.getParameter<double> ("selePtPairMaxEndCap_region3");
70 
71 
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");
78 
79  store5x5RecHitEE_ = endcapSelection.getParameter<bool> ("store5x5RecHitEE");
80  EndcapHits_ = endcapSelection.getParameter<string > ("endcapHitCollection");
81  produces< EERecHitCollection >(EndcapHits_);
82 
83 
84  }
85 
86 
87  useRecoFlag_ = iConfig.getParameter<bool>("useRecoFlag");
88  flagLevelRecHitsToUse_ = iConfig.getParameter<int>("flagLevelRecHitsToUse");
89 
90  useDBStatus_ = iConfig.getParameter<bool>("useDBStatus");
91  statusLevelRecHitsToUse_ = iConfig.getParameter<int>("statusLevelRecHitsToUse");
92 
93 
94  preshHitProducer_ = iConfig.getParameter<edm::InputTag>("preshRecHitProducer");
95  preshHitsToken_ = consumes<EBRecHitCollection>(preshHitProducer_);
96 
98  storeRecHitES_ = iConfig.getParameter<bool>("storeRecHitES");
99  if(storeRecHitES_){
100 
101  edm::ParameterSet preshowerSelection = iConfig.getParameter<edm::ParameterSet>( "preshowerSelection" );
102 
103  // maximum number of matched ES clusters (in each ES layer) to each BC
104  preshNclust_ = preshowerSelection.getParameter<int>("preshNclust");
105  // min energy of ES clusters
106  preshClustECut = preshowerSelection.getParameter<double>("preshClusterEnergyCut");
107  // algo params
108  float preshStripECut = preshowerSelection.getParameter<double>("preshStripEnergyCut");
109  int preshSeededNst = preshowerSelection.getParameter<int>("preshSeededNstrip");
110  // calibration parameters:
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");
115 
116  // ES algo constructor:
117  presh_algo_ = new PreshowerClusterAlgo(preshStripECut,preshClustECut,preshSeededNst);
118 
119  ESHits_ = preshowerSelection.getParameter< std::string > ("ESCollection");
120  produces< ESRecHitCollection >(ESHits_);
121  }
122 
123  debug_ = iConfig.getParameter<int> ("debugLevel");
124 
125 }
T getParameter(std::string const &) const
edm::EDGetTokenT< EERecHitCollection > endcapHitsToken_
edm::EDGetTokenT< EBRecHitCollection > barrelHitsToken_
std::string BarrelHits_
output hits
bool doSelBarrel_
for pi0/eta ->gg barrel
edm::EDGetTokenT< reco::BasicClusterCollection > barrelClustersToken_
edm::EDGetTokenT< ESRecHitCollection > preshHitsToken_
PreshowerClusterAlgo * presh_algo_
edm::EDGetTokenT< reco::BasicClusterCollection > endcapClustersToken_
HLTEcalResonanceFilter::~HLTEcalResonanceFilter ( )
override

Definition at line 128 of file HLTEcalResonanceFilter.cc.

129 {
130  if(storeRecHitES_){
131  delete presh_algo_;
132  }
133 }
PreshowerClusterAlgo * presh_algo_

Member Function Documentation

void HLTEcalResonanceFilter::calcPaircluster ( const reco::BasicCluster bc1,
const reco::BasicCluster bc2,
float &  mpair,
float &  ptpair,
float &  etapair,
float &  phipair 
)
private

Definition at line 848 of file HLTEcalResonanceFilter.cc.

References funct::cos(), JetChargeProducer_cfi::exp, hiDetachedQuadStep_cff::pt1, hiDetachedQuadStep_cff::pt2, funct::sin(), and findQualityFiles::v.

848  {
849 
850 
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);
855 
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);
860 
861  TLorentzVector v = v1 + v2;
862 
863  m_pair = v.M();
864  pt_pair = v.Pt();
865  eta_pair = v.Eta();
866  phi_pair = v.Phi();
867 
868 
869 }
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
Cos< T >::type cos(const T &t)
Definition: Cos.h:22
void HLTEcalResonanceFilter::calcShowerShape ( const reco::BasicCluster bc,
const EcalChannelStatus channelStatus,
const EcalRecHitCollection recHits,
const CaloSubdetectorTopology topology_p,
bool  calc5x5,
std::vector< EcalRecHit > &  rechit5x5,
float  res[] 
)
private

has to add "f", make it float

only store those not belonging to this cluster

S4, S9 are defined inside the cluster, the same as below.

if not asked to calculte 5x5, then just make e5x5 = e3x3

e2x2

Definition at line 727 of file HLTEcalResonanceFilter.cc.

References funct::abs(), PVValHelper::dx, PVValHelper::dy, EcalBarrel, edm::SortedCollection< T, SORT >::end(), f, spr::find(), edm::SortedCollection< T, SORT >::find(), CaloSubdetectorTopology::getWindow(), EBDetId::ieta(), EBDetId::iphi(), EEDetId::ix(), EEDetId::iy(), and DetId::subdetId().

727  {
728 
729 
730  const std::vector< std::pair<DetId, float> > &vid = bc.hitsAndFractions();
731 
732 
733  float e2x2[4]={0};
734  float e3x3 =0 ;
735  float e5x5 =0;
736  int seedx ;
737  int seedy;
738  DetId seedId = bc.seed();
739 
740  bool InBarrel = true;
741  if( seedId.subdetId() == EcalBarrel){
742  EBDetId ebd = EBDetId(seedId);
743  seedx = ebd.ieta();
744  seedy = ebd.iphi();
745  convxtalid(seedy,seedx);
746  }else{
747  InBarrel = false;
748  EEDetId eed = EEDetId(seedId);
749  seedx = eed.ix();
750  seedy = eed.iy();
751  }
752  int x,y, dx, dy;
753 
754 
755 
756  if( calc5x5 ){
757  rechit5x5.clear();
758  std::vector<DetId> clus_v5x5;
759  clus_v5x5 = topology_p->getWindow(seedId,5,5);
760 
761  for( std::vector<DetId>::const_iterator idItr = clus_v5x5.begin(); idItr != clus_v5x5.end(); idItr++){
762  DetId ed = *idItr;
763  if( InBarrel == true){
764  EBDetId ebd = EBDetId(ed);
765  x = ebd.ieta();
766  y = ebd.iphi();
767  convxtalid(y,x);
768  dx = diff_neta_s(x,seedx);
769  dy = diff_nphi_s(y,seedy);
770  }else{
771  EEDetId eed = EEDetId(ed);
772  x = eed.ix();
773  y = eed.iy();
774  dx = x-seedx;
775  dy = y-seedy;
776  }
777  auto rit = recHits->find( ed );
778  if ( rit == recHits->end() ) continue;
779  if( ! checkStatusOfEcalRecHit(channelStatus, *rit) ) continue;
780 
781  float energy = (*rit).energy();
782  e5x5 += energy;
783 
784  auto idItrF = std::find( vid.begin(),vid.end(), std::make_pair(ed,1.0f));
785  if( idItrF == vid.end()){
786  rechit5x5.push_back(*rit);
787  }else{
788  if(std::abs(dx)<=1 && std::abs(dy)<=1) {
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;
793  e3x3 += energy;
794  }
795  }
796  }
797 
798 
799  }else{
800 
801  for (auto const & idItr : vid){
802  DetId ed = idItr.first;
803  if( InBarrel == true){
804  EBDetId ebd = EBDetId(ed);
805  x = ebd.ieta();
806  y = ebd.iphi();
807  convxtalid(y,x);
808  dx = diff_neta_s(x,seedx);
809  dy = diff_nphi_s(y,seedy);
810  }else{
811  EEDetId eed = EEDetId(ed);
812  x = eed.ix();
813  y = eed.iy();
814  dx = x-seedx;
815  dy = y-seedy;
816  }
817  auto rit = recHits->find( ed );
818  if ( rit == recHits->end() ) {
819  continue;
820  }
821 
822  float energy = (*rit).energy();
823  if(std::abs(dx)<=1 && std::abs(dy)<=1){
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;
828  e3x3 += energy;
829  }
830 
831  }
832  e5x5 = e3x3;
833  }
834 
835 
836 
838  res[0] = *max_element( e2x2,e2x2+4);
839  res[1] = e3x3;
840  res[2] = e5x5;
841 
842 
843 }
int ix() const
Definition: EEDetId.h:77
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:20
Definition: Electron.h:6
int iphi() const
get the crystal iphi
Definition: EBDetId.h:51
bool checkStatusOfEcalRecHit(const EcalChannelStatus &channelStatus, const EcalRecHit &rh)
constexpr int subdetId() const
get the contents of the subdetector field (not cast into any detector&#39;s numbering enum) ...
Definition: DetId.h:41
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
double f[11][100]
int iy() const
Definition: EEDetId.h:83
int ieta() const
get the crystal ieta
Definition: EBDetId.h:49
const_iterator end() const
Definition: DetId.h:18
virtual std::vector< DetId > getWindow(const DetId &id, const int &northSouthSize, const int &eastWestSize) const
iterator find(key_type k)
bool HLTEcalResonanceFilter::checkStatusOfEcalRecHit ( const EcalChannelStatus channelStatus,
const EcalRecHit rh 
)
private

from recoFlag()

good

good || PoorCalib

good || PoorCalib || LeadingEdgeRecovered || kNeighboursRecovered,

Definition at line 875 of file HLTEcalResonanceFilter.cc.

References RemoveAddSevLevel::flag, EcalRecHit::id(), createfilelist::int, DetId::rawId(), EcalRecHit::recoFlag(), and mps_update::status.

875  {
876 
877  if(useRecoFlag_ ){
878  int flag = rh.recoFlag();
879  if( flagLevelRecHitsToUse_ ==0){
880  if( flag != 0) return false;
881  }
882  else if( flagLevelRecHitsToUse_ ==1){
883  if( flag !=0 && flag != 4 ) return false;
884  }
885  else if( flagLevelRecHitsToUse_ ==2){
886  if( flag !=0 && flag != 4 && flag != 6 && flag != 7) return false;
887  }
888  }
889  if ( useDBStatus_){
890  int status = int(channelStatus[rh.id().rawId()].getStatusCode());
891  if ( status > statusLevelRecHitsToUse_ ) return false;
892  }
893 
894  return true;
895 }
constexpr uint32_t rawId() const
get the raw id
Definition: DetId.h:50
DetId id() const
get the id
Definition: EcalRecHit.h:77
Flags recoFlag() const
DEPRECATED provided for temporary backward compatibility.
Definition: EcalRecHit.h:207
void HLTEcalResonanceFilter::convxtalid ( int &  ,
int &   
)
private

Definition at line 688 of file HLTEcalResonanceFilter.cc.

689 {
690  // Barrel only
691  // Output nphi 0...359; neta 0...84; nside=+1 (for eta>0), or 0 (for eta<0).
692  // neta will be [-85,-1] , or [0,84], the minus sign indicates the z<0 side.
693 
694  if(neta > 0) neta -= 1;
695  if(nphi > 359) nphi=nphi-360;
696 
697  // final check
698  if(nphi >359 || nphi <0 || neta< -85 || neta > 84)
699  {
700  LogError("") <<" unexpected fatal error in HLTEcalResonanceFilter::convxtalid "<< nphi << " " << neta << " " <<std::endl;
701  }
702 } //end of convxtalid
float HLTEcalResonanceFilter::DeltaPhi ( float  phi1,
float  phi2 
)
staticprivate

Definition at line 898 of file HLTEcalResonanceFilter.cc.

References diffTreeTool::diff.

898  {
899 
900  float diff = fabs(phi2 - phi1);
901 
902  while (diff >acos(-1)) diff -= 2*acos(-1);
903  while (diff <= -acos(-1)) diff += 2*acos(-1);
904 
905  return diff;
906 
907 }
int HLTEcalResonanceFilter::diff_neta_s ( int  ,
int   
)
private

Definition at line 707 of file HLTEcalResonanceFilter.cc.

707  {
708  Int_t mdiff;
709  mdiff=(neta1-neta2);
710  return mdiff;
711 }
int HLTEcalResonanceFilter::diff_nphi_s ( int  ,
int   
)
private

Definition at line 714 of file HLTEcalResonanceFilter.cc.

References funct::abs().

714  {
715  Int_t mdiff;
716  if(std::abs(nphi1-nphi2) < (360-std::abs(nphi1-nphi2))) {
717  mdiff=nphi1-nphi2;
718  }
719  else {
720  mdiff=360-std::abs(nphi1-nphi2);
721  if(nphi1>nphi2) mdiff=-mdiff;
722  }
723  return mdiff;
724 }
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
void HLTEcalResonanceFilter::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 
)
private

those clusters identified as pi0s

pt & Pt pair Cut

Mass window Cut

remember which Iso cluster used

Isolation cut

Save two good clusters' index( plus Iso cluster ) if not yet saved

good cluster

Parameters
indIsoClusgood cluster all , 5x5 rechit done already during the loop
indClusSelectedIso cluster all , 5x5 rechit not yet done saved so far, all

Definition at line 481 of file HLTEcalResonanceFilter.cc.

References EcalBarrel, EcalEndcap, JetChargeProducer_cfi::exp, spr::find(), createfilelist::int, gen::k, gen::n, TriggerAnalyzer::passed, hiDetachedQuadStep_cff::pt1, hiDetachedQuadStep_cff::pt2, ptmin, and funct::sin().

489  {
490 
491 
492  vector<int> indClusPi0Candidates;
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);
503  }
504  }
505  }
506  }//end of loop over finding pi0's clusters
507  }
508 
509 
510 
511 
512 
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_;
522 
523  if( detector ==EcalEndcap){
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_;
533 
534  }
535 
536 
537 
538 
539  map<int,bool> passShowerShape_clus; //if this cluster passed showershape cut, so no need to compute the quantity again for each loop
540 
541  for( auto it_bc = clusterCollection->begin(); it_bc != clusterCollection->end();it_bc++){
542 
544  auto it = find(indClusPi0Candidates.begin(),indClusPi0Candidates.end(),int(it_bc - clusterCollection->begin()) );
545  if( it != indClusPi0Candidates.end()) continue;
546  }
547 
548  float en1 = it_bc->energy();
549  float theta1 = 2. * atan(exp(-it_bc->position().eta()));
550  float pt1 = en1*sin(theta1);
551 
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){
556  continue;
557  }
558  }
559 
560  for( auto it_bc2 = it_bc + 1 ; it_bc2 != clusterCollection->end();it_bc2++){
562  auto it = find(indClusPi0Candidates.begin(),indClusPi0Candidates.end(),int(it_bc2 - clusterCollection->begin()) );
563  if( it != indClusPi0Candidates.end()) continue;
564  }
565  float en2 = it_bc2 ->energy();
566  float theta2 = 2. * atan(exp(-it_bc2->position().eta()));
567  float pt2 = en2*sin(theta2);
568 
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){
573  continue;
574  }
575  }
576 
577  float m_pair,pt_pair,eta_pair, phi_pair;
578  calcPaircluster(*it_bc,*it_bc2, m_pair, pt_pair,eta_pair,phi_pair);
580  float ptmin = pt1< pt2 ? pt1:pt2;
581  if( detector ==EcalBarrel ){
582  if( ptmin < selePtGamma_ ) continue;
583  if (pt_pair < selePtPair_ )continue;
584  }else{
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;
590  }else{
591  if(ptmin < selePtGammaEndCap_region3_ || pt_pair < selePtPairEndCap_region3_) continue;
592  if(pt_pair > selePtPairMaxEndCap_region3_ ) continue;
593  }
594  }
595 
596 
597 
599  if( m_pair < m_minCut || m_pair > m_maxCut) continue;
600 
601 
602 
603 
605  vector<int> IsoClus;
606  IsoClus.push_back(ind1); //first two are good clusters
607  IsoClus.push_back(ind2);
608 
609  float Iso = 0;
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;
617  Iso += pt3;
618  int ind3 = int(it_bc3 - clusterCollection->begin());
619  IsoClus.push_back( ind3);
620  }
622  if(Iso/pt_pair > isoCut) continue;
623 
624 
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;
633  n=2; //exit the loop
634  }
635  }else{
636  vector<EcalRecHit> RecHitsCluster_5x5;
637  float res[3];
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));
643  if( !passed ){
644  failShowerShape = true;
645  n=2; //exit the loop
646  }else{
647  RecHits5x5_clus.insert(pair<int, vector<EcalRecHit> >(ind,RecHitsCluster_5x5) );
648  }
649  }
650  }
651 
652  if( failShowerShape == true) continue; //if any of the two clusters fail shower shape
653 
654 
656  for(unsigned int iii=0 ; iii<IsoClus.size() ; iii++){
657  int ind = IsoClus[iii];
658 
659  if( iii < 2){
660  auto it = find(indCandClus.begin(),indCandClus.end(), ind);
661  if( it == indCandClus.end()) indCandClus.push_back(ind);
662  else continue;
663  }else{
664  auto it = find(indIsoClus.begin(),indIsoClus.end(), ind); //iso cluster
665  if( it == indIsoClus.end()) indIsoClus.push_back(ind);
666  else continue;
667  }
668 
669  auto it = find(indClusSelected.begin(),indClusSelected.end(),ind);
670  if( it != indClusSelected.end()) continue;
671  indClusSelected.push_back(ind);
672  }
673 
674  }
675  }
676 
677 
678 
679 
680 }
Sin< T >::type sin(const T &t)
Definition: Sin.h:22
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:20
Definition: Electron.h:6
void calcPaircluster(const reco::BasicCluster &bc1, const reco::BasicCluster &bc2, float &mpair, float &ptpair, float &etapair, float &phipair)
static float GetDeltaR(float eta1, float eta2, float phi1, float phi2)
int k[5][pyjets_maxn]
double ptmin
Definition: HydjetWrapper.h:90
void calcShowerShape(const reco::BasicCluster &bc, const EcalChannelStatus &channelStatus, const EcalRecHitCollection *recHits, const CaloSubdetectorTopology *topology_p, bool calc5x5, std::vector< EcalRecHit > &rechit5x5, float res[])
void HLTEcalResonanceFilter::fillDescriptions ( edm::ConfigurationDescriptions descriptions)
static

Definition at line 137 of file HLTEcalResonanceFilter.cc.

References edm::ConfigurationDescriptions::add(), edm::ParameterSetDescription::add(), and AlCaHLTBitMon_QueryRunRegistry::string.

137  {
139  desc.add<edm::InputTag>("barrelHits",edm::InputTag("hltEcalRegionalPi0EtaRecHit","EcalRecHitsEB"));
140  desc.add<edm::InputTag>("endcapHits",edm::InputTag("hltEcalRegionalPi0EtaRecHit","EcalRecHitsEE"));
141  desc.add<edm::InputTag>("preshRecHitProducer",edm::InputTag("hltEcalRegionalPi0EtaRecHit","EcalRecHitsES"));
142  desc.add<edm::InputTag>("barrelClusters",edm::InputTag("hltSimple3x3Clusters","Simple3x3ClustersBarrel"));
143  desc.add<edm::InputTag>("endcapClusters",edm::InputTag("hltSimple3x3Clusters","Simple3x3ClustersEndcap"));
144  desc.add<bool>("useRecoFlag",false);
145  desc.add<int>("flagLevelRecHitsToUse",1);
146  desc.add<bool>("useDBStatus",true);
147  desc.add<int>("statusLevelRecHitsToUse",1);
148 
149  desc.add<bool>("doSelBarrel",true);
150  edm::ParameterSetDescription barrelSelection;
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");
166  desc.add<edm::ParameterSetDescription>("barrelSelection",barrelSelection);
167 
168  desc.add<bool>("doSelEndcap",true);
169  edm::ParameterSetDescription endcapSelection;
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");
189  desc.add<edm::ParameterSetDescription>("endcapSelection",endcapSelection);
190 
191  desc.add<bool>("storeRecHitES",true);
192  edm::ParameterSetDescription preshowerSelection;
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",""); // *** This is not needed and shoul be better removed !
203  desc.add<edm::ParameterSetDescription>("preshowerSelection",preshowerSelection);
204 
205  desc.add<int>("debugLevel",0);
206  descriptions.add("hltEcalResonanceFilter",desc);
207 }
ParameterDescriptionBase * add(U const &iLabel, T const &value)
void add(std::string const &label, ParameterSetDescription const &psetDescription)
bool HLTEcalResonanceFilter::filter ( edm::Event iEvent,
const edm::EventSetup iSetup 
)
override

if no preshower

get status from DB

==============Start to process barrel part==================///

5x5 for selected pairs

Iso cluster all , 5x5 rechit not yet done

good cluster all , 5x5 rechit done already during the loop

saved so far, all

Now save all rechits in the selected clusters

stroe 5x5 of good clusters, 5x5 arleady got

store 5x5 of Iso clusters, need to getWindow of 5x5

check if already saved in the good cluster vector

==============End of barrel ==================///

get preshower rechits

5x5 for selected pairs

Iso cluster all , 5x5 rechit not yet done

good cluster all , 5x5 rechit done already during the loop

saved so far, all

Now save all rechits in the selected clusters

save preshower rechits

store 5x5 of good clusters, 5x5 arleady got

store 5x5 of Iso clusters, need to getWindow of 5x5

check if already saved in the good cluster vector

Definition at line 211 of file HLTEcalResonanceFilter.cc.

References edm::SortedCollection< T, SORT >::begin(), DetId::Ecal, EcalBarrel, EcalEndcap, EcalPreshower, edm::SortedCollection< T, SORT >::end(), edm::EventID::event(), spr::find(), edm::SortedCollection< T, SORT >::find(), edm::EventSetup::get(), edm::Event::getByToken(), CaloGeometry::getSubdetectorGeometry(), CaloTopology::getSubdetectorTopology(), CaloSubdetectorTopology::getWindow(), edm::EventBase::id(), edm::HandleBase::isValid(), LogDebug, eostools::move(), gen::n, edm::Handle< T >::product(), edm::Event::put(), edm::EventID::run(), and edm::SortedCollection< T, SORT >::size().

212 {
213 
214  //Create empty output collections
215  std::unique_ptr< EBRecHitCollection > selEBRecHitCollection( new EBRecHitCollection );
216  //Create empty output collections
217  std::unique_ptr< EERecHitCollection > selEERecHitCollection( new EERecHitCollection );
218 
219 
221  vector<DetId> selectedEBDetIds;
222  vector<DetId> selectedEEDetIds;
223 
224 
225  edm::ESHandle<CaloTopology> pTopology;
226  iSetup.get<CaloTopologyRecord>().get(pTopology);
227  const CaloSubdetectorTopology *topology_eb = pTopology->getSubdetectorTopology(DetId::Ecal,EcalBarrel);
228  const CaloSubdetectorTopology *topology_ee = pTopology->getSubdetectorTopology(DetId::Ecal,EcalEndcap);
229 
230 
231  edm::ESHandle<CaloGeometry> geoHandle;
232  iSetup.get<CaloGeometryRecord>().get(geoHandle);
234  std::unique_ptr<CaloSubdetectorTopology> topology_es;
235  if (geometry_es) {
236  topology_es = std::make_unique<EcalPreshowerTopology>();
237  }else{
238  storeRecHitES_ = false;
239  }
240 
241 
244  if ( useDBStatus_ ) iSetup.get<EcalChannelStatusRcd>().get(csHandle);
245  const EcalChannelStatus &channelStatus = *csHandle;
246 
248 
249  Handle<EBRecHitCollection> barrelRecHitsHandle;
250 
251  iEvent.getByToken(barrelHitsToken_,barrelRecHitsHandle);
252  if (!barrelRecHitsHandle.isValid()) {
253  LogDebug("") << "AlCaEcalResonanceProducer: Error! can't get product barrel hits!" << std::endl;
254  }
255 
256  const EcalRecHitCollection *hitCollection_eb = barrelRecHitsHandle.product();
257 
258 
259  Handle<reco::BasicClusterCollection> barrelClustersHandle;
260  iEvent.getByToken(barrelClustersToken_,barrelClustersHandle);
261  if (!barrelClustersHandle.isValid()) {
262  LogDebug("") << "AlCaEcalResonanceProducer: Error! can't get product barrel clusters!" << std::endl;
263  }
264  const reco::BasicClusterCollection *clusterCollection_eb = barrelClustersHandle.product();
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;
266 
267 
268  if(doSelBarrel_){
269 
270  map<int, vector<EcalRecHit> > RecHits5x5_clus;
271  vector<int> indIsoClus;
272  vector<int> indCandClus;
273  vector<int> indClusSelected;
274 
275  doSelection( EcalBarrel,clusterCollection_eb, hitCollection_eb, channelStatus,topology_eb,
276  RecHits5x5_clus,
277  indCandClus,indIsoClus, indClusSelected);
278 
279 
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; //this should not happen.
287  selEBRecHitCollection->push_back(*hit);
288  selectedEBDetIds.push_back(idItr.first);
289  }
290  }
291 
292 
293  if( store5x5RecHitEB_ ){
295  for(int ind : indCandClus){
296  vector<EcalRecHit> v5x5 = RecHits5x5_clus[ind];
297  for(auto & n : v5x5){
298  DetId ed = n.id();
299  auto itdet = find(selectedEBDetIds.begin(),selectedEBDetIds.end(),ed);
300  if( itdet == selectedEBDetIds.end()){
301  selectedEBDetIds.push_back(ed);
302  selEBRecHitCollection->push_back(n);
303  }
304  }
305  }
306 
307 
309  for(int ind : indIsoClus){
310  auto it = find(indCandClus.begin(),indCandClus.end(), ind);
311  if( it != indCandClus.end()) continue;
312 
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++){
317  DetId ed = *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);
325  }
326  }
327  }
328  }
329 
330 
331  }// end of selection for eta/pi0->gg in the barrel
332 
333  int eb_collsize = selEBRecHitCollection->size();
334 
335  if(debug_>=1) LogDebug("")<<" barrel_output_size_run "<<iEvent.id().run()<<" event "<<iEvent.id().event()<<" nEBSaved "<<selEBRecHitCollection->size()<<std::endl;
337 
338 
339 
340  //===============Start of Endcap =================/////
342  Handle<ESRecHitCollection> esRecHitsHandle;
343  iEvent.getByToken(preshHitsToken_,esRecHitsHandle);
344  if( !esRecHitsHandle.isValid()){
345  LogDebug("") << "AlCaEcalResonanceProducer: Error! can't get product esRecHit!" << std::endl;
346  }
347  const EcalRecHitCollection* hitCollection_es = esRecHitsHandle.product();
348  // make a map of rechits:
349  m_esrechit_map.clear();
351  for (iter = esRecHitsHandle->begin(); iter != esRecHitsHandle->end(); iter++) {
352  //Make the map of DetID, EcalRecHit pairs
353  m_esrechit_map.insert(std::make_pair(iter->id(), *iter));
354  }
355  // The set of used DetID's for a given event:
356  m_used_strips.clear();
357  std::unique_ptr<ESRecHitCollection> selESRecHitCollection(new ESRecHitCollection );
358 
359  Handle<EERecHitCollection> endcapRecHitsHandle;
360  iEvent.getByToken(endcapHitsToken_,endcapRecHitsHandle);
361  if (!endcapRecHitsHandle.isValid()) {
362  LogDebug("") << "AlCaEcalResonanceProducer: Error! can't get product endcap hits!" << std::endl;
363  }
364  const EcalRecHitCollection *hitCollection_ee = endcapRecHitsHandle.product();
365  Handle<reco::BasicClusterCollection> endcapClustersHandle;
366  iEvent.getByToken(endcapClustersToken_,endcapClustersHandle);
367  if (!endcapClustersHandle.isValid()) {
368  LogDebug("") << "AlCaEcalResonanceProducer: Error! can't get product endcap clusters!" << std::endl;
369  }
370  const reco::BasicClusterCollection *clusterCollection_ee = endcapClustersHandle.product();
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;
372 
373 
374  if(doSelEndcap_){
375 
376  map<int, vector<EcalRecHit> > RecHits5x5_clus;
377  vector<int> indIsoClus;
378  vector<int> indCandClus;
379  vector<int> indClusSelected;
380 
381  doSelection( EcalEndcap,clusterCollection_ee, hitCollection_ee, channelStatus,topology_ee,
382  RecHits5x5_clus,
383  indCandClus,indIsoClus, indClusSelected);
384 
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; //this should not happen.
392  selEERecHitCollection->push_back(*hit);
393  selectedEEDetIds.push_back(idItr.first);
394  }
396  if(storeRecHitES_){
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 ){
401  ESDetId d1 = ESDetId(*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);
406  }
407  }
408  }
409  }
410 
411 
412  if( store5x5RecHitEE_ ){
414  for(int ind : indCandClus){
415  vector<EcalRecHit> v5x5 = RecHits5x5_clus[ind];
416  for(auto & n : v5x5){
417  DetId ed = n.id();
418  auto itdet = find(selectedEEDetIds.begin(),selectedEEDetIds.end(),ed);
419  if( itdet == selectedEEDetIds.end()){
420  selectedEEDetIds.push_back(ed);
421  selEERecHitCollection->push_back(n);
422  }
423  }
424  }
425 
426 
428  for(int ind : indIsoClus){
429  auto it = find(indCandClus.begin(),indCandClus.end(), ind);
430  if( it != indCandClus.end()) continue;
431 
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++){
436  DetId ed = *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);
444  }
445  }
446  }
447  }
448 
449  }// end of selection for eta/pi0->gg in the endcap
450 
451 
452 
454 
455  if(debug_>=1) LogDebug("")<<" endcap_output_size run "<<iEvent.id().run()<<"_"<<iEvent.id().event()<<" nEESaved "<<selEERecHitCollection->size()<<" nESSaved: " << selESRecHitCollection->size() <<endl;
456 
457 
458  //Put selected information in the event
459  int ee_collsize = selEERecHitCollection->size();
460 
461  if( eb_collsize < 2 && ee_collsize <2) return false;
462 
464  if(doSelBarrel_){
465  iEvent.put(std::move(selEBRecHitCollection), BarrelHits_);
466  }
467  if(doSelEndcap_){
468  iEvent.put(std::move(selEERecHitCollection), EndcapHits_);
469  if(storeRecHitES_){
470  iEvent.put(std::move(selESRecHitCollection), ESHits_);
471  }
472  }
473 
474  return true;
475 
476 
477 }
#define LogDebug(id)
RunNumber_t run() const
Definition: EventID.h:39
const CaloSubdetectorGeometry * getSubdetectorGeometry(const DetId &id) const
access the subdetector geometry for the given subdetector directly
Definition: CaloGeometry.cc:49
EventNumber_t event() const
Definition: EventID.h:41
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.
Definition: Event.h:125
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:517
edm::EDGetTokenT< EERecHitCollection > endcapHitsToken_
std::vector< EcalRecHit >::const_iterator const_iterator
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
Definition: FindCaloHit.cc:20
bool checkStatusOfEcalRecHit(const EcalChannelStatus &channelStatus, const EcalRecHit &rh)
void makeClusterES(float x, float y, float z, const CaloSubdetectorGeometry *iSubGeom, const CaloSubdetectorTopology *topology_p)
edm::EDGetTokenT< EBRecHitCollection > barrelHitsToken_
std::map< DetId, EcalRecHit > m_esrechit_map
std::string BarrelHits_
output hits
bool isValid() const
Definition: HandleBase.h:74
bool doSelBarrel_
for pi0/eta ->gg barrel
const_iterator end() const
Definition: DetId.h:18
virtual std::vector< DetId > getWindow(const DetId &id, const int &northSouthSize, const int &eastWestSize) const
T const * product() const
Definition: Handle.h:74
const CaloSubdetectorTopology * getSubdetectorTopology(const DetId &id) const
access the subdetector Topology for the given subdetector directly
Definition: CaloTopology.cc:20
std::vector< BasicCluster > BasicClusterCollection
collection of BasicCluster objects
edm::EventID id() const
Definition: EventBase.h:59
iterator find(key_type k)
size_type size() const
edm::EDGetTokenT< reco::BasicClusterCollection > barrelClustersToken_
T get() const
Definition: EventSetup.h:71
edm::EDGetTokenT< ESRecHitCollection > preshHitsToken_
def move(src, dest)
Definition: eostools.py:511
const_iterator begin() const
edm::EDGetTokenT< reco::BasicClusterCollection > endcapClustersToken_
float HLTEcalResonanceFilter::GetDeltaR ( float  eta1,
float  eta2,
float  phi1,
float  phi2 
)
staticprivate

Definition at line 910 of file HLTEcalResonanceFilter.cc.

References allConversions_cfi::DeltaPhi, and mathSSE::sqrt().

910  {
911 
912  return sqrt( (eta1-eta2)*(eta1-eta2)
913  + DeltaPhi(phi1, phi2)*DeltaPhi(phi1, phi2) );
914 
915 }
static float DeltaPhi(float phi1, float phi2)
T sqrt(T t)
Definition: SSEVec.h:18
void HLTEcalResonanceFilter::makeClusterES ( float  x,
float  y,
float  z,
const CaloSubdetectorGeometry iSubGeom,
const CaloSubdetectorTopology topology_p 
)
private

get assosicated ES clusters of this endcap cluster

Definition at line 918 of file HLTEcalResonanceFilter.cc.

References GetRecoTauVFromDQM_MC_cff::cl2, DEFINE_FWK_MODULE, and point.

920  {
921 
922 
924  const GlobalPoint point(x,y,z);
925  DetId tmp1 = (dynamic_cast<const EcalPreshowerGeometry*>(geometry_es))->getClosestCellInPlane(point, 1);
926  DetId tmp2 = (dynamic_cast<const EcalPreshowerGeometry*>(geometry_es))->getClosestCellInPlane(point, 2);
927  ESDetId strip1 = (tmp1 == DetId(0)) ? ESDetId(0) : ESDetId(tmp1);
928  ESDetId strip2 = (tmp2 == DetId(0)) ? ESDetId(0) : ESDetId(tmp2);
929 
930  // Get ES clusters (found by the PreshSeeded algorithm) associated with a given EE cluster.
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);
934  } // end of cycle over ES clusters
935 
936 }
reco::PreshowerCluster makeOneCluster(ESDetId strip, HitsID *used_strips, RecHitsMap *rechits_map, const CaloSubdetectorGeometry *geometry_p, const CaloSubdetectorTopology *topology_p)
std::map< DetId, EcalRecHit > m_esrechit_map
Definition: DetId.h:18
PreshowerClusterAlgo * presh_algo_
*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
Definition: invegas.h:5

Member Data Documentation

edm::InputTag HLTEcalResonanceFilter::barrelClusters_
private

Definition at line 113 of file HLTEcalResonanceFilter.h.

edm::EDGetTokenT<reco::BasicClusterCollection> HLTEcalResonanceFilter::barrelClustersToken_
private

Definition at line 119 of file HLTEcalResonanceFilter.h.

edm::InputTag HLTEcalResonanceFilter::barrelHits_
private

Definition at line 111 of file HLTEcalResonanceFilter.h.

std::string HLTEcalResonanceFilter::BarrelHits_
private

output hits

Definition at line 123 of file HLTEcalResonanceFilter.h.

edm::EDGetTokenT<EBRecHitCollection> HLTEcalResonanceFilter::barrelHitsToken_
private

Definition at line 116 of file HLTEcalResonanceFilter.h.

double HLTEcalResonanceFilter::calib_planeX_
private

Definition at line 178 of file HLTEcalResonanceFilter.h.

double HLTEcalResonanceFilter::calib_planeY_
private

Definition at line 179 of file HLTEcalResonanceFilter.h.

int HLTEcalResonanceFilter::debug_
private

Definition at line 191 of file HLTEcalResonanceFilter.h.

bool HLTEcalResonanceFilter::doSelBarrel_
private

for pi0/eta ->gg barrel

Definition at line 129 of file HLTEcalResonanceFilter.h.

bool HLTEcalResonanceFilter::doSelEndcap_
private

Definition at line 146 of file HLTEcalResonanceFilter.h.

edm::InputTag HLTEcalResonanceFilter::endcapClusters_
private

Definition at line 114 of file HLTEcalResonanceFilter.h.

edm::EDGetTokenT<reco::BasicClusterCollection> HLTEcalResonanceFilter::endcapClustersToken_
private

Definition at line 120 of file HLTEcalResonanceFilter.h.

edm::InputTag HLTEcalResonanceFilter::endcapHits_
private

Definition at line 112 of file HLTEcalResonanceFilter.h.

std::string HLTEcalResonanceFilter::EndcapHits_
private

Definition at line 124 of file HLTEcalResonanceFilter.h.

edm::EDGetTokenT<EERecHitCollection> HLTEcalResonanceFilter::endcapHitsToken_
private

Definition at line 117 of file HLTEcalResonanceFilter.h.

std::string HLTEcalResonanceFilter::ESHits_
private

Definition at line 125 of file HLTEcalResonanceFilter.h.

double HLTEcalResonanceFilter::etThresh_
private

Definition at line 177 of file HLTEcalResonanceFilter.h.

int HLTEcalResonanceFilter::flagLevelRecHitsToUse_
private

Definition at line 169 of file HLTEcalResonanceFilter.h.

double HLTEcalResonanceFilter::gamma_
private

Definition at line 181 of file HLTEcalResonanceFilter.h.

std::map<DetId, EcalRecHit> HLTEcalResonanceFilter::m_esrechit_map
private

Definition at line 187 of file HLTEcalResonanceFilter.h.

std::set<DetId> HLTEcalResonanceFilter::m_used_strips
private

Definition at line 188 of file HLTEcalResonanceFilter.h.

double HLTEcalResonanceFilter::massHighPi0Cand_
private

Definition at line 142 of file HLTEcalResonanceFilter.h.

double HLTEcalResonanceFilter::massLowPi0Cand_
private

Definition at line 141 of file HLTEcalResonanceFilter.h.

double HLTEcalResonanceFilter::mip_
private

Definition at line 180 of file HLTEcalResonanceFilter.h.

PreshowerClusterAlgo* HLTEcalResonanceFilter::presh_algo_
private

Definition at line 183 of file HLTEcalResonanceFilter.h.

float HLTEcalResonanceFilter::preshClustECut
private

Definition at line 176 of file HLTEcalResonanceFilter.h.

edm::InputTag HLTEcalResonanceFilter::preshHitProducer_
private

Definition at line 174 of file HLTEcalResonanceFilter.h.

edm::EDGetTokenT<ESRecHitCollection> HLTEcalResonanceFilter::preshHitsToken_
private

Definition at line 118 of file HLTEcalResonanceFilter.h.

int HLTEcalResonanceFilter::preshNclust_
private

Definition at line 175 of file HLTEcalResonanceFilter.h.

double HLTEcalResonanceFilter::ptMinForIsolation_
private

Definition at line 139 of file HLTEcalResonanceFilter.h.

double HLTEcalResonanceFilter::ptMinForIsolationEndCap_
private

Definition at line 163 of file HLTEcalResonanceFilter.h.

double HLTEcalResonanceFilter::region1_EndCap_
private

Definition at line 147 of file HLTEcalResonanceFilter.h.

double HLTEcalResonanceFilter::region2_EndCap_
private

Definition at line 150 of file HLTEcalResonanceFilter.h.

bool HLTEcalResonanceFilter::removePi0CandidatesForEta_
private

Definition at line 140 of file HLTEcalResonanceFilter.h.

double HLTEcalResonanceFilter::seleBeltDeta_
private

Definition at line 137 of file HLTEcalResonanceFilter.h.

double HLTEcalResonanceFilter::seleBeltDetaEndCap_
private

Definition at line 162 of file HLTEcalResonanceFilter.h.

double HLTEcalResonanceFilter::seleBeltDR_
private

Definition at line 136 of file HLTEcalResonanceFilter.h.

double HLTEcalResonanceFilter::seleBeltDREndCap_
private

Definition at line 161 of file HLTEcalResonanceFilter.h.

double HLTEcalResonanceFilter::seleIso_
private

Definition at line 138 of file HLTEcalResonanceFilter.h.

double HLTEcalResonanceFilter::seleIsoEndCap_
private

Definition at line 160 of file HLTEcalResonanceFilter.h.

double HLTEcalResonanceFilter::seleMinvMaxBarrel_
private

Definition at line 132 of file HLTEcalResonanceFilter.h.

double HLTEcalResonanceFilter::seleMinvMaxEndCap_
private

Definition at line 156 of file HLTEcalResonanceFilter.h.

double HLTEcalResonanceFilter::seleMinvMinBarrel_
private

Definition at line 133 of file HLTEcalResonanceFilter.h.

double HLTEcalResonanceFilter::seleMinvMinEndCap_
private

Definition at line 157 of file HLTEcalResonanceFilter.h.

double HLTEcalResonanceFilter::selePtGamma_
private

Definition at line 130 of file HLTEcalResonanceFilter.h.

double HLTEcalResonanceFilter::selePtGammaEndCap_region1_
private

Definition at line 148 of file HLTEcalResonanceFilter.h.

double HLTEcalResonanceFilter::selePtGammaEndCap_region2_
private

Definition at line 151 of file HLTEcalResonanceFilter.h.

double HLTEcalResonanceFilter::selePtGammaEndCap_region3_
private

Definition at line 153 of file HLTEcalResonanceFilter.h.

double HLTEcalResonanceFilter::selePtPair_
private

Definition at line 131 of file HLTEcalResonanceFilter.h.

double HLTEcalResonanceFilter::selePtPairEndCap_region1_
private

Definition at line 149 of file HLTEcalResonanceFilter.h.

double HLTEcalResonanceFilter::selePtPairEndCap_region2_
private

Definition at line 152 of file HLTEcalResonanceFilter.h.

double HLTEcalResonanceFilter::selePtPairEndCap_region3_
private

Definition at line 154 of file HLTEcalResonanceFilter.h.

double HLTEcalResonanceFilter::selePtPairMaxEndCap_region3_
private

Definition at line 155 of file HLTEcalResonanceFilter.h.

double HLTEcalResonanceFilter::seleS4S9Gamma_
private

Definition at line 134 of file HLTEcalResonanceFilter.h.

double HLTEcalResonanceFilter::seleS4S9GammaEndCap_
private

Definition at line 158 of file HLTEcalResonanceFilter.h.

double HLTEcalResonanceFilter::seleS9S25Gamma_
private

Definition at line 135 of file HLTEcalResonanceFilter.h.

double HLTEcalResonanceFilter::seleS9S25GammaEndCap_
private

Definition at line 159 of file HLTEcalResonanceFilter.h.

int HLTEcalResonanceFilter::statusLevelRecHitsToUse_
private

Definition at line 170 of file HLTEcalResonanceFilter.h.

bool HLTEcalResonanceFilter::store5x5RecHitEB_
private

Definition at line 143 of file HLTEcalResonanceFilter.h.

bool HLTEcalResonanceFilter::store5x5RecHitEE_
private

Definition at line 164 of file HLTEcalResonanceFilter.h.

bool HLTEcalResonanceFilter::storeRecHitES_
private

Definition at line 173 of file HLTEcalResonanceFilter.h.

bool HLTEcalResonanceFilter::useDBStatus_
private

Definition at line 168 of file HLTEcalResonanceFilter.h.

bool HLTEcalResonanceFilter::useRecoFlag_
private

Definition at line 167 of file HLTEcalResonanceFilter.h.