QwAnalysis
QwPromptSummary Class Reference

#include <QwPromptSummary.h>

Inherits TObject.

Public Member Functions

 QwPromptSummary ()
 
 QwPromptSummary (Int_t run_number, Int_t runlet_number)
 
virtual ~QwPromptSummary ()
 
void SetRunNumber (const Int_t in)
 
const Int_t GetRunNumber ()
 
void SetRunletNumber (const Int_t in)
 
const Int_t GetRunletNumber ()
 
void AddElement (PromptSummaryElement *in)
 
PromptSummaryElementGetElementByName (TString name)
 
void FillDataInElement (TString name, Double_t yield, Double_t yield_err, Double_t yield_width, TString yield_unit, Double_t asym_diff, Double_t asym_diff_err, Double_t asym_diff_width, TString asym_diff_unit)
 
void FillYieldToElement (TString name, Double_t yield, Double_t yield_error, Double_t yield_width, TString yield_unit)
 
void FillAsymDiffToElement (TString name, Double_t asym_diff, Double_t asym_diff_err, Double_t asym_diff_width, TString asym_diff_unit)
 
void FillDoubleDifference (TString type, TString name1, TString name2)
 
Int_t GetSize () const
 
Int_t Size () const
 
Int_t HowManyElements () const
 
void PrintCSV ()
 
void PrintTextSummary ()
 

Data Fields

Int_t fNElements
 
TObjArray * fElementList
 

Private Member Functions

TString PrintTextSummaryHeader ()
 
TString PrintTextSummaryTailer ()
 
TString PrintCSVHeader ()
 
void SetupElementList ()
 
 ClassDef (QwPromptSummary, 0)
 

Private Attributes

Int_t fRunNumber
 
Int_t fRunletNumber
 
Bool_t fLocalDebug
 

Detailed Description

Definition at line 121 of file QwPromptSummary.h.

Constructor & Destructor Documentation

QwPromptSummary::QwPromptSummary ( )

Definition at line 155 of file QwPromptSummary.cc.

References fElementList, fLocalDebug, fNElements, fRunletNumber, fRunNumber, and SetupElementList().

156 {
157  fRunNumber = 0;
158  fRunletNumber = 0;
159  fElementList = new TObjArray();
160 
161  fElementList -> Clear();
162  fElementList -> SetOwner(kTRUE);
163 
164  fNElements = 0;
165 
166  fLocalDebug = kTRUE;
167 
168  this->SetupElementList();
169 
170 };
TObjArray * fElementList

+ Here is the call graph for this function:

QwPromptSummary::QwPromptSummary ( Int_t  run_number,
Int_t  runlet_number 
)

Definition at line 173 of file QwPromptSummary.cc.

References fElementList, fLocalDebug, fNElements, fRunletNumber, fRunNumber, and SetupElementList().

174 {
175  fRunNumber = run_number;
176  fRunletNumber = runlet_number;
177 
178  fElementList = new TObjArray();
179 
180  fElementList -> Clear();
181  fElementList -> SetOwner(kTRUE);
182 
183  fNElements = 0;
184 
185  fLocalDebug = kFALSE;
186 
187  this->SetupElementList();
188 
189 };
TObjArray * fElementList

+ Here is the call graph for this function:

QwPromptSummary::~QwPromptSummary ( )
virtual

Definition at line 192 of file QwPromptSummary.cc.

References fElementList.

193 {
194  if(fElementList) delete fElementList; fElementList = NULL;
195 };
TObjArray * fElementList

Member Function Documentation

void QwPromptSummary::AddElement ( PromptSummaryElement in)

Definition at line 300 of file QwPromptSummary.cc.

References fElementList, fLocalDebug, and fNElements.

Referenced by SetupElementList().

301 {
302  Int_t pos = 0;
303 
304  pos = fElementList -> AddAtFree(in);
305  if(fLocalDebug) {
306  printf("AddElement at pos %d\n", pos);
307  }
308 
309  fNElements++;
310  return;
311 };
TObjArray * fElementList

+ Here is the caller graph for this function:

QwPromptSummary::ClassDef ( QwPromptSummary  ,
 
)
private
void QwPromptSummary::FillAsymDiffToElement ( TString  name,
Double_t  asym_diff,
Double_t  asym_diff_err,
Double_t  asym_diff_width,
TString  asym_diff_unit 
)

Definition at line 443 of file QwPromptSummary.cc.

