1 #ifndef __CorrectedECALPFClusterProducer__
2 #define __CorrectedECALPFClusterProducer__
23 bool sortByKey(
const EEPSPair&
a,
const EEPSPair&
b) {
24 return a.first < b.first;
28 if( psclus.
isNull() )
return -1.0;
43 if( eeclus->z()*psclus->z() < 0 )
return -1.0;
46 if( dphi > 0.6 )
return -1.0;
47 const double deta=
std::abs(eepos.eta() - pspos.eta());
48 if( deta > 0.3 )
return -1.0;
68 produces<reco::PFCluster::EEtoPSAssociation>();
69 produces<reco::PFClusterCollection>();
86 std::auto_ptr<reco::PFClusterCollection> clusters_out;
88 std::auto_ptr<reco::PFCluster::EEtoPSAssociation> association_out;
96 clusters_out->reserve(handleECAL->size());
97 association_out->reserve(handleECAL->size());
98 clusters_out->insert(clusters_out->end(),
99 handleECAL->begin(),handleECAL->end());
101 double dist = -1.0, min_dist = -1.0;
102 for(
unsigned i = 0;
i < handlePS->size(); ++
i ) {
103 switch( handlePS->at(
i).layer() ) {
113 dist = min_dist = -1.0;
114 for(
size_t ic = 0; ic < handleECAL->size(); ++ic ) {
117 dist = testPreshowerDistance(eeclus,psclus);
118 if( dist == -1.0 || (min_dist != -1.0 && dist > min_dist) )
continue;
119 if( dist < min_dist || min_dist == -1.0 ) {
125 association_out->push_back(std::make_pair(eematch.
key(),psclus));
128 std::sort(association_out->begin(),association_out->end(),sortByKey);
130 _corrector->correctEnergies(e,es,*association_out,*clusters_out);
132 association_out->shrink_to_fit();
134 e.
put(association_out);
140 desc.
add<
double>(
"minimumPSEnergy",0.0);
144 psd0.
add<
bool>(
"applyCrackCorrections",
false);
145 psd0.
add<
bool>(
"applyMVACorrections",
false);
146 psd0.
add<
double>(
"maxPtForMVAEvaluation",-99.);
151 psd0.
add<
bool>(
"autoDetectBunchSpacing",
true);
152 psd0.
add<
int>(
"bunchSpacing",25);
156 descriptions.
add(
"particleFlowClusterECAL",desc);
T getParameter(std::string const &) const
edm::EDGetTokenT< reco::PFClusterCollection > _inputPS
CorrectedECALPFClusterProducer(const edm::ParameterSet &conf)
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
static double testECALAndPSByRecHit(const reco::PFCluster &clusterECAL, const reco::PFCluster &clusterPS, bool debug=false)
#define DEFINE_FWK_MODULE(type)
double Phi_mpi_pi(double x)
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
ConsumesCollector consumesCollector()
Use a ConsumesCollector to gather consumes information from helper functions.
std::vector< std::pair< CaloClusterPtr::key_type, edm::Ptr< PFCluster > > > EEtoPSAssociation
bool isNull() const
Checks for null.
Abs< T >::type abs(const T &t)
ParameterDescriptionBase * add(U const &iLabel, T const &value)
Container::value_type value_type
const double _minimumPSEnergy
edm::EDGetTokenT< reco::PFClusterCollection > _inputECAL
bool isNonnull() const
Checks for non-null.
virtual void produce(edm::Event &e, const edm::EventSetup &es)
std::unique_ptr< PFClusterEMEnergyCorrector > _corrector
ParameterSet const & getParameterSet(std::string const &) const
void add(std::string const &label, ParameterSetDescription const &psetDescription)
ROOT::Math::PositionVector3D< ROOT::Math::CylindricalEta3D< double > > REPPoint
std::vector< PFCluster > PFClusterCollection
collection of PFCluster objects