// ************************************************************************ // // Online SoftTrigger TriggerLine class // // K.Goetzen 08/2014 // // ************************************************************************ // The header file #include "PndSoftTriggerLine.h" // C++ headers #include // ROOT headers #include "TDatabasePDG.h" #include "TParticlePDG.h" #include "TObjArray.h" #include "TObjString.h" // RHO headers #include "RhoMassParticleSelector.h" #include "RhoTuple.h" using std::cout; using std::endl; // ------------------------------------------------------------------------- // Default constructor // ------------------------------------------------------------------------- PndSoftTriggerLine::PndSoftTriggerLine() : fMode(-1), fName(""), fDecay(""), fPrefix(""), fNTupleName(""), fWriteQA(false), fActive(true), fCC(false), fAux(false), fQAMassMin(0.), fQAMassMax(20.), fMean(0.), fSigma(0.01), fThresh(0.), fTagNSig(5.), fQASelector(0), fSelector(0), fNTuple(0) { fPdg = TDatabasePDG::Instance(); } // ------------------------------------------------------------------------- // constructor // ------------------------------------------------------------------------- PndSoftTriggerLine::PndSoftTriggerLine(int mode, TString name, TString dec, TString pre, TString ntpname) : fMode(mode), fName(name), fDecay(dec), fPrefix(pre), fNTupleName(ntpname), fWriteQA(false), fActive(true), fCC(false), fAux(false), fQAMassMin(0.), fQAMassMax(20.), fMean(0.), fSigma(0.01), fThresh(0.), fTagNSig(5.), fQASelector(0), fSelector(0), fNTuple(0) { fPdg = TDatabasePDG::Instance(); } // ------------------------------------------------------------------------- // Destructor // ------------------------------------------------------------------------- PndSoftTriggerLine::~PndSoftTriggerLine() { if (fQASelector) delete fQASelector; if (fSelector) delete fSelector; } // ------------------------------------------------------------------------- // creates the Ntuple; user is responsible to call this function // ------------------------------------------------------------------------- void PndSoftTriggerLine::Init() { // initialize RhoTuple according to flag if (fWriteQA && fNTuple==0) fNTuple = new RhoTuple(fNTupleName, fDecay); // parse the decay pattern string and transform to fPdgList ParseDecayString(); // create the selectors SetQASelector((fQAMassMax+fQAMassMin)/2., (fQAMassMax-fQAMassMin)); SetSelector(fMean, fSigma*2.*fTagNSig); } // ------------------------------------------------------------------------- // convert the decay pattern string to a list of pdg codes (fPdgList) // E.g.: "D0 -> K- pi+" gets converted to 421 -321 211 // Example with auxiliary resonance: "D*0 -> D0 [K- pi+] pi0" converts to 432 421 -99 -321 211 -98 111 // ------------------------------------------------------------------------- bool PndSoftTriggerLine::ParseDecayString() { if (fDecay=="") return false; fPdgList.clear(); TString toks[20]; int n=SplitString(fDecay," ",toks,20); if (toks[1]!="->" || n<4) { cout <<"[PndSoftTriggerLine] **** Invalid decay pattern '"<") continue; // ignore the arrow if (toks[i] == "pbp0") {fPdgList.push_back(88880); continue;} // treat shortcut for pbarpSystem0 if (toks[i] == "pbp") {fPdgList.push_back(88888); continue;} // treat shortcut for pbarpSystem if (toks[i] == "[") {fPdgList.push_back(-99);fAux=true; continue;} // auxiliary resonance list starts if (toks[i] == "]") {fPdgList.push_back(-98); continue;} // auxiliary resonance list ends if (toks[i].BeginsWith("[")) {toks[i]=toks[i](1,1000); fAux=true; fPdgList.push_back(-99);} // auxiliary resonance list starts if (toks[i].EndsWith("]")) {toks[i]=toks[i](0,toks[i].Length()-1); flag = true;} // auxiliary resonance list ends TParticlePDG *part = fPdg->GetParticle(toks[i]); if (part) fPdgList.push_back(part->PdgCode()); else { cout <<"[PndSoftTriggerLine] **** Unknown particle name '"<GetEntries(); for (int i=0;iAt(i))->String()).Strip(TString::kBoth); return N; } // ------------------------------------------------------------------------- // prints summary of this trigger line // ------------------------------------------------------------------------- void PndSoftTriggerLine::Print() { cout << "PndSoftTriggerLine: " << fName.Data() << " ("<0 ) { cout << " ( " << fPdgList[0]<<" -> "; for (int i=1;i