FairRoot/PandaRoot
Typedefs | Functions | Variables
softtrigger_toy12.C File Reference
#include "EventShape.h"
#include <iostream>
#include <vector>
#include <map>
#include "TFile.h"
#include "TTree.h"
#include "TRandom3.h"
#include "TDatabasePDG.h"
#include "TParticlePDG.h"
#include "TCanvas.h"
#include "TH1F.h"
#include "TH2F.h"
#include "TLegend.h"
#include "TParticle.h"
#include "TClonesArray.h"
#include "TF1.h"
#include "TStyle.h"
#include "TNtuple.h"
#include "TLatex.h"

Go to the source code of this file.

Typedefs

typedef std::vector< SimpleCandCandList
 

Functions

void boostList (CandList &list, CandList &boostlist, TVector3 boost)
 
bool isFinalState (int n)
 
double dponline (TLorentzVector &v)
 
void makePidTable (double pideff, double misid)
 
void init (double pideff, double misid)
 
void printCand (SimpleCand c)
 
void printList (CandList &l, TString tit="")
 
void printAllLists ()
 
int massCrit (CandList &l, double m, double w)
 
bool eventAccepted (CandList &l, double m=0, double w=0)
 
int fillHisto (CandList &l, TH1 *hall, TH1 *hbg=0, double m=0, double w=0, TH1 *hallsel=0, TH1 *hbgsel=0, TH1 *hsig=0, TH1 *hmm=0, TH2 *hmvsmm=0)
 
int combine (CandList &l1, CandList &l2, CandList &out, int matchPdg=0)
 
int combine (CandList &l1, CandList &l2, CandList &l3, CandList &out, int matchPdg=0)
 
int combine (CandList &l1, CandList &l2, CandList &l3, CandList &l4, CandList &out, int matchPdg=0)
 
void smearMom (SimpleCand &c, double dpr=0.05, double dtht=0.000, double dphi=0.000)
 
bool isDetected (double eff=0.90)
 
void makeRecoCands (CandList &mc, CandList &reco, double eff=0.90, double dp=0.05, double dtht=0.001, double dphi=0.001)
 
void selectMass (CandList &in, CandList &out, double mmean=0, double mw=0)
 
void select (CandList &in, CandList &out, int chrg=0, int pdg=0, double mass=0.139)
 
void makePidSelection (CandList &l)
 
void makeIni4Vector (TLorentzVector &l, double s)
 
void configHisto (TH1 *h)
 
int softtrigger_toy12 (TString fsig, int nev=2, double sqrts=3.77, bool simcut=false, bool evcut=false, double dp=0.03, double trkeff=100., double pideff=95., double misid=5., double P_mix=0.00)
 

Variables

TRandom3 fRand
 
TLorentzVector fIni
 
const int fMAX = 100
 
int nbins = 300
 
double low = 0.0
 
double high = 5.0
 
const double fNeutEff = 1.0
 
const double fdE = 0.05
 
const double fNdtht = 0.003
 
const double fNdphi = 0.003
 
int fPi0Pdg = 111
 
double fPi0Mass = 0.13497
 
double fPi0win = 0.020
 
int fKsPdg = 310
 
double fKsMass = 0.497614
 
double fKswin = 0.025
 
int fDPdg = 411
 
double fDMass = 1.8693
 
double fDsig = 0.88
 
double fDwin =0.25
 
int fD0Pdg = 421
 
double fD0Mass = 1.8645
 
double fD0sig = 1.04
 
double fD0win =0.25
 
int fJpsiPdg = 443
 
double fJMass = 3.09687
 
double fJsig = 2.24
 
double fJsig3pi = 1.5
 
double fJ3pioff = 0.027
 
double fJwin =0.7
 
int fLamPdg = 3122
 
double fLamMass = 1.115684
 
double fLamsig = 0.08
 
double fLamwin =0.1
 
int fDsPdg = 431
 
double fDsMass = 1.9686
 
double fDssig = 0.75
 
double fDswin =0.2
 
int fPhiPdg = 333
 
double fPhiMass = 1.0195
 
double fPhisig = 0.15
 
double fPhiwin =0.2
 
int fEtacPdg = 441
 
double fEtacMass = 2.9798
 
double fEtacsig = 0.15
 
double fEtacwin =0.15
 
int fLamcPdg = 4122
 
double fLamcMass = 2.2849
 
double fLamcsig = 0.15
 
double fLamcwin =0.2
 
double pidtab [25]
 
double pidreal [25]
 
double mE
 
double mMu
 
double mPi
 
double mK
 
double mP
 
double mPi0
 
TF1 * f_res =0
 
std::map< int, int > pdgidx
 
TDatabasePDG * pdg_db
 
CandList mclist
 
CandList mcFSlist
 
CandList recolist
 
CandList recocmslist
 
CandList eplus
 
CandList eminus
 
CandList muplus
 
CandList muminus
 
CandList piplus
 
CandList piminus
 
CandList kplus
 
CandList kminus
 
CandList pplus
 
CandList pminus
 
CandList gam
 

Typedef Documentation

typedef std::vector<SimpleCand> CandList

Definition at line 118 of file softtrigger_toy12.C.

Function Documentation

void boostList ( CandList list,
CandList boostlist,
TVector3  boost 
)

Definition at line 127 of file softtrigger_toy12.C.

References c, i, SimpleCand::P4(), and SimpleCand::SetP4().

Referenced by softtrigger_toy12().

128 {
129  int N=list.size();
130  boostlist.clear();
131 
132  for (unsigned int i=0;i<N;i++)
133  {
134  SimpleCand c=list[i];
135  TLorentzVector lv(c.P4());
136  lv.Boost(-boost);
137  c.SetP4(lv);
138  boostlist.push_back(c);
139  }
140 }
void SetP4(TLorentzVector lv)
Definition: SimpleCand.C:20
Int_t i
Definition: run_full.C:25
TLorentzVector P4() const
Definition: SimpleCand.C:39
int combine ( CandList l1,
CandList l2,
CandList out,
int  matchPdg = 0 
)

Definition at line 326 of file softtrigger_toy12.C.

References c, i, m2(), mclist, SimpleCand::SetCharge(), SimpleCand::SetEvtId(), SimpleCand::SetId(), SimpleCand::SetMarker(), SimpleCand::SetMcPid(), SimpleCand::SetMct(), SimpleCand::SetMotherIdx(), SimpleCand::SetNFS(), and SimpleCand::SetP4().

Referenced by softtrigger_toy12().

327 {
328  out.clear();
329 
330  bool sameList = (&l1 == &l2);
331 
332  for (unsigned int i=0;i<l1.size();++i)
333  {
334  for (unsigned int j=0;j<l2.size();++j)
335  {
336  if (sameList && j<=i) continue;
337  if (l1[i].Marker() & l2[j].Marker()) continue; // *** overlap
338  //if (l1[i].EvtId()!=l2[j].EvtId()) continue; // *** tracks from different events
339  SimpleCand c;
340  c.SetP4(l1[i].P4()+l2[j].P4());
341  c.SetCharge(l1[i].Charge()+l2[j].Charge());
342  c.SetNFS(l1[i].NFS()+l2[j].NFS());
343  c.SetMarker(l1[i].Marker() | l2[j].Marker());
344 
345  int m1 = l1[i].MotherIdx();
346  int m2 = l2[j].MotherIdx();
347  int ev1 = l1[i].EvtId();
348  int ev2 = l2[j].EvtId();
349 
350  if ( ev1==ev2 && // *** particles are from same event
351  m1>=0 && m1 == m2 && // *** there is a common mother of all particles
352  (l1[i].McPid()||l1[i].Mct()) && // *** all particles match (FS: PID, Comp:mct)
353  (l2[j].McPid()||l2[j].Mct()) && // *** "
354  2==mclist[m1].NDau() && // *** mother has as many daughters as we combine particles
355  matchPdg == mclist[m1].Pid() ) // *** mother has correct PDG
356  {
357  c.SetId(m1);
358  c.SetMcPid();
359  c.SetMct();
360  c.SetMotherIdx(mclist[m1].MotherIdx());
361  c.SetEvtId(ev1);
362  }
363 
364  out.push_back(c);
365  }
366  }
367  return out.size();
368 }
CandList mclist
void SetP4(TLorentzVector lv)
Definition: SimpleCand.C:20
void SetEvtId(int ev)
Definition: SimpleCand.C:35
Int_t i
Definition: run_full.C:25
void SetMcPid(bool mct=true)
Definition: SimpleCand.C:30
void SetMarker(unsigned int i)
Definition: SimpleCand.C:33
void SetCharge(int ch)
Definition: SimpleCand.C:27
void SetMct(bool mct=true)
Definition: SimpleCand.C:29
TString m2(TString pts, TString exts="e px py pz")
Definition: invexp.C:117
void SetId(int id)
Definition: SimpleCand.C:26
TFile * out
Definition: reco_muo.C:20
void SetMotherIdx(int idx)
Definition: SimpleCand.C:28
void SetNFS(int n)
Definition: SimpleCand.C:32
int combine ( CandList l1,
CandList l2,
CandList l3,
CandList out,
int  matchPdg = 0 
)

Definition at line 370 of file softtrigger_toy12.C.

References c, m2(), mclist, SimpleCand::SetCharge(), SimpleCand::SetEvtId(), SimpleCand::SetId(), SimpleCand::SetMarker(), SimpleCand::SetMcPid(), SimpleCand::SetMct(), SimpleCand::SetMotherIdx(), SimpleCand::SetNFS(), and SimpleCand::SetP4().

371 {
372  out.clear();
373 
374  bool same12 = (&l1 == &l2);
375  bool same13 = (&l1 == &l3);
376  bool same23 = (&l2 == &l3);
377 
378  for (unsigned int i1=0;i1<l1.size();++i1)
379  {
380  for (unsigned int i2=0;i2<l2.size();++i2)
381  {
382  if (same12 && i2<i1) continue;
383  if (l1[i1].Marker() & l2[i2].Marker()) continue;
384 
385  for (unsigned int i3=0;i3<l3.size();++i3)
386  {
387  if ((same13 && i3<i1) || (same23 && i3<i2)) continue;
388 
389  if ( l1[i1].Marker() & l3[i3].Marker() ) continue;
390  if ( l2[i2].Marker() & l3[i3].Marker() ) continue;
391 
392  //if (l1[i1].EvtId()!=l2[i2].EvtId() ||
393  // l1[i1].EvtId()!=l3[i3].EvtId() ||
394  // l2[i2].EvtId()!=l3[i3].EvtId() ) continue; // *** tracks from different events
395 
396  SimpleCand c;
397  c.SetP4( l1[i1].P4() + l2[i2].P4() + l3[i3].P4());
398  c.SetCharge( l1[i1].Charge() + l2[i2].Charge() + l3[i3].Charge() );
399  c.SetNFS( l1[i1].NFS() + l2[i2].NFS() + l3[i3].NFS());
400  c.SetMarker( l1[i1].Marker() | l2[i2].Marker() | l3[i3].Marker() );
401 
402  int m1 = l1[i1].MotherIdx();
403  int m2 = l2[i2].MotherIdx();
404  int m3 = l3[i3].MotherIdx();
405 
406  int ev1 = l1[i1].EvtId();
407  int ev2 = l2[i2].EvtId();
408  int ev3 = l3[i3].EvtId();
409 
410  if ( ev1==ev2 && ev2==ev3 && // *** particles are from same event
411  m1>=0 && m1 == m2 && m2 == m3 && // *** there is a common mother of all particles
412  (l1[i1].McPid()||l1[i1].Mct()) && // *** all particles match (FS: PID, Comp:mct)
413  (l2[i2].McPid()||l2[i2].Mct()) && // *** "
414  (l3[i3].McPid()||l3[i3].Mct()) && // *** "
415  3==mclist[m1].NDau() && // *** mother has as many daughters as we combine particles
416  matchPdg == mclist[m1].Pid() ) // *** mother has correct PDG
417  {
418  c.SetId(m1);
419  c.SetMcPid();
420  c.SetMct();
421  c.SetMotherIdx(mclist[m1].MotherIdx());
422  c.SetEvtId(ev1);
423  }
424 
425  out.push_back(c);
426  }
427  }
428  }
429 
430  return out.size();
431 }
CandList mclist
void SetP4(TLorentzVector lv)
Definition: SimpleCand.C:20
void SetEvtId(int ev)
Definition: SimpleCand.C:35
void SetMcPid(bool mct=true)
Definition: SimpleCand.C:30
void SetMarker(unsigned int i)
Definition: SimpleCand.C:33
void SetCharge(int ch)
Definition: SimpleCand.C:27
void SetMct(bool mct=true)
Definition: SimpleCand.C:29
TString m2(TString pts, TString exts="e px py pz")
Definition: invexp.C:117
void SetId(int id)
Definition: SimpleCand.C:26
TFile * out
Definition: reco_muo.C:20
void SetMotherIdx(int idx)
Definition: SimpleCand.C:28
void SetNFS(int n)
Definition: SimpleCand.C:32
int combine ( CandList l1,
CandList l2,
CandList l3,
CandList l4,
CandList out,
int  matchPdg = 0 
)

