42 CombinatoricGroup::CombinatoricGroup(
const std::string& sname,
43 const std::string& stitle) :
46 m_Type = kCombinatoricGroup;
49 CombinatoricGroup::CombinatoricGroup() : Group() {}
51 CombinatoricGroup::~CombinatoricGroup() {}
53 CombinatoricGroup& CombinatoricGroup::Empty(){
54 return CombinatoricGroup::m_Empty;
59 m_NElementsForFrame.clear();
60 m_NExclusiveElementsForFrame.clear();
65 void CombinatoricGroup::AddFrame(
RestFrame& frame){
67 if(!frame.IsVisibleFrame())
return;
68 if(!frame.IsRecoFrame())
return;
71 Group::AddFrame(frame);
75 m_NElementsForFrame[&frame] = 0;
76 m_NExclusiveElementsForFrame[&frame] =
true;
79 void CombinatoricGroup::RemoveFrame(RestFrame& frame){
80 if(!ContainsFrame(frame))
82 m_NElementsForFrame.erase(&frame);
83 m_NExclusiveElementsForFrame.erase(&frame);
84 Group::RemoveFrame(frame);
87 void CombinatoricGroup::SetNElementsForFrame(
const RestFrame& frame,
88 int N,
bool exclusive_N){
89 if(!ContainsFrame(frame)){
97 m_NElementsForFrame[&frame] = std::max(0, N);
98 m_NExclusiveElementsForFrame[&frame] = exclusive_N;
101 void CombinatoricGroup::GetNElementsForFrame(
const RestFrame& frame,
int& N,
102 bool& exclusive_N)
const {
103 if(!ContainsFrame(frame))
return;
105 N = m_NElementsForFrame[&frame];
106 exclusive_N = m_NExclusiveElementsForFrame[&frame];
109 void CombinatoricGroup::AddJigsaw(Jigsaw& jigsaw){
111 if(!jigsaw.IsCombinatoricJigsaw())
return;
112 Group::AddJigsaw(jigsaw);
115 CombinatoricState& CombinatoricGroup::InitializeParentState(){
116 std::string name =
GetName()+
"_parent";
117 CombinatoricState* statePtr =
new CombinatoricState(name, name);
122 CombinatoricState& CombinatoricGroup::GetParentState()
const {
124 return static_cast<CombinatoricState&
>(*m_GroupStatePtr);
126 return CombinatoricState::Empty();
129 CombinatoricState& CombinatoricGroup::GetChildState(
int i)
const {
130 if(!Group::GetChildState(i))
131 return CombinatoricState::Empty();
133 return static_cast<CombinatoricState&
>(Group::GetChildState(i));
137 bool CombinatoricGroup::ClearEvent(){
142 bool CombinatoricGroup::AnalyzeEvent(){
144 UnSoundMind(RF_FUNCTION);
145 return SetSpirit(
false);
148 GetParentState().ClearElements();
149 GetParentState().AddElements(m_Elements);
151 return SetSpirit(
true);
154 RFKey CombinatoricGroup::AddLabFrameFourVector(
const TLorentzVector& V,
155 const RFCharge& charge){
156 if(
IsEmpty())
return RFKey(-1);
158 TLorentzVector P = V;
159 if(P.M() < 0.) P.SetVectM(V.Vect(),0.);
161 VisibleState& state = GetNewElement();
162 state.SetFourVector(P);
163 state.SetCharge(charge);
164 m_Elements.Add(state);
166 return state.GetKey();
169 RFKey CombinatoricGroup::AddLabFrameFourVector(
const TLorentzVector& V,
171 return AddLabFrameFourVector(V, RFCharge(charge));
174 RFKey CombinatoricGroup::AddLabFrameFourVector(
const TLorentzVector& V,
177 return AddLabFrameFourVector(V, RFCharge(charge_num,charge_den));
180 RestFrame
const& CombinatoricGroup::GetFrame(
const RFKey& key)
const {
181 int N = GetNChildStates();
182 for(
int i = N-1; i >= 0; i--)
183 if(GetChildState(i).ContainsElement(key))
184 return GetChildState(i).GetListFrames()[0];
185 return RestFrame::Empty();
188 TLorentzVector CombinatoricGroup::GetLabFrameFourVector(
const RFKey& key)
const {
189 TLorentzVector P(0.,0.,0.,0.);
190 int N = GetNChildStates();
191 for(
int i = N-1; i >= 0; i--)
192 if(GetChildState(i).ContainsElement(key))
193 return GetChildState(i).GetElement(key).GetFourVector();
194 return TLorentzVector(0.,0.,0.,0.);
197 int CombinatoricGroup::GetNElementsInFrame(
const RestFrame& frame)
const {
198 if(!ContainsFrame(frame))
return -1;
199 return static_cast<CombinatoricState&
>(Group::GetChildState(frame)).GetNElements();
202 VisibleState& CombinatoricGroup::GetNewElement(){
203 if(m_Elements.GetN() < m_InitStates.GetN())
204 return m_InitStates[m_Elements.GetN()];
206 sprintf(strn,
"%d",m_Elements.GetN()+1);
207 std::string name =
GetName()+
"_"+std::string(strn);
208 VisibleState* statePtr =
new VisibleState(name,name);
210 m_InitStates.Add(*statePtr);
214 CombinatoricGroup CombinatoricGroup::m_Empty;
std::string GetName() const
Returns object name.
virtual void Clear()
Clears Group of all connections to other objects.
bool IsEmpty() const
Checks whether this is default (empty) instance of class.
void AddDependent(RFBase *dep)
pointer to RFBase object owned by this one
virtual void Clear()
Clears Group of all connections to other objects.
abstract base class for all Frame objects