#include <AlignmentTwoBodyDecayTrackSelector.h>
Public Types | |
typedef std::vector< const reco::Track * > | Tracks |
Public Member Functions | |
AlignmentTwoBodyDecayTrackSelector (const edm::ParameterSet &cfg) | |
constructor | |
Tracks | select (const Tracks &tracks, const edm::Event &iEvent) |
select tracks | |
bool | useThisFilter () |
returns if any of the Filters is used. | |
~AlignmentTwoBodyDecayTrackSelector () | |
destructor | |
Private Member Functions | |
bool | checkAcoplanarity (const reco::Track *trk1, const reco::Track *trk2) const |
checks if the [cands] are acoplanar (returns empty set if not) | |
bool | checkCharge (const reco::Track *trk1, const reco::Track *trk2=0) const |
checks if the mother has charge = [theCharge] | |
Tracks | checkMass (const Tracks &cands) const |
checks if the mass of the mother is in the mass region | |
bool | checkMETAcoplanarity (const reco::Track *trk, const reco::CaloMET *met) const |
checks if [cands] contains a acoplanar track w.r.t missing ET (returns empty set if not) | |
Tracks | checkMETMass (const Tracks &cands, const edm::Event &iEvent) const |
checks if the mass of the mother is in the mass region adding missing E_T | |
void | printTracks (const Tracks &col) const |
print Information on Track-Collection | |
Private Attributes | |
double | theAcoplanarDistance |
bool | theAcoplanarityFilterSwitch |
unsigned int | theCandNumber |
int | theCharge |
bool | theChargeSwitch |
double | theDaughterMass |
bool | theMassrangeSwitch |
private data members | |
double | theMaxMass |
double | theMinMass |
edm::InputTag | theMissingETSource |
bool | theMissingETSwitch |
bool | theUnsignedSwitch |
Definition at line 14 of file AlignmentTwoBodyDecayTrackSelector.h.
typedef std::vector<const reco::Track*> AlignmentTwoBodyDecayTrackSelector::Tracks |
Definition at line 18 of file AlignmentTwoBodyDecayTrackSelector.h.
AlignmentTwoBodyDecayTrackSelector::AlignmentTwoBodyDecayTrackSelector | ( | const edm::ParameterSet & | cfg | ) |
constructor
Definition at line 23 of file AlignmentTwoBoyDecayTrackSelector.cc.
References abs, edm::ParameterSet::getParameter(), LogDebug, theAcoplanarDistance, theAcoplanarityFilterSwitch, theCandNumber, theCharge, theChargeSwitch, theDaughterMass, theMassrangeSwitch, theMaxMass, theMinMass, theMissingETSource, theMissingETSwitch, and theUnsignedSwitch.
: theMissingETSource("met") { LogDebug("Alignment") << "> applying two body decay Trackfilter ..."; theMassrangeSwitch = cfg.getParameter<bool>( "applyMassrangeFilter" ); if (theMassrangeSwitch){ theMinMass = cfg.getParameter<double>( "minXMass" ); theMaxMass = cfg.getParameter<double>( "maxXMass" ); theDaughterMass = cfg.getParameter<double>( "daughterMass" ); theCandNumber = cfg.getParameter<unsigned int>( "numberOfCandidates" );//Number of candidates to keep LogDebug("Alignment") << "> Massrange min,max : " << theMinMass << "," << theMaxMass << "\n> Mass of daughter Particle : " << theDaughterMass; }else{ theMinMass = 0; theMaxMass = 0; theDaughterMass = 0; } theChargeSwitch = cfg.getParameter<bool>( "applyChargeFilter" ); if(theChargeSwitch){ theCharge = cfg.getParameter<int>( "charge" ); theUnsignedSwitch = cfg.getParameter<bool>( "useUnsignedCharge" ); if(theUnsignedSwitch) theCharge=std::abs(theCharge); LogDebug("Alignment") << "> Desired Charge, unsigned: "<<theCharge<<" , "<<theUnsignedSwitch; }else{ theCharge =0; theUnsignedSwitch = true; } theMissingETSwitch = cfg.getParameter<bool>( "applyMissingETFilter" ); if(theMissingETSwitch){ theMissingETSource = cfg.getParameter<InputTag>( "missingETSource" ); LogDebug("Alignment") << "> missing Et Source: "<< theMissingETSource; } theAcoplanarityFilterSwitch = cfg.getParameter<bool>( "applyAcoplanarityFilter" ); if(theAcoplanarityFilterSwitch){ theAcoplanarDistance = cfg.getParameter<double>( "acoplanarDistance" ); LogDebug("Alignment") << "> Acoplanar Distance: "<<theAcoplanarDistance; } }
AlignmentTwoBodyDecayTrackSelector::~AlignmentTwoBodyDecayTrackSelector | ( | ) |
bool AlignmentTwoBodyDecayTrackSelector::checkAcoplanarity | ( | const reco::Track * | trk1, |
const reco::Track * | trk2 | ||
) | const [private] |
checks if the [cands] are acoplanar (returns empty set if not)
Definition at line 278 of file AlignmentTwoBoyDecayTrackSelector.cc.
References SiPixelRawToDigiRegional_cfi::deltaPhi, M_PI, reco::TrackBase::phi(), and theAcoplanarDistance.
Referenced by checkMass().
{ if (fabs(deltaPhi(trk1->phi(),trk2->phi()-M_PI)) < theAcoplanarDistance) return true; return false; }
bool AlignmentTwoBodyDecayTrackSelector::checkCharge | ( | const reco::Track * | trk1, |
const reco::Track * | trk2 = 0 |
||
) | const [private] |
checks if the mother has charge = [theCharge]
Definition at line 267 of file AlignmentTwoBoyDecayTrackSelector.cc.
References abs, reco::TrackBase::charge(), theCharge, and theUnsignedSwitch.
Referenced by checkMass(), and checkMETMass().
{ int sumCharge = trk1->charge(); if (trk2) sumCharge += trk2->charge(); if (theUnsignedSwitch) sumCharge = std::abs(sumCharge); if (sumCharge == theCharge) return true; return false; }
AlignmentTwoBodyDecayTrackSelector::Tracks AlignmentTwoBodyDecayTrackSelector::checkMass | ( | const Tracks & | cands | ) | const [private] |
checks if the mass of the mother is in the mass region
checks if the mass of the X is in the mass region
Definition at line 106 of file AlignmentTwoBoyDecayTrackSelector.cc.
References checkAcoplanarity(), checkCharge(), i, LogDebug, query::result, python::multivaluedict::sort(), mathSSE::sqrt(), theAcoplanarityFilterSwitch, theCandNumber, theChargeSwitch, theDaughterMass, theMaxMass, and theMinMass.
Referenced by select().
{ Tracks result; LogDebug("Alignment") <<"> cands size : "<< cands.size(); if (cands.size()<2) return result; TLorentzVector track0; TLorentzVector track1; TLorentzVector mother; typedef pair<const reco::Track*,const reco::Track*> constTrackPair; typedef pair<double,constTrackPair> candCollectionItem; vector<candCollectionItem> candCollection; for (unsigned int iCand = 0; iCand < cands.size(); iCand++) { track0.SetXYZT(cands.at(iCand)->px(), cands.at(iCand)->py(), cands.at(iCand)->pz(), sqrt( cands.at(iCand)->p()*cands.at(iCand)->p() + theDaughterMass*theDaughterMass )); for (unsigned int jCand = iCand+1; jCand < cands.size(); jCand++) { track1.SetXYZT(cands.at(jCand)->px(), cands.at(jCand)->py(), cands.at(jCand)->pz(), sqrt( cands.at(jCand)->p()*cands.at(jCand)->p() + theDaughterMass*theDaughterMass )); mother = track0 + track1; const reco::Track *trk1 = cands.at(iCand); const reco::Track *trk2 = cands.at(jCand); bool correctCharge = true; if (theChargeSwitch) correctCharge = this->checkCharge(trk1, trk2); bool acoplanarTracks = true; if (theAcoplanarityFilterSwitch) acoplanarTracks = this->checkAcoplanarity(trk1, trk2); if (mother.M() > theMinMass && mother.M() < theMaxMass && correctCharge && acoplanarTracks) { candCollection.push_back(candCollectionItem(mother.Pt(), constTrackPair(trk1, trk2))); } } } if (candCollection.size()==0) return result; sort(candCollection.begin(), candCollection.end(), higherTwoBodyDecayPt<candCollectionItem>()); std::map<const reco::Track*,unsigned int> uniqueTrackIndex; std::map<const reco::Track*,unsigned int>::iterator it; for (unsigned int i=0; i<candCollection.size() && i<theCandNumber; i++) { constTrackPair & trackPair = candCollection[i].second; it = uniqueTrackIndex.find(trackPair.first); if (it==uniqueTrackIndex.end()) { result.push_back(trackPair.first); uniqueTrackIndex[trackPair.first] = i; } it = uniqueTrackIndex.find(trackPair.second); if (it==uniqueTrackIndex.end()) { result.push_back(trackPair.second); uniqueTrackIndex[trackPair.second] = i; } } return result; }
bool AlignmentTwoBodyDecayTrackSelector::checkMETAcoplanarity | ( | const reco::Track * | trk, |
const reco::CaloMET * | met | ||
) | const [private] |
checks if [cands] contains a acoplanar track w.r.t missing ET (returns empty set if not)
checks if the [cands] are acoplanar (returns empty set if not)
Definition at line 286 of file AlignmentTwoBoyDecayTrackSelector.cc.
References SiPixelRawToDigiRegional_cfi::deltaPhi, M_PI, reco::LeafCandidate::phi(), reco::TrackBase::phi(), and theAcoplanarDistance.
Referenced by checkMETMass().
{ if (fabs(deltaPhi(trk1->phi(),met->phi()-M_PI)) < theAcoplanarDistance) return true; return false; }
AlignmentTwoBodyDecayTrackSelector::Tracks AlignmentTwoBodyDecayTrackSelector::checkMETMass | ( | const Tracks & | cands, |
const edm::Event & | iEvent | ||
) | const [private] |
checks if the mass of the mother is in the mass region adding missing E_T
checks if the mass of the X is in the mass region adding missing E_T
Definition at line 186 of file AlignmentTwoBoyDecayTrackSelector.cc.
References checkCharge(), checkMETAcoplanarity(), edm::Event::getByLabel(), i, edm::HandleBase::isValid(), LogDebug, CaloMET_cfi::met, query::result, edm::second(), python::multivaluedict::sort(), mathSSE::sqrt(), theAcoplanarityFilterSwitch, theCandNumber, theChargeSwitch, theDaughterMass, theMaxMass, theMinMass, and theMissingETSource.
Referenced by select().
{ Tracks result; LogDebug("Alignment") <<"> cands size : "<< cands.size(); if (cands.size()==0) return result; TLorentzVector track; TLorentzVector met4; TLorentzVector mother; Handle<reco::CaloMETCollection> missingET; iEvent.getByLabel(theMissingETSource ,missingET); if (!missingET.isValid()) { LogError("Alignment")<< "@SUB=AlignmentTwoBodyDecayTrackSelector::checkMETMass" << "> could not optain missingET Collection!"; return result; } typedef pair<double,const reco::Track*> candCollectionItem; vector<candCollectionItem> candCollection; for (reco::CaloMETCollection::const_iterator itMET = missingET->begin(); itMET != missingET->end(); ++itMET) { met4.SetXYZT((*itMET).px(), (*itMET).py(), (*itMET).pz(), (*itMET).p()); for (unsigned int iCand = 0; iCand < cands.size(); iCand++) { track.SetXYZT(cands.at(iCand)->px(), cands.at(iCand)->py(), cands.at(iCand)->pz(), sqrt( cands.at(iCand)->p()*cands.at(iCand)->p() + theDaughterMass*theDaughterMass )); mother = track + met4; const reco::Track *trk = cands.at(iCand); const reco::CaloMET *met = &(*itMET); bool correctCharge = true; if (theChargeSwitch) correctCharge = this->checkCharge(trk); bool acoplanarTracks = true; if (theAcoplanarityFilterSwitch) acoplanarTracks = this->checkMETAcoplanarity(trk, met); if (mother.M() > theMinMass && mother.M() < theMaxMass && correctCharge && acoplanarTracks) { candCollection.push_back(candCollectionItem(mother.Pt(), trk)); } } } if (candCollection.size()==0) return result; sort(candCollection.begin(), candCollection.end(), higherTwoBodyDecayPt<candCollectionItem>()); std::map<const reco::Track*,unsigned int> uniqueTrackIndex; std::map<const reco::Track*,unsigned int>::iterator it; for (unsigned int i=0; i<candCollection.size() && i<theCandNumber; i++) { it = uniqueTrackIndex.find(candCollection[i].second); if (it==uniqueTrackIndex.end()) { result.push_back(candCollection[i].second); uniqueTrackIndex[candCollection[i].second] = i; } } return result; }
void AlignmentTwoBodyDecayTrackSelector::printTracks | ( | const Tracks & | col | ) | const [private] |
print Information on Track-Collection
Definition at line 295 of file AlignmentTwoBoyDecayTrackSelector.cc.
References prof2calltree::count, and LogDebug.
{ int count = 0; LogDebug("Alignment") << ">......................................"; for(Tracks::const_iterator it = col.begin();it < col.end();++it,++count){ LogDebug("Alignment") <<"> Track No. "<< count <<": p = ("<<(*it)->px()<<","<<(*it)->py()<<","<<(*it)->pz()<<")\n" <<"> pT = "<<(*it)->pt()<<" eta = "<<(*it)->eta()<<" charge = "<<(*it)->charge(); } LogDebug("Alignment") << ">......................................"; }
AlignmentTwoBodyDecayTrackSelector::Tracks AlignmentTwoBodyDecayTrackSelector::select | ( | const Tracks & | tracks, |
const edm::Event & | iEvent | ||
) |
select tracks
Definition at line 80 of file AlignmentTwoBoyDecayTrackSelector.cc.
References checkMass(), checkMETMass(), LogDebug, query::result, theMassrangeSwitch, theMissingETSwitch, and testEve_cfg::tracks.
Referenced by TrackConfigSelector::select().
{ Tracks result = tracks; if (theMassrangeSwitch) { if (theMissingETSwitch) result = checkMETMass(result,iEvent); else result = checkMass(result); } LogDebug("Alignment") << "> TwoBodyDecay tracks all,kept: " << tracks.size() << "," << result.size(); return result; }
bool AlignmentTwoBodyDecayTrackSelector::useThisFilter | ( | ) |
returns if any of the Filters is used.
Definition at line 72 of file AlignmentTwoBoyDecayTrackSelector.cc.
References theAcoplanarityFilterSwitch, theChargeSwitch, and theMassrangeSwitch.
Referenced by TrackConfigSelector::TrackConfigSelector().
{ return theMassrangeSwitch || theChargeSwitch || theAcoplanarityFilterSwitch; }
double AlignmentTwoBodyDecayTrackSelector::theAcoplanarDistance [private] |
Definition at line 60 of file AlignmentTwoBodyDecayTrackSelector.h.
Referenced by AlignmentTwoBodyDecayTrackSelector(), checkAcoplanarity(), and checkMETAcoplanarity().
Definition at line 48 of file AlignmentTwoBodyDecayTrackSelector.h.
Referenced by AlignmentTwoBodyDecayTrackSelector(), checkMass(), checkMETMass(), and useThisFilter().
unsigned int AlignmentTwoBodyDecayTrackSelector::theCandNumber [private] |
Definition at line 53 of file AlignmentTwoBodyDecayTrackSelector.h.
Referenced by AlignmentTwoBodyDecayTrackSelector(), checkMass(), and checkMETMass().
int AlignmentTwoBodyDecayTrackSelector::theCharge [private] |
Definition at line 55 of file AlignmentTwoBodyDecayTrackSelector.h.
Referenced by AlignmentTwoBodyDecayTrackSelector(), and checkCharge().
bool AlignmentTwoBodyDecayTrackSelector::theChargeSwitch [private] |
Definition at line 46 of file AlignmentTwoBodyDecayTrackSelector.h.
Referenced by AlignmentTwoBodyDecayTrackSelector(), checkMass(), checkMETMass(), and useThisFilter().
double AlignmentTwoBodyDecayTrackSelector::theDaughterMass [private] |
Definition at line 52 of file AlignmentTwoBodyDecayTrackSelector.h.
Referenced by AlignmentTwoBodyDecayTrackSelector(), checkMass(), and checkMETMass().
bool AlignmentTwoBodyDecayTrackSelector::theMassrangeSwitch [private] |
private data members
Definition at line 45 of file AlignmentTwoBodyDecayTrackSelector.h.
Referenced by AlignmentTwoBodyDecayTrackSelector(), select(), and useThisFilter().
double AlignmentTwoBodyDecayTrackSelector::theMaxMass [private] |
Definition at line 51 of file AlignmentTwoBodyDecayTrackSelector.h.
Referenced by AlignmentTwoBodyDecayTrackSelector(), checkMass(), and checkMETMass().
double AlignmentTwoBodyDecayTrackSelector::theMinMass [private] |
Definition at line 50 of file AlignmentTwoBodyDecayTrackSelector.h.
Referenced by AlignmentTwoBodyDecayTrackSelector(), checkMass(), and checkMETMass().
Definition at line 58 of file AlignmentTwoBodyDecayTrackSelector.h.
Referenced by AlignmentTwoBodyDecayTrackSelector(), and checkMETMass().
bool AlignmentTwoBodyDecayTrackSelector::theMissingETSwitch [private] |
Definition at line 47 of file AlignmentTwoBodyDecayTrackSelector.h.
Referenced by AlignmentTwoBodyDecayTrackSelector(), and select().
bool AlignmentTwoBodyDecayTrackSelector::theUnsignedSwitch [private] |
Definition at line 56 of file AlignmentTwoBodyDecayTrackSelector.h.
Referenced by AlignmentTwoBodyDecayTrackSelector(), and checkCharge().