Definition at line 433 of file softtrigger_toy12.C.

References c, m2(), mclist, SimpleCand::SetCharge(), SimpleCand::SetEvtId(), SimpleCand::SetId(), SimpleCand::SetMarker(), SimpleCand::SetMcPid(), SimpleCand::SetMct(), SimpleCand::SetMotherIdx(), SimpleCand::SetNFS(), and SimpleCand::SetP4().

434 {
435  out.clear();
436 
437  bool same12 = (&l1 == &l2);
438  bool same13 = (&l1 == &l3);
439  bool same14 = (&l1 == &l4);
440 
441  bool same23 = (&l2 == &l3);
442  bool same24 = (&l2 == &l4);
443 
444  bool same34 = (&l3 == &l4);
445 
446  for (unsigned int i1=0;i1<l1.size();++i1)
447  {
448  for (unsigned int i2=0;i2<l2.size();++i2)
449  {
450  if (same12 && i2<i1) continue;
451  if (l1[i1].Marker() & l2[i2].Marker()) continue;
452 
453  for (unsigned int i3=0;i3<l3.size();++i3)
454  {
455  if ((same13 && i3<i1) || (same23 && i3<i2)) continue;
456 
457  if ( l1[i1].Marker() & l3[i3].Marker() ) continue;
458  if ( l2[i2].Marker() & l3[i3].Marker() ) continue;
459 
460  for (unsigned int i4=0;i4<l4.size();++i4)
461  {
462  if ((same14 && i4<i1) || (same24 && i4<i2) || (same34 && i4<i3)) continue;
463 
464  if ( l1[i1].Marker() & l4[i4].Marker() ) continue;
465  if ( l2[i2].Marker() & l4[i4].Marker() ) continue;
466  if ( l3[i3].Marker() & l4[i4].Marker() ) continue;
467 
468  //if (l1[i1].EvtId()!=l2[i2].EvtId() ||
469  // l1[i1].EvtId()!=l3[i3].EvtId() ||
470  // l2[i2].EvtId()!=l3[i3].EvtId() ) continue; // *** tracks from different events
471 
472  SimpleCand c;
473  c.SetP4( l1[i1].P4() + l2[i2].P4() + l3[i3].P4() + l4[i4].P4() );
474  c.SetCharge( l1[i1].Charge() + l2[i2].Charge() + l3[i3].Charge() + l4[i4].Charge() );
475  c.SetNFS( l1[i1].NFS() + l2[i2].NFS() + l3[i3].NFS() + l4[i4].NFS() );
476  c.SetMarker( l1[i1].Marker() | l2[i2].Marker() | l3[i3].Marker() | l4[i4].Marker() );
477 
478  int m1 = l1[i1].MotherIdx();
479  int m2 = l2[i2].MotherIdx();
480  int m3 = l3[i3].MotherIdx();
481  int m4 = l4[i4].MotherIdx();
482 
483  int ev1 = l1[i1].EvtId();
484  int ev2 = l2[i2].EvtId();
485  int ev3 = l3[i3].EvtId();
486  int ev4 = l4[i4].EvtId();
487 
488  if ( ev1==ev2 && ev2==ev3 && ev3==ev4 && // *** particles are from same event
489  m1>=0 && m1 == m2 && m2 == m3 && m3 == m4 && // *** there is a common mother of all particles
490  (l1[i1].McPid()||l1[i1].Mct()) && // *** all particles match (FS: PID, Comp:mct)
491  (l2[i2].McPid()||l2[i2].Mct()) && // *** "
492  (l3[i3].McPid()||l3[i3].Mct()) && // *** "
493  (l4[i4].McPid()||l4[i4].Mct()) && // *** "
494  4==mclist[m1].NDau() && // *** mother has as many daughters as we combine particles
495  matchPdg == mclist[m1].Pid() ) // *** mother has correct PDG
496  {
497  c.SetId(m1);
498  c.SetMcPid();
499  c.SetMct();
500  c.SetMotherIdx(mclist[m1].MotherIdx());
501  c.SetEvtId(ev1);
502  }
503 
504  out.push_back(c);
505  }
506  }
507  }
508  }
509 
510  return out.size();
511 }
CandList mclist
void SetP4(TLorentzVector lv)
Definition: SimpleCand.C:20
void SetEvtId(int ev)
Definition: SimpleCand.C:35
void SetMcPid(bool mct=true)
Definition: SimpleCand.C:30
void SetMarker(unsigned int i)
Definition: SimpleCand.C:33
void SetCharge(int ch)
Definition: SimpleCand.C:27
void SetMct(bool mct=true)
Definition: SimpleCand.C:29
TString m2(TString pts, TString exts="e px py pz")
Definition: invexp.C:117
void SetId(int id)
Definition: SimpleCand.C:26
TFile * out
Definition: reco_muo.C:20
void SetMotherIdx(int idx)
Definition: SimpleCand.C:28
void SetNFS(int n)
Definition: SimpleCand.C:32
void configHisto ( TH1 *  h)

Definition at line 652 of file softtrigger_toy12.C.

Referenced by softtrigger_toy12().

653 {
654  h->SetFillStyle(3001);
655  h->SetFillColor(602);
656  h->SetLineStyle(3);
657  h->SetLineColor(602);
658 }
double dponline ( TLorentzVector &  v)

Definition at line 152 of file softtrigger_toy12.C.

References f_res.

Referenced by smearMom().

153 {
154  return f_res->Eval(v.Pt())/100.;
155 }
TF1 * f_res
__m128 v
Definition: P4_F32vec4.h:4
bool eventAccepted ( CandList l,
double  m = 0,
double  w = 0 
)

Definition at line 283 of file softtrigger_toy12.C.

References i, and m.

Referenced by softtrigger_toy12().

284 {
285  bool accepted = false;
286  unsigned int i=0;
287 
288  while (!accepted && i<l.size())
289  //for (unsigned int i=0;i<l.size();++i)
290  {
291  double mass = l[i++].P4().M();
292  if (mass>m-w && mass<m+w) accepted =true;
293  }
294 
295  return accepted;
296 }
Int_t i
Definition: run_full.C:25
__m128 m
Definition: P4_F32vec4.h:28
int fillHisto ( CandList l,
TH1 *  hall,
TH1 *  hbg = 0,
double  m = 0,
double  w = 0,
TH1 *  hallsel = 0,
TH1 *  hbgsel = 0,
TH1 *  hsig = 0,
TH1 *  hmm = 0,
TH2 *  hmvsmm = 0 
)

Definition at line 300 of file softtrigger_toy12.C.

References cnt, fIni, i, and m.

Referenced by softtrigger_toy12().

301 {
302  int cnt =0;
303  for (unsigned int i=0;i<l.size();++i)
304  {
305  double mass = l[i].P4().M();
306  double miss = (fIni-l[i].P4()).M();
307  hall->Fill(mass);
308 
309  //missing mass
310  if (hmm) hmm->Fill(miss);
311  if (hmvsmm) hmvsmm->Fill(mass, miss);
312 
313  bool mct = l[i].Mct();
314  if (hbg && !mct) hbg->Fill(mass);
315  if (hsig && mct) hsig->Fill(mass);
316  if (mass>m-w && mass<m+w)
317  {
318  cnt++;
319  if (hallsel) hallsel->Fill(mass);
320  if (hbgsel && !mct) hbgsel->Fill(mass);
321  }
322  }
323  return cnt;
324 }
TLorentzVector fIni
Int_t i
Definition: run_full.C:25
__m128 m
Definition: P4_F32vec4.h:28
Int_t cnt
Definition: hist-t7.C:106
void init ( double  pideff,
double  misid 
)

Definition at line 198 of file softtrigger_toy12.C.

References f_res, makePidTable(), mE, mK, mMu, mP, mPi, mPi0, pdg_db, and pdgidx.

Referenced by softtrigger_toy12().

199 {
200  // *** setting the mapping of PDG code to tab index
201  pdgidx.clear();
202  pdgidx[11]=0;
203  pdgidx[13]=1;
204  pdgidx[211]=2;
205  pdgidx[321]=3;
206  pdgidx[2212]=4;
207 
208  pdg_db=TDatabasePDG::Instance();
209 
210  // *** create pid table
211  makePidTable(pideff, misid);
212 
213  // *** gets particle masses from pdg database and set them globally
214  mE = pdg_db->GetParticle(11)->Mass();
215  mMu = pdg_db->GetParticle(13)->Mass();
216  mPi = pdg_db->GetParticle(211)->Mass();
217  mK = pdg_db->GetParticle(321)->Mass();
218  mP = pdg_db->GetParticle(2212)->Mass();
219 
220  mPi0= pdg_db->GetParticle(111)->Mass();
221 
222  // *** resolution fcn based on Yutie Lang results; see routine dponline above
223  f_res=new TF1("f_res","pol2(0)");
224  f_res->SetParameters(2.367,1.3,0.133);
225  f_res->SetRange(0,10);
226 }
double mPi
void makePidTable(double pideff, double misid)
TF1 * f_res
double mMu
double mPi0
double mK
TDatabasePDG * pdg_db
std::map< int, int > pdgidx
double mP
double mE
bool isDetected ( double  eff = 0.90)

Definition at line 544 of file softtrigger_toy12.C.

References fRand.

Referenced by makeRecoCands().

545 {
546  // very simple efficiency cut; might be dependent on candidate itself later
547  if (fRand.Rndm()<eff) return true;
548  return false;
549 }
TRandom3 fRand
bool isFinalState ( int  n)

Definition at line 143 of file softtrigger_toy12.C.

Referenced by makeRecoCands(), and softtrigger_toy12().

144 {
145  n=abs(n);
146  return (n==11 || n==13 || n==211 || n==321 || n==2212 || n==22);
147 }
int n
void makeIni4Vector ( TLorentzVector &  l,
double  s 
)

Definition at line 645 of file softtrigger_toy12.C.

References mP, p, sqrt(), and X.

Referenced by softtrigger_toy12().

646 {
647  double X = (s*s-2*mP*mP)/(2*mP);
648  double p = sqrt(X*X - mP*mP);
649  l.SetXYZM(0,0,p,s);
650 }
friend F32vec4 sqrt(const F32vec4 &a)
Definition: P4_F32vec4.h:29
TLorentzVector s
Definition: Pnd2DStar.C:50
Double_t p
Definition: anasim.C:58
double X
Definition: anaLmdDigi.C:68
double mP
void makePidSelection ( CandList l)

Definition at line 624 of file softtrigger_toy12.C.

References eminus, eplus, gam, kminus, kplus, mE, mK, mMu, mP, mPi, muminus, muplus, piminus, piplus, pminus, pplus, and select().

Referenced by softtrigger_toy12().

