______ now same code as in the function Execute_ConstantBTDensity ___________________
703{
704
705
706
707
708
709
710
711
712
713
714
716
717 for (int i=0; i<80; ++i) cout << "-";
718 cout << endl;
719 cout << "-";
720 cout << endl;
721 cout << "EdbShowPVRQuality::Execute_ConstantBTDensity " << endl;
722 cout << "-";
723 cout << endl;
724 for (int i=0; i<80; ++i) cout << "-";
725 cout << endl;
726 cout << "---------- Works for tracks passing the volume to extract their mean chi2/W " << endl;
727 cout << "---------- If eAli->Tracks is there we take them from there." << endl;
728 cout << "---------- If not, we try if there is a file linked_tracks.root " << endl;
729 cout << "---------- we take tracks from there. " << endl;
730 cout << "---------- If that doesnt work either, nothing is done." << endl;
731 for (int i=0; i<80; ++i) cout << "-";
732 cout << endl;
733 cout << "-";
734 cout << endl;
735
736 cout <<
"EdbShowPVRQuality::Execute_ConstantQuality() eAli_orig.eTracks :" <<
eAli_orig->
eTracks << endl;
737
738 Float_t meanChi2=0.5;
739 Float_t rmsChi2=0.2;
740 Float_t meanW=22;
741 Float_t rmsW=4;
742 Float_t agreementChi2=100;
743
744
746 cout << "EdbShowPVRQuality::Execute_ConstantQuality() No eAli.Tracks. Look for tracks in linked_track.root" << endl;
747 TFile* trackfile = new TFile("linked_tracks.root");
748 trackfile->ls();
749 TTree*
tracks = (TTree*)trackfile->Get(
"tracks");
751 cout << "EdbShowPVRQuality::Execute_ConstantQuality() No tracks in linked_track.root file. Return, leave eAli_orig unchanged and dont do any cleaning. You might try Execute_ConstantBTDensity instead. " << endl;
752 return;
753 }
754
755
756 tracks->Draw(
"nseg>>h(60,0,60)",
"",
"");
757 TH1F *
h1 = (TH1F*)gPad->GetPrimitive(
"h");
758
759
760 int lastfilledbin=0;
761 for (
int k=1; k<
h1->GetNbinsX()-1; k++) {
762 if (
h1->GetBinContent(k)>0) lastfilledbin=k;
763 }
764
765 Float_t travellenghtpercentage=Float_t(lastfilledbin)/Float_t(
eAli_maxNpatterns);
766
767 TString cutstring = TString(Form(
"nseg>=%d",
int(
h1->GetBinCenter(lastfilledbin-3)) ));
768 tracks->Draw(
"s.eChi2>>hChi2(100,0,2)",cutstring);
769 TH1F *hChi2 = (TH1F*)gPad->GetPrimitive("hChi2");
770
771 cout << "EdbShowPVRQuality::Execute_ConstantQuality() Found tracks in the file! Good. Info:" << endl;
772 cout << "EdbShowPVRQuality::Execute_ConstantQuality() The long tracks in the file have an average percentage length of:" << travellenghtpercentage << endl;
773 cout << "EdbShowPVRQuality::Execute_ConstantQuality() Mean(RMS) of Chi2 distribution of passing tracks: " << hChi2->GetMean() << "+-" << hChi2->GetRMS() << endl;
774
777 tracks->Draw(
"s.eW>>hW(50,0,50)",cutstring);
778 TH1F *hW = (TH1F*)gPad->GetPrimitive("hW");
779 cout << "EdbShowPVRQuality::Execute_ConstantQuality() Mean(RMS) of W distribution of passing tracks: " << hW->GetMean() << "+-" << hW->GetRMS() << endl;
780
781 meanChi2=hChi2->GetMean();
782 rmsChi2=hChi2->GetRMS();
783 meanW=hW->GetMean();
784 rmsW=hW->GetRMS();
785
786
787 if (TMath::Abs(meanChi2-0.5)>1 || TMath::Abs(meanW-22)>6) {
788 cout << "WARNING EdbShowPVRQuality::Execute_ConstantQuality() The tracks might have a strange distribution. You are urgently requested to check these manually!!!"<<endl;
789 }
790 else {
791 cout << "EdbShowPVRQuality::Execute_ConstantQuality() The tracks have reasonable values."<<endl;
792 }
793
794
795
796
797
802 }
803
805
806
808 cout <<
"EdbShowPVRQuality::Execute_ConstantQuality eAli_orig->Npatterns()= " <<
eAli_maxNpatterns << endl;
809 if (
eAli_maxNpatterns>57) cout <<
" This tells us not yet if we do have one/two brick reconstruction done. A possibility could also be that the dataset was read with microtracks. Further investigation is needed! (On todo list)." << endl;
811 cout <<
"ERROR! EdbShowPVRQuality::Execute_ConstantQuality eAli_orig->Npatterns()= " <<
eAli_maxNpatterns <<
" is greater than possible basetrack data two bricks. This class does (not yet) work with this large number of patterns. Set maximum patterns to 114!!!." << endl;
813 }
814
815 TH1F* histPatternBTDensity = new TH1F("histPatternBTDensity","histPatternBTDensity",100,0,200);
816 TH1F* histagreementChi2 = new TH1F("histagreementChi2","histagreementChi2",100,0,5);
817
818
819 cout << "Execute_ConstantQuality Loop over the patterns..." << endl;
821 if (i>56) {
822 cout << "ERROR EdbShowPVRQuality::Execute_ConstantQuality() Your EdbPVRec object has more than 57 patterns! " << endl;
823 cout << "ERROR EdbShowPVRQuality::Execute_ConstantQuality() Check it! " << endl;
824 }
825
826 if (
gEDBDEBUGLEVEL>2) cout <<
"Execute_ConstantQuality Doing Pattern " << i << endl;
827
828
829
830 for (int l=0; l<30; l++) {
831
832 if (
gEDBDEBUGLEVEL>2) cout <<
"Execute_ConstantQuality Doing condition loop = " << l << endl;
833
836 histPatternBTDensity->Reset();
837
841
842 if (
gEDBDEBUGLEVEL>2) cout <<
"Execute_ConstantQuality Loop over segments of pattern " << i <<
",Number of segments= " <<
npat << endl;
843 for (
int j=0; j<
npat; j++) {
845
846 if (
gEDBDEBUGLEVEL>4) cout <<
"Execute_ConstantQuality Doing segment= " << j << endl;
847
848
849
850
851
852
853
854
855 Bool_t result=kTRUE;
856 if (seg->
MCEvt()>0) {
858 result = kTRUE;
859
860 }
861 else {
862 result = kFALSE;
863 }
864 }
865
866 if (
gEDBDEBUGLEVEL>4) cout <<
"Doing segment " << j <<
" result for bool query is: " << result << endl;
867
868
869 if ( kFALSE == result ) continue;
870
871
872
873 agreementChi2=TMath::Sqrt(0.5 *( (seg->
Chi2()-meanChi2)/rmsChi2)*((seg->
Chi2()-meanChi2)/rmsChi2) + ((seg->
W()-meanW)/rmsW)*((seg->
W()-meanW)/rmsW) );
874 histagreementChi2->Fill(agreementChi2);
875
876
878
881 }
882
883 if (
gEDBDEBUGLEVEL>2) cout <<
"I have filled the eHistYX Histogram. Entries = " <<
eHistYX->GetEntries() << endl;
884
886 Int_t nemptybinsXY=0;
887 for (int k=1; k<nbins-1; k++) {
888 if (
eHistYX->GetBinContent(k)==0) {
889 ++nemptybinsXY;
890 continue;
891 }
892 histPatternBTDensity->Fill(
eHistYX->GetBinContent(k));
893 }
894
895
896
898
900
902
903
905 if (
gEDBDEBUGLEVEL>2) cout <<
"Execute_ConstantQuality We reached the loop end due to good BT density level ... and break loop." << endl;
906
913 break;
914 }
915 else {
916
918 }
919
920 }
921
922
923 Float_t bincontentXY=histPatternBTDensity->GetMean();
924 cout << "Execute_ConstantQuality histPatternBTDensity->GetMean()." << histPatternBTDensity->GetMean() << endl;
926
927 }
928 cout << "Execute_ConstantQuality Loop over the patterns...done." << endl;
929
930
933 cout << "----------void EdbShowPVRQuality::Execute_ConstantBTDensity() Check if modified or original PVRec object should be returned: " << endl;
934 cout <<
"----------void EdbShowPVRQuality::Execute_ConstantBTDensity() " <<
eNeedModified << endl;
935 }
936
938
939
940
948 histPatternBTDensity->DrawCopy("");
955
960
965
966 histPatternBTDensity->Reset();
969 delete histPatternBTDensity;
970
971
972 cout << "----------void EdbShowPVRQuality::Execute_ConstantQuality() Cuts are done and saved to obtain desired BT density. " << endl;
973 cout << "----------void EdbShowPVRQuality::Execute_ConstantQuality() If you want to apply the cuts now, run the CreateEdbPVRec() function now. " << endl;
974
975 cout << "----------void EdbShowPVRQuality::Execute_ConstantQuality()....done." << endl;
976 return;
977}
TObjArray * eTracks
Definition: EdbPVRec.h:161
Float_t eCutDistChi2[114]
Definition: EdbShowPVRQuality.h:76
Float_t eCutDistW[114]
Definition: EdbShowPVRQuality.h:77
TTree * tracks
Definition: check_tr.C:19
TH1F * h1
Definition: energy.C:16