CMS 3D CMS Logo

List of all members | Public Types | Public Member Functions | Private Member Functions | Private Attributes
AlignmentTwoBodyDecayTrackSelector Class Reference

#include <AlignmentTwoBodyDecayTrackSelector.h>

Public Types

typedef std::vector< const reco::Track * > Tracks
 

Public Member Functions

 AlignmentTwoBodyDecayTrackSelector (const edm::ParameterSet &cfg, edm::ConsumesCollector &iC)
 constructor More...
 
Tracks select (const Tracks &tracks, const edm::Event &iEvent, const edm::EventSetup &iSetup)
 select tracks More...
 
bool useThisFilter ()
 returns if any of the Filters is used. More...
 
 ~AlignmentTwoBodyDecayTrackSelector ()
 destructor More...
 

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) More...
 
bool checkCharge (const reco::Track *trk1, const reco::Track *trk2=0) const
 checks if the mother has charge = [theCharge] More...
 
Tracks checkMass (const Tracks &cands) const
 checks if the mass of the mother is in the mass region More...
 
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) More...
 
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 More...
 
void printTracks (const Tracks &col) const
 print Information on Track-Collection More...
 

Private Attributes

bool secThrBool
 
double theAcoplanarDistance
 
bool theAcoplanarityFilterSwitch
 
unsigned int theCandNumber
 
int theCharge
 
bool theChargeSwitch
 
double theDaughterMass
 
bool theMassrangeSwitch
 private data members More...
 
double theMaxMass
 
double theMinMass
 
bool theMissingETSwitch
 
edm::EDGetTokenT< reco::CaloMETCollectiontheMissingETToken
 
double thesecThr
 
bool theUnsignedSwitch
 

Detailed Description

Definition at line 17 of file AlignmentTwoBodyDecayTrackSelector.h.

Member Typedef Documentation

Definition at line 21 of file AlignmentTwoBodyDecayTrackSelector.h.

Constructor & Destructor Documentation

AlignmentTwoBodyDecayTrackSelector::AlignmentTwoBodyDecayTrackSelector ( const edm::ParameterSet cfg,
edm::ConsumesCollector iC 
)

constructor

Definition at line 24 of file AlignmentTwoBoyDecayTrackSelector.cc.

References funct::abs(), edm::ConsumesCollector::consumes(), edm::ParameterSet::getParameter(), LogDebug, and AlignmentTrackSelector_cfi::theCharge.

25 {
26  LogDebug("Alignment") << "> applying two body decay Trackfilter ...";
27  theMassrangeSwitch = cfg.getParameter<bool>( "applyMassrangeFilter" );
28  if (theMassrangeSwitch){
29  theMinMass = cfg.getParameter<double>( "minXMass" );
30  theMaxMass = cfg.getParameter<double>( "maxXMass" );
31  theDaughterMass = cfg.getParameter<double>( "daughterMass" );
32  theCandNumber = cfg.getParameter<unsigned int>( "numberOfCandidates" );//Number of candidates to keep
33  secThrBool = cfg.getParameter<bool> ( "applySecThreshold" );
34  thesecThr = cfg.getParameter<double>( "secondThreshold" );
35  LogDebug("Alignment") << "> Massrange min,max : " << theMinMass << "," << theMaxMass
36  << "\n> Mass of daughter Particle : " << theDaughterMass;
37 
38  }else{
39  theMinMass = 0;
40  theMaxMass = 0;
41  theDaughterMass = 0;
42  }
43  theChargeSwitch = cfg.getParameter<bool>( "applyChargeFilter" );
44  if(theChargeSwitch){
45  theCharge = cfg.getParameter<int>( "charge" );
46  theUnsignedSwitch = cfg.getParameter<bool>( "useUnsignedCharge" );
47  if(theUnsignedSwitch)
49  LogDebug("Alignment") << "> Desired Charge, unsigned: "<<theCharge<<" , "<<theUnsignedSwitch;
50  }else{
51  theCharge =0;
52  theUnsignedSwitch = true;
53  }
54  theMissingETSwitch = cfg.getParameter<bool>( "applyMissingETFilter" );
56  edm::InputTag theMissingETSource = cfg.getParameter<InputTag>( "missingETSource" );
57  theMissingETToken = iC.consumes<reco::CaloMETCollection>(theMissingETSource);
58  LogDebug("Alignment") << "> missing Et Source: "<< theMissingETSource;
59  }
60  theAcoplanarityFilterSwitch = cfg.getParameter<bool>( "applyAcoplanarityFilter" );
62  theAcoplanarDistance = cfg.getParameter<double>( "acoplanarDistance" );
63  LogDebug("Alignment") << "> Acoplanar Distance: "<<theAcoplanarDistance;
64  }
65 
66 }
#define LogDebug(id)
EDGetTokenT< ProductType > consumes(edm::InputTag const &tag)
T getParameter(std::string const &) const
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
std::vector< reco::CaloMET > CaloMETCollection
collection of CaloMET objects
edm::EDGetTokenT< reco::CaloMETCollection > theMissingETToken
AlignmentTwoBodyDecayTrackSelector::~AlignmentTwoBodyDecayTrackSelector ( )