References fLocalDebug, GetElementByName(), PromptSummaryElement::SetAsymmetry(), PromptSummaryElement::SetAsymmetryError(), and PromptSummaryElement::SetAsymmetryWidth().

449 {
450  PromptSummaryElement* an_element = NULL;
451  an_element = this->GetElementByName(name);
452  if(an_element) {
453  an_element->SetAsymmetry(asym_diff);
454  an_element->SetAsymmetryError(asym_diff_err);
455  an_element->SetAsymmetryWidth(asym_diff_width);
456  }
457  else {
458  if(fLocalDebug) {
459  std::cout
460  << "QwPromptSummary::FillYieldToElement : No Element with the name "
461  << name
462  << std::endl;
463  }
464  }
465 
466  return;
467 };
void SetAsymmetryWidth(const Double_t in)
void SetAsymmetryError(const Double_t in)
void SetAsymmetry(const Double_t in)
PromptSummaryElement * GetElementByName(TString name)

+ Here is the call graph for this function:

void QwPromptSummary::FillDataInElement ( TString  name,
Double_t  yield,
Double_t  yield_err,
Double_t  yield_width,
TString  yield_unit,
Double_t  asym_diff,
Double_t  asym_diff_err,
Double_t  asym_diff_width,
TString  asym_diff_unit 
)

Definition at line 387 of file QwPromptSummary.cc.

References PromptSummaryElement::FillData(), fLocalDebug, and GetElementByName().

397 {
398 
399  PromptSummaryElement* an_element = NULL;
400  an_element = this->GetElementByName(name);
401  if(an_element) {
402  an_element->FillData(yield, yield_err, yield_width, yield_unit, asym_diff, asym_diff_err, asym_diff_width, asym_diff_unit);
403  }
404  else {
405  if(fLocalDebug) {
406  std::cout
407  << "QwPromptSummary::FillDataInElement : No Element with the name "
408  << name
409  << std::endl;
410  }
411  }
412  return;
413 };
void FillData(Double_t yield, Double_t yield_err, Double_t yield_width, TString yield_unit, Double_t asym_diff, Double_t asym_diff_err, Double_t asym_diff_width, TString asym_diff_unit)
PromptSummaryElement * GetElementByName(TString name)

+ Here is the call graph for this function:

void QwPromptSummary::FillDoubleDifference ( TString  type,
TString  name1,
TString  name2 
)

Definition at line 470 of file QwPromptSummary.cc.

References fLocalDebug, and GetElementByName().

Referenced by QwBeamLine::WritePromptSummary().

471 {
472  PromptSummaryElement* an_element = NULL;
473 
474 
475  PromptSummaryElement* one_element = NULL;
476  PromptSummaryElement* two_element = NULL;
477 
478  one_element = this->GetElementByName(name1);
479  two_element = this->GetElementByName(name2);
480 
481 
482  if(one_element and two_element ) {
483 
484  an_element = this->GetElementByName(name1+"-"+name2);
485 
486  if(an_element) {
487 
488 
489  Double_t diff = 0.0;
490  Double_t error_diff = 0.0;
491  Double_t width_diff = 0.0;
492 
493  Double_t a = 0.0;
494  Double_t b = 0.0;
495  Double_t a_err = 0.0;
496  Double_t b_err = 0.0;
497  Double_t a_wit = 0.0;
498  Double_t b_wit = 0.0;
499 
500  if(type.Contains("yield")) {
501  a = one_element -> GetYield();
502  b = two_element -> GetYield();
503  a_err = one_element -> GetYieldError();
504  b_err = two_element -> GetYieldError();
505  a_wit = one_element -> GetYieldWidth();
506  b_wit = two_element -> GetYieldWidth();
507 
508  diff = a - b;
509  error_diff = TMath::Sqrt(a_err*a_err + b_err*b_err);
510  width_diff = a_wit - b_wit;
511 
512  an_element -> SetYield(diff);
513  an_element -> SetYieldError(error_diff);
514  an_element -> SetYieldWidth(width_diff);
515 
516  }
517  else if (type.Contains("asymmetry")) {
518  a = one_element -> GetAsymmetry();
519  b = two_element -> GetAsymmetry();
520  a_err = one_element -> GetAsymmetryError();
521  b_err = two_element -> GetAsymmetryError();
522  a_wit = one_element -> GetAsymmetryWidth();
523  b_wit = two_element -> GetAsymmetryWidth();
524 
525  diff = a - b;
526  error_diff = TMath::Sqrt(a_err*a_err + b_err*b_err);
527  width_diff = a_wit - b_wit;
528 
529  an_element -> SetAsymmetry(diff);
530  an_element -> SetAsymmetryError(error_diff);
531  an_element -> SetAsymmetryWidth(width_diff);
532  }
533 
534  }
535  else {
536  if(fLocalDebug) {
537  std::cout
538  << "QwPromptSummary::FillYieldToElement : No Element with the name "
539  << name1 + "-" + name2
540  << std::endl;
541  }
542  }
543 
544  }
545  else {
546  if(fLocalDebug) {
547  std::cout
548  << "QwPromptSummary::FillDoubleDifference: No Elements with the name "
549  << name1 << " and " << name2
550  << std::endl;
551  }
552  }
553 }
PromptSummaryElement * GetElementByName(TString name)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void QwPromptSummary::FillYieldToElement ( TString  name,
Double_t  yield,
Double_t  yield_error,
Double_t  yield_width,
TString  yield_unit 
)

