13 srcSelectedMuons_(cfg.getParameter<edm::InputTag>(
"muons")),
14 srcDistanceMapMuPlus_(cfg.getParameter<edm::InputTag>(
"distanceMapMuPlus")),
15 srcDistanceMapMuMinus_(cfg.getParameter<edm::InputTag>(
"distanceMapMuMinus"))
18 typedef std::vector<std::string>
vstring;
20 for ( vstring::const_iterator detName = detNames.begin();
21 detName != detNames.end(); ++detName ) {
29 produces<detIdToFloatMap>(
"energyDepositsMuPlus");
30 produces<double>(
"totalDistanceMuPlus");
31 produces<double>(
"totalEnergyDepositMuPlus");
32 produces<detIdToFloatMap>(
"energyDepositsMuMinus");
33 produces<double>(
"totalDistanceMuMinus");
34 produces<double>(
"totalEnergyDepositMuMinus");
44 std::auto_ptr<detIdToFloatMap> energyDepositsMuPlus(
new detIdToFloatMap());
45 std::auto_ptr<detIdToFloatMap> energyDepositsMuMinus(
new detIdToFloatMap());
56 std::auto_ptr<double> totalDistanceMuPlus(
new double(0.));
57 std::auto_ptr<double> totalEnergyDepositMuPlus(
new double(0.));
58 if ( muPlus.
isNonnull() )
fillEnergyDepositMap(*muPlus, *distanceMapMuPlus, *energyDepositsMuPlus, *totalDistanceMuPlus, *totalEnergyDepositMuPlus);
59 std::auto_ptr<double> totalDistanceMuMinus(
new double(0.));
60 std::auto_ptr<double> totalEnergyDepositMuMinus(
new double(0.));
61 if ( muMinus.
isNonnull() )
fillEnergyDepositMap(*muMinus, *distanceMapMuMinus, *energyDepositsMuMinus, *totalDistanceMuMinus, *totalEnergyDepositMuMinus);
65 std::cout <<
" mu+: distance = " << (*totalDistanceMuPlus) <<
", expected(EnergyDeposits) = " << (*totalEnergyDepositMuPlus) << std::endl;
66 std::cout <<
" mu-: distance = " << (*totalDistanceMuMinus) <<
", expected(EnergyDeposits) = " << (*totalEnergyDepositMuMinus) << std::endl;
69 evt.
put(energyDepositsMuPlus,
"energyDepositsMuPlus");
70 evt.
put(totalDistanceMuPlus,
"totalDistanceMuPlus");
71 evt.
put(totalEnergyDepositMuPlus,
"totalEnergyDepositMuPlus");
72 evt.
put(energyDepositsMuMinus,
"energyDepositsMuMinus");
73 evt.
put(totalDistanceMuMinus,
"totalDistanceMuMinus");
74 evt.
put(totalEnergyDepositMuMinus,
"totalEnergyDepositMuMinus");
78 double& totalDistance,
double& totalEnergyDeposit)
80 for ( detIdToFloatMap::const_iterator rawDetId_and_distance = distanceMap.begin();
81 rawDetId_and_distance != distanceMap.end(); ++rawDetId_and_distance ) {
82 DetId detId(rawDetId_and_distance->first);
88 <<
"No energy deposit correction defined for detId = " << detId.
rawId() <<
" (key = " << key <<
") !!\n";
90 double distance = rawDetId_and_distance->second;
95 switch ( detId.
det() ) {
108 distance += 31.2 /
sin(theta);
115 <<
"Unknown detector type: " << key <<
", detId = " <<
static_cast<unsigned int>(detId);
118 double energyDeposit = distance*dEdx*rho*energyDepositCorrection_value;
119 energyDepositMap[rawDetId_and_distance->first] += energyDeposit;
120 totalDistance += distance;
121 totalEnergyDeposit += energyDeposit;
const double DENSITY_PBWO4
T getParameter(std::string const &) const
reco::CandidateBaseRef getTheMuMinus(const std::vector< reco::CandidateBaseRef > &)
const double DENSITY_IRON
#define DEFINE_FWK_MODULE(type)
std::map< std::string, double > energyDepositCorrection_
Sin< T >::type sin(const T &t)
Geom::Theta< T > theta() const
bool exists(std::string const ¶meterName) const
checks if a parameter exists
bool isNonnull() const
Checks for non-null.
~MuonCaloCleanerByDistance()
edm::InputTag srcSelectedMuons_
std::vector< std::string > getParameterNamesForType(bool trackiness=true) const
uint32_t rawId() const
get the raw id
virtual double p() const =0
magnitude of momentum vector
edm::InputTag srcDistanceMapMuMinus_
const double DENSITY_BRASS
virtual double theta() const =0
momentum polar angle
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
double getDeDxForPbWO4(double)
int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum) ...
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
std::map< uint32_t, float > detIdToFloatMap
void fillEnergyDepositMap(const reco::Candidate &muon, const detIdToFloatMap &, detIdToFloatMap &, double &, double &)
edm::InputTag srcDistanceMapMuPlus_
std::string getKey(const DetId &)
virtual void produce(edm::Event &, const edm::EventSetup &)
std::vector< reco::CandidateBaseRef > getSelMuons(const edm::Event &, const edm::InputTag &)
MuonCaloCleanerByDistance(const edm::ParameterSet &)
reco::CandidateBaseRef getTheMuPlus(const std::vector< reco::CandidateBaseRef > &)
Detector det() const
get the detector field from this detid