destructor

Definition at line 70 of file AlignmentTwoBoyDecayTrackSelector.cc.

71 {}

Member Function Documentation

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 270 of file AlignmentTwoBoyDecayTrackSelector.cc.

References hiPixelPairStep_cff::deltaPhi, M_PI, and reco::TrackBase::phi().

271 {
272  if (fabs(deltaPhi(trk1->phi(),trk2->phi()-M_PI)) < theAcoplanarDistance) return true;
273  return false;
274 }
double phi() const
azimuthal angle of momentum vector
Definition: TrackBase.h:678
#define M_PI
bool AlignmentTwoBodyDecayTrackSelector::checkCharge ( const reco::Track trk1,
const reco::Track trk2 = 0 
) const
private

checks if the mother has charge = [theCharge]

Definition at line 259 of file AlignmentTwoBoyDecayTrackSelector.cc.

References funct::abs(), reco::TrackBase::charge(), and AlignmentTrackSelector_cfi::theCharge.

260 {
261  int sumCharge = trk1->charge();
262  if (trk2) sumCharge += trk2->charge();
263  if (theUnsignedSwitch) sumCharge = std::abs(sumCharge);
264  if (sumCharge == theCharge) return true;
265  return false;
266 }
Abs< T >::type abs(const T &t)
Definition: Abs.h:22
int charge() const
track electric charge
Definition: TrackBase.h:600
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 100 of file AlignmentTwoBoyDecayTrackSelector.cc.

References a, b, electrons_cff::checkCharge, mps_fire::i, LogDebug, mps_fire::result, and mathSSE::sqrt().

