31 #include "Math/VectorUtil.h"
84 std::map<int, std::string > detMap_;
85 std::map<int, std::map<int, std::string> > subDetMap_;
104 return "H_"+detMap_[det.
det()]+
"_"+subDetMap_[det.
det()][det.
subdetId()];
109 if ( zP4.pt() == 0. ) {
111 <<
" Failed to compute projection, because Z0 candidate has zero Pt --> returning dummy solution !!";
113 return std::pair<double, double>(0., 0.);
116 double qX = zP4.px();
117 double qY = zP4.py();
118 double qT = TMath::Sqrt(qX*qX + qY*qY);
123 double u1 = (uX*qX + uY*qY)/qT;
124 double u2 = (uX*qY - uY*qX)/qT;
126 return std::pair<double, double>(u1, u2);
133 colCaloLengthsMinus_(iConfig.getParameter<edm::InputTag>(
"caloLengthsMinus")),
134 colCaloLengthsPlus_(iConfig.getParameter<edm::InputTag>(
"caloLengthsPlus")),
135 colCaloDepositsMinus_(iConfig.getParameter<edm::InputTag>(
"caloDepositsMinus")),
136 colCaloDepositsPlus_(iConfig.getParameter<edm::InputTag>(
"caloDepositsPlus")),
137 colL1ETM_(iConfig.getParameter<edm::InputTag>(
"l1ETM")),
138 colCaloMET_(iConfig.getParameter<edm::InputTag>(
"caloMET")),
139 colGenParticles_(iConfig.getParameter<edm::InputTag>(
"genParticles")),
140 colMuons_(iConfig.getParameter<edm::InputTag>(
"muons"))
143 tree_ = fs->
make<TTree>(
"L1AnaTree",
"L1AnaTree");
146 tree_->Branch(
"p", &
p_,
"p/F");
169 for(std::vector<reco::GenParticle>::const_iterator
iter = genHandle->begin();
iter != genHandle->end(); ++
iter)
173 if(gen.
status() != 1)
continue;
185 for(std::vector<reco::Muon>::const_iterator
iter = muonsHandle->begin();
iter != muonsHandle->end(); ++
iter)
189 if(ROOT::Math::VectorUtil::DeltaR(genMuon->
p4(), mu.
p4()) > 0.1)
continue;
190 if(recoMuon && ROOT::Math::VectorUtil::DeltaR(genMuon->
p4(), mu.
p4()) > ROOT::Math::VectorUtil::DeltaR(genMuon->
p4(), recoMuon->
p4()))
continue;
195 if(!recoMuon)
return;
204 const std::map<unsigned int,float>& caloLengths = recoMuon->
charge() < 0 ? *hLengthsMinus : *hLengthsPlus;
205 const std::map<unsigned int,float>& caloDeposits = recoMuon->
charge() < 0 ? *hDepositsMinus : *hDepositsPlus;
206 float len_ecal = 0.0f, len_hcal = 0.0f, len_ho = 0.0f;
207 float dep_ecal = 0.0f, dep_hcal = 0.0f, dep_ho = 0.0f;
208 for(std::map<unsigned int, float>::const_iterator
iter = caloLengths.begin();
iter != caloLengths.end(); ++
iter)
211 std::map<unsigned int, float>::const_iterator dep_iter = caloDeposits.find(det);
212 const float dep = (dep_iter != caloDeposits.end()) ? dep_iter->second : 0.0f;
219 len_ecal +=
iter->second;
224 len_hcal +=
iter->second;
229 len_ho +=
iter->second;
237 assert(hl1Etm->size() == 1);
239 std::pair<double, double> l1_u1u2 =
compMEtProjU(genMuon->
p4(), (*hl1Etm)[0].px(), (*hl1Etm)[0].py(), errorFlag);
240 if(errorFlag)
return;
245 assert(hCaloMet->size() == 1);
247 std::pair<double, double> calo_u1u2 =
compMEtProjU(genMuon->
p4(), (*hCaloMet)[0].px(), (*hCaloMet)[0].py(), errorFlag);
248 if(errorFlag)
return;
251 pt_ = recoMuon->
pt();
virtual int pdgId() const
PDG identifier.
virtual double p() const
magnitude of momentum vector
edm::InputTag colCaloDepositsMinus_
virtual float pt() const
transverse momentum
edm::InputTag colGenParticles_
#define DEFINE_FWK_MODULE(type)
virtual int status() const
status word
virtual float phi() const
momentum azimuthal angle
bool isGlobalMuon() const
T * make(const Args &...args) const
make new ROOT object
edm::InputTag colCaloLengthsMinus_
edm::InputTag colCaloMET_
std::string getKey(const DetId &det)
edm::InputTag colCaloDepositsPlus_
edm::InputTag colCaloLengthsPlus_
AnaL1CaloCleaner(const edm::ParameterSet &)
void addDefault(ParameterSetDescription const &psetDescription)
virtual float eta() const
momentum pseudorapidity
virtual int charge() const
electric charge
int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum) ...
virtual void analyze(const edm::Event &, const edm::EventSetup &)
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
std::pair< double, double > compMEtProjU(const reco::Candidate::LorentzVector &zP4, double metPx, double metPy, int &errorFlag)
math::XYZTLorentzVector LorentzVector
Lorentz vector.
Detector det() const
get the detector field from this detid
virtual const LorentzVector & p4() const
four-momentum Lorentz vector
static void fillDescriptions(edm::ConfigurationDescriptions &descriptions)