20 muonTag_(iConfig.getParameter<edm::InputTag>(
"muonCandidates")),
21 trackTag_(iConfig.getParameter<edm::InputTag>(
"tracks")),
22 minMasses_(iConfig.getParameter< std::vector<double> >(
"MinMasses")),
23 maxMasses_(iConfig.getParameter< std::vector<double> >(
"MaxMasses")),
24 checkCharge_(iConfig.getParameter<bool>(
"checkCharge")),
25 minTrackPt_(iConfig.getParameter<double>(
"MinTrackPt")),
26 minTrackP_(iConfig.getParameter<double>(
"MinTrackP")),
27 maxTrackEta_(iConfig.getParameter<double>(
"MaxTrackEta"))
36 produces<reco::TrackCollection>();
48 edm::LogError(
"QuarkoniaTrackSelector") <<
"Inconsistency in definition of mass windows, "
49 <<
"no track will be selected";
55 stream <<
"instantiated with parameters\n"
58 stream <<
" mass windows =";
64 stream <<
" MinTrackP = " <<
minTrackP_ <<
"\n";
66 LogDebug(
"QuarkoniaTrackSelector") << stream.str();
99 stream <<
"\nInput muons: # / q / pt / p / eta\n";
100 for (
size_t im=0; im<muonHandle->size(); ++im ) {
102 stream <<
" " << im <<
" "
103 << muon.
charge() <<
" " << muon.
pt() <<
" "
104 << muon.
p() <<
" " << muon.
eta() <<
"\n";
106 stream <<
"Input tracks: # / q / pt / p / eta\n";
107 for (
size_t it=0; it<trackHandle->size(); ++it ) {
109 stream <<
" " << it <<
" "
110 << track.
charge() <<
" " << track.
pt() <<
" "
111 << track.
p() <<
" " << track.
eta() <<
"\n";
113 LogDebug(
"QuarkoniaTrackSelector") << stream.str();
120 unsigned int nComb(0);
121 std::vector<size_t> selectedTrackIndices;
122 selectedTrackIndices.reserve(muonHandle->size());
126 for (
size_t im=0; im<muonHandle->size(); ++im ) {
128 int qMuon = muon.
charge();
131 for (
size_t it=0; it<trackHandle->size(); ++it ) {
138 sqrt(track.
p()*track.
p()+0.0111636));
140 double mass = (p4Muon+p4Track).mass();
147 if (
find(selectedTrackIndices.begin(),selectedTrackIndices.end(),it)==
148 selectedTrackIndices.end() ) selectedTrackIndices.push_back(it);
159 for (
size_t i=0;
i<selectedTrackIndices.size(); ++
i )
160 product->push_back((*trackHandle)[selectedTrackIndices[
i]]);
165 std::ostringstream
stream;
166 stream <<
"Total number of combinations = " << muonHandle->size()*trackHandle->size()
167 <<
" , after charge " << nQ <<
" , after mass " << nComb << std::endl;
168 stream <<
"Selected " << product->size() <<
" tracks with # / q / pt / eta\n";
169 for (
size_t i=0; i<product->size(); ++
i ) {
171 stream <<
" " << i <<
" " << track.
charge() <<
" "
172 << track.
pt() <<
" " << track.
eta() <<
"\n";
174 LogDebug(
"QuarkoniaTrackSelector") << stream.str();
edm::EDGetTokenT< reco::RecoChargedCandidateCollection > muonToken_
virtual void produce(edm::Event &, const edm::EventSetup &)
double p() const
momentum vector magnitude
virtual double p() const
magnitude of momentum vector
virtual float pt() const
transverse momentum
bool getByToken(EDGetToken token, Handle< PROD > &result) const
#define DEFINE_FWK_MODULE(type)
std::vector< Track > TrackCollection
collection of Tracks
std::vector< double > minMasses_
lower mass limits
double px() const
x coordinate of momentum vector
void find(edm::Handle< EcalRecHitCollection > &hits, DetId thisDet, std::vector< EcalRecHitCollection::const_iterator > &hit, bool debug=false)
std::vector< double > maxMasses_
upper mass limits
QuarkoniaTrackSelector(const edm::ParameterSet &)
double eta() const
pseudorapidity of momentum vector
OrphanHandle< PROD > put(std::auto_ptr< PROD > product)
Put a new product.
virtual float eta() const
momentum pseudorapidity
double pt() const
track transverse momentum
virtual int charge() const
electric charge
double pz() const
z coordinate of momentum vector
edm::EDGetTokenT< reco::TrackCollection > trackToken_
double minTrackP_
track p cut
int charge() const
track electric charge
edm::InputTag trackTag_
tag for TrackCollection
virtual const LorentzVector & p4() const
four-momentum Lorentz vector
math::XYZTLorentzVector LorentzVector
Lorentz vector.
double minTrackPt_
track pt cut
edm::InputTag muonTag_
tag for RecoChargedCandidateCollection
double py() const
y coordinate of momentum vector
bool checkCharge_
check opposite charge?
double maxTrackEta_
track |eta| cut