101 {
102  Tracks result;
103 
104  LogDebug("Alignment") <<"> cands size : "<< cands.size();
105 
106  if (cands.size()<2) return result;
107 
108  TLorentzVector track0;
109  TLorentzVector track1;
110  TLorentzVector mother;
111  typedef pair<const reco::Track*,const reco::Track*> constTrackPair;
112  typedef pair<double,constTrackPair> candCollectionItem;
113  vector<candCollectionItem> candCollection;
114 
115  for (unsigned int iCand = 0; iCand < cands.size(); iCand++) {
116 
117  track0.SetXYZT(cands.at(iCand)->px(),
118  cands.at(iCand)->py(),
119  cands.at(iCand)->pz(),
120  sqrt( cands.at(iCand)->p()*cands.at(iCand)->p() + theDaughterMass*theDaughterMass ));
121 
122  for (unsigned int jCand = iCand+1; jCand < cands.size(); jCand++) {
123 
124  track1.SetXYZT(cands.at(jCand)->px(),
125  cands.at(jCand)->py(),
126  cands.at(jCand)->pz(),
127  sqrt( cands.at(jCand)->p()*cands.at(jCand)->p() + theDaughterMass*theDaughterMass ));
128  if (secThrBool==true && track1.Pt() < thesecThr && track0.Pt()< thesecThr) continue;
129  mother = track0 + track1;
130 
131  const reco::Track *trk1 = cands.at(iCand);
132  const reco::Track *trk2 = cands.at(jCand);
133 
134  bool correctCharge = true;
135  if (theChargeSwitch) correctCharge = this->checkCharge(trk1, trk2);
136 
137  bool acoplanarTracks = true;
138  if (theAcoplanarityFilterSwitch) acoplanarTracks = this->checkAcoplanarity(trk1, trk2);
139 
140  if (mother.M() > theMinMass &&
141  mother.M() < theMaxMass &&
142  correctCharge &&
143  acoplanarTracks) {
144  candCollection.push_back(candCollectionItem(mother.Pt(),
145  constTrackPair(trk1, trk2)));
146  }
147  }
148  }
149 
150  if (candCollection.empty()) return result;
151 
152  sort(candCollection.begin(), candCollection.end(), [](auto& a, auto& b){return a.first > b.first ;});
153 
154  std::map<const reco::Track*,unsigned int> uniqueTrackIndex;
155  std::map<const reco::Track*,unsigned int>::iterator it;
156  for (unsigned int i=0;
157  i<candCollection.size() && i<theCandNumber;
158  i++) {
159  constTrackPair & trackPair = candCollection[i].second;
160 
161  it = uniqueTrackIndex.find(trackPair.first);
162  if (it==uniqueTrackIndex.end()) {
163  result.push_back(trackPair.first);
164  uniqueTrackIndex[trackPair.first] = i;
165  }
166 
167  it = uniqueTrackIndex.find(trackPair.second);
168  if (it==uniqueTrackIndex.end()) {
169  result.push_back(trackPair.second);
170  uniqueTrackIndex[trackPair.second] = i;
171  }
172  }
173 
174  return result;
175 }
#define LogDebug(id)
bool checkAcoplanarity(const reco::Track *trk1, const reco::Track *trk2) const
checks if the [cands] are acoplanar (returns empty set if not)
T sqrt(T t)
Definition: SSEVec.h:18
bool checkCharge(const reco::Track *trk1, const reco::Track *trk2=0) const
checks if the mother has charge = [theCharge]
double b
Definition: hdecay.h:120
double a
Definition: hdecay.h:121
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 278 of file AlignmentTwoBoyDecayTrackSelector.cc.

References hiPixelPairStep_cff::deltaPhi, M_PI, reco::LeafCandidate::phi(), and reco::TrackBase::phi().

279 {
280  if (fabs(deltaPhi(trk1->phi(),met->phi()-M_PI)) < theAcoplanarDistance) return true;
281  return false;
282 }
#define M_PI
double phi() const final
momentum azimuthal angle
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 179 of file AlignmentTwoBoyDecayTrackSelector.cc.

References a, b, electrons_cff::checkCharge, edm::Event::getByToken(), mps_fire::i, edm::HandleBase::isValid(), LogDebug, RazorAnalyzer::met, mps_fire::result, edm::second(), mathSSE::sqrt(), and HiIsolationCommonParameters_cff::track.

