00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027 #include "StHbtMaker/Infrastructure/StHbtCheckPdgIdList.h"
00028
00029
00030
00031
00032
00033 #ifdef __ROOT__
00034 ClassImp(StHbtCheckPdgIdList)
00035 #endif
00036
00037
00038 inline double min(double a, double b) { return (a<b) ? a : b; }
00039 inline double max(double a, double b) { return (a<b) ? b : a; }
00040
00041
00042 StHbtCheckPdgIdList::StHbtCheckPdgIdList(){
00043 mAcceptedParticles = new pdgIdList;
00044 mAcceptedMothers = new pdgIdList;
00045 mAcceptedDaughters = new pdgIdList;
00046 }
00047
00048 StHbtCheckPdgIdList::~StHbtCheckPdgIdList(){
00049 delete mAcceptedParticles;
00050 delete mAcceptedMothers;
00051 delete mAcceptedDaughters;
00052 }
00053
00054 StHbtString StHbtCheckPdgIdList::Report(){
00055 StHbtString temp = "\n This is the StHbtCheckPdgIdList\n"; temp += "---> EventCuts in Reader: ";
00056 char Ctemp[10];
00057 temp += "\n Accepted Particles (pdgId): ";
00058 pdgIdListIterator iter;
00059 for (iter=mAcceptedParticles->begin(); iter!=mAcceptedParticles->end(); iter++) {
00060 sprintf(Ctemp," %i",*iter);
00061 temp += Ctemp;
00062 }
00063 temp += "\n Accepted Mothers (pdgId): ";
00064 for (iter=mAcceptedMothers->begin(); iter!=mAcceptedMothers->end(); iter++) {
00065 sprintf(Ctemp," %i",*iter);
00066 temp += Ctemp;
00067 }
00068 temp += "\n Accepted Daughters (pdgId): ";
00069 for (iter=mAcceptedDaughters->begin(); iter!=mAcceptedDaughters->end(); iter++) {
00070 sprintf(Ctemp," %i",*iter);
00071 temp += Ctemp;
00072 }
00073 temp += "\n";
00074 return temp;
00075 }
00076
00077 void StHbtCheckPdgIdList::AddAcceptedParticle( int pdgCode ){
00078 mAcceptedParticles->push_back( pdgCode );
00079 }
00080
00081 void StHbtCheckPdgIdList::AddAcceptedMother( int pdgCode ){
00082 mAcceptedMothers->push_back( pdgCode );
00083 }
00084
00085 void StHbtCheckPdgIdList::AddAcceptedDaughter( int pdgCode ){
00086 mAcceptedDaughters->push_back( pdgCode );
00087 }
00088
00089 int StHbtCheckPdgIdList::CheckPdgIdLists(){
00090 return mAcceptedParticles->size()+mAcceptedMothers->size()+mAcceptedDaughters->size();
00091 }
00092
00093 int StHbtCheckPdgIdList::CheckPdgIdList( pdgIdList* list){
00094 if (list->size()==0) return 1;
00095 return 0;
00096 }
00097
00098 int StHbtCheckPdgIdList::CheckPdgIdList( pdgIdList* list, int pdgCode ){
00099 if (list->size()==0) return 1;
00100 for (pdgIdListIterator iter=list->begin(); iter!=list->end(); iter++)
00101 if ( (*iter)==pdgCode) return 1;
00102 return 0;
00103 }
00104
00105 int StHbtCheckPdgIdList::CheckPdgIdList( int pdgCode, int motherPdgCode, int daughterPdgCode ){
00106 return CheckPdgIdList(mAcceptedParticles,pdgCode)
00107 * CheckPdgIdList(mAcceptedMothers,motherPdgCode)
00108 * CheckPdgIdList(mAcceptedDaughters,daughterPdgCode);
00109 }