625 {
626  // *** prepare globally defined PID lists
627  select(l, eplus, 1, -11, mE);
628  select(l, eminus, -1, 11, mE);
629 
630  select(l, muplus, 1, -13, mMu);
631  select(l, muminus, -1, 13, mMu);
632 
633  select(l, piplus, 1, 211, mPi);
634  select(l, piminus, -1, -211, mPi);
635 
636  select(l, kplus, 1, 321, mK);
637  select(l, kminus, -1, -321, mK);
638 
639  select(l, pplus, 1, 2212, mP);
640  select(l, pminus, -1, -2212, mP);
641 
642  select(l, gam, 0, 22, 0);
643 }
double mPi
void select(CandList &in, CandList &out, int chrg=0, int pdg=0, double mass=0.139)
CandList kminus
CandList muplus
CandList gam
CandList pplus
CandList eminus
double mMu
CandList piminus
CandList pminus
CandList muminus
double mK
CandList eplus
CandList piplus
CandList kplus
double mP
double mE
void makePidTable ( double  pideff,
double  misid 
)

Definition at line 158 of file softtrigger_toy12.C.

References i, pidtab, and printf().

Referenced by init().

159 {
160  cout<< "Using PID table:"<<endl;
161 
162  if (pideff<0 && misid<0)
163  {
164  for (int i=0;i<5;++i)
165  {
166  for (int j=0;j<5;++j)
167  {
168  //pidtab[j+5*i] = pidreal[j+5*i];
169  printf("%4.0f",pidtab[j+5*i]);
170  //cout << pidtab[i+5*j]<<" ";
171  }
172  cout<< endl;
173  }
174  return;
175  }
176 
177  if (pideff<0) pideff=0;
178  if (pideff>100) pideff=100;
179  if (misid>100) misid=100;
180 
181  // *** neff is the efficiency for particles of wrong type
182  //double neff = pideff*(100-pidpur)/(4*pidpur);
183  //if (neff>100) neff=100;
184 
185  for (int i=0;i<5;++i)
186  {
187  for (int j=0;j<5;++j)
188  {
189  if (i==j) pidtab[i+5*j] = pideff;
190  else pidtab[i+5*j] = misid;
191  cout << pidtab[i+5*j]<<" ";
192  }
193  cout<< endl;
194  }
195 }
printf("RealTime=%f seconds, CpuTime=%f seconds\n", rtime, ctime)
double pidtab[25]
Int_t i
Definition: run_full.C:25
void makeRecoCands ( CandList mc,
CandList reco,
double  eff = 0.90,
double  dp = 0.05,
double  dtht = 0.001,
double  dphi = 0.001 
)

Definition at line 551 of file softtrigger_toy12.C.

References c, fdE, fNdphi, fNdtht, fNeutEff, i, isDetected(), isFinalState(), pid(), SimpleCand::Pid(), SimpleCand::SetMass(), and smearMom().

Referenced by softtrigger_toy12().

552 {
553  reco.clear();
554 
555  for (unsigned int i=0;i<mc.size();i++)
556  {
557  SimpleCand c=mc[i];
558  int pid = abs(c.Pid());
559  if (!isFinalState(pid)) continue;
560 
561  if (pid!=22 && isDetected(eff)) // *** charged track
562  {
563  smearMom(c,dp,dtht,dphi);
564  // set pion mass as default
565  c.SetMass(0.13957);
566  reco.push_back(c);
567  }
568  else if (pid==22 && isDetected(fNeutEff)) // *** neutral
569  {
570  smearMom(c,fdE, fNdtht, fNdphi);
571  reco.push_back(c);
572  }
573  }
574 }
Int_t i
Definition: run_full.C:25
const double fNeutEff
int pid()
const double fNdtht
int Pid() const
Definition: SimpleCand.C:40
void SetMass(double mass)
Definition: SimpleCand.C:22
const double fNdphi
int reco()
const double fdE
bool isFinalState(int n)
void smearMom(SimpleCand &c, double dpr=0.05, double dtht=0.000, double dphi=0.000)
bool isDetected(double eff=0.90)
int massCrit ( CandList l,
double  m,
double  w 
)

Definition at line 270 of file softtrigger_toy12.C.

References cnt, and i.

271 {
272  int cnt = 0;
273  for (unsigned int i=0;i<l.size();++i)
274  {
275  double mass=l[i].P4().M();
276  if (mass>m-w && mass<m+w) cnt++;
277  }
278 
279  return cnt;
280 }
Int_t i
Definition: run_full.C:25
__m128 m
Definition: P4_F32vec4.h:28
Int_t cnt
Definition: hist-t7.C:106
void printAllLists ( )

Definition at line 246 of file softtrigger_toy12.C.

References eminus, eplus, gam, kminus, kplus, mclist, muminus, muplus, piminus, piplus, pminus, pplus, printList(), and recolist.

247 {
248  printList(mclist, "MC List");
249  printList(recolist, "Reco List");
250 
251  printList(eplus, "e+ List");
252  printList(eminus, "e- List");
253 
254  printList(muplus, "mu+ List");
255  printList(muminus, "mu- List");
256 
257  printList(piplus, "pi+ List");
258  printList(piminus, "pi- List");
259 
260  printList(kplus, "k+ List");
261  printList(kminus, "k- List");
262 
263  printList(pplus, "p+ List");
264  printList(pminus, "p- List");
265 
266  printList(gam, "gamma List");
267 }
CandList mclist
CandList kminus
CandList muplus
CandList gam
CandList pplus
CandList eminus
void printList(CandList &l, TString tit="")
CandList piminus
CandList pminus
CandList muminus
CandList eplus
CandList piplus
CandList kplus
CandList recolist
void printCand ( SimpleCand  c)

Definition at line 229 of file softtrigger_toy12.C.

References SimpleCand::Charge(), SimpleCand::Id(), SimpleCand::McPid(), SimpleCand::Mct(), SimpleCand::MotherIdx(), SimpleCand::NFS(), SimpleCand::NSiblings(), SimpleCand::P4(), and SimpleCand::Pid().

Referenced by printList().

230 {
231  cout <<c.Id()<<" pid:"<<c.Pid()<<" ("<<c.P4().X()<<","<<c.P4().Y()<<","<<c.P4().Z()<<";"<<c.P4().T()<<") ";
232  cout <<c.Charge()<<" "<<c.P4().M();
233  cout <<" moth:"<<c.MotherIdx()<<" nsib:"<<c.NSiblings()<<" nfs:"<<c.NFS();
234  cout <<" mcpid:"<<c.McPid()<<" mct:"<<c.Mct()<<endl;
235 }
int NFS() const
Definition: SimpleCand.C:47
bool Mct() const
Definition: SimpleCand.C:48
int Pid() const
Definition: SimpleCand.C:40
int NSiblings() const
Definition: SimpleCand.C:46
int Id() const
Definition: SimpleCand.C:42
TLorentzVector P4() const
Definition: SimpleCand.C:39
int MotherIdx() const
Definition: SimpleCand.C:45
int Charge() const
Definition: SimpleCand.C:44
bool McPid() const
Definition: SimpleCand.C:49
void printList ( CandList l,
TString  tit = "" 
)

Definition at line 238 of file softtrigger_toy12.C.

References printCand().

Referenced by printAllLists().

239 {
240  if (tit!="") cout << tit<<endl;
241  for (unsigned int j=0;j<l.size();++j) printCand(l[j]);
242  cout <<endl;
243 }
void printCand(SimpleCand c)
void select ( CandList in,
CandList out,
int  chrg = 0,
int  pdg = 0,
double  mass = 0.139 
)

Definition at line 587 of file softtrigger_toy12.C.

References c, SimpleCand::Charge(), fRand, i, pdg_db, pdgidx, SimpleCand::Pid(), pidtab, SimpleCand::SetMass(), and SimpleCand::SetMcPid().

Referenced by makePidSelection().

588 {
589  out.clear();
590 
591  TParticlePDG *part = pdg_db->GetParticle(pdg);
592 
593  //pdg *= pdg<20 ? -chrg : chrg;
594 
595  if (part) mass = part->Mass();
596  if (mass<0) mass = 0.139;
597 
598  for (unsigned int i=0;i<in.size();++i)
599  {
600  SimpleCand c=in[i];
601 
602  // select a specific charge in any case
603  if (c.Charge()==chrg)
604  {
605  c.SetMass(mass);
606  if (c.Pid()==pdg) c.SetMcPid();
607  if (pdg==0 || pdg==22) out.push_back(c); // do we want select a pdg code? 0=only charge
608  else
609  {
610  // invalid pdg code?
611  if (pdgidx.find(abs(pdg))==pdgidx.end()) continue;
612 
613  int selidx = pdgidx[abs(pdg)];
614  int partidx = pdgidx[abs(c.Pid())];
615  double prob = pidtab[5*selidx + partidx]/100.;
616  //cout <<pdg <<" "<<c.Pid()<<" : "<<selidx<<" "<<partidx<<" P:"<<prob<<endl;
617 
618  if (fRand.Rndm()<prob) out.push_back(c);
619  }
620  }
621  }
622 }
double pidtab[25]
Int_t i
Definition: run_full.C:25
void SetMcPid(bool mct=true)
Definition: SimpleCand.C:30
int Pid() const
Definition: SimpleCand.C:40
void SetMass(double mass)
Definition: SimpleCand.C:22
TDatabasePDG * pdg_db
TFile * out
Definition: reco_muo.C:20
std::map< int, int > pdgidx
TRandom3 fRand
int Charge() const
Definition: SimpleCand.C:44
void selectMass ( CandList in,
CandList out,
double  mmean = 0,
double  mw = 0 
)

Definition at line 577 of file softtrigger_toy12.C.

References fabs(), and i.

Referenced by softtrigger_toy12().

578 {
579  out.clear();
580 
581  for (unsigned int i=0;i<in.size();++i)
582  if (fabs(in[i].P4().M()-mmean)<mw) out.push_back(in[i]);
583 
584 }
Int_t i
Definition: run_full.C:25
friend F32vec4 fabs(const F32vec4 &a)
Definition: P4_F32vec4.h:47
TFile * out
Definition: reco_muo.C:20
void smearMom ( SimpleCand c,
double  dpr = 0.05,
double  dtht = 0.000,
double  dphi = 0.000 
)

Definition at line 514 of file softtrigger_toy12.C.

References dponline(), fRand, m, p, SimpleCand::P4(), and SimpleCand::SetP4().

Referenced by makeRecoCands().

515 {
516  TLorentzVector p4=c.P4();
517 
518  // *** use resolution function
519  if (dpr<0) dpr = dponline(p4);
520 
521  double p = p4.P();
522  double m = p4.M();
523 
524  double dp = p*dpr;
525  double newp = -1;
526 
527  if (dp==0) newp=p;
528  while (newp<0) newp = p4.P() + fRand.Gaus(0.0,dp);
529 
530  p4.SetVectM( p4.Vect().Unit()*newp, m );
531 
532  double newtht = p4.Theta();
533  if (dtht!=0) newtht += fRand.Gaus(0.,dtht);
534  p4.SetTheta(newtht);
535 
536  double newphi = p4.Phi();
537  if (dphi!=0) newphi += fRand.Gaus(0.,dphi);
538  p4.SetPhi(newphi);
539 
540  c.SetP4(p4);
541 
542 }
double dponline(TLorentzVector &v)
void SetP4(TLorentzVector lv)
Definition: SimpleCand.C:20
__m128 m
Definition: P4_F32vec4.h:28
Double_t p
Definition: anasim.C:58
TLorentzVector P4() const
Definition: SimpleCand.C:39
TRandom3 fRand
int softtrigger_toy12 ( TString  fsig,
int  nev = 2,
double  sqrts = 3.77,
bool  simcut = false,
bool  evcut = false,
double  dp = 0.03,
double  trkeff = 100.,
double  pideff = 95.,
double  misid = 5.,
double  P_mix = 0.00 
)

Definition at line 660 of file softtrigger_toy12.C.