180 {
181  Tracks result;
182 
183  LogDebug("Alignment") <<"> cands size : "<< cands.size();
184 
185  if (cands.empty()) return result;
186 
187  TLorentzVector track;
188  TLorentzVector met4;
189  TLorentzVector mother;
190 
192  iEvent.getByToken(theMissingETToken ,missingET);
193  if (!missingET.isValid()) {
194  LogError("Alignment")<< "@SUB=AlignmentTwoBodyDecayTrackSelector::checkMETMass"
195  << "> could not optain missingET Collection!";
196  return result;
197  }
198 
199  typedef pair<double,const reco::Track*> candCollectionItem;
200  vector<candCollectionItem> candCollection;
201 
202  for (reco::CaloMETCollection::const_iterator itMET = missingET->begin();
203  itMET != missingET->end();
204  ++itMET) {
205 
206  met4.SetXYZT((*itMET).px(),
207  (*itMET).py(),
208  (*itMET).pz(),
209  (*itMET).p());
210 
211  for (unsigned int iCand = 0; iCand < cands.size(); iCand++) {
212 
213  track.SetXYZT(cands.at(iCand)->px(),
214  cands.at(iCand)->py(),
215  cands.at(iCand)->pz(),
216  sqrt( cands.at(iCand)->p()*cands.at(iCand)->p() + theDaughterMass*theDaughterMass ));
217 
218  mother = track + met4;
219 
220  const reco::Track *trk = cands.at(iCand);
221  const reco::CaloMET *met = &(*itMET);
222 
223  bool correctCharge = true;
224  if (theChargeSwitch) correctCharge = this->checkCharge(trk);
225 
226  bool acoplanarTracks = true;
227  if (theAcoplanarityFilterSwitch) acoplanarTracks = this->checkMETAcoplanarity(trk, met);
228 
229  if (mother.M() > theMinMass &&
230  mother.M() < theMaxMass &&
231  correctCharge &&
232  acoplanarTracks) {
233  candCollection.push_back(candCollectionItem(mother.Pt(), trk));
234  }
235  }
236  }
237 
238  if (candCollection.empty()) return result;
239 
240  sort(candCollection.begin(), candCollection.end(), [](auto& a, auto& b){return a.first > b.first ;});
241 
242  std::map<const reco::Track*,unsigned int> uniqueTrackIndex;
243  std::map<const reco::Track*,unsigned int>::iterator it;
244  for (unsigned int i=0;
245  i<candCollection.size() && i<theCandNumber;
246  i++) {
247  it = uniqueTrackIndex.find(candCollection[i].second);
248  if (it==uniqueTrackIndex.end()) {
249  result.push_back(candCollection[i].second);
250  uniqueTrackIndex[candCollection[i].second] = i;
251  }
252  }
253 
254  return result;
255 }
#define LogDebug(id)
bool getByToken(EDGetToken token, Handle< PROD > &result) const
Definition: Event.h:579
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) ...
U second(std::pair< T, U > const &p)
T sqrt(T t)
Definition: SSEVec.h:18
bool checkCharge(const reco::Track *trk1, const reco::Track *trk2=0) const
checks if the mother has charge = [theCharge]
bool isValid() const
Definition: HandleBase.h:74
met
===> hadronic RAZOR
double b
Definition: hdecay.h:120
edm::EDGetTokenT< reco::CaloMETCollection > theMissingETToken
double a
Definition: hdecay.h:121
void AlignmentTwoBodyDecayTrackSelector::printTracks ( const Tracks col) const
private

print Information on Track-Collection

Definition at line 287 of file AlignmentTwoBoyDecayTrackSelector.cc.

References KineDebug3::count(), and LogDebug.

288 {
289  int count = 0;
290  LogDebug("Alignment") << ">......................................";
291  for(Tracks::const_iterator it = col.begin();it < col.end();++it,++count){
292  LogDebug("Alignment")
293  <<"> Track No. "<< count <<": p = ("<<(*it)->px()<<","<<(*it)->py()<<","<<(*it)->pz()<<")\n"
294  <<"> pT = "<<(*it)->pt()<<" eta = "<<(*it)->eta()<<" charge = "<<(*it)->charge();
295  }
296  LogDebug("Alignment") << ">......................................";
297 }
#define LogDebug(id)
col
Definition: cuy.py:1010
AlignmentTwoBodyDecayTrackSelector::Tracks AlignmentTwoBodyDecayTrackSelector::select ( const Tracks tracks,
const edm::Event iEvent,
const edm::EventSetup iSetup 
)