Definition at line 417 of file QwPromptSummary.cc.

References fLocalDebug, GetElementByName(), PromptSummaryElement::SetYield(), PromptSummaryElement::SetYieldError(), and PromptSummaryElement::SetYieldWidth().

423 {
424  PromptSummaryElement* an_element = NULL;
425  an_element = this->GetElementByName(name);
426  if(an_element) {
427  an_element->SetYield(yield);
428  an_element->SetYieldError(yield_error);
429  an_element->SetYieldWidth(yield_width);
430  }
431  else {
432  if(fLocalDebug) {
433  std::cout
434  << "QwPromptSummary::FillYieldToElement : No Element with the name "
435  << name
436  << std::endl;
437  }
438  }
439  return;
440 };
void SetYieldWidth(const Double_t in)
void SetYield(const Double_t in)
PromptSummaryElement * GetElementByName(TString name)
void SetYieldError(const Double_t in)

+ Here is the call graph for this function:

PromptSummaryElement * QwPromptSummary::GetElementByName ( TString  name)

Definition at line 315 of file QwPromptSummary.cc.

References fElementList, fLocalDebug, and PromptSummaryElement::GetName().

Referenced by FillAsymDiffToElement(), FillDataInElement(), FillDoubleDifference(), and FillYieldToElement().

316 {
317 
318  PromptSummaryElement* an_element = NULL;
319  TObjArrayIter next(fElementList);
320  TObject* obj = NULL;
321  TString get_name = "";
322 
323  while ( (obj = next()) )
324  {
325  an_element = (PromptSummaryElement*) obj;
326  get_name = an_element->GetName();
327  if( get_name.Contains(name) ) {
328  if(fLocalDebug) {
329  std::cout << "System " << an_element->GetName()
330  << " QwPromptSummary::GetElementByName address at" << an_element << std::endl;
331  }
332  return an_element;
333  }
334  }
335 
336  return NULL;
337 };
TObjArray * fElementList

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

const Int_t QwPromptSummary::GetRunletNumber ( )
inline

Definition at line 138 of file QwPromptSummary.h.

References fRunletNumber.

138 {return fRunletNumber;};
const Int_t QwPromptSummary::GetRunNumber ( )
inline

Definition at line 135 of file QwPromptSummary.h.

References fRunNumber.

135 {return fRunNumber;};
Int_t QwPromptSummary::GetSize ( ) const
inline

Definition at line 156 of file QwPromptSummary.h.

References fNElements.

156 {return fNElements;};
Int_t QwPromptSummary::HowManyElements ( ) const
inline

Definition at line 158 of file QwPromptSummary.h.

References fNElements.

158 {return fNElements;};
void QwPromptSummary::PrintCSV ( )

Definition at line 557 of file QwPromptSummary.cc.

References fElementList.

558 {
559  printf("-----------------------\n");
560  TObjArrayIter next(fElementList);
561  TObject* obj = NULL;
562  while ( (obj = next()) )
563  {
564  PromptSummaryElement* an_element = (PromptSummaryElement*) obj;
565  std::cout << an_element -> GetCSVSummary() << std::endl;
566  }
567  printf("-----------------------\n");
568  return;
569 };
TObjArray * fElementList
TString QwPromptSummary::PrintCSVHeader ( )
private

Definition at line 368 of file QwPromptSummary.cc.

References fRunletNumber, and fRunNumber.