References boostList(), c, c2, EventShape::ChrgPSumCms(), EventShape::ChrgPtSumLab(), combine(), configHisto(), Double_t, eminus, eplus, eventAccepted(), f, fD0Mass, fD0Pdg, fD0win, fDMass, fDPdg, fDsMass, fDsPdg, fDswin, fDwin, fillHisto(), fIni, fJMass, fJpsiPdg, fJwin, fKsMass, fKsPdg, fKswin, fLamcMass, fLamcPdg, fLamcwin, fLamMass, fLamPdg, fLamwin, fMAX, EventShape::FoxWolfMomR(), fPhiMass, fPhiPdg, fPhiwin, fPi0Mass, fPi0Pdg, fPi0win, fRand, gam, high, i, init(), isFinalState(), kminus, kplus, m, makeIni4Vector(), makePidSelection(), makeRecoCands(), max(), mcFSlist, mclist, min(), EventShape::MultPminCms(), muminus, muplus, EventShape::NCharged(), EventShape::NeutESumCms(), nk, nlep, EventShape::NNeutral(), EventShape::NParticles(), npi, npr, offset(), p, pdg_db, piminus, piplus, EventShape::PmaxCms(), EventShape::PmaxLab(), EventShape::PminCms(), pminus, pplus, pt(), EventShape::Ptmax(), EventShape::PtSumLab(), pz, recocmslist, recolist, selectMass(), SimpleCand::SetDau(), SimpleCand::SetEvtId(), SimpleCand::SetMotherIdx(), SimpleCand::SetNSiblings(), EventShape::SumChrgPminCms(), t, and TString.

