311 |
file->cd(); |
file->cd(); |
312 |
TString name = Form("fqplmeann%i",bin); |
TString name = Form("fqplmeann%i",bin); |
313 |
file->WriteObject(&(*qpl),name.Data()); |
file->WriteObject(&(*qpl),name.Data()); |
314 |
|
file->Purge(); |
315 |
|
} |
316 |
|
|
317 |
|
void CaloFranzini::WriteFullNMean(TMatrixD *qpl, Int_t bin){ |
318 |
|
file->cd(); |
319 |
|
TString name = Form("fnqplmeann%i",bin); |
320 |
|
file->WriteObject(&(*qpl),name.Data()); |
321 |
|
file->Purge(); |
322 |
} |
} |
323 |
|
|
324 |
void CaloFranzini::WriteInvertedLongMatrix(TMatrixD mat, Int_t bin){ |
void CaloFranzini::WriteInvertedLongMatrix(TMatrixD mat, Int_t bin){ |
347 |
TString name = Form("origfmatrixn%i",bin); |
TString name = Form("origfmatrixn%i",bin); |
348 |
// mat.Write(name.Data()); |
// mat.Write(name.Data()); |
349 |
file->WriteObject(&(*mat),name.Data()); |
file->WriteObject(&(*mat),name.Data()); |
350 |
|
file->Purge(); |
351 |
|
} |
352 |
|
|
353 |
|
void CaloFranzini::WriteFullNMatrix(TMatrixF *mat, Int_t bin){ |
354 |
|
file->cd(); |
355 |
|
TString name = Form("origfnmatrixn%i",bin); |
356 |
|
// mat.Write(name.Data()); |
357 |
|
file->WriteObject(&(*mat),name.Data()); |
358 |
|
file->Purge(); |
359 |
} |
} |
360 |
|
|
361 |
void CaloFranzini::CloseMatrixFile(){ |
void CaloFranzini::CloseMatrixFile(){ |
512 |
// |
// |
513 |
} |
} |
514 |
|
|
515 |
|
TMatrixD *CaloFranzini::LoadFullAverage(Int_t rigbin){ |
516 |
|
// |
517 |
|
TString name = Form("fqplmeann%i",rigbin); |
518 |
|
TMatrixD *fmean=(TMatrixD*)file->Get(name.Data()); |
519 |
|
// |
520 |
|
return(fmean); |
521 |
|
// |
522 |
|
} |
523 |
|
|
524 |
|
TMatrixF *CaloFranzini::LoadFullMatrix(Int_t rigbin){ |
525 |
|
// |
526 |
|
TString name = Form("origfmatrixn%i",rigbin); |
527 |
|
TMatrixF *fmatri=(TMatrixF*)file->Get(name.Data()); |
528 |
|
// |
529 |
|
return(fmatri); |
530 |
|
// |
531 |
|
} |
532 |
|
|
533 |
|
void CaloFranzini::LoadFullMatrix(Int_t rigbin, TMatrixF *&fmatri){ |
534 |
|
// |
535 |
|
TString name = Form("origfmatrixn%i",rigbin); |
536 |
|
fmatri=(TMatrixF*)file->Get(name.Data()); |
537 |
|
// |
538 |
|
} |
539 |
|
|
540 |
|
void CaloFranzini::UnLoadFullAverage(Int_t rigbin){ |
541 |
|
// |
542 |
|
TString name = Form("fqplmeann%i",rigbin); |
543 |
|
file->Delete(name.Data()); |
544 |
|
// |
545 |
|
} |
546 |
|
|
547 |
|
void CaloFranzini::UnLoadFullMatrix(Int_t rigbin){ |
548 |
|
// |
549 |
|
TString name = Form("origfmatrixn%i",rigbin); |
550 |
|
file->Delete(name.Data()); |
551 |
|
// |
552 |
|
} |
553 |
|
|
554 |
|
TMatrixF *CaloFranzini::LoadFullNMatrix(Int_t rigbin){ |
555 |
|
// |
556 |
|
TString name = Form("origfnmatrixn%i",rigbin); |
557 |
|
TMatrixF *fnmatri=(TMatrixF*)file->Get(name.Data()); |
558 |
|
// |
559 |
|
return(fnmatri); |
560 |
|
// |
561 |
|
} |
562 |
|
|
563 |
|
void CaloFranzini::UnLoadFullNMatrix(Int_t rigbin){ |
564 |
|
// |
565 |
|
TString name = Form("origfnmatrixn%i",rigbin); |
566 |
|
file->Delete(name.Data()); |
567 |
|
// |
568 |
|
} |
569 |
|
|
570 |
|
TMatrixD *CaloFranzini::LoadFullNAverage(Int_t rigbin){ |
571 |
|
// |
572 |
|
TString name = Form("fnqplmeann%i",rigbin); |
573 |
|
TMatrixD *fnmean=(TMatrixD*)file->Get(name.Data()); |
574 |
|
// |
575 |
|
return(fnmean); |
576 |
|
// |
577 |
|
} |
578 |
|
|
579 |
|
void CaloFranzini::UnLoadFullNAverage(Int_t rigbin){ |
580 |
|
// |
581 |
|
TString name = Form("fnqplmeann%i",rigbin); |
582 |
|
file->Delete(name.Data()); |
583 |
|
// |
584 |
|
} |
585 |
|
|
586 |
|
|
587 |
TArrayF *CaloFranzini::LoadLongAverage(Float_t rig){ |
TArrayF *CaloFranzini::LoadLongAverage(Float_t rig){ |
588 |
// |
// |
646 |
Float_t b = log(maxene/minene)/(maxrig-minrig); |
Float_t b = log(maxene/minene)/(maxrig-minrig); |
647 |
Float_t a = minene/exp(minrig*b); |
Float_t a = minene/exp(minrig*b); |
648 |
Float_t ave = a*exp(b*rig); |
Float_t ave = a*exp(b*rig); |
649 |
|
if ( a == 0. || minene == 0. || ave != ave ){ |
650 |
|
// if ( a == 0. || minene == 0. ){ |
651 |
|
Float_t m = (maxene-minene)/(maxrig-minrig); |
652 |
|
Float_t q = minene - m * minrig; |
653 |
|
ave = rig * m + q; |
654 |
|
}; |
655 |
// |
// |
656 |
return(ave); |
return(ave); |
657 |
// |
// |
658 |
} |
} |
659 |
|
|
660 |
Float_t CaloFranzini::GetFullAverageAt(Int_t plane, Int_t strip, Float_t rig){ |
Float_t CaloFranzini::GetFullAverageAt(Int_t plane, Int_t strip, Float_t rig){ |
661 |
// |
// |
662 |
Int_t therigb = 0; |
Int_t therigb = 0; |
667 |
}; |
}; |
668 |
}; |
}; |
669 |
// |
// |
|
Float_t minrig; |
|
|
Float_t maxrig; |
|
|
// |
|
670 |
// |
// |
671 |
if ( rig < brigm->At(0) ){ |
if ( rig < brigm->At(0) ){ |
672 |
if ( rig < brig->At(0) ){ |
if ( rig < brig->At(0) ){ |
681 |
therigb = nbin - 3; |
therigb = nbin - 3; |
682 |
}; |
}; |
683 |
// |
// |
684 |
|
return(this->GetFullAverageAt(plane,strip,rig,therigb)); |
685 |
|
// |
686 |
|
} |
687 |
|
|
688 |
|
Float_t CaloFranzini::GetFullAverageAt(Int_t plane, Int_t strip, Float_t rig, Int_t therigb){ |
689 |
|
// |
690 |
|
Float_t minrig; |
691 |
|
Float_t maxrig; |
692 |
|
// |
693 |
minrig = brigm->At(therigb); |
minrig = brigm->At(therigb); |
694 |
maxrig = brigm->At(therigb+1); |
maxrig = brigm->At(therigb+1); |
695 |
// |
// |
703 |
Float_t b = log(maxene/minene)/(maxrig-minrig); |
Float_t b = log(maxene/minene)/(maxrig-minrig); |
704 |
Float_t a = minene/exp(minrig*b); |
Float_t a = minene/exp(minrig*b); |
705 |
Float_t ave = a*exp(b*rig); |
Float_t ave = a*exp(b*rig); |
706 |
|
if ( a == 0. || minene == 0. || ave != ave ){ |
707 |
|
Float_t m = (maxene-minene)/(maxrig-minrig); |
708 |
|
Float_t q = minene - m * minrig; |
709 |
|
ave = rig * m + q; |
710 |
|
}; |
711 |
|
// |
712 |
|
// ave += (44.-plane)*strip; |
713 |
|
//if ( a == 0. ) ave = 0.; |
714 |
|
if ( !(ave == ave) ) printf("a %f b %f ave %f maxene %f minene %f maxrig %f minrig %f \n",a,b,ave,maxene,minene,maxrig,minrig); |
715 |
// |
// |
716 |
return(ave); |
return(ave); |
717 |
// |
// |
783 |
}; |
}; |
784 |
}; |
}; |
785 |
// |
// |
|
Float_t minrig; |
|
|
Float_t maxrig; |
|
|
// |
|
786 |
if ( rig < brigm->At(0) ){ |
if ( rig < brigm->At(0) ){ |
787 |
if ( rig < brig->At(0) ){ |
if ( rig < brig->At(0) ){ |
788 |
// printf(" WARNING: Event with rigidity lower than the first qplmean bin (rig = %f, lower limit = %f)\n",rig,brigm->At(0)); |
// printf(" WARNING: Event with rigidity lower than the first qplmean bin (rig = %f, lower limit = %f)\n",rig,brigm->At(0)); |
799 |
}; |
}; |
800 |
// |
// |
801 |
if ( therigb < 2 ) therigb = 2; |
if ( therigb < 2 ) therigb = 2; |
802 |
|
// |
803 |
|
return(this->GetFullHmatrixAt(iindex,jindex,rig,therigb)); |
804 |
|
// |
805 |
|
} |
806 |
|
|
807 |
|
Float_t CaloFranzini::GetFullHmatrixAt(Int_t iindex, Int_t jindex, Float_t rig, Int_t therigb){ |
808 |
|
// |
809 |
|
Float_t minrig; |
810 |
|
Float_t maxrig; |
811 |
|
// |
812 |
minrig = brigm->At(therigb); |
minrig = brigm->At(therigb); |
813 |
maxrig = brigm->At(therigb+1); |
maxrig = brigm->At(therigb+1); |
814 |
// printf(" therigb %i minrig %f maxrig %f rig %f %i i %i j \n",therigb,minrig,maxrig,rig,iindex,jindex); |
// printf(" therigb %i minrig %f maxrig %f rig %f %i i %i j \n",therigb,minrig,maxrig,rig,iindex,jindex); |