44 MeanTime::MeanTime(TString name, Long64_t ev_id, Double_t p_in, Double_t n_in, Int_t p_id, Int_t n_id)
92 output += Form(
"-- ID %d ------Event ",
fMeanTimeId);
94 output +=
": HitIndex[";
101 output += Form(
" MDp%+9.2f MDm%+9.2f dMD%+9.2f MDsMT %+10.2f << ---------------------------- <<",
105 output += Form(
" TSp%+9.2f TSm%+9.2f dTS%+9.2f TSsMT %+10.2f TShMT %+10.2f dTSMT %+8.2f >>",
109 printf(
"%s\n", output.Data());
118 Bool_t status =
false;
119 status = ( fabs(
fSubtractTime) < time_window ) ?
true :
false;
127 Bool_t status =
false;
188 for(Int_t i=0;i<7;i++)
215 for(Int_t i=0;i<7;i++)
237 temp =
new MeanTime(name, ev_id, p_in, n_in, p_id, n_id);
245 delete temp; temp = NULL;
258 temp =
new MeanTime(name, ev_id, p_in, n_in, p_id, n_id);
267 delete temp; temp = NULL;
287 for(Int_t i=0; i<7; i++)
304 else if (element == 2) {
322 for(Int_t i=0; i<7; i++)
325 if(p_value[i]!=0.0) {
330 if(n_value[i]!=0.0) {
335 if(hardware_meantime[i]!=0.0) {
367 Bool_t local_debug =
false;
368 Bool_t GS_Stable_marriage_debug =
false;
370 Double_t ini = 100000.0;
372 Double_t nst[7][7] = {{ini}};
373 Double_t pst[7][7] = {{ini}};
382 Int_t n_preference_list[7][7] = {{0}};
383 Int_t p_preference_list[7][7] = {{0}};
402 if(local_debug) printf(
"neg [%d,%d], nst %f \n", n,p, nst[n][p]);
407 TMath::Sort(7, nst[n], n_preference_list[n],
false);
430 if(local_debug) printf(
"pos [%d,%d], pst %f \n", p,n,pst[p][n]);
435 TMath::Sort(7, pst[p], p_preference_list[p],
false);
451 printf(
"Sort [%d,%d], index sorting %d st sorting %f\n", n,p, n_preference_list[n][p], nst[n][p]);
463 printf(
"Sort [%d,%d], index sorting %d st sorting %f\n", p,n, p_preference_list[p][n], nst[p][n]);
474 Int_t n_rank[7][7] = {{0}};
478 for (rank=0; rank<7; rank++)
480 n_rank[n][n_preference_list[n][rank]] = rank;
490 Int_t decrease_rank[7];
491 Int_t getting_engaged = 0;
498 decrease_rank[p] = 0; fiancee[p] = -1;
506 while (getting_engaged < 7)
510 for (p=0; fiancee[p]!=-1; p++)
513 if(GS_Stable_marriage_debug) printf(
">>> positive channel %d proposing:\n", p);
515 while (fiancee[p] == -1) {
521 n = p_preference_list[p][decrease_rank[p]];
523 if(GS_Stable_marriage_debug) printf(
" to negative %2d", n);
530 if (suitor[n] == -1) {
531 if(GS_Stable_marriage_debug) printf(
" accepted\t(negative %2d previously free)\n", n);
532 suitor[n] = p; fiancee[p] = n;
539 if (n_rank[n][suitor[n]] < n_rank[n][p]) {
540 if(GS_Stable_marriage_debug) printf(
" rejected\t(negative %2d prefers %d)\n", n, suitor[n]);
544 if(GS_Stable_marriage_debug) printf(
" accepted\t(negative %2d dumps positive %d)\n", n, suitor[n]);
546 fiancee[suitor[n]] = -1;
548 suitor[n] = p; fiancee[p] = n;
610 printf(
"%s fNPositive %d fNNegative %d, fNMeanTimes %d fNHarewareMeanTimes %d\n",
617 while ( (obj = next()) )
637 while ( (obj = next()) )
642 if( mt_index == index ) {
675 Double_t h_mt_pos = 0.0;
676 Double_t h_mt_neg = 0.0;
679 while ( (obj = next()) )
691 while ( (obj = next()) )
700 Int_t idx = mt_index;
706 if ( fabs(s_mt - h_mt) <50 ) {
719 while ( (obj = next()) )
725 if ( fabs(s_mt - h_mt) < 50 ) {
735 while ( (obj = next()) )
738 Int_t negative_id = mean_time -> GetNegativeHitId();
739 Int_t positive_id = mean_time -> GetPositiveHitId();
776 while ( (obj = next()) )
780 if( mt_index == index ) {
791 Bool_t status =
false;
811 for(Int_t i=0;i<7;i++)
822 while ( (obj = next()) )
Int_t GetMeanTimeId() const
TObjArray * fMeanTimeList
static const Int_t fSoftwareNegativeHitElementID
static const Int_t fSoftwareSubtractHitElementID
virtual ~MeanTimeContainer()
static const Int_t fSoftwarePositiveHitElementID
void Add(Double_t p_value, Double_t n_value, Int_t hit_id)
Double_t fDiffHardSoftMeanTime
Software Meantime container.
Double_t fHardWareMeanTime
Double_t fPositiveValue[7]
void MatchHardwareMeanTime()
one software meantim holder
MeanTime * GetMeanTimeObject(Int_t index)
Bool_t IsInTimeWindow(Double_t time_window)
Bool_t fDisableMatchHardwareMeanTime
Double_t GetMeanTime(Int_t index)
void AddPNValues(Double_t p_value, Double_t n_value, Int_t p_id, Int_t n_id)
Bool_t IsHarewareMatchSoftware()
void SetPlane(const Int_t in)
Double_t fNegativeValue[7]
Double_t GetMeanTime() const
void SetHardwareMeanTime(Double_t hardware_meantime)
Double_t fHardwareMeantimeValue[7]
Int_t fNHarewareMeanTimes
Int_t AddMeanTime(TString name, Long64_t ev_id, Double_t p_in, Double_t n_in, Int_t p_id, Int_t n_id)
void SetDisableMatchHardwareMeantime(const Bool_t disable)
static const Int_t fSoftwareMeantimeHitElementID