select tracks

Definition at line 83 of file AlignmentTwoBoyDecayTrackSelector.cc.

References LogDebug, mps_fire::result, and l1t::tracks.

Referenced by Vispa.Views.LineDecayView.LineDecayContainer::createObject(), Vispa.Plugins.Browser.BrowserTabController.BrowserTabController::find(), Vispa.Views.LineDecayView.LineDecayContainer::mousePressEvent(), Vispa.Gui.PortConnection.PointToPointConnection::mousePressEvent(), Vispa.Gui.VispaWidget.VispaWidget::mousePressEvent(), Vispa.Views.AbstractView.AbstractView::restoreSelection(), and TrackConfigSelector::select().

84 {
86 
87  if (theMassrangeSwitch) {
89  result = checkMETMass(result,iEvent);
90  else
91  result = checkMass(result);
92  }
93 
94  LogDebug("Alignment") << "> TwoBodyDecay tracks all,kept: " << tracks.size() << "," << result.size();
95  return result;
96 }
#define LogDebug(id)
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
Tracks checkMass(const Tracks &cands) const
checks if the mass of the mother is in the mass region
bool AlignmentTwoBodyDecayTrackSelector::useThisFilter ( )

Member Data Documentation

bool AlignmentTwoBodyDecayTrackSelector::secThrBool
private

Definition at line 57 of file AlignmentTwoBodyDecayTrackSelector.h.

double AlignmentTwoBodyDecayTrackSelector::theAcoplanarDistance
private

Definition at line 65 of file AlignmentTwoBodyDecayTrackSelector.h.

bool AlignmentTwoBodyDecayTrackSelector::theAcoplanarityFilterSwitch
private

Definition at line 51 of file AlignmentTwoBodyDecayTrackSelector.h.

unsigned int AlignmentTwoBodyDecayTrackSelector::theCandNumber
private

Definition at line 56 of file AlignmentTwoBodyDecayTrackSelector.h.

int AlignmentTwoBodyDecayTrackSelector::theCharge
private

Definition at line 60 of file AlignmentTwoBodyDecayTrackSelector.h.

bool AlignmentTwoBodyDecayTrackSelector::theChargeSwitch
private

Definition at line 49 of file AlignmentTwoBodyDecayTrackSelector.h.

double AlignmentTwoBodyDecayTrackSelector::theDaughterMass
private

Definition at line 55 of file AlignmentTwoBodyDecayTrackSelector.h.

bool AlignmentTwoBodyDecayTrackSelector::theMassrangeSwitch
private

private data members

Definition at line 48 of file AlignmentTwoBodyDecayTrackSelector.h.

double AlignmentTwoBodyDecayTrackSelector::theMaxMass
private

Definition at line 54 of file AlignmentTwoBodyDecayTrackSelector.h.

double AlignmentTwoBodyDecayTrackSelector::theMinMass
private

Definition at line 53 of file AlignmentTwoBodyDecayTrackSelector.h.

bool AlignmentTwoBodyDecayTrackSelector::theMissingETSwitch
private

Definition at line 50 of file AlignmentTwoBodyDecayTrackSelector.h.

edm::EDGetTokenT<reco::CaloMETCollection> AlignmentTwoBodyDecayTrackSelector::theMissingETToken
private

Definition at line 63 of file AlignmentTwoBodyDecayTrackSelector.h.

double AlignmentTwoBodyDecayTrackSelector::thesecThr
private

Definition at line 58 of file AlignmentTwoBodyDecayTrackSelector.h.

bool AlignmentTwoBodyDecayTrackSelector::theUnsignedSwitch
private

Definition at line 61 of file AlignmentTwoBodyDecayTrackSelector.h.