662 {
663  fRand.SetSeed();
664 
665  init(pideff, misid);
666 
667  int i,j,k;
668 
669  makeIni4Vector(fIni, sqrts);
670 
671  fIni.Print();
672 
673  //gStyle->SetOptStat(1111);
674 
675  // *** open file and get tree
676  TFile *f=new TFile(fsig,"READ");
677  if (f->IsZombie())
678  {
679  cout <<"File not found:"<<fsig<<endl;
680  return;
681  }
682 
683  bool dpm=fsig.Contains("DPM"); // *** DPM events
684  TString treename = dpm ? "data" : "ntp"; // *** set treename
685  TTree *t=(TTree*)f->Get(treename);
686 
687  if (t==0)
688  {
689  cout <<"Tree '"<<treename<<"' not found in '"<<fsig<<"'."<<endl;
690  return;
691  }
692 
693  // *** how many events ?
694  int Nevt = t->GetEntriesFast();
695  if (nev==0) nev = Nevt;
696 
697  double mmean=0, mwsig=0, mwoff=0;
698  int matchPDG=0;
699 
700  // *** choose histogram scale according to resonance
701  high = mmean+2;
702 
703  TCanvas *c2=new TCanvas("c2","c2",10,10,1500,830);
704  c2->Divide(5,3);
705 
706 /* TCanvas *c3=new TCanvas("c3","c3",1010,10,600,600);
707  c3->Divide(2,2);*/
708 
709 // TCanvas *c4=new TCanvas("c4","c4",1220,20,500,500);
710 
711  double min=0, max=5.5;
712 
713  // *** create some histograms
714  TH1F *h_mom= new TH1F("h_mom","Momenta",200,0,5);
715  TH1F *h_momc= new TH1F("h_momc","Momenta charged",200,0,5);
716  TH1F *h_momn= new TH1F("h_momn","Momenta neutral",200,0,5);
717  TH1F *h_mult= new TH1F("h_mult","Multiplicity",50,-0.5,49.5);
718  TH1F *h_multrec= new TH1F("h_multrec","Multiplicity reco",50,-0.5,49.5);
719  TH1F *h_multc= new TH1F("h_multc","Multiplicity charged",30,-0.5,29.5);
720  TH1F *h_multn= new TH1F("h_multn","Multiplicity neutral",50,-0.5,49.5);
721  TH1F *h_fw1= new TH1F("h_fw1","Fox Wolfram R1",300,-1.1,1.1);
722  TH1F *h_pmax= new TH1F("h_pmax","pmax cms",300,0,5);
723 
724  TH1F *h_mult_k = new TH1F("h_mult_k","Multiplicity Kaons",10,-0.5,9.5);
725  TH1F *h_mult_lep = new TH1F("h_mult_lep","Multiplicity Leptons",10,-0.5,9.5);
726  TH1F *h_sum_klep = new TH1F("h_sum_lep","Sum Kaons + Leptons",15,-0.5,14.5);
727  TH2F *h_mult_klep=new TH2F("h_mult_klep","#Kaons vs. #Leptons",10,-0.5,9.5, 10, -0.5, 9.5);
728  h_mult_klep->SetYTitle("#Leptons");
729  h_mult_klep->SetXTitle("#Kaons");
730 
731  // ****** pi0
732  TH1F *h_pi0=new TH1F("h_pi0","#pi^{0} #rightarrow #gamma#gamma",200,min,0.4);
733  TH1F *h_pi0sel=new TH1F("h_pi0sel","Pi0",200,min,0.4);
734  TH1F *h_pi0sig=new TH1F("h_pi0sig","Pi0",200,min,0.4);
735  h_pi0sig->SetLineColor(2);
736  configHisto(h_pi0sel);
737 
738  // ****** Ks
739  TH1F *h_ks=new TH1F("h_ks","K_{S}^{0} #rightarrow #pi^{+}#pi^{-}",200,0.2,0.8);
740  TH1F *h_kssel=new TH1F("h_kssel","Pi0",200,0.2,0.8);
741  TH1F *h_kssig=new TH1F("h_kssig","Pi0",200,0.2,0.8);
742  h_kssig->SetLineColor(2);
743  configHisto(h_kssel);
744 
745  // ****** pi0
746  TH1F *h_jpsi=new TH1F("h_jpsi","J/#psi #rightarrow l^{+}l^{-}",200,min,max);
747  TH1F *h_jpsisel=new TH1F("h_jpsisel","J/psi",200,min,max);
748  TH1F *h_jpsisig=new TH1F("h_jpsisig","J/psi",200,min,max);
749  h_jpsisig->SetLineColor(2);
750  configHisto(h_jpsisel);
751 
752  // ****** D0
753  TH1F *h_d0=new TH1F("h_d0","D^{0} #rightarrow K^{-}#pi^{+}",200,min,max);
754  TH1F *h_d0sel=new TH1F("h_d0sel","D0",200,min,max);
755  TH1F *h_d0sig=new TH1F("h_d0sig","D0",200,min,max);
756  h_d0sig->SetLineColor(2);
757  configHisto(h_d0sel);
758 
759  TH1F *h_d02=new TH1F("h_d02","D^{0} #rightarrow K^{-}#pi^{+}#pi^{0}",200,min,max);
760  TH1F *h_d02sel=new TH1F("h_d02sel","D0",200,min,max);
761  TH1F *h_d02sig=new TH1F("h_d02sig","D0",200,min,max);
762  h_d02sig->SetLineColor(2);
763  configHisto(h_d02sel);
764 
765  TH1F *h_d03=new TH1F("h_d03","D^{0} #rightarrow K^{-}#pi^{+}#pi^{+}#pi^{-}",200,min,max);
766  TH1F *h_d03sel=new TH1F("h_d03sel","D0",200,min,max);
767  TH1F *h_d03sig=new TH1F("h_d03sig","D0",200,min,max);
768  h_d03sig->SetLineColor(2);
769  configHisto(h_d03sel);
770 
771  // ****** D+
772  TH1F *h_dpm=new TH1F("h_dpm","D^{+} #rightarrow K^{-}#pi^{+}#pi^{+}",200,min,max);
773  TH1F *h_dpmsel=new TH1F("h_dpmsel","D#pm",200,min,max);
774  TH1F *h_dpmsig=new TH1F("h_dpmsig","D#pm",200,min,max);
775  h_dpmsig->SetLineColor(2);
776  configHisto(h_dpmsel);
777 
778  TH1F *h_dpm2=new TH1F("h_dpm2","D^{+} #rightarrow K^{-}#pi^{+}#pi^{+}#pi^{0}",200,min,max);
779  TH1F *h_dpm2sel=new TH1F("h_dpm2sel","D#pm",200,min,max);
780  TH1F *h_dpm2sig=new TH1F("h_dpm2sig","D#pm",200,min,max);
781  h_dpm2sig->SetLineColor(2);
782  configHisto(h_dpm2sel);
783 
784  TH1F *h_dpm3=new TH1F("h_dpm3","D^{+} #rightarrow K_{S}^{0}#pi^{+}#pi^{0}",200,min,max);
785  TH1F *h_dpm3sel=new TH1F("h_dpm3sel","D#pm",200,min,max);
786  TH1F *h_dpm3sig=new TH1F("h_dpm3sig","D#pm",200,min,max);
787  h_dpm3sig->SetLineColor(2);
788  configHisto(h_dpm3sel);
789 
790  TH1F *h_dpm4=new TH1F("h_dpm4","D^{+} #rightarrow K_{S}^{0}#pi^{+}#pi^{+}#pi^{-}",200,min,max);
791  TH1F *h_dpm4sel=new TH1F("h_dpm4sel","D#pm",200,min,max);
792  TH1F *h_dpm4sig=new TH1F("h_dpm4sig","D#pm",200,min,max);
793  h_dpm4sig->SetLineColor(2);
794  configHisto(h_dpm4sel);
795 
796  // ****** Ds+
797  TH1F *h_ds=new TH1F("h_ds","D_{s}^{+} #rightarrow K^{+}K^{-}#pi^{+}",200,min,max);
798  TH1F *h_dssel=new TH1F("h_dssel","Ds",200,min,max);
799  TH1F *h_dssig=new TH1F("h_dssig","Ds",200,min,max);
800  h_dssig->SetLineColor(2);
801  configHisto(h_dssel);
802 
803  TH1F *h_ds2=new TH1F("h_ds2","D_{s}^{+} #rightarrow K^{+}K^{-}#pi^{+}#pi^{0}",200,min,max);
804  TH1F *h_ds2sel=new TH1F("h_ds2sel","Ds",200,min,max);
805  TH1F *h_ds2sig=new TH1F("h_ds2sig","Ds",200,min,max);
806  h_ds2sig->SetLineColor(2);
807  configHisto(h_ds2sel);
808 
809  // ****** phi
810  TH1F *h_phi=new TH1F("h_phi","#phi #rightarrow K^{+}K^{-}",200,min,max);
811  TH1F *h_phisel=new TH1F("h_phisel","Phi",200,min,max);
812  TH1F *h_phisig=new TH1F("h_phisig","Phi",200,min,max);
813  h_phisig->SetLineColor(2);
814  configHisto(h_phisel);
815 
816  // ****** Lambda_c
817  TH1F *h_lamc=new TH1F("h_lamc","#Lambda_{c} #rightarrow pK^{-}#pi^{+}",200,min,max);
818  TH1F *h_lamcsel=new TH1F("h_lamcsel","Lam_c",200,min,max);
819  TH1F *h_lamcsig=new TH1F("h_lamcsig","Lam_c",200,min,max);
820  h_lamcsig->SetLineColor(2);
821  configHisto(h_lamcsel);
822 
823  // ****** Lambda
824  TH1F *h_lam=new TH1F("h_lam","#Lambda #rightarrow p#pi^{-}",200,min,max);
825  TH1F *h_lamsel=new TH1F("h_lamsel","Lam",200,min,max);
826  TH1F *h_lamsig=new TH1F("h_lamsig","Lam",200,min,max);
827  h_lamsig->SetLineColor(2);
828  configHisto(h_lamsel);
829 
830  TNtuple *ntp=new TNtuple("ntp","ntp","m:tht:pt:p:d1tht:d1pt:d1p:d2tht:d2pt:d2p:d3tht:d3pt:d3p");
831 
832  h_jpsi->SetXTitle("m(l^{+}l^{-}) [GeV/c^{2}]");
833 
834  h_d0->SetXTitle("m(K^{-}#pi^{+}) [GeV/c^{2}]");
835  h_d02->SetXTitle("m(K^{-}#pi^{+}#pi^{0}) [GeV/c^{2}]");
836  h_d03->SetXTitle("m(K^{-}#pi^{+}#pi^{+}#pi^{-}) [GeV/c^{2}]");
837 
838  h_dpm->SetXTitle("m(K^{-}#pi^{+}#pi^{+}) [GeV/c^{2}]");
839 
840  h_ds->SetXTitle("m(K^{+}K^{-}#pi^{+}) [GeV/c^{2}]");
841 
842  h_phi->SetXTitle("m(K^{+}K^{-}) [GeV/c^{2}]");
843  h_lamc->SetXTitle("m(pK^{-}#pi^{+}) [GeV/c^{2}]");
844  h_lam->SetXTitle("m(p#pi^{-}) [GeV/c^{2}]");
845 
846  // *** prepare the tree to loop through
847 
848  Int_t nTrk,Id[fMAX],DF[fMAX],DL[fMAX];
849  Double_t px[fMAX],py[fMAX],pz[fMAX],E[fMAX],m[fMAX];
850  TClonesArray* DpmPart=0;
851 
852  if (dpm)
853  {
854  DpmPart=new TClonesArray("TParticle",100);
855  t->SetBranchAddress("Npart",&nTrk);
856  t->SetBranchAddress("Particles", &DpmPart);
857  }
858  else
859  {
860  t->SetBranchAddress("nTrk",&nTrk);
861  t->SetBranchAddress("Id",Id);
862  t->SetBranchAddress("DF",DF);
863  t->SetBranchAddress("DL",DL);
864  t->SetBranchAddress("px",px);
865  t->SetBranchAddress("py",py);
866  t->SetBranchAddress("pz",pz);
867  t->SetBranchAddress("E",E);
868  t->SetBranchAddress("m",m);
869  }
870 
871 
872  int combCnt=0; // how many combinatione are within our mass criterion
873  int evCnt=0; // how many _events_ (not combinations!) are within our mass criterion
874  int evMultCut=0;
875 
876  // *** the event loop
877 
878  int mixevts=1;
879  int currmix=0;
880 
881  int cntInLam=0;
882 
883  // how many events are tagged by individual algo?
884  bool channelselect[13];
885  double channelcount[13];
886  TString channelname[13]={"Phi(KK)","Lam(ppi)","J/psi(ll)","D+-(K2pi)","D+-(K2pipi0)","D+-(KSpipi0)","D+-(KS3pi)","D0(Kpi)","D0(Kpipi0)","D0(K3pi)","Ds(KKpi)","Ds(KKpipi0)","Lamc(pKpi)"};
887 
888  for (i=0;i<13;++i) channelcount[i]=0.;
889 
890  if (fRand.Rndm()<P_mix) mixevts=2;
891 
892  for (i=0;i<nev;++i)
893  {
894  t->GetEntry(i);
895 
896  if (i%5000==0) cout <<"ev "<<i<<endl;
897 
898  // *** read in from file the mc candidate
899  if (0==currmix)
900  {
901  mclist.clear(); // *** contains all MC cands (also non-final-states)
902  mcFSlist.clear(); // *** contains only final state MC cands
903  }
904 
905  bool good = true;
906 
907  if (dpm)
908  {
909  int npi = 0;
910  int nstab = 0;
911 
912  for (j=0;j<nTrk;++j)
913  {
914  TParticle *pt=(TParticle*)DpmPart->At(j);
915  Id[j] = pt->GetPdgCode();
916  int pdg = abs(Id[j]);
917  px[j] = pt->Px();
918  py[j] = pt->Py();
919  pz[j] = pt->Pz();
920  E[j] = pt->Energy();
921  m[j] = pt->GetMass();
922  DF[j] = 0;
923  DL[j] = -1;
924  if (pdg==211) npi++;
925  if (isFinalState(pdg)) nstab++;
926  }
927  //if (npi!=4 || nstab!=npi ) good = false;
928  }
929 
930  if (!good) continue;
931 
932  for (j=0;j<nTrk;++j)
933  {
934  int chrg = 0;
935  int pdg = abs(Id[j]);
936  TParticlePDG *p=pdg_db->GetParticle(Id[j]);
937  if (p) chrg = p->Charge();
938  if (abs(chrg)>1) chrg/=3;
939 
940  SimpleCand c(px[j], py[j], pz[j], E[j], Id[j], j, chrg);
941  c.SetDau(DF[j], DL[j]);
942 
943  for (k=0;k<j;++k) if (j>=DF[k] && j<=DL[k])
944  {
945  c.SetMotherIdx(k);
946  c.SetNSiblings(DL[k]-DF[k]+1);
947  }
948 
949  c.SetEvtId(i);
950 
951  mclist.push_back(c);
952 
953  // final state particle?
954  if (isFinalState(pdg)) mcFSlist.push_back(c);
955  }
956 
957  if (++currmix<mixevts) continue;
958 
959  currmix=0;
960 
961  h_mult->Fill(mcFSlist.size());
962 
963  // *** if mass cut is negative (= number of sigmas), compute absolute window size
964  //if (mwin<0) mwidth=-mwin*(dp*mwsig+mwoff);
965 
966  // *** prepare the toy reco: smear momentum and apply track efficiency (both flat at the moment)
967  makeRecoCands(mcFSlist, recolist, trkeff/100., dp );
968 
969  // *** the boost of the system
970  TVector3 boost = fIni.BoostVector();
971  boostList(recolist, recocmslist, boost);
972 
973  // *** Make Event Selection
974  EventShape evsh(recolist, fIni);
975 /* if (evcut)
976  {
977  if (evshape.ChrgPtSumLab()<1.5) continue;
978  }*/
979 
980  h_multrec->Fill(recolist.size());
981  //cout <<mcFSlist.size()<<" "<<recolist.size()<<endl;
982 
983  // *** prepare all pid list according to the pidtable probabilities
985 
986  int npi = piplus.size()+piminus.size();
987  int nk = kplus.size()+kminus.size();
988  int npr = pplus.size()+pminus.size();
989  int nlep = eplus.size()+eminus.size()+muplus.size()+muminus.size();
990 
991  int nk10 = 0; // # kaons with p>1.0
992  for (j=0;j<kplus.size();++j) if (kplus[j].P4().P()>1.0) nk10++;
993  for (j=0;j<kminus.size();++j) if (kminus[j].P4().P()>1.0) nk10++;
994 
995  int npr10 = 0; // # protons with p>1.0
996  for (j=0;j<pplus.size();++j) if (pplus[j].P4().P()>1.0) npr10++;
997  for (j=0;j<pminus.size();++j) if (pminus[j].P4().P()>1.0) npr10++;
998 
999  h_mult_k->Fill(nk);
1000  h_mult_lep->Fill(nlep);
1001  h_mult_klep->Fill(nk, nlep);
1002  h_sum_klep->Fill(nk + nlep);
1003 
1004 
1005  // *** the lists we need for combinatorics
1006  CandList comb1, comb2, comb3;
1007 
1008  CandList LPhi, LPi0, LKs; // phi -> KK , pi0 -> gg (mass cut), KS -> pi+ pi- (mass cut)
1009  CandList LJpsiE, LJpsiMu; // J/psi -> ee/mu mu
1010  CandList LDp, LDm, LDp2, LDm2, LDp3, LDm3, LDp4, LDm4; // D+- -> K2pi, K2pipi0, KS pi pi0, KS pi pi pi
1011  CandList LDsp, LDsm, LDsp2, LDsm2; // Ds -> KKpi, KKpipi0
1012  CandList LD0, LD02, LD0b, LD02b, LD03, LD03b; // D0 -> Kpi, Kpipi0, K3pi
1013  CandList LLamcp, LLamcm; // Lc -> pKpi
1014  CandList LLam, LLamb; // Lam -> ppi
1015 
1016 
1017  int ncomb1=0, ncomb2=0;
1018  bool selected=false;
1019 
1020  for (j=0;j<13;++j) channelselect[j]=false;
1021 
1022  // Apply cut on kaon/lepton multiplicity
1023 /* if ( multcut>0 && (N_K+N_lep<multcut) )
1024  {
1025  mixevts=1;
1026  if (fRand.Rndm()<P_mix) mixevts=2;
1027  continue;
1028  }*/
1029 
1030  evMultCut++;
1031 
1032  bool accepted = false;
1033 
1034  //
1035  // ********* pi0 / KS
1036  //
1037  // *** do combinatorics (pi0 -> gg)
1038  combine(gam, gam, comb1, fPi0Pdg);
1039  fillHisto(comb1, h_pi0, 0, fPi0Mass, fPi0win, h_pi0sel, 0, h_pi0sig );
1040  selectMass(comb1, LPi0, fPi0Mass, fPi0win);
1041 
1042  // *** do combinatorics (pi0 -> gg)
1043  combine(piplus, piminus, comb1, fKsPdg);
1044  fillHisto(comb1, h_ks, 0, fKsMass, fKswin, h_kssel, 0, h_kssig );
1045  selectMass(comb1, LKs, fKsMass, fKswin);
1046 
1047 
1048  // **** cache some eventshape vars
1049  int npart = evsh.NParticles();
1050  int nchrg = evsh.NCharged();
1051  int nneut = evsh.NNeutral();
1052  int npi0 = LPi0.size(); // #pi0 candidates
1053  int nks0 = LKs.size(); // #KS0 candidates
1054  int npi005 = 0.0;
1055  int npi010 = 0.0;
1056  int nks005 = 0.0;
1057  int nks010 = 0.0;
1058  int np05 = evsh.MultPminCms(0.5);
1059  int np10 = evsh.MultPminCms(1.0);
1060 
1061  double pmaxl = evsh.PmaxLab();
1062  double pmax = evsh.PmaxCms();
1063  double pmin = evsh.PminCms();
1064  double ptmax = evsh.Ptmax();
1065 
1066  double sumpc = evsh.ChrgPSumCms();
1067  double sumpc05 = evsh.SumChrgPminCms(0.5);
1068  double sumpt = evsh.PtSumLab();
1069  double sumptc = evsh.ChrgPtSumLab();
1070  double sumptl = sumpt;
1071  double sumen = evsh.NeutESumCms();
1072 
1073  double fw1 = evsh.FoxWolfMomR(1);
1074  double fw2 = evsh.FoxWolfMomR(2);
1075  double fw3 = evsh.FoxWolfMomR(3);
1076  double fw4 = evsh.FoxWolfMomR(4);
1077  double fw5 = evsh.FoxWolfMomR(5);
1078 
1079  // count pi0 with threshold
1080  for (j=0; j<LPi0.size(); ++j)
1081  {
1082  if (LPi0[j].P4().P()>0.5) npi005++;
1083  if (LPi0[j].P4().P()>1.0) npi010++;
1084  }
1085  // count KS with threshold
1086  for (j=0; j<LKs.size(); ++j)
1087  {
1088  if (LKs[j].P4().P()>0.5) nks005++;
1089  if (LKs[j].P4().P()>1.0) nks010++;
1090  }
1091 
1092  h_fw1->Fill(fw2);
1093  h_pmax->Fill(pmax);
1094 
1095 
1096  // **** find out, whether event was accepted
1097 
1098  // ********* PHI -> K+ K-
1099  if ( !evcut
1100  || (sqrts==2.4 && nk>1 && npart<7 && pmax<0.648 )
1101  || (sqrts==3.77 && nk>1 && fw2>0.5456 )
1102  || (sqrts==4.28 && nk>1 && 1 )
1103  || (sqrts==5.0 && nk>1 && 1 )
1104  || (sqrts==5.5 && nk>1 && 1 )
1105  )
1106  {
1107  // *** do combinatorics (phi -> K K)
1108  combine (kplus, kminus, LPhi, fPhiPdg);
1109 
1110  accepted |= eventAccepted(LPhi,fPhiMass, fPhiwin);
1111  }
1112 
1113 
1114  // ********* LAMBDA -> p pi-
1115  if ( !evcut
1116  || (sqrts==2.4 && npart>3 && npr>0 && npi>0 && fw1>0.132 && fw4>0.2024 )
1117  || (sqrts==3.77 && npart>3 && pmax>1.056 && fw1>0.0 && fw2>0.6248 && fw5>0.22 )
1118  || (sqrts==4.28 && npart>3 && 1 )
1119  || (sqrts==5.0 && npart>3 && 1 )
1120  || (sqrts==5.5 && npart>3 && 1 )
1121  )
1122  {
1123  // *** do combinatorics (Lam -> p pi)
1124  combine (pplus, piminus, LLam, fLamPdg);
1125  combine (pminus, piplus, LLamb, -fLamPdg);
1126 
1127  accepted |= eventAccepted(LLam, fLamMass, fLamwin);
1128  accepted |= eventAccepted(LLamb, fLamMass, fLamwin);
1129  }
1130 
1131 
1132  // ********* JPSI -> e+e-/mu+mu-
1133  if ( !evcut
1134  || (sqrts==3.77 && np10>1 && npi<4 && pmin<0.3 && sumpc>3.296 )
1135  || (sqrts==4.28 && 1 )
1136  || (sqrts==5.0 && 1 )
1137  || (sqrts==5.5 && 1 )
1138  )
1139  {
1140  // *** do combinatorics (J/psi -> ll)
1141  combine(eminus, eplus, LJpsiE, fJpsiPdg);
1142  combine(muminus, muplus, LJpsiMu, fJpsiPdg);
1143 
1144  accepted |= eventAccepted(LJpsiE, fJMass, fJwin);
1145  accepted |= eventAccepted(LJpsiMu, fJMass, fJwin);
1146  }
1147 
1148 
1149  // ********* D+ -> K- pi+ pi+
1150  if ( !evcut
1151  || (sqrts==3.77 && nk>0 && npart<12 && pmax<0.936 && sumpc>1.76 )
1152  || (sqrts==4.28 && nk>0 && 1 )
1153  || (sqrts==5.0 && nk>0 && 1 )
1154  || (sqrts==5.5 && nk>0 && 1 )
1155  )
1156  {
1157  // *** do combinatorics (D+- -> K pi pi)
1158  combine (piplus, piplus, kminus, LDp, fDPdg);
1159  combine (piminus, piminus, kplus, LDm, -fDPdg);
1160 
1161  accepted |= eventAccepted(LDp,fDMass, fDwin);
1162  accepted |= eventAccepted(LDm,fDMass, fDwin);
1163  }
1164 
1165  // ********* D+ -> K- pi+ pi+ pi0
1166  if ( !evcut
1167  || (sqrts==3.77 && nk>0 && nneut>1 && pmax<0.888 && pmaxl<2.76 && sumptc>0.84 )
1168  || (sqrts==4.28 && nk>0 )
1169  || (sqrts==5.0 && nk>0 )
1170  || (sqrts==5.5 && nk>0 )
1171  )
1172  {
1173  // *** do combinatorics (D+- -> K pi pi pi0)
1174  combine (piplus, piplus, kminus, LPi0, LDp2, fDPdg);
1175  combine (piminus, piminus, kplus, LPi0, LDm2, -fDPdg);
1176 
1177  accepted |= eventAccepted(LDp2,fDMass, fDwin);
1178  accepted |= eventAccepted(LDm2,fDMass, fDwin);
1179  }
1180 
1181  //********* D+ -> KS pi+ pi0
1182  if ( !evcut
1183  || (sqrts==3.77 && nks0>0 && npi0>0 && pmax<0.91 && sumen<1.62 )
1184  || (sqrts==4.28 && 1 )
1185  || (sqrts==5.0 && 1 )
1186  || (sqrts==5.5 && 1 )
1187  )
1188  {
1189  // *** do combinatorics (D+- -> KS pi pi0)
1190  combine (piplus, LPi0, LKs, LDp3, fDPdg);
1191  combine (piminus, LPi0, LKs, LDm3, -fDPdg);
1192 
1193  accepted |= eventAccepted(LDp3,fDMass, fDwin);
1194  accepted |= eventAccepted(LDm3,fDMass, fDwin);
1195  }
1196 
1197  //********* D+ -> KS pi+ pi+ pi-
1198  if ( !evcut
1199  || (sqrts==3.77 && nchrg>5 && np05<4 && pmax<0.888 && pmaxl<2.64 && sumen<1.02)
1200  || (sqrts==4.28 && 1 )
1201  || (sqrts==5.0 && 1 )
1202  || (sqrts==5.5 && 1 )
1203  )
1204  {
1205  // *** do combinatorics (D+- -> KS pi pi pi)
1206  combine (piplus, piplus, piminus, LKs, LDp4, fDPdg);
1207  combine (piminus, piminus, piplus, LKs, LDm4, -fDPdg);
1208 
1209  accepted |= eventAccepted(LDp4,fDMass, fDwin);
1210  accepted |= eventAccepted(LDm4,fDMass, fDwin);
1211  }
1212 
1213 
1214  // ********* D0 -> K- pi+
1215  if ( !evcut
1216  || (sqrts==3.77 && nk>0 && sumpc05>3.18 && pmax>0.768 && pmax<1.056 && fw3<0.1848 )
1217  || (sqrts==4.28 && nk>0 && 1 )
1218  || (sqrts==5.0 && nk>0 && 1 )
1219  || (sqrts==5.5 && nk>0 && 1 )
1220  )
1221  {
1222  // *** do combinatorics (D0 -> K pi)
1223  combine (kplus, piminus, LD0, -fD0Pdg);
1224  combine (kminus, piplus, LD0b, fD0Pdg);
1225 
1226  accepted |= eventAccepted(LD0, fD0Mass, fD0win);
1227  accepted |= eventAccepted(LD0b, fD0Mass, fD0win);
1228  }
1229 
1230  // ********* D0 -> K- pi+ pi0
1231  if ( !evcut
1232  || (sqrts==3.77 && nk>0 && nneut>1 && npi<6 && pmax<0.948 && sumpt>1.56 && sumen<1.92)
1233  || (sqrts==4.28 && nk>0 )
1234  || (sqrts==5.0 && nk>0 )
1235  || (sqrts==5.5 && nk>0 )
1236  )
1237  {
1238  // *** do combinatorics (D0 -> K pi pi0)
1239  combine (kplus, piminus, LPi0, LD02, -fD0Pdg);
1240  combine (kminus, piplus, LPi0, LD02b, fD0Pdg);
1241 
1242  accepted |= eventAccepted(LD02, fD0Mass, fD0win);
1243  accepted |= eventAccepted(LD02b, fD0Mass, fD0win);
1244  }
1245 
1246  // ********* D0 -> K- pi+ pi+ pi-
1247  if ( !evcut
1248  || (sqrts==3.77 && nk>0 && nchrg>5 && npi>2 && pmax<0.96 && sumen<1.32)
1249  || (sqrts==4.28 && nk>0 )
1250  || (sqrts==5.0 && nk>0 )
1251  || (sqrts==5.5 && nk>0 )
1252  )
1253  {
1254  // *** do combinatorics (D0 -> K pi pi pi)
1255  combine (kplus, piminus, piminus, piplus, LD03, -fD0Pdg);
1256  combine (kminus, piplus, piminus, piplus, LD03b, fD0Pdg);
1257 
1258  accepted |= eventAccepted(LD03, fD0Mass, fD0win);
1259  accepted |= eventAccepted(LD03b, fD0Mass, fD0win);
1260  }
1261 
1262 
1263  // ********* DS -> K+ K- pi+
1264  if ( !evcut
1265  || (sqrts==4.28 && nk>1 && 1 )
1266  || (sqrts==5.0 && nk>1 && 1 )
1267  || (sqrts==5.5 && nk>1 && 1 )
1268  )
1269  {
1270  // *** do combinatorics (Ds+- -> K K pi)
1271  combine (kplus, kminus, piplus, LDsp, fDsPdg);
1272  combine (kplus, kminus, piminus, LDsm, -fDsPdg);
1273 
1274  accepted |= eventAccepted(LDsp, fDsMass, fDswin);
1275  accepted |= eventAccepted(LDsm, fDsMass, fDswin);
1276  }
1277 
1278  // ********* DS -> K+ K- pi+ pi0
1279  if ( !evcut
1280  || (sqrts==4.28 && nk>1 )
1281  || (sqrts==5.0 && nk>1 )
1282  || (sqrts==5.5 && nk>1 )
1283  )
1284  {
1285  // *** do combinatorics (Ds+- -> K K pi pi0)
1286  combine (kplus, kminus, piplus, LPi0, LDsp2, fDsPdg);
1287  combine (kplus, kminus, piminus, LPi0, LDsm2, -fDsPdg);
1288 
1289  accepted |= eventAccepted(LDsp2, fDsMass, fDswin);
1290  accepted |= eventAccepted(LDsm2, fDsMass, fDswin);
1291  }
1292 
1293 
1294  // ********* LAMBDA_C -> p K- pi+
1295  if ( !evcut
1296  || (sqrts==5.0 && 1 )
1297  || (sqrts==5.5 && 1 )
1298  )
1299  {
1300  // *** do combinatorics (Lamc)
1301  combine (pplus, kminus, piplus, LLamcp, fLamcPdg);
1302  combine (pminus, kplus, piminus, LLamcm, -fLamcPdg);
1303 
1304  accepted |= eventAccepted(LLamcp, fLamcMass, fLamcwin);
1305  accepted |= eventAccepted(LLamcm, fLamcMass, fLamcwin);
1306  }
1307 
1308 
1309  // ********* NOW do counting and drawing, ONLY for events which are accepted by any selector
1310  // {"Phi(KK)","Lam(ppi)","J/psi(ll)","D+-(K2pi)","D+-(K2pipi0)","D+-(KSpipi0)","D+-(KS3pi)","D0(Kpi)","D0(Kpipi0)","D0(K3pi)","Ds(KKpi)","Ds(KKpipi0)","Lamc(pKpi)"};
1311  // 0 1 2 3 4 5 6 7 8 9 10 11 12
1312  if (!simcut || accepted)
1313  {
1314  // **** Phi
1315  if (sqrts>2.2)
1316  {
1317  ncomb1 = fillHisto(LPhi, h_phi, 0, fPhiMass, fPhiwin, h_phisel, 0, h_phisig );
1318  combCnt += ncomb1;
1319  if (ncomb1>0) {selected=true; channelselect[0]=true;}
1320  }
1321 
1322  // **** Lam
1323  if (sqrts>2.2)
1324  {
1325  ncomb1 = fillHisto(LLam, h_lam, 0, fLamMass, fLamwin, h_lamsel, 0, h_lamsig );
1326  ncomb2 = fillHisto(LLamb, h_lam, 0, fLamMass, fLamwin, h_lamsel, 0, h_lamsig );
1327  combCnt += ncomb1 + ncomb2;
1328  if (ncomb1>0 || ncomb2>0) {selected=true; channelselect[1]=true;}
1329  }
1330 
1331  // **** J/psi
1332  if (sqrts>3.1)
1333  {
1334  ncomb1 = fillHisto(LJpsiE, h_jpsi, 0, fJMass, fJwin, h_jpsisel, 0, h_jpsisig );
1335  ncomb2 = fillHisto(LJpsiMu, h_jpsi, 0, fJMass, fJwin, h_jpsisel, 0, h_jpsisig );
1336  combCnt += ncomb1 +ncomb2;
1337  if (ncomb1>0 || ncomb2>0) {selected=true; channelselect[2]=true;}
1338  }
1339 
1340  // **** Dp
1341  if (sqrts>3.75)
1342  {
1343  ncomb1 = fillHisto(LDp, h_dpm, 0, fDMass, fDwin, h_dpmsel, 0, h_dpmsig );
1344  ncomb2 = fillHisto(LDm, h_dpm, 0, fDMass, fDwin, h_dpmsel, 0, h_dpmsig );
1345  combCnt += ncomb1 +ncomb2;
1346  if (ncomb1>0 || ncomb2>0) {selected=true; channelselect[3]=true;}
1347 
1348  ncomb1 = fillHisto(LDp2, h_dpm2, 0, fDMass, fDwin, h_dpm2sel, 0, h_dpm2sig );
1349  ncomb2 = fillHisto(LDm2, h_dpm2, 0, fDMass, fDwin, h_dpm2sel, 0, h_dpm2sig );
1350  combCnt += ncomb1 +ncomb2;
1351  if (ncomb1>0 || ncomb2>0) {selected=true; channelselect[4]=true;}
1352 
1353  ncomb1 = fillHisto(LDp3, h_dpm3, 0, fDMass, fDwin, h_dpm3sel, 0, h_dpm3sig );
1354  ncomb2 = fillHisto(LDm3, h_dpm3, 0, fDMass, fDwin, h_dpm3sel, 0, h_dpm3sig );
1355  combCnt += ncomb1 +ncomb2;
1356  if (ncomb1>0 || ncomb2>0) {selected=true; channelselect[5]=true;}
1357 
1358  ncomb1 = fillHisto(LDp4, h_dpm4, 0, fDMass, fDwin, h_dpm4sel, 0, h_dpm4sig );
1359  ncomb2 = fillHisto(LDm4, h_dpm4, 0, fDMass, fDwin, h_dpm4sel, 0, h_dpm4sig );
1360  combCnt += ncomb1 +ncomb2;
1361  if (ncomb1>0 || ncomb2>0) {selected=true; channelselect[6]=true;}
1362 
1363  }
1364 
1365  // **** D0
1366  if (sqrts>3.75)
1367  {
1368  ncomb1 = fillHisto(LD0, h_d0, 0, fD0Mass, fD0win, h_d0sel, 0, h_d0sig );
1369  ncomb2 = fillHisto(LD0b, h_d0, 0, fD0Mass, fD0win, h_d0sel, 0, h_d0sig );
1370  combCnt += ncomb1 +ncomb2;
1371  if (ncomb1>0 || ncomb2>0) {selected=true; channelselect[7]=true;}
1372 
1373  ncomb1 = fillHisto(LD02, h_d02, 0, fD0Mass, fD0win, h_d02sel, 0, h_d02sig );
1374  ncomb2 = fillHisto(LD02b, h_d02, 0, fD0Mass, fD0win, h_d02sel, 0, h_d02sig );
1375  combCnt += ncomb1 +ncomb2;
1376  if (ncomb1>0 || ncomb2>0) {selected=true; channelselect[8]=true;}
1377 
1378  ncomb1 = fillHisto(LD03, h_d03, 0, fD0Mass, fD0win, h_d03sel, 0, h_d03sig );
1379  ncomb2 = fillHisto(LD03b, h_d03, 0, fD0Mass, fD0win, h_d03sel, 0, h_d03sig );
1380  combCnt += ncomb1 +ncomb2;
1381  if (ncomb1>0 || ncomb2>0) {selected=true; channelselect[9]=true;}
1382  }
1383 
1384  // **** Ds
1385  if (sqrts>4.)
1386  {
1387  ncomb1 = fillHisto(LDsp, h_ds, 0, fDsMass, fDswin, h_dssel, 0, h_dssig );
1388  ncomb2 = fillHisto(LDsm, h_ds, 0, fDsMass, fDswin, h_dssel, 0, h_dssig );
1389  combCnt += ncomb1 +ncomb2;
1390  if (ncomb1>0 || ncomb2>0) {selected=true; channelselect[10]=true;}
1391 
1392  ncomb1 = fillHisto(LDsp2, h_ds2, 0, fDsMass, fDswin, h_ds2sel, 0, h_ds2sig );
1393  ncomb2 = fillHisto(LDsm2, h_ds2, 0, fDsMass, fDswin, h_ds2sel, 0, h_ds2sig );
1394  combCnt += ncomb1 +ncomb2;
1395  if (ncomb1>0 || ncomb2>0) {selected=true; channelselect[11]=true;}
1396  }
1397 
1398  // **** Lamc
1399  if (sqrts>4.57)
1400  {
1401  ncomb1 = fillHisto(LLamcp, h_lamc, 0, fLamcMass, fLamcwin, h_lamcsel, 0, h_lamcsig );
1402  ncomb2 = fillHisto(LLamcm, h_lamc, 0, fLamcMass, fLamcwin, h_lamcsel, 0, h_lamcsig );
1403  combCnt += ncomb1 + ncomb2;
1404  if (ncomb1>0 || ncomb2>0) {selected=true; channelselect[12]=true;}
1405  }
1406  }
1407  // ****************
1408 
1409  if (selected) evCnt+=mixevts; // *** if any combination is in window count event
1410 
1411  for (j=0;j<13;++j) if (channelselect[j]) channelcount[j]+=mixevts;
1412 
1413  //hmix->Fill(mixevts);
1414  // new round of mixing
1415  mixevts=1;
1416  if (fRand.Rndm()<P_mix) mixevts=2;
1417 
1418  //if (i<3) printAllLists();
1419  }
1420  //cout <<"cntInLam "<<cntInLam<<endl;
1421  cout<< "#Combinations:"<<combCnt<<" #Events:"<<evCnt<<" ";
1422  cout <<"Efficiency (ev):"<<(double)evCnt/(double)nev<<endl;
1423  cout <<"Mult Cut Eff (ev):"<<(double)evMultCut/(double)nev<<endl;
1424 
1425  for (i=0;i<13;++i)
1426  {
1427  channelcount[i]/=nev;
1428  cout <<channelname[i]<<":"<<channelcount[i]<<endl;
1429  }
1430  cout <<endl;
1431 
1432  TLatex latex;
1433  latex.SetTextSize(0.055);
1434  char tmp[200];
1435  double offset = 0.1;
1436  // *** plot all stuff and write out info
1437  c2->cd(1); h_pi0->Draw(); h_pi0sel->Draw("same"); h_pi0sig->Draw("same");
1438  c2->cd(2); h_ks->Draw(); h_kssel->Draw("same"); h_kssig->Draw("same");
1439 
1440  c2->cd(3); h_phi->Draw(); h_phisel->Draw("same"); h_phisig->Draw("same");
1441  sprintf(tmp,"#epsilon = %4.1f%%",channelcount[0]*100.);
1442  latex.DrawLatex(2.5,h_phi->GetMaximum()*0.95+offset,tmp);
1443 
1444  c2->cd(4); h_lam->Draw(); h_lamsel->Draw("same"); h_lamsig->Draw("same");
1445  sprintf(tmp,"#epsilon = %4.1f%%",channelcount[1]*100.);
1446  latex.DrawLatex(2.5,h_lam->GetMaximum()*0.95+offset,tmp);
1447 
1448  c2->cd(5); h_jpsi->Draw(); h_jpsisel->Draw("same"); h_jpsisig->Draw("same");
1449  sprintf(tmp,"#epsilon = %4.1f%%",channelcount[2]*100.);
1450  latex.DrawLatex(2.5,h_jpsi->GetMaximum()*0.95+offset,tmp);
1451 
1452  c2->cd(6); h_dpm->Draw(); h_dpmsel->Draw("same"); h_dpmsig->Draw("same");
1453  sprintf(tmp,"#epsilon = %4.1f%%",channelcount[3]*100.);
1454  latex.DrawLatex(2.5,h_dpm->GetMaximum()*0.95+offset,tmp);
1455 
1456  c2->cd(7); h_dpm2->Draw(); h_dpm2sel->Draw("same"); h_dpm2sig->Draw("same");
1457  sprintf(tmp,"#epsilon = %4.1f%%",channelcount[4]*100.);
1458  latex.DrawLatex(2.5,h_dpm2->GetMaximum()*0.95+offset,tmp);
1459 
1460  c2->cd(8); h_dpm3->Draw(); h_dpm3sel->Draw("same"); h_dpm3sig->Draw("same");
1461  sprintf(tmp,"#epsilon = %4.1f%%",channelcount[5]*100.);
1462  latex.DrawLatex(2.5,h_dpm3->GetMaximum()*0.95+offset,tmp);
1463 
1464  c2->cd(9); h_dpm4->Draw(); h_dpm4sel->Draw("same"); h_dpm4sig->Draw("same");
1465  sprintf(tmp,"#epsilon = %4.1f%%",channelcount[6]*100.);
1466  latex.DrawLatex(2.5,h_dpm4->GetMaximum()*0.95+offset,tmp);
1467 
1468  c2->cd(10); h_d0->Draw(); h_d0sel->Draw("same"); h_d0sig->Draw("same");
1469  sprintf(tmp,"#epsilon = %4.1f%%",channelcount[7]*100.);
1470  latex.DrawLatex(2.5,h_d0->GetMaximum()*0.95+offset,tmp);
1471 
1472  c2->cd(11); h_d02->Draw(); h_d02sel->Draw("same"); h_d02sig->Draw("same");
1473  sprintf(tmp,"#epsilon = %4.1f%%",channelcount[8]*100.);
1474  latex.DrawLatex(2.5,h_d02->GetMaximum()*0.95+offset,tmp);
1475 
1476  c2->cd(12); h_d03->Draw(); h_d03sel->Draw("same"); h_d03sig->Draw("same");
1477  sprintf(tmp,"#epsilon = %4.1f%%",channelcount[9]*100.);
1478  latex.DrawLatex(2.5,h_d03->GetMaximum()*0.95+offset,tmp);
1479 
1480  c2->cd(13); h_ds->Draw(); h_dssel->Draw("same"); h_dssig->Draw("same");
1481  sprintf(tmp,"#epsilon = %4.1f%%",channelcount[10]*100.);
1482  latex.DrawLatex(2.5,h_ds->GetMaximum()*0.95+offset,tmp);
1483 
1484  c2->cd(14); h_ds2->Draw(); h_ds2sel->Draw("same"); h_ds2sig->Draw("same");
1485  sprintf(tmp,"#epsilon = %4.1f%%",channelcount[11]*100.);
1486  latex.DrawLatex(2.5,h_ds2->GetMaximum()*0.95+offset,tmp);
1487 
1488  c2->cd(15); h_lamc->Draw(); h_lamcsel->Draw("same"); h_lamcsig->Draw("same");
1489  sprintf(tmp,"#epsilon = %4.1f%%",channelcount[12]*100.);
1490  latex.DrawLatex(2.5,h_lamc->GetMaximum()*0.95+offset,tmp);
1491 
1492  //sprintf(tmp,"#epsilon = %4.1f%%",channelcount[6]*100.);
1493  //latex.DrawLatex(2.5,h_pi0->GetMaximum()*0.95,tmp);
1494 
1495  c2->cd();
1496  TPad *peff=new TPad("peff","peff",0.46,0.665,0.54,0.70);
1497  peff->Draw();
1498  peff->cd();
1499  sprintf(tmp,"#epsilon_{tot} = %4.1f%%",double(evCnt)/double(nev)*100.);
1500  latex.SetTextSize(0.7);
1501  latex.SetTextColor(2);
1502  latex.DrawLatex(0.15,0.3,tmp);
1503  c2->cd();
1504 
1505  h_mult_klep->Scale(1.0/nev);
1506 
1507 /* c3->cd(1); h_sum_klep->Draw(); //h_dpmmm->Draw();
1508  c3->cd(2); h_mult_klep->Draw("colz");//h_d0mm->Draw();
1509  c3->cd(3); h_mult_k->Draw(); // h_dpmmvsmm->Draw("colz");
1510  c3->cd(4); h_mult_lep->Draw(); // h_d0mvsmm->Draw("colz");
1511  c3->cd();
1512  */
1513 // c4->cd();
1514 // h_pmax->Draw();
1515  //h_lamc->Draw(); h_lamcsel->Draw("same"); h_lamcsig->Draw("same");
1516  //h_dpm->Draw(); h_dpmsel->Draw("same"); h_dpmsig->Draw("same");
1517 
1518  return 0;
1519 }
CandList mclist
void makeIni4Vector(TLorentzVector &l, double s)
CandList kminus
void makeRecoCands(CandList &mc, CandList &reco, double eff=0.90, double dp=0.05, double dtht=0.001, double dphi=0.001)
double fLamcMass
TLorentzVector fIni
double fJMass
CandList muplus
Int_t i
Definition: run_full.C:25
int combine(CandList &l1, CandList &l2, CandList &out, int matchPdg=0)
__m128 m
Definition: P4_F32vec4.h:28
CandList gam
CandList pplus
int nk
Definition: toy_core.C:124
int npr
Definition: toy_core.C:124
CandList eminus
double fLamwin
double fLamcwin
double fPi0win
int ev
double fPhiMass
void makePidSelection(CandList &l)
c2
Definition: plot_dirc.C:39
double fD0win
friend F32vec4 max(const F32vec4 &a, const F32vec4 &b)
Definition: P4_F32vec4.h:26
TVector3 offset(2, 0, 0)
void configHisto(TH1 *h)
double fPhiwin
std::vector< SimpleCand > CandList
Definition: SimpleCand.C:76
void boostList(CandList &list, CandList &boostlist, TVector3 boost)
CandList piminus
Double_t p
Definition: anasim.C:58
for(int j=0;j< ncounts;j++)
TString pt(TString pts, TString exts="px py pz")
Definition: invexp.C:133
CandList mcFSlist
int fD0Pdg
int fPhiPdg
CandList pminus
CandList recocmslist
CandList muminus
int fillHisto(CandList &l, TH1 *hall, TH1 *hbg=0, double m=0, double w=0, TH1 *hallsel=0, TH1 *hbgsel=0, TH1 *hsig=0, TH1 *hmm=0, TH2 *hmvsmm=0)
double fDwin
Double_t
double fDsMass
double fLamMass
const int fMAX
TFile * f
Definition: bump_analys.C:12
CandList eplus
friend F32vec4 min(const F32vec4 &a, const F32vec4 &b)
Definition: P4_F32vec4.h:25
int fPi0Pdg
TDatabasePDG * pdg_db
bool eventAccepted(CandList &l, double m=0, double w=0)
int fDPdg
CandList piplus
int nlep
Definition: toy_core.C:124
double fKswin
int fJpsiPdg
double fJwin
double high
CandList kplus
int fDsPdg
TRandom3 fRand
void init(double pideff, double misid)
TTree * t
Definition: bump_analys.C:13
int fLamPdg
double fDMass
double fKsMass
bool isFinalState(int n)
double fDswin
double fD0Mass
int fLamcPdg
double pz[39]
Definition: pipisigmas.h:14
int fKsPdg
double fPi0Mass
void selectMass(CandList &in, CandList &out, double mmean=0, double mw=0)
CandList recolist
int npi
Definition: toy_core.C:124