369 {
370  TString out = "";
371  TString filename = "";
372 
373  filename = Form("summary_%d_%d.txt", fRunNumber, fRunletNumber);
374 
375  out = "! This csv file is desinged for making plots easily.\n";
376  out += "!See ";
377  out += filename;
378  out += " in http://qweak.jlab.org/textsummaries/ for theirs units\n";
379  out += "!Please contact Jeong Han Lee via jhlee@jlab.org if one has comments or questions.\n";
380 
381  return out;
382 };
void QwPromptSummary::PrintTextSummary ( )

Definition at line 572 of file QwPromptSummary.cc.

References fElementList.

573 {
574  printf("-----------------------\n");
575  TObjArrayIter next(fElementList);
576  TObject* obj = NULL;
577  while ( (obj = next()) )
578  {
579  PromptSummaryElement* an_element = (PromptSummaryElement*) obj;
580  std::cout << an_element -> GetTextSummary() << std::endl;
581  }
582  printf("-----------------------\n");
583  return;
584 };
TObjArray * fElementList
TString QwPromptSummary::PrintTextSummaryHeader ( )
private

Definition at line 340 of file QwPromptSummary.cc.

References fRunletNumber, and fRunNumber.

341 {
342  TString out = "";
343  // TString filename = "";
344 
345  // filename = Form("summary_%d_%d.txt", fRunNumber, fRunletNumber);
346 
347  out = "======= BEGIN ======= \n";
348  out += Form(" RUN = %5d RUNLET %2d \n\n\n\n\n\n", fRunNumber, fRunletNumber);
349  return out;
350 };
TString QwPromptSummary::PrintTextSummaryTailer ( )
private

Definition at line 355 of file QwPromptSummary.cc.

356 {
357  TString out = "";
358 
359  out = " ======== END of SUMMARY======== \n";
360  out += " ======== END ======== \n\n";
361  out += " Please contact Rakitha Beminiwattha for any queries and suggestions \n";
362  out += " rakithab@jlab.org \n";
363  return out;
364 };
void QwPromptSummary::SetRunletNumber ( const Int_t  in)
inline

Definition at line 137 of file QwPromptSummary.h.

References fRunletNumber, and Qw::in.

137 {fRunletNumber = in;};
static const double in
Definition: QwUnits.h:66
void QwPromptSummary::SetRunNumber ( const Int_t  in)
inline

Definition at line 134 of file QwPromptSummary.h.

References fRunNumber, and Qw::in.

134 {fRunNumber = in;};
static const double in
Definition: QwUnits.h:66
void QwPromptSummary::SetupElementList ( )
private

Definition at line 200 of file QwPromptSummary.cc.

References AddElement().

Referenced by QwPromptSummary().

