CMS 3D CMS Logo

BPHOniaToMuMuBuilder.cc
Go to the documentation of this file.
1 /*
2  * See header file for a description of this class.
3  *
4  * \author Paolo Ronchese INFN Padova
5  *
6  */
7 
8 //-----------------------
9 // This Class' Header --
10 //-----------------------
12 
13 //-------------------------------
14 // Collaborating Class Headers --
15 //-------------------------------
25 
26 //---------------
27 // C++ Headers --
28 //---------------
29 using namespace std;
30 
31 //-------------------
32 // Initializations --
33 //-------------------
34 
35 
36 //----------------
37 // Constructors --
38 //----------------
40  const edm::EventSetup& es,
41  const BPHRecoBuilder::BPHGenericCollection* muPosCollection,
42  const BPHRecoBuilder::BPHGenericCollection* muNegCollection ):
43  muPosName( "MuPos" ),
44  muNegName( "MuNeg" ),
45  evSetup( &es ),
46  posCollection( muPosCollection ),
47  negCollection( muNegCollection ) {
48  setParameters( Phi , 3.0, 10.0, 0.50, 1.50, 0.0,
50  setParameters( Psi1, 3.0, 10.0, 2.00, 3.40, 0.0,
52  setParameters( Psi2, 3.0, 10.0, 3.40, 6.00, 0.0,
54  setParameters( Ups , 3.0, 10.0, 6.00, 12.00, 0.0,
55  -1.0 , 0.0 );
56  setParameters( Ups1, 3.0, 10.0, 6.00, 9.75, 0.0,
58  setParameters( Ups2, 3.0, 10.0, 9.75, 10.20, 0.0,
60  setParameters( Ups3, 3.0, 10.0, 10.20, 12.00, 0.0,
62  updated = false;
63 }
64 
65 //--------------
66 // Destructor --
67 //--------------
69  map< oniaType, OniaParameters >::iterator iter = oniaPar.begin();
70  map< oniaType, OniaParameters >::iterator iend = oniaPar.end();
71  while ( iter != iend ) {
72  OniaParameters& par = iter++->second;
73  delete par. ptSel;
74  delete par. etaSel;
75  delete par.massSel;
76  delete par.chi2Sel;
77  }
78 }
79 
80 //--------------
81 // Operations --
82 //--------------
83 vector<BPHPlusMinusConstCandPtr> BPHOniaToMuMuBuilder::build() {
84 
85  if ( updated ) return fullList;
86 
91 
92  map< oniaType, OniaParameters >::iterator iter = oniaPar.begin();
93  map< oniaType, OniaParameters >::iterator iend = oniaPar.end();
94  while ( iter != iend ) {
95  OniaParameters& par = iter++->second;
96  ptSel.include( *par. ptSel );
97  etaSel.include( *par. etaSel );
98  mSel.include( *par.massSel );
99  vSel.include( *par.chi2Sel );
100  }
101 
102  BPHRecoBuilder bOnia( *evSetup );
107  bOnia.filter( muPosName, ptSel );
108  bOnia.filter( muNegName, ptSel );
109  bOnia.filter( muPosName, etaSel );
110  bOnia.filter( muNegName, etaSel );
111  bOnia.filter( mSel );
112  bOnia.filter( vSel );
113 
115  updated = true;
116  return fullList;
117 
118 }
119 
120 
121 vector<BPHPlusMinusConstCandPtr> BPHOniaToMuMuBuilder::getList(
122  oniaType type,
123  BPHRecoSelect * dSel,
124  BPHMomentumSelect* mSel,
125  BPHVertexSelect * vSel,
126  BPHFitSelect * kSel ) {
127  extractList( type );
128  vector<BPHPlusMinusConstCandPtr>& list = oniaList[type];
129  int i;
130  int n = list.size();
131  vector<BPHPlusMinusConstCandPtr> lsub;
132  lsub.reserve( n );
133  for ( i = 0; i < n; ++i ) {
134  BPHPlusMinusConstCandPtr ptr = list[i];
135  const reco::Candidate* muPos = ptr->originalReco( ptr->getDaug(
136  muPosName ) );
137  const reco::Candidate* muNeg = ptr->originalReco( ptr->getDaug(
138  muNegName ) );
139  if ( ( dSel != nullptr ) && ( !dSel->accept( *muPos ) ) ) continue;
140  if ( ( dSel != nullptr ) && ( !dSel->accept( *muNeg ) ) ) continue;
141  if ( ( mSel != nullptr ) && ( !mSel->accept( *ptr ) ) ) continue;
142  if ( ( vSel != nullptr ) && ( !vSel->accept( *ptr ) ) ) continue;
143  if ( ( kSel != nullptr ) && ( !kSel->accept( *ptr ) ) ) continue;
144  lsub.push_back( list[i] );
145  }
146  return lsub;
147 }
148 
149 
151  const BPHRecoCandidate& cand ) {
152  const reco::Candidate* mp = cand.originalReco( cand.getDaug( muPosName ) );
153  const reco::Candidate* mn = cand.originalReco( cand.getDaug( muNegName ) );
154  int nc = fullList.size();
155  int ic;
156  for ( ic = 0; ic < nc; ++ ic ) {
158  const BPHPlusMinusCandidate* pmc = pmp.get();
159  if ( pmc->originalReco( pmc->getDaug( muPosName ) ) != mp ) continue;
160  if ( pmc->originalReco( pmc->getDaug( muNegName ) ) != mn ) continue;
161  return pmp;
162  }
163  return BPHPlusMinusConstCandPtr( nullptr );
164 }
165 
168  setNotUpdated();
169  OniaParameters& par = oniaPar[type];
170  par.ptSel->setPtMin( pt );
171  return;
172 }
173 
174 
176  setNotUpdated();
177  OniaParameters& par = oniaPar[type];
178  par.etaSel->setEtaMax( eta );
179  return;
180 }
181 
182 
184  setNotUpdated();
185  OniaParameters& par = oniaPar[type];
186  par.massSel->setMassMin( m );
187  return;
188 }
189 
190 
192  setNotUpdated();
193  OniaParameters& par = oniaPar[type];
194  par.massSel->setMassMax( m );
195  return;
196 }
197 
198 
200  setNotUpdated();
201  OniaParameters& par = oniaPar[type];
202  par.chi2Sel->setProbMin( p );
203  return;
204 }
205 
206 
208  double mass, double sigma ) {
209  setNotUpdated();
210  OniaParameters& par = oniaPar[type];
211  par.mass = mass;
212  par.sigma = sigma;
213  return;
214 }
215 
218  const OniaParameters& par = oniaPar.at( type );
219  return par.ptSel->getPtMin();
220 }
221 
222 
224  const OniaParameters& par = oniaPar.at( type );
225  return par.etaSel->getEtaMax();
226 }
227 
228 
230  const OniaParameters& par = oniaPar.at( type );
231  return par.massSel->getMassMin();
232 }
233 
234 
236  const OniaParameters& par = oniaPar.at( type );
237  return par.massSel->getMassMax();
238 }
239 
240 
242  const OniaParameters& par = oniaPar.at( type );
243  return par.chi2Sel->getProbMin();
244 }
245 
246 
248  const OniaParameters& par = oniaPar.at( type );
249  return par.mass;
250 }
251 
252 
254  const OniaParameters& par = oniaPar.at( type );
255  return par.sigma;
256 }
257 
258 
260  map< oniaType, OniaParameters >::iterator iter = oniaPar.begin();
261  map< oniaType, OniaParameters >::iterator iend = oniaPar.end();
262  while ( iter != iend ) iter++->second.updated = false;
263  updated = false;
264  return;
265 }
266 
267 
269  double ptMin, double etaMax,
270  double massMin, double massMax,
271  double probMin,
272  double mass, double sigma ) {
273  OniaParameters& par = oniaPar[type];
274  par. ptSel = new BPHMuonPtSelect( ptMin );
275  par. etaSel = new BPHMuonEtaSelect( etaMax );
276  par.massSel = new BPHMassSelect( massMin, massMax );
277  par.chi2Sel = new BPHChi2Select( probMin );
278  par.mass = mass;
279  par.sigma = sigma;
280  par.updated = false;
281  return;
282 }
283 
284 
286  if ( !updated ) build();
287  OniaParameters& par = oniaPar[type];
288  vector<BPHPlusMinusConstCandPtr>& list = oniaList[type];
289  if ( par.updated ) return;
290  int i;
291  int n = fullList.size();
292  list.clear();
293  list.reserve( n );
294  for ( i = 0; i < n; ++i ) {
296  const reco::Candidate* mcPos = ptr->getDaug( "MuPos" );
297  const reco::Candidate* mcNeg = ptr->getDaug( "MuNeg" );
298  const reco::Candidate* muPos = ptr->originalReco( mcPos );
299  const reco::Candidate* muNeg = ptr->originalReco( mcNeg );
300  if ( !par.massSel->accept( *ptr ) ) continue;
301  if ( !par. ptSel->accept( *muPos ) ) continue;
302  if ( !par. etaSel->accept( *muPos ) ) continue;
303  if ( !par. ptSel->accept( *muNeg ) ) continue;
304  if ( !par. etaSel->accept( *muNeg ) ) continue;
305  if ( !par.chi2Sel->accept( *ptr ) ) continue;
307  np->add( "MuPos", muPos, ptr->getTrackSearchList( mcPos ),
309  np->add( "MuNeg", muNeg, ptr->getTrackSearchList( mcNeg ),
311  if ( par.mass > 0.0 )
312  np->setConstraint( par.mass, par.sigma );
313  list.push_back( BPHPlusMinusConstCandPtr( np ) );
314  }
315  par.updated = true;
316  return;
317 }
318 
static const double ups2MWidth
static std::vector< BPHPlusMinusConstCandPtr > build(const BPHRecoBuilder &builder, const std::string &nPos, const std::string &nNeg, double mass=-1, double msig=-1)
type
Definition: HCALResponse.h:21
const BPHRecoBuilder::BPHGenericCollection * posCollection
void setMassMax(double m)
Definition: BPHMassCuts.h:51
double getMassMax(oniaType type) const
void setMassMax(oniaType type, double m)
static const double ups3Mass
static const double ups2Mass
static const double jPsiMWidth
double getConstrMass(oniaType type) const
static const double muonMSigma
double getProbMin(oniaType type) const
bool accept(const BPHDecayMomentum &cand) const override
select particle
Definition: BPHMassSelect.h:48
static const double jPsiMass
void setPtMin(double pt)
set pt min
virtual bool accept(const BPHDecayMomentum &cand) const =0
accept function
BPHPlusMinusConstCandPtr getOriginalCandidate(const BPHRecoCandidate &cand)
std::map< oniaType, std::vector< BPHPlusMinusConstCandPtr > > oniaList
virtual bool accept(const BPHDecayVertex &cand) const =0
accept function
void setProbMin(oniaType type, double p)
void include(T &s, bool m=true)
include selection
bool accept(const BPHDecayVertex &cand) const override
select vertex
Definition: BPHChi2Select.h:47
double getMassMin(oniaType type) const
void setParameters(oniaType type, double ptMin, double etaMax, double massMin, double massMax, double probMin, double mass, double sigma)
virtual bool accept(const reco::Candidate &cand) const
void add(const std::string &name, const reco::Candidate *daug, double mass=-1.0, double sigma=-1.0) override
BPHGenericPtr< const BPHPlusMinusCandidate >::type BPHPlusMinusConstCandPtr
static const double ups1MWidth
double getPtMin() const
get current pt min
void setProbMin(double p)
set prob min
Definition: BPHChi2Select.h:55
int np
Definition: AMPTWrapper.h:33
double getConstrSigma(oniaType type) const
void extractList(oniaType type)
BPHOniaToMuMuBuilder(const edm::EventSetup &es, const BPHRecoBuilder::BPHGenericCollection *muPosCollection, const BPHRecoBuilder::BPHGenericCollection *muNegCollection)
static const double phiMWidth
double getEtaMax(oniaType type) const
void setEtaMax(double eta)
set eta max
double getProbMin() const
get current prob min
Definition: BPHChi2Select.h:58
virtual const reco::Candidate * originalReco(const reco::Candidate *daug) const
get the original particle from the clone
static const double phiMass
void setMassMin(double m)
set mass cuts
Definition: BPHMassCuts.h:50
void add(const std::string &name, const BPHGenericCollection *collection, double mass=-1.0, double msig=-1.0)
double getMassMax() const
Definition: BPHMassCuts.h:55
static const double psi2Mass
double getMassMin() const
get current mass cuts
Definition: BPHMassCuts.h:54
static const double ups1Mass
const BPHRecoBuilder::BPHGenericCollection * negCollection
virtual bool accept(const BPHKinematicFit &cand) const =0
accept function
double getPtMin(oniaType type) const
get current cuts
static const double muonMass
void filter(const std::string &name, const BPHRecoSelect &sel) const
static const double ups3MWidth
std::vector< BPHPlusMinusConstCandPtr > build()
build resonance candidates
void setConstr(oniaType type, double mass, double sigma)
void setEtaMax(oniaType type, double eta)
std::map< oniaType, OniaParameters > oniaPar
std::vector< BPHPlusMinusConstCandPtr > fullList
std::vector< BPHPlusMinusConstCandPtr > getList(oniaType type, BPHRecoSelect *dSel=0, BPHMomentumSelect *mSel=0, BPHVertexSelect *vSel=0, BPHFitSelect *kSel=0)
void setConstraint(double mass, double sigma)
apply a mass constraint
double getEtaMax() const
get current eta max
virtual const reco::Candidate * getDaug(const std::string &name) const
void setMassMin(oniaType type, double m)
const edm::EventSetup * evSetup
static const double psi2MWidth
void setPtMin(oniaType type, double pt)
set cuts
How EventSelector::AcceptEvent() decides whether to accept an event for output otherwise it is excluding the probing of A single or multiple positive and the trigger will pass if any such matching triggers are PASS or EXCEPTION[A criterion thatmatches no triggers at all is detected and causes a throw.] A single negative with an expectation of appropriate bit checking in the decision and the trigger will pass if any such matching triggers are FAIL or EXCEPTION A wildcarded negative criterion that matches more than one trigger in the trigger list("!*","!HLTx*"if it matches 2 triggers or more) will accept the event if all the matching triggers are FAIL.It will reject the event if any of the triggers are PASS or EXCEPTION(this matches the behavior of"!*"before the partial wildcard feature was incorporated).Triggers which are in the READY state are completely ignored.(READY should never be returned since the trigger paths have been run