Variable Documentation

CandList eminus

Definition at line 124 of file softtrigger_toy12.C.

Referenced by makePidSelection(), printAllLists(), and softtrigger_toy12().

CandList eplus

Definition at line 124 of file softtrigger_toy12.C.

Referenced by makePidSelection(), printAllLists(), and softtrigger_toy12().

TF1* f_res =0

Definition at line 110 of file softtrigger_toy12.C.

Referenced by dponline(), and init().

double fD0Mass = 1.8645

Definition at line 56 of file softtrigger_toy12.C.

Referenced by softtrigger_toy12().

int fD0Pdg = 421

Definition at line 55 of file softtrigger_toy12.C.

Referenced by softtrigger_toy12().

double fD0sig = 1.04

Definition at line 57 of file softtrigger_toy12.C.

double fD0win =0.25

Definition at line 58 of file softtrigger_toy12.C.

Referenced by softtrigger_toy12().

const double fdE = 0.05

Definition at line 37 of file softtrigger_toy12.C.

Referenced by makeRecoCands().

double fDMass = 1.8693

Definition at line 51 of file softtrigger_toy12.C.

Referenced by softtrigger_toy12().

int fDPdg = 411

Definition at line 50 of file softtrigger_toy12.C.

Referenced by softtrigger_toy12().

double fDsig = 0.88

Definition at line 52 of file softtrigger_toy12.C.

double fDsMass = 1.9686

Definition at line 73 of file softtrigger_toy12.C.

Referenced by softtrigger_toy12().

int fDsPdg = 431

Definition at line 72 of file softtrigger_toy12.C.

Referenced by softtrigger_toy12().

double fDssig = 0.75

Definition at line 74 of file softtrigger_toy12.C.

double fDswin =0.2

Definition at line 75 of file softtrigger_toy12.C.

Referenced by softtrigger_toy12().

double fDwin =0.25

Definition at line 53 of file softtrigger_toy12.C.

Referenced by softtrigger_toy12().

double fEtacMass = 2.9798

Definition at line 83 of file softtrigger_toy12.C.

int fEtacPdg = 441

Definition at line 82 of file softtrigger_toy12.C.

double fEtacsig = 0.15

Definition at line 84 of file softtrigger_toy12.C.

double fEtacwin =0.15

Definition at line 85 of file softtrigger_toy12.C.

TLorentzVector fIni

Definition at line 27 of file softtrigger_toy12.C.

Referenced by fillHisto(), and softtrigger_toy12().

double fJ3pioff = 0.027

Definition at line 64 of file softtrigger_toy12.C.

double fJMass = 3.09687