201 {
202  this->AddElement(new PromptSummaryElement("charge"));
203  this->AddElement(new PromptSummaryElement("target_x"));
204  this->AddElement(new PromptSummaryElement("target_y"));
205  this->AddElement(new PromptSummaryElement("angle_x"));
206  this->AddElement(new PromptSummaryElement("angle_y"));
207  this->AddElement(new PromptSummaryElement("energy"));
208 
209  this->AddElement(new PromptSummaryElement("bcm1"));
210  this->AddElement(new PromptSummaryElement("bcm2"));
211  this->AddElement(new PromptSummaryElement("bcm5"));
212  this->AddElement(new PromptSummaryElement("bcm6"));
213  this->AddElement(new PromptSummaryElement("bcm7"));
214  this->AddElement(new PromptSummaryElement("bcm8"));
215  this->AddElement(new PromptSummaryElement("bpm3h04_effectivecharge"));
216  this->AddElement(new PromptSummaryElement("bpm3h09_effectivecharge"));
217  this->AddElement(new PromptSummaryElement("3c12x"));
218  this->AddElement(new PromptSummaryElement("3c12y"));
219  this->AddElement(new PromptSummaryElement("3h04x"));
220  this->AddElement(new PromptSummaryElement("3h04y"));
221  this->AddElement(new PromptSummaryElement("3h07cx"));
222  this->AddElement(new PromptSummaryElement("3h07cy"));
223  this->AddElement(new PromptSummaryElement("3h09x"));
224  this->AddElement(new PromptSummaryElement("3h09y"));
225  this->AddElement(new PromptSummaryElement("3h09bx"));
226  this->AddElement(new PromptSummaryElement("3h09by"));
227 
228  this->AddElement(new PromptSummaryElement("bcm1-bcm2"));
229  this->AddElement(new PromptSummaryElement("bcm1-bcm5"));
230  this->AddElement(new PromptSummaryElement("bcm1-bcm6"));
231  this->AddElement(new PromptSummaryElement("bcm2-bcm5"));
232  this->AddElement(new PromptSummaryElement("bcm2-bcm6"));
233  this->AddElement(new PromptSummaryElement("bcm5-bcm6"));
234 
235  this->AddElement(new PromptSummaryElement("bcm1-bcm7"));
236  this->AddElement(new PromptSummaryElement("bcm1-bcm8"));
237 
238  // this->AddElement(new PromptSummaryElement("bcm2-bcm7"));
239  // this->AddElement(new PromptSummaryElement("bcm2-bcm8"));
240 
241  // this->AddElement(new PromptSummaryElement("bcm5-bcm7"));
242  // this->AddElement(new PromptSummaryElement("bcm5-bcm8"));
243  // this->AddElement(new PromptSummaryElement("bcm6-bcm7"));
244  // this->AddElement(new PromptSummaryElement("bcm6-bcm8"));
245 
246  this->AddElement(new PromptSummaryElement("bcm5-bcm7"));
247  this->AddElement(new PromptSummaryElement("bcm7-bcm8"));
248 
249 
250 
251 
252  this->AddElement(new PromptSummaryElement("MD1"));
253  this->AddElement(new PromptSummaryElement("MD2"));
254  this->AddElement(new PromptSummaryElement("MD3"));
255  this->AddElement(new PromptSummaryElement("MD4"));
256  this->AddElement(new PromptSummaryElement("MD5"));
257  this->AddElement(new PromptSummaryElement("MD6"));
258  this->AddElement(new PromptSummaryElement("MD7"));
259  this->AddElement(new PromptSummaryElement("MD8"));
260 
261  this->AddElement(new PromptSummaryElement("MD1-MD5"));
262  this->AddElement(new PromptSummaryElement("MD2-MD6"));
263  this->AddElement(new PromptSummaryElement("MD3-MD7"));
264  this->AddElement(new PromptSummaryElement("MD4-MD8"));
265 
266  this->AddElement(new PromptSummaryElement("MD_AllBars"));
267  this->AddElement(new PromptSummaryElement("MD_EvenBars"));
268  this->AddElement(new PromptSummaryElement("MD_OddBars"));
269 
270  this->AddElement(new PromptSummaryElement("MD_Even-Odd"));
271  this->AddElement(new PromptSummaryElement("MD1/5-MD3/7"));
272  this->AddElement(new PromptSummaryElement("MD2/6-MD4/8"));
273 
274  this->AddElement(new PromptSummaryElement("dslumi1"));
275  this->AddElement(new PromptSummaryElement("dslumi2"));
276  this->AddElement(new PromptSummaryElement("dslumi3"));
277  this->AddElement(new PromptSummaryElement("dslumi4"));
278  this->AddElement(new PromptSummaryElement("dslumi5"));
279  this->AddElement(new PromptSummaryElement("dslumi6"));
280  this->AddElement(new PromptSummaryElement("dslumi7"));
281  this->AddElement(new PromptSummaryElement("dslumi8"));
282 
283  this->AddElement(new PromptSummaryElement("dslumi_even"));
284  this->AddElement(new PromptSummaryElement("dslumi_odd"));
285  this->AddElement(new PromptSummaryElement("dslumi_sum"));
286 
287  this->AddElement(new PromptSummaryElement("uslumi1"));
288  this->AddElement(new PromptSummaryElement("uslumi3"));
289  this->AddElement(new PromptSummaryElement("uslumi5"));
290  this->AddElement(new PromptSummaryElement("uslumi7"));
291 
292  this->AddElement(new PromptSummaryElement("uslumi_sum"));
293 
294 
295 
296 };
void AddElement(PromptSummaryElement *in)

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Int_t QwPromptSummary::Size ( ) const
inline

Definition at line 157 of file QwPromptSummary.h.

References fNElements.

157 {return fNElements;};

Field Documentation

TObjArray* QwPromptSummary::fElementList
Bool_t QwPromptSummary::fLocalDebug
private
Int_t QwPromptSummary::fNElements

Definition at line 131 of file QwPromptSummary.h.

Referenced by AddElement(), GetSize(), HowManyElements(), QwPromptSummary(), and Size().

Int_t QwPromptSummary::fRunletNumber
private
Int_t QwPromptSummary::fRunNumber
private

The documentation for this class was generated from the following files: