StRoot  1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
StHbtCheckPdgIdList.cxx
1 /***************************************************************************
2  *
3  * $Id: StHbtCheckPdgIdList.cxx,v 1.3 2001/06/23 21:55:17 laue Exp $
4  *
5  * Author: Frank Laue, Ohio State, laue@mps.ohio-state.edu
6  ***************************************************************************
7  *
8  * Description: part of STAR HBT Framework: StHbtMaker package
9  *
10  * $Log: StHbtCheckPdgIdList.cxx,v $
11  * Revision 1.3 2001/06/23 21:55:17 laue
12  * StHbtCheckPdgIdList can take can not check for mother,particle,daughter
13  * Some output turned off
14  *
15  * Revision 1.2 2000/07/16 21:38:22 laue
16  * StHbtCoulomb.cxx StHbtSectoredAnalysis.cxx : updated for standalone version
17  * StHbtV0.cc StHbtV0.hh : some cast to prevent compiling warnings
18  * StHbtParticle.cc StHbtParticle.hh : pointers mTrack,mV0 initialized to 0
19  * StHbtIOBinary.cc : some printouts in #ifdef STHBTDEBUG
20  * StHbtEvent.cc : B-Field set to 0.25Tesla, we have to think about a better
21  * solution
22  *
23  * Revision 1.1 2000/05/25 21:23:03 laue
24  * Adding to CVS. Tool to select particle Ids from event generator input.
25  *
26  **************************************************************************/
27 #include "StHbtMaker/Infrastructure/StHbtCheckPdgIdList.h"
28 
29 //#if !(ST_NO_NAMESPACES)
30 // using namespace units;
31 //#endif
32 
33 #ifdef __ROOT__
34  ClassImp(StHbtCheckPdgIdList)
35 #endif
36 
37 
38 inline double min(double a, double b) { return (a<b) ? a : b; }
39 inline double max(double a, double b) { return (a<b) ? b : a; }
40 
41 //__________________
42 StHbtCheckPdgIdList::StHbtCheckPdgIdList(){
43  mAcceptedParticles = new pdgIdList;
44  mAcceptedMothers = new pdgIdList;
45  mAcceptedDaughters = new pdgIdList;
46 }
47 //__________________
48 StHbtCheckPdgIdList::~StHbtCheckPdgIdList(){
49  delete mAcceptedParticles;
50  delete mAcceptedMothers;
51  delete mAcceptedDaughters;
52 }
53 //__________________
54 StHbtString StHbtCheckPdgIdList::Report(){
55  StHbtString temp = "\n This is the StHbtCheckPdgIdList\n"; temp += "---> EventCuts in Reader: ";
56  char Ctemp[10];
57  temp += "\n Accepted Particles (pdgId): ";
58  pdgIdListIterator iter;
59  for (iter=mAcceptedParticles->begin(); iter!=mAcceptedParticles->end(); iter++) {
60  sprintf(Ctemp," %i",*iter);
61  temp += Ctemp;
62  }
63  temp += "\n Accepted Mothers (pdgId): ";
64  for (iter=mAcceptedMothers->begin(); iter!=mAcceptedMothers->end(); iter++) {
65  sprintf(Ctemp," %i",*iter);
66  temp += Ctemp;
67  }
68  temp += "\n Accepted Daughters (pdgId): ";
69  for (iter=mAcceptedDaughters->begin(); iter!=mAcceptedDaughters->end(); iter++) {
70  sprintf(Ctemp," %i",*iter);
71  temp += Ctemp;
72  }
73  temp += "\n";
74  return temp;
75 }
76 //__________________
77 void StHbtCheckPdgIdList::AddAcceptedParticle( int pdgCode ){
78  mAcceptedParticles->push_back( pdgCode );
79  }
80 //__________________
81 void StHbtCheckPdgIdList::AddAcceptedMother( int pdgCode ){
82  mAcceptedMothers->push_back( pdgCode );
83 }
84 //__________________
85 void StHbtCheckPdgIdList::AddAcceptedDaughter( int pdgCode ){
86  mAcceptedDaughters->push_back( pdgCode );
87 }
88 //__________________
89 int StHbtCheckPdgIdList::CheckPdgIdLists(){
90  return mAcceptedParticles->size()+mAcceptedMothers->size()+mAcceptedDaughters->size();
91 }
92 //__________________
93 int StHbtCheckPdgIdList::CheckPdgIdList( pdgIdList* list){
94  if (list->size()==0) return 1; // if there are no specified particles at all, accept everything
95  return 0; // there is a list of particles, to you have to check them
96 }
97 //__________________
98 int StHbtCheckPdgIdList::CheckPdgIdList( pdgIdList* list, int pdgCode ){
99  if (list->size()==0) return 1; // if there are no specified particles at all, accept everything
100  for (pdgIdListIterator iter=list->begin(); iter!=list->end(); iter++)
101  if ( (*iter)==pdgCode) return 1; // particle accepted
102  return 0; // pdgCode refused
103 }
104 //__________________
105 int StHbtCheckPdgIdList::CheckPdgIdList( int pdgCode, int motherPdgCode, int daughterPdgCode ){
106  return CheckPdgIdList(mAcceptedParticles,pdgCode)
107  * CheckPdgIdList(mAcceptedMothers,motherPdgCode)
108  * CheckPdgIdList(mAcceptedDaughters,daughterPdgCode);
109 }