Definition at line 61 of file softtrigger_toy12.C.

Referenced by softtrigger_toy12().

int fJpsiPdg = 443

Definition at line 60 of file softtrigger_toy12.C.

Referenced by softtrigger_toy12().

double fJsig = 2.24

Definition at line 62 of file softtrigger_toy12.C.

double fJsig3pi = 1.5

Definition at line 63 of file softtrigger_toy12.C.

double fJwin =0.7

Definition at line 65 of file softtrigger_toy12.C.

Referenced by softtrigger_toy12().

double fKsMass = 0.497614

Definition at line 47 of file softtrigger_toy12.C.

Referenced by softtrigger_toy12().

int fKsPdg = 310

Definition at line 46 of file softtrigger_toy12.C.

Referenced by softtrigger_toy12().

double fKswin = 0.025

Definition at line 48 of file softtrigger_toy12.C.

Referenced by softtrigger_toy12().

double fLamcMass = 2.2849

Definition at line 88 of file softtrigger_toy12.C.

Referenced by softtrigger_toy12().

int fLamcPdg = 4122

Definition at line 87 of file softtrigger_toy12.C.

Referenced by softtrigger_toy12().

double fLamcsig = 0.15

Definition at line 89 of file softtrigger_toy12.C.

double fLamcwin =0.2

Definition at line 90 of file softtrigger_toy12.C.

Referenced by softtrigger_toy12().

double fLamMass = 1.115684

Definition at line 68 of file softtrigger_toy12.C.

Referenced by softtrigger_toy12().

int fLamPdg = 3122

Definition at line 67 of file softtrigger_toy12.C.

Referenced by softtrigger_toy12().

double fLamsig = 0.08

Definition at line 69 of file softtrigger_toy12.C.

double fLamwin =0.1

Definition at line 70 of file softtrigger_toy12.C.

Referenced by softtrigger_toy12().

const int fMAX = 100

Definition at line 30 of file softtrigger_toy12.C.

Referenced by softtrigger_toy12().

const double fNdphi = 0.003

Definition at line 39 of file softtrigger_toy12.C.

Referenced by makeRecoCands().

const double fNdtht = 0.003

Definition at line 38 of file softtrigger_toy12.C.

Referenced by makeRecoCands().

const double fNeutEff = 1.0

Definition at line 36 of file softtrigger_toy12.C.

Referenced by makeRecoCands().

double fPhiMass = 1.0195

Definition at line 78 of file softtrigger_toy12.C.

Referenced by softtrigger_toy12().

int fPhiPdg = 333

Definition at line 77 of file softtrigger_toy12.C.

Referenced by softtrigger_toy12().

double fPhisig = 0.15

Definition at line 79 of file softtrigger_toy12.C.

double fPhiwin =0.2

Definition at line 80 of file softtrigger_toy12.C.

Referenced by softtrigger_toy12().

double fPi0Mass = 0.13497

Definition at line 43 of file softtrigger_toy12.C.

Referenced by softtrigger_toy12().

int fPi0Pdg = 111

Definition at line 42 of file softtrigger_toy12.C.

Referenced by softtrigger_toy12().

double fPi0win = 0.020

Definition at line 44 of file softtrigger_toy12.C.

Referenced by softtrigger_toy12().

TRandom3 fRand

Definition at line 26 of file softtrigger_toy12.C.

Referenced by isDetected(), select(), smearMom(), and softtrigger_toy12().

CandList gam

Definition at line 124 of file softtrigger_toy12.C.

Referenced by makePidSelection(), printAllLists(), and softtrigger_toy12().

double high = 5.0

Definition at line 33 of file softtrigger_toy12.C.

Referenced by softtrigger_toy12().

CandList kminus

Definition at line 124 of file softtrigger_toy12.C.

Referenced by makePidSelection(), printAllLists(), and softtrigger_toy12().

CandList kplus

Definition at line 124 of file softtrigger_toy12.C.

Referenced by makePidSelection(), printAllLists(), and softtrigger_toy12().

double low = 0.0

Definition at line 32 of file softtrigger_toy12.C.

CandList mcFSlist

Definition at line 121 of file softtrigger_toy12.C.

Referenced by softtrigger_toy12().

CandList mclist

Definition at line 121 of file softtrigger_toy12.C.

Referenced by combine(), printAllLists(), and softtrigger_toy12().

double mE

Definition at line 108 of file softtrigger_toy12.C.

Referenced by init(), and makePidSelection().

double mK

Definition at line 108 of file softtrigger_toy12.C.

Referenced by init(), and makePidSelection().

double mMu

Definition at line 108 of file softtrigger_toy12.C.

Referenced by init(), and makePidSelection().

double mP

Definition at line 108 of file softtrigger_toy12.C.

Referenced by init(), makeIni4Vector(), and makePidSelection().

double mPi

Definition at line 108 of file softtrigger_toy12.C.

Referenced by init(), and makePidSelection().

double mPi0

Definition at line 108 of file softtrigger_toy12.C.

Referenced by init().

CandList muminus

Definition at line 124 of file softtrigger_toy12.C.

Referenced by makePidSelection(), printAllLists(), and softtrigger_toy12().

CandList muplus

Definition at line 124 of file softtrigger_toy12.C.

Referenced by makePidSelection(), printAllLists(), and softtrigger_toy12().

int nbins = 300

Definition at line 31 of file softtrigger_toy12.C.

TDatabasePDG* pdg_db

Definition at line 116 of file softtrigger_toy12.C.

Referenced by init(), select(), and softtrigger_toy12().

std::map<int,int> pdgidx

Definition at line 114 of file softtrigger_toy12.C.

Referenced by init(), and select().

double pidreal[25]
Initial value:
= { 95, 6, 10, 7, 10,
5, 86, 27, 6, 7,
9, 29, 85, 18, 16,
9, 21, 40, 67, 24,
12, 12, 20, 16, 90 }

Definition at line 101 of file softtrigger_toy12.C.

double pidtab[25]
Initial value:
= { 80, 5, 5, 5, 5,
5, 80, 5, 5, 5,
5, 5, 80, 5, 5,
5, 5, 5, 80, 5,
5, 5, 5, 5, 80 }

Definition at line 94 of file softtrigger_toy12.C.

Referenced by makePidTable(), and select().

CandList piminus

Definition at line 124 of file softtrigger_toy12.C.

Referenced by makePidSelection(), printAllLists(), and softtrigger_toy12().

CandList piplus

Definition at line 124 of file softtrigger_toy12.C.

Referenced by makePidSelection(), printAllLists(), and softtrigger_toy12().

CandList pminus

Definition at line 124 of file softtrigger_toy12.C.

Referenced by makePidSelection(), printAllLists(), and softtrigger_toy12().

CandList pplus

Definition at line 124 of file softtrigger_toy12.C.

Referenced by makePidSelection(), printAllLists(), and softtrigger_toy12().

CandList recocmslist

Definition at line 121 of file softtrigger_toy12.C.

Referenced by softtrigger_toy12().

CandList recolist

Definition at line 121 of file softtrigger_toy12.C.

Referenced by printAllLists(), and softtrigger_toy12().