FEDRA emulsion software from the OPERA Collaboration
EdbPVRQuality Class Reference

#include <EdbPVRQuality.h>

Inheritance diagram for EdbPVRQuality:
Collaboration diagram for EdbPVRQuality:

Public Member Functions

void CheckEdbPVRec ()
 
void CheckEdbPVRecThetaSpace (Int_t AliType)
 
Int_t CheckFilledXYSize (TH2F *HistXY)
 
Bool_t CheckSegmentQualityInPattern_ConstBTDens (EdbPVRec *ali, Int_t PatternAtNr, EdbSegP *seg)
 
Bool_t CheckSegmentQualityInPattern_ConstQual (EdbPVRec *ali, Int_t PatternAtNr, EdbSegP *seg)
 
Bool_t Chi2WRelation (EdbSegP *seg, Float_t Cutp0, Float_t Cutp1, Int_t qualitycuttype)
 HERE ANOTHER FUNCTION ??? WHICH ONE ??? More...
 
 ClassDef (EdbPVRQuality, 1)
 
EdbPVRecCreateEdbPVRec ()
 
void CreateEdbPVRec_TT_Algorithms ()
 
EdbPVRecCreatePVRWithExcludedSegmentList (EdbPVRec *aliSource, TObjArray *SegmentArray)
 
void Cut ()
 
void Cut_ConstantBTDensity ()
 
void Cut_ConstantBTQuality ()
 
void Cut_ConstantBTX2Hat ()
 
void Cut_RandomCut ()
 
void Cut_TTBin (Int_t TTbin)
 
void DetermineCutTTReductionFactor (Int_t patNR)
 
 EdbPVRQuality ()
 
 EdbPVRQuality (EdbPVRec *ali)
 
 EdbPVRQuality (EdbPVRec *ali, Float_t BTDensityTargetLevel)
 
 EdbPVRQuality (EdbPVRec *ali, Float_t BTDensityTargetLevel, Int_t BG_CutMethod)
 
void Execute ()
 
void Execute (Int_t CutType)
 
void Execute_ConstantBTDensity ()
 
void Execute_ConstantBTDensityInAngularBins ()
 
void Execute_ConstantBTQuality ()
 
void Execute_ConstantBTQualityInAngularBins ()
 
void Execute_ConstantBTX2Hat ()
 
void Execute_ConstantBTX2HatInAngularBins ()
 
void Execute_EqualizeTanThetaSpace ()
 
void Execute_EqualizeTanThetaSpace_ConstantBTDensity ()
 
void Execute_EqualizeTanThetaSpace_ConstantBTQuality ()
 
void Execute_EqualizeTanThetaSpace_ConstantBTX2Hat ()
 
void Execute_EqualizeTanThetaSpace_RandomCut ()
 
void Execute_RandomCut ()
 
void Execute_RandomCutInAngularBins ()
 
EdbPVRecExtractDataVolume (EdbPVRec *pvr, EdbSegP *seg, Float_t tolerance[4])
 
void FillHistosPattern (EdbPVRec *aliSource, Int_t patNR=0, Bool_t DoResetHistos=kTRUE, Float_t weightXY=1)
 
void FillHistosVolume (EdbPVRec *aliSource)
 
void FillTanThetaTArrays (Int_t patNR)
 
void FindEventRelatedBTs ()
 
TObjArray * FindFakeDoubleBTs (EdbPVRec *aliSource=NULL)
 
Int_t FindFirstBinAbove (TH1 *hist, Double_t threshold, Int_t axis)
 
Int_t FindFirstBinAboveTH2 (TH2 *hist, Double_t threshold, Int_t axis)
 
void FindHighDensityBTs ()
 
Int_t FindLastBinAbove (TH1 *hist, Double_t threshold, Int_t axis)
 
Int_t FindLastBinAboveTH2 (TH2 *hist, Double_t threshold, Int_t axis)
 
void FindPassingBTs ()
 
Float_t * GetagreementChi2Cut ()
 
Float_t GetagreementChi2Cut (Int_t patNR)
 
Float_t GetagreementChi2CutMeanChi2 ()
 
Float_t GetagreementChi2CutMeanW ()
 
Float_t GetagreementChi2CutRMSChi2 ()
 
Float_t GetagreementChi2CutRMSW ()
 
Int_t GetAngularSpaceBin (EdbSegP *seg)
 
TObjArray * GetArrayAllExcludedSegments ()
 
Float_t GetBTDensity (Int_t patNR=-1)
 
Float_t GetBTDensity_modified (Int_t patNR=-1)
 
Float_t GetBTDensity_orig (Int_t patNR=-1)
 
Float_t GetBTDensityLevel ()
 
Bool_t GetBTDensityLevelCalcMethodMC ()
 
Int_t GetBTDensityLevelCalcMethodMCConfirmation ()
 
Int_t GetCutMethod ()
 
Bool_t GetCutMethodIsDone (Int_t type)
 
Float_t * GetCutp0 ()
 
Float_t GetCutp0 (Int_t patNR)
 
Float_t * GetCutp1 ()
 
Float_t GetCutp1 (Int_t patNR)
 
Float_t GetCutTTReductionFactor (Int_t binTT)
 
Float_t GetCutTTSqueezeFactor ()
 
EdbPVRecGetEdbPVRec ()
 
EdbPVRecGetEdbPVRec (Bool_t NeedModified)
 
EdbPVRecGetEdbPVRec (Int_t EdbPVRecType)
 
EdbPVRecGetEdbPVRec_modified ()
 
EdbPVRecGetEdbPVRec_orig ()
 
EdbPVRecGetEdbPVRecNew ()
 
TH1F * GetHistChi2 ()
 
TH2F * GetHistChi2W ()
 
TH1F * GetHistTT ()
 
TH1F * GetHistTTFillcheck ()
 
TH2F * GetHistTYTX ()
 
TH1F * GetHistW ()
 
TH1F * GetHistWTilde ()
 
TH2F * GetHistYX ()
 
TCanvasGetQualityPlots (Int_t CountNr=0, Int_t aliSourceType=0)
 
TPad * GetQualityPlotsSingle (Int_t CountNr=0, Int_t aliSourceType=0, Int_t Plottype=-1)
 
TObjArray * GetTracksFromLinkedTracksRootFile ()
 
void Help ()
 
void MergeExclusionLists ()
 
void MergeHighDensBTsLists ()
 
void MergeTTSegments ()
 
void Print ()
 
void PrintBTDensities ()
 
void PrintCutType ()
 
void PrintCutType0 ()
 
void PrintCutType1 ()
 
void PrintCutType2 ()
 
void PrintCutType3 ()
 
void PrintCutType4 ()
 
void PrintCutType5 ()
 
void PrintCutType6 ()
 
void PrintCutType7 ()
 
void PrintCutValues (Int_t CutType)
 
void RebinTTHistogram (Int_t nbins=5)
 
EdbPVRecRemove_DoubleBT (EdbPVRec *aliSource)
 
EdbPVRecRemove_Passing (EdbPVRec *aliSource)
 
EdbPVRecRemove_Segment (EdbSegP *seg, EdbPVRec *aliSource=NULL, Int_t Option=0)
 
EdbPVRecRemove_SegmentArray (TObjArray *segarray, EdbPVRec *aliSource=NULL, Int_t Option=0)
 
EdbPVRecRemove_Track (EdbTrackP *track, EdbPVRec *aliSource=NULL, Int_t Option=0)
 
EdbPVRecRemove_TrackArray (TObjArray *trackArray, EdbPVRec *aliSource=NULL, Int_t Option=0)
 
void SetBTDensityLevel (Float_t BTDensityLevel)
 
void SetBTDensityLevelCalcMethodMC (Bool_t BTDensityLevelCalcMethodMC)
 
void SetBTDensityLevelCalcMethodMCConfirmation (Int_t BTDensityLevelCalcMethodMCConfirmationNumber)
 
void SetCutMethod (Int_t CutMethod)
 
void SetCutMethodIsDone (Int_t CutMethod)
 
void SetCutTTReductionFactor (Int_t binTT, Float_t CutTTReductionFactor)
 
void SetCutTTSqueezeFactor (Float_t CutTTSqueezeFactor)
 
void SetEdbPVRec (EdbPVRec *Ali_orig)
 
void SetHistGeometry_MC ()
 
void SetHistGeometry_OPERA ()
 
void SetHistGeometry_OPERAandMC ()
 
void SetHistGeometry_OPERAandMCBinArea4mm2 ()
 
void SetHistGeometry_OPERAandMCBinArea625 ()
 
TObjArray * TrackArrayToSegmentArray (TObjArray *trackArray)
 
TObjArray * TrackToSegmentArray (EdbTrackP *track)
 
Bool_t X2HatCutRelation (EdbSegP *seg, Double_t CutValueX2Hat, Double_t CutValueX2Hat_Chi2Mean, Double_t CutValueX2Hat_Chi2Sigma, Double_t CutValueX2Hat_WTildeMean, Double_t CutValueX2Hat_WTildeSigma)
 
virtual ~EdbPVRQuality ()
 

Protected Member Functions

void Init ()
 
void ResetHistos ()
 
void ResetHistosSinglePattern ()
 
void Set0 ()
 

Private Attributes

Float_t eAgreementChi2CutMeanChi2
 
Float_t eAgreementChi2CutMeanW
 
Float_t eAgreementChi2CutRMSChi2
 
Float_t eAgreementChi2CutRMSW
 
Float_t eAgreementChi2WDistCut [114]
 
Int_t eAli_maxNpatterns
 
EdbPVReceAli_modified
 
EdbPVReceAli_orig
 
EdbPVReceAli_pointer
 
TObjArray * eArrayAllExcludedSegments
 
TObjArray * eArrayPatternAllExcluded [4]
 
TObjArray * eArrayPatternAllTTAccepted
 
TObjArray * eArrayPatternAllTTRejected
 
TObjArray * eArrayPatternAllTTSource
 
TObjArray * eArrayPatternTTAccepted [12]
 
TObjArray * eArrayPatternTTRejected [12]
 
TObjArray * eArrayPatternTTSource [12]
 
Int_t eBinTT
 
Float_t eBTDensityLevel
 
Float_t eBTDensityLevelAngularSpace [20]
 
Bool_t eBTDensityLevelCalcMethodMC
 
Int_t eBTDensityLevelCalcMethodMCConfirmationNumber
 
Float_t eCutDistChi2 [114]
 
Float_t eCutDistW [114]
 
Int_t eCutMethod
 
Bool_t eCutMethodIsDone [8]
 
TString eCutMethodString
 
Float_t eCutp0 [114]
 
Float_t eCutp1 [114]
 
Float_t eCutTTp0 [114][20]
 
Float_t eCutTTp1 [114][20]
 
Float_t eCutTTReductionFactor [12]
 
Float_t eCutTTSqueezeFactor
 
Float_t eGlobalTTReductionFactorC
 
TH1F * eHistBTDensityPattern
 
TH1F * eHistBTDensityVolume
 
TH1F * eHistChi2
 
Int_t eHistGeometry
 
TH1F * eHistTT
 
TH1F * eHistTTFillcheck
 
TH2F * eHistTXTY
 
TH1F * eHistW
 
TH2F * eHistWChi2
 
TH1F * eHistWTilde
 
TH2F * eHistXY
 
Bool_t eIsSource
 
Bool_t eIsTarget
 
Bool_t eNeedModified
 
Float_t ePatternBTDensity_modified [114]
 
Float_t ePatternBTDensity_orig [114]
 
TProfile * eProfileBTdens_vs_PID_generic
 
TProfile * eProfileBTdens_vs_PID_source
 
Float_t eProfileBTdens_vs_PID_source_meanX
 
Float_t eProfileBTdens_vs_PID_source_meanY
 
Float_t eProfileBTdens_vs_PID_source_rmsX
 
Float_t eProfileBTdens_vs_PID_source_rmsY
 
TProfile * eProfileBTdens_vs_PID_target
 
Float_t eProfileBTdens_vs_PID_target_meanX
 
Float_t eProfileBTdens_vs_PID_target_meanY
 
Float_t eProfileBTdens_vs_PID_target_rmsX
 
Float_t eProfileBTdens_vs_PID_target_rmsY
 
Float_t eRandomCutThreshold
 
Float_t eX2Hat
 
Float_t eX2HatCut [114]
 
Float_t eXi2Hat_m_chi2 [114]
 
Float_t eXi2Hat_m_WTilde [114]
 
Float_t eXi2Hat_s_chi2 [114]
 
Float_t eXi2Hat_s_WTilde [114]
 
Float_t eXi2HatTT_m_chi2 [114][20]
 
Float_t eXi2HatTT_m_WTilde [114][20]
 
Float_t eXi2HatTT_s_chi2 [114][20]
 
Float_t eXi2HatTT_s_WTilde [114][20]
 
Float_t maxX
 
Float_t maxY
 
Float_t minX
 
Float_t minY
 
Int_t NbinsX
 
Int_t NbinsY
 

Constructor & Destructor Documentation

◆ EdbPVRQuality() [1/4]

EdbPVRQuality::EdbPVRQuality ( )

◆ EdbPVRQuality() [2/4]

EdbPVRQuality::EdbPVRQuality ( EdbPVRec ali)

TO BE COMMENTET OUT WHEN ALL BG-Reduction-Algorithms are fully implemented:

TO BE CHECKED WHICH METHOD SHOULD BE THE DEFAULT ONE...

41 {
42  // Default Constructor with a EdbPVRec object.
43  // (the EdbPVRec object corresponds to the collection of plates scanned with the collection
44  // of basetracks (and additionally linked tracks)).
45  // This constructor automatically checks the original data for background level and
46  // creates a new EdbPVRec object that contains only segments that fulfill the quality
47  // cut in accordance with the desired (predefined) background level.
48  // If general basetrack density is lower than 20 BT/mm2 then no cleaning is done.
49 
50  Log(2,"EdbPVRQuality::EdbPVRQuality(EdbPVRec* ali)","Default Constructor with EdbPVRec object");
51  Init();
52  Set0();
53 
54  if (NULL == ali || ali->Npatterns()<1) {
55  cout << "WARNING EdbPVRQuality(EdbPVRec* ali) ali is no good EdbPVRec object! Check!" << endl;
56  return;
57  }
58 
59  // Set ali as eAli_orig
61 
62  // Check EdbPVRec object for defects:
63  CheckEdbPVRec();
64 
65 
67 // Remove_Passing(eAli_orig);
68 // Remove_DoubleBT(eAli_orig);
70 // Execute_ConstantBTDensity();
71 // Execute_ConstantBTDensityInAngularBins();
72 // Execute_ConstantBTQuality();
73  // Execute_ConstantBTQualityInAngularBins();
74 // Execute_ConstantBTX2Hat();
75  // Execute_ConstantBTX2HatInAngularBins();
76 // Execute_RandomCut();
77  // Execute_RandomCutInAngularBins();
78 
79  // Create then the modified EdbPVRec object.
80 // CreateEdbPVRec();
81  // Finally Print Status Information
82 // Print();
83 }
bool Log(int level, const char *location, const char *fmt,...)
Definition: EdbLog.cxx:75
EdbPVRec * ali
Definition: align.C:1
void CheckEdbPVRec()
Definition: EdbPVRQuality.cxx:452
void Init()
Definition: EdbPVRQuality.cxx:318
void Set0()
Definition: EdbPVRQuality.cxx:221
void SetEdbPVRec(EdbPVRec *Ali_orig)
Definition: EdbPVRQuality.h:260
Int_t Npatterns() const
Definition: EdbPattern.h:380
#define NULL
Definition: nidaqmx.h:84

◆ EdbPVRQuality() [3/4]

EdbPVRQuality::EdbPVRQuality ( EdbPVRec ali,
Float_t  BTDensityTargetLevel 
)

TO BE COMMENTET OUT WHEN ALL BG-Reduction-Algorithms are fully implemented:

TO BE CHECKED WHICH METHOD SHOULD BE THE DEFAULT ONE...

88 {
89  // Default Constructor with a EdbPVRec object and the desired basetrack density target level.
90  // Does same as constructor EdbPVRQuality::EdbPVRQuality(EdbPVRec* ali) but now with adjustable
91  // background target level.
92 
93  Log(2,"EdbPVRQuality::EdbPVRQuality(EdbPVRec* ali, Float_t BTDensityTargetLevel)","Default Constructor with EdbPVRec object and given BT density level");
94 
95  Init();
96  Set0();
97 
98  if (NULL == ali || ali->Npatterns()<1) {
99  cout << "WARNING EdbPVRQuality(EdbPVRec* ali) ali is no good EdbPVRec object! Check!" << endl;
100  return;
101  }
102 
103  // Set ali as eAli_orig
104  SetEdbPVRec(ali);
105 
106  // Set BTDensityTargetLevel
107  SetBTDensityLevel(BTDensityTargetLevel);
108  cout << "EdbPVRQuality::EdbPVRQuality(EdbPVRec* ali) Set BTDensityTargetLevel to (1/mm^2)= " << GetBTDensityLevel() << endl;
109 
110  // Check EdbPVRec object for defects:
111  CheckEdbPVRec();
112 
113 
115 // Remove_Passing(eAli_orig);
116 // Remove_DoubleBT(eAli_orig);
118 // Execute_ConstantBTDensity();
119 // CreateEdbPVRec();
120 // Print();
121 }
void SetBTDensityLevel(Float_t BTDensityLevel)
Definition: EdbPVRQuality.h:196
Float_t GetBTDensityLevel()
Definition: EdbPVRQuality.h:320

◆ EdbPVRQuality() [4/4]

EdbPVRQuality::EdbPVRQuality ( EdbPVRec ali,
Float_t  BTDensityTargetLevel,
Int_t  BG_CutMethod 
)

TO BE COMMENTET OUT WHEN ALL BG-Reduction-Algorithms are fully implemented:

TO BE CHECKED WHICH METHOD SHOULD BE THE DEFAULT ONE...

127 {
128  // Default Constructor with a EdbPVRec object and the desired basetrack density target level,
129  // and already fixed BG_CutMethod.
130  // Does same as constructor EdbPVRQuality::EdbPVRQuality(EdbPVRec* ali) but now with adjustable
131  // background target level and direct setting of the background reduction algorithm.
132 
133  Log(2,"EdbPVRQuality::EdbPVRQuality(EdbPVRec* ali, Float_t BTDensityTargetLevel)","Default Constructor with EdbPVRec object and given BT density level");
134  Init();
135  Set0();
136 
137  if (NULL == ali || ali->Npatterns()<1) {
138  cout << "WARNING EdbPVRQuality(EdbPVRec* ali) ali is no good EdbPVRec object! Check!" << endl;
139  return;
140  }
141 
142  // Set ali as eAli_orig
143  SetEdbPVRec(ali);
144 
145  // Set BTDensityTargetLevel
146  SetBTDensityLevel(BTDensityTargetLevel);
147  cout << "EdbPVRQuality::EdbPVRQuality(EdbPVRec* ali) Set BTDensityTargetLevel to (1/mm^2)= " << GetBTDensityLevel() << endl;
148 
149  // Set BG reduction cut method
150  SetCutMethod(BG_CutMethod);
151  cout << "EdbPVRQuality::EdbPVRQuality(EdbPVRec* ali) Set CutMethod to = " << GetCutMethod() << endl;
152 
153  // Check EdbPVRec object for defects:
154  CheckEdbPVRec();
155 
157 // Remove_Passing(eAli_orig);
158 // Remove_DoubleBT(eAli_orig);
160 // Execute_ConstantBTDensity();
161 // CreateEdbPVRec();
162 // Print();
163 }
Int_t GetCutMethod()
Definition: EdbPVRQuality.h:313
void SetCutMethod(Int_t CutMethod)
Definition: EdbPVRQuality.cxx:383

◆ ~EdbPVRQuality()

EdbPVRQuality::~EdbPVRQuality ( )
virtual
168 {
169  // Default Destructor
170  Log(2,"EdbPVRQuality::~EdbPVRQuality()","Default Destructor");
171 
172  delete eHistWChi2;
173  delete eHistXY;
174  delete eHistTXTY;
175  delete eHistTT;
176  delete eHistTTFillcheck;
177  delete eHistBTDensityPattern;
178  delete eHistBTDensityVolume;
180 }
TH1F * eHistTTFillcheck
Definition: EdbPVRQuality.h:78
TH2F * eHistTXTY
Definition: EdbPVRQuality.h:72
TH2F * eHistXY
Definition: EdbPVRQuality.h:71
TProfile * eProfileBTdens_vs_PID_source
Definition: EdbPVRQuality.h:86
TH1F * eHistBTDensityVolume
Definition: EdbPVRQuality.h:80
TH2F * eHistWChi2
Definition: EdbPVRQuality.h:70
TH1F * eHistTT
Definition: EdbPVRQuality.h:73
TH1F * eHistBTDensityPattern
Definition: EdbPVRQuality.h:79

Member Function Documentation

◆ CheckEdbPVRec()

void EdbPVRQuality::CheckEdbPVRec ( )
453 {
454  // Main function to check if the EdbPVRec object of the scanned data is of low/high background.
455  // Following steps are carried out:
456  // * Get plate, count number of basetracks in the unit area (1x1mm^2).
457  // * Fill (draw if desired (like in EDA display)) histogram with the entries of the unit area.
458  // * Get mean of the histogram, compare this value with the reference value.
459  // The histogram covers all the area of one emulsion. (for the record: the old ORFEO MC
460  // simulation gives not the same position as data does. The area of the histogramm was largely
461  // increased to cover both cases).
462  // It gives a good estimation of the density. Spikes in some plates, or in some zones are not
463  // checked for, this is on the todo list, but maybe not so important.
464 
465  Log(2,"EdbPVRQuality::CheckEdbPVRec","CheckEdbPVRec");
466 
467  if (!eIsSource) {
468  cout << "WARNING EdbPVRQuality::CheckEdbPVRec eIsSource = " << eIsSource << ". This means no source set. Return!" << endl;
469  return;
470  }
471 
472  // Fill the histos. From the filled histos, the bg-densities are then calculated.
474 
475  // No assignment for the eProfileBTdens_vs_PID_target histogram yet.
476  // This will be done in one of the two Execute_/Cut_ functions.
477 
478  // TO BE DONE HERE ...
479 
480  cout << "EdbPVRQuality::CheckEdbPVRec TO BE DONE HERE: REPORT IF BACKGROUND IS TO HIGH, AND WHAT IS THE CLASS DOING THEN! " << endl;
481  cout << "EdbPVRQuality::CheckEdbPVRec INFORMATION ON THE SOURCE VOLUME. Average basetrack density is " << eProfileBTdens_vs_PID_source_meanY << " which means ..." << endl;
482 
483  // TO BE DONE HERE ...
484 
485  Log(2,"EdbPVRQuality::CheckEdbPVRec","CheckEdbPVRec...done");
486  return;
487 }
Float_t eProfileBTdens_vs_PID_source_meanY
Definition: EdbPVRQuality.h:87
Bool_t eIsSource
Definition: EdbPVRQuality.h:48
EdbPVRec * eAli_orig
Definition: EdbPVRQuality.h:43
void FillHistosVolume(EdbPVRec *aliSource)
Definition: EdbPVRQuality.cxx:4555

◆ CheckEdbPVRecThetaSpace()

void EdbPVRQuality::CheckEdbPVRecThetaSpace ( Int_t  AliType)

Decision if, cut out strong different TTheta values, because for shower reco there is only the TTheta space around the InBT of interest.

TODO SHOULDNT BE HERE THE CLONE eHistXYClone histogram be

IN THERE (eHistXY is not resetted plate by plate ...).

725 {
726  //------------------------------------------------------------------------------
727  // ATTENTION: This function might be deprecated in the future!
728  //------------------------------------------------------------------------------
729 
730  // Alternative Implementation.
731  // Following a suggestion to Akitaka Ariga when doing reco of a specified shower:
732  // ------------------------------------------------------------------------------
733  // Main function to check if the EdbPVRec object of the scanned data is of low/high background.
734  // But w.r.t. the TanTheta Space of scanned tracks.
735  //
736  // AliType
737  // ------------------------------------------------------------------------------
738 
739  // Following steps are carried out:
740  // Get plate, count number of basetracks in the unit area (1x1cm^2).
741  // Fill (draw if desired (like in EDA display)) histogram with the entries of the unit area.
742  // Get mean of the histogram, compare this value with the reference value.
743  // The histogram covers all the area of one emulsion. (for the record: the old ORFEO MC
744  // simulation gives not the same position as data does. The area of the histogramm was largely
745  // increased to cover both cases).
746  // It gives a good estimation of the density. Spikes in some plates, or in some zones are not
747  // checked for, this is on the todo list, but maybe not so important.
748 
749  Log(2,"EdbPVRQuality::CheckEdbPVRecThetaSpace","CheckEdbPVRecThetaSpace");
750 
751  EdbPVRec* AliSource=NULL;
752  cout << "EdbPVRQuality::CheckEdbPVRecThetaSpace AliType = " << AliType << endl;
753  if (AliType==1) {
754  AliSource=eAli_orig;
755  }
756  else {
757  AliSource = eAli_modified;
758  if (NULL == eAli_modified) {
759  AliSource=eAli_orig;
760  cout << "EdbPVRQuality::CheckEdbPVRecThetaSpace NULL == eAli_modified. This means that source will be set to eAli_orig." << endl;
761  }
762  }
763 
764  if (!eIsSource) {
765  cout << "EdbPVRQuality::CheckEdbPVRecThetaSpace eIsSource= " << eIsSource << ". This means no source set. Return!" << endl;
766  return;
767  }
768  // Check the patterns of the EdbPVRec:
770 
771  cout << "EdbPVRQuality::CheckEdbPVRecThetaSpace eAli_orig->Npatterns()= " << eAli_maxNpatterns << endl;
772 
773  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;
774  if (eAli_maxNpatterns>114) {
775  cout << "ERROR! EdbPVRQuality::CheckEdbPVRecThetaSpace 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;
776  eAli_maxNpatterns=114;
777  }
778 
779  int Npat = eAli_maxNpatterns;
780  TH1F* histPatternBTDensity = new TH1F("histPatternBTDensity","histPatternBTDensity",200,0,200);
781  TH1F* histPatternBTDensityTanTheta = new TH1F("histPatternBTDensityTanTheta","histPatternBTDensityTanTheta",40,0,1);
782 
783  TH2F* histPatternBTDensityTanThetaVsPID = new TH2F("histPatternBTDensityTanThetaVsPID","histPatternBTDensityTanThetaVsPID",57,0.5,57.5,40,0,1);
784 
785  TH1F* QualityValue_Chi2 = new TH1F("QualityValue_Chi2","QualityValue_Chi2",100,0,10);
786  TH1F* QualityValue_W = new TH1F("QualityValue_W","QualityValue_W",100,0,100);
787  TH1F* QualityValue_Total = new TH1F("QualityValue_Total","QualityValue_Total",100,0,3);
788 
789  TProfile* eProfileBTdens_vs_TanTheta = new TProfile("eProfileBTdens_vs_TanTheta","eProfileBTdens_vs_TanTheta",40,0,1,0,200);
790 
791  // Loop over the patterns of the EdbPVRec:
792  for (Int_t i=0; i<Npat; i++) {
793 
794  if (i>56) {
795  cout << "WARNING EdbPVRQuality::CheckEdbPVRecThetaSpace() Your EdbPVRec object has more than 57 patterns! " << endl;
796  cout << "WARNING EdbPVRQuality::CheckEdbPVRecThetaSpace() Check it! " << endl;
797  }
798  if (gEDBDEBUGLEVEL>2) cout << "EdbPVRQuality::CheckEdbPVRecThetaSpace Doing Pattern " << i << endl;
799 
800 
801  eHistXY->Reset(); // important to clean the histogram
802  eHistWChi2->Reset(); // important to clean the histogram
803  histPatternBTDensityTanTheta->Reset(); // important to clean the histogram
804 
805 
806  EdbPattern* pat = (EdbPattern*)AliSource->GetPattern(i);
807  Int_t npat=pat->N();
808 
809  EdbSegP* seg=0;
810  // Loop over the segments of the pattern
811  for (Int_t j=0; j<npat; j++) {
812  seg=pat->GetSegment(j);
813  // Very important:
814  // For the data case, we assume the following:
815  // Data (MCEvt<0) will be taken for BTdensity calculation
816  // Sim (MCEvt>0) will NOT be taken for BTdensity calculation
817  // We take it ONLY and ONLY into account if it is especially wished
818  // by the user!
819  // Therefore (s)he needs to know how many Gauge Coupling Parameters
820  // in the Standard Model exist (at least)...
821  Bool_t result=kTRUE;
822  if (seg->MCEvt()>0) {
824  result = kTRUE;
825  }
826  else {
827  result = kFALSE;
828  }
829  }
830 
831  if (gEDBDEBUGLEVEL>4) cout << "EdbPVRQuality::CheckEdbPVRecThetaSpace Doing segment " << j << " result for bool query is: " << result << endl;
832 
833  // Main decision for segment to be kept or not (seg is of MC or data type).
834  if ( kFALSE == result ) continue;
835 
836 
840  Float_t sx=0.3;
841  Float_t sy=0.3;
842 
843  // For the check, fill the histograms in any case:
844  eHistXY->Fill(seg->X(),seg->Y());
845  eHistWChi2->Fill(seg->W(),seg->Chi2());
846 
847  // New: Fill also histPatternBTDensityTanTheta
848  histPatternBTDensityTanTheta->Fill(seg->Theta());
849 
850  histPatternBTDensityTanThetaVsPID->Fill(i,seg->Theta());
851 
852  eProfileBTdens_vs_TanTheta->Fill(seg->Theta(),1);
853 
854  QualityValue_Chi2->Fill(seg->Chi2());
855  QualityValue_W->Fill(seg->W());
856 
857  // To check: Where do these hardcoded values come from?
858  Double_t xxx = TMath::Sqrt((seg->Chi2()-0.8)*(seg->Chi2()-0.8)/0.2/0.2+(seg->W()-17.)*(seg->W()-17.)/2./2.);
859  QualityValue_Total->Fill(xxx);
860 
861  }
862 
863  if (gEDBDEBUGLEVEL>2) cout << "EdbPVRQuality::CheckEdbPVRecThetaSpace I have filled the eHistXY Histogram. Entries = " << eHistXY->GetEntries() << endl;
864 
865  // Important to reset histogram before it is filled.
866  histPatternBTDensity->Reset();
867 
868  // Search for empty bins, because they can spoil the overall calulation
869  // of the mean value.
870  Int_t nbins=eHistXY->GetNbinsX()*eHistXY->GetNbinsY();
871  Int_t nemptybinsXY=0;
872  Int_t bincontentXY=0;
873  for (int k=1; k<nbins-1; k++) {
874  if (eHistXY->GetBinContent(k)==0) {
875  ++nemptybinsXY;
876  continue;
877  }
878  bincontentXY=eHistXY->GetBinContent(k);
879  histPatternBTDensity->Fill(bincontentXY);
880  eProfileBTdens_vs_PID_source->Fill(i,bincontentXY);
881  }
882 
883 
884  cout << "EdbPVRQuality::CheckEdbPVRecThetaSpace histPatternBTDensity->GetMean() = " << histPatternBTDensity->GetMean() << endl;
885 
886  // failsafe warning in case that there are many bins with zero content.
887  // for now we print a error message: TODO REBIN THE YX HISTOGRA WITH 2.5x2.5 mm!!!!
891 
892 
893  // Save the density in the variable.
894  ePatternBTDensity_orig[i]=histPatternBTDensity->GetMean();
895 
896  }
897 
902 
903 
904  // No assignment for the eProfileBTdens_vs_PID_target histogram yet.
905  // This will be done in one of the two Execute_ functions.
906 
907 
908  // This will be commented when using in batch mode...
909  // For now its there for clarity reasons.
910  // ...
911  TFile* file = new TFile(TString(Form("Histograms_CheckEdbPVRecThetaSpace_aliType_%d.root",AliType)),"RECREATE");
912  // Write the Histograms into root file:
913  eHistXY->Write();
914  eHistWChi2->Write();
915  eHistWChi2->Write();
916  histPatternBTDensity->Write();
918  histPatternBTDensityTanTheta->Write();
919  QualityValue_Chi2->Write();
920  QualityValue_Total->Write();
921  histPatternBTDensityTanThetaVsPID->Write();
922  file->Close();
923 
924  TCanvas* c1 = new TCanvas();
925  c1->Divide(2,2);
926  c1->cd(1);
927  eHistXY->DrawCopy("colz");
928  c1->cd(2);
929  eHistWChi2->DrawCopy("colz");
930  c1->cd(3);
931  histPatternBTDensity->DrawCopy("");
932  c1->cd(4);
933  eProfileBTdens_vs_PID_source->Draw("profileZ");
934  eProfileBTdens_vs_PID_source->GetXaxis()->SetRangeUser(0,eAli_maxNpatterns+2);
935  c1->cd();
936 
937  eHistXY->Reset();
938  eHistWChi2->Reset();
939 
940  TCanvas* c3 = new TCanvas();
941  histPatternBTDensityTanTheta->Draw("");
942 
943  TCanvas* c5 = new TCanvas();
944  QualityValue_Chi2->Draw("");
945  TCanvas* c6 = new TCanvas();
946  QualityValue_Total->Draw("");
947 
948  TCanvas* c4 = new TCanvas();
949  histPatternBTDensityTanThetaVsPID->Draw("colz");
950 
951  histPatternBTDensityTanTheta->Smooth();
952  histPatternBTDensityTanTheta->Smooth();
953  histPatternBTDensityTanTheta->Smooth();
954  TSpectrum* spec2 = new TSpectrum();
955  spec2->Search(histPatternBTDensityTanTheta);
956 
957  TList *functions = histPatternBTDensityTanTheta->GetListOfFunctions();
958  TPolyMarker *pm = (TPolyMarker*)functions->FindObject("TPolyMarker");
959  pm->Print();
960 
961  cout << spec2->GetNPeaks() << endl;
962  cout << spec2->GetNPeaks() << endl;
963  Double_t* xarr;
964  Double_t* yarr;
965  xarr = (Double_t*) spec2-> GetPositionX();
966  yarr = (Double_t*) spec2-> GetPositionY();
967  cout << xarr[0] << endl;
968  cout << xarr[1] << endl;
969  cout << yarr[0] << endl;
970  cout << yarr[1] << endl;
971 
972  // delete unnecessary variables/ objects
973  delete spec2;
974 
975  cout << "TODO // Reset interims variables/ histograms and delete unnecessary objects." << endl;
976 
977 
978  Log(2,"EdbPVRQuality::CheckEdbPVRecThetaSpace","CheckEdbPVRecThetaSpace...done.");
979  return;
980 }
Int_t npat
Definition: Xi2HatStartScript.C:33
Float_t eProfileBTdens_vs_PID_source_rmsX
Definition: EdbPVRQuality.h:88
Int_t eAli_maxNpatterns
Definition: EdbPVRQuality.h:51
Float_t ePatternBTDensity_orig[114]
Definition: EdbPVRQuality.h:64
Float_t eProfileBTdens_vs_PID_source_meanX
Definition: EdbPVRQuality.h:87
EdbPVRec * eAli_modified
Definition: EdbPVRQuality.h:44
Int_t eBTDensityLevelCalcMethodMCConfirmationNumber
Definition: EdbPVRQuality.h:62
Int_t CheckFilledXYSize(TH2F *HistXY)
Definition: EdbPVRQuality.cxx:2655
Float_t eProfileBTdens_vs_PID_source_rmsY
Definition: EdbPVRQuality.h:88
Bool_t eBTDensityLevelCalcMethodMC
Definition: EdbPVRQuality.h:61
Definition: EdbPVRec.h:148
Definition: EdbPattern.h:280
EdbPattern * GetPattern(int id) const
Definition: EdbPattern.cxx:1887
Definition: EdbSegP.h:18
Float_t X() const
Definition: EdbSegP.h:170
Float_t Chi2() const
Definition: EdbSegP.h:154
Float_t Y() const
Definition: EdbSegP.h:171
Float_t W() const
Definition: EdbSegP.h:148
Float_t Theta() const
Definition: EdbSegP.h:181
Int_t MCEvt() const
Definition: EdbSegP.h:142
Int_t N() const
Definition: EdbPattern.h:89
EdbSegP * GetSegment(int i) const
Definition: EdbPattern.h:66
gEDBDEBUGLEVEL
Definition: energy.C:7
TCanvas * c1
Definition: energy.C:13
new TCanvas()
TFile * file
Definition: write_pvr.C:3

◆ CheckFilledXYSize()

Int_t EdbPVRQuality::CheckFilledXYSize ( TH2F *  HistXY)
2656 {
2657  // ...............................................
2658  // Check the bins filled in the actual pattern.
2659  // The histogram of the XY distribution is analysed.
2660  // A warning is given if more than 10 percent of
2661  // the bins are empty. Because empty bins are NOT counted
2662  // in the BT density distribution.
2663  // In this case one should look closer at the specific
2664  // plate distribution, or ...
2665  // rebin the XY histogram to get a better statistics,
2666  // i.e. switch to larger bin areas
2667  // (for example 1 mm^2 to 2x2 mm^2 or so...)
2668  // ... Checked, but then problems with bin entries
2669  // at the edges spoil the average cacluation (because
2670  // the edges get a larger fraction of the total XY-area.
2671  // So skipped this bin-resizing. Stick to 1x1 mm^2 binsize.
2672  // Also comparison whit the simpla approach (number of
2673  // tracks / rectangular area) shows, that both mehthods
2674  // give roughly the same density.
2675  // ...............................................
2676 
2677  Int_t nbx=HistXY->GetNbinsX();
2678  Int_t nby=HistXY->GetNbinsY();
2679  Int_t nEntries=HistXY->GetEntries();
2680 
2681  // Return bins with content >= 0.1 in the bins for the each axes:
2682  // (0.1 to make sure that it is really greater 0)
2683  Int_t n1x= FindFirstBinAboveTH2(HistXY,0.1,1);
2684  Int_t n1y= FindFirstBinAboveTH2(HistXY,0.1,2);
2685  Int_t n2x= FindLastBinAboveTH2(HistXY,0.1,1);
2686  Int_t n2y= FindLastBinAboveTH2(HistXY,0.1,2);
2687 
2688  /*
2689  cout << "EdbPVRQuality::CheckFilledXYSize() return maximum/minimum entries of histogram HistXY -----" << endl;
2690  printf("EdbPVRQuality::CheckFilledXYSize() BinsX() = %d, BinsY() = %d\n", nbx,nby);
2691  printf("EdbPVRQuality::CheckFilledXYSize() EntriesX() = %d\n", nEntries);
2692  cout << "EdbPVRQuality::CheckFilledXYSize() The First Bin Above 0 in x-Axis is bin nr " << n1x << endl;
2693  cout << "EdbPVRQuality::CheckFilledXYSize() The Last Bin Above 0 in x-Axis is bin nr " << n2x << endl;
2694  cout << "EdbPVRQuality::CheckFilledXYSize() The First Bin Above 0 in y-Axis is bin nr " << n1y << endl;
2695  cout << "EdbPVRQuality::CheckFilledXYSize() The Last Bin Above 0 in y-Axis is bin nr " << n2y << endl;
2696  */
2697 
2698  Double_t width_x=0;
2699  Double_t width_y=0;
2700  width_x=TMath::Abs(HistXY->GetXaxis()->GetBinCenter(n1x)-HistXY->GetXaxis()->GetBinCenter(n2x));
2701  width_y=TMath::Abs(HistXY->GetYaxis()->GetBinCenter(n1y)-HistXY->GetYaxis()->GetBinCenter(n2y));
2702  Double_t area_xy=width_x*width_y;
2703 
2704  // printf("EdbPVRQuality::CheckFilledXYSize() Filled bins span X (microns) = %.1f, Filled bins span Y (microns) = %.1f, covered area (microns^2) = %.1f\n", width_x,width_y,area_xy);
2705 
2706  // Now check the number of empty bins between! the filled area
2707  // within (FindFirstBinAbove,FindLastBinAbove)
2708  // This function is NOT optimized for speed :-)
2709  // Attention: FindLastBinAbove is including last bin of the histogram
2710  // so the double loop has to be modified (<=) accordingly to take it
2711  // also!
2712  Int_t NonEmptyBins=0;
2713  Int_t nBins=0;
2714  Int_t SumBinContent=0;
2715 
2716  Double_t eHistXYBinArea = HistXY->GetXaxis()->GetBinWidth(1)*HistXY->GetYaxis()->GetBinWidth(1);
2717  Double_t eHistXYBinAreamm2 = eHistXYBinArea/1000/1000;
2718 
2719  for (Int_t i=n1x; i<=n2x; ++i) {
2720  for (Int_t j=n1y; j<=n2y; ++j) {
2721  ++nBins;
2722  //cout << "EdbPVRQuality::CheckFilledXYSize() GetBinContent(" << i << "," << j <<") = " << HistXY->GetBinContent(i,j) << endl;
2723 
2724  SumBinContent+=HistXY->GetBinContent(i,j);
2725 
2726  if (HistXY->GetBinContent(i,j)==0) continue;
2727  ++NonEmptyBins;
2728  }
2729  }
2730  Float_t FractionOfEmptyBins=1-(Float_t(NonEmptyBins)/Float_t(nBins));
2731  Float_t BGdensSimple = Float_t(SumBinContent)/Float_t(NonEmptyBins)/eHistXYBinAreamm2;
2732 
2733  /*
2734  cout << "EdbPVRQuality::CheckFilledXYSize() SumBinContent = " << SumBinContent << endl;
2735  cout << "EdbPVRQuality::CheckFilledXYSize() BGdensSimple = " << BGdensSimple << endl;
2736  cout << "EdbPVRQuality::CheckFilledXYSize() NonEmptyBins = " << NonEmptyBins << endl;
2737  cout << "EdbPVRQuality::CheckFilledXYSize() nBins = " << nBins << endl;
2738  cout << "EdbPVRQuality::CheckFilledXYSize() FractionOfEmptyBins = " << FractionOfEmptyBins << endl;
2739  */
2740 
2741  if (FractionOfEmptyBins>0.1) {
2742  cout << "WARNING: void EdbPVRQuality::CheckFilledXYSize() FractionOfEmptyBins = " << FractionOfEmptyBins << endl;
2743  return 1;
2744  }
2745 
2746  if (gEDBDEBUGLEVEL>3) {
2747  cout << "---- NonEmptyBins bins in covered area: = " << NonEmptyBins << endl;
2748  cout << "---- nBins totale bins in covered area: = " << nBins << endl;
2749  cout << "---- Extrem Center Endpoints of eHistXY --- " << endl;
2750  cout << "---- nbxMin= " << n1x << endl;
2751  cout << "---- nbxMax= " << n1y << endl;
2752  cout << "---- nbyMin= " << n2x << endl;
2753  cout << "---- nbyMax= " << n2y << endl;
2754  cout << "---- nbxMin= " << eHistXY->GetXaxis()->GetBinCenter(n1x) << endl;
2755  cout << "---- nbxMax= " << eHistXY->GetYaxis()->GetBinCenter(n1y) << endl;
2756  cout << "---- nbxMin= " << eHistXY->GetXaxis()->GetBinCenter(n2x) << endl;
2757  cout << "---- nbxMax= " << eHistXY->GetYaxis()->GetBinCenter(n2y) << endl;
2758  cout << "----- void EdbPVRQuality::CheckFilledXYSize() ... done. " << endl;
2759  }
2760 
2761  return 0;
2762 }
Int_t FindFirstBinAboveTH2(TH2 *hist, Double_t threshold, Int_t axis)
Definition: EdbPVRQuality.cxx:3531
Int_t FindLastBinAboveTH2(TH2 *hist, Double_t threshold, Int_t axis)
Definition: EdbPVRQuality.cxx:3574

◆ CheckSegmentQualityInPattern_ConstBTDens()

Bool_t EdbPVRQuality::CheckSegmentQualityInPattern_ConstBTDens ( EdbPVRec ali,
Int_t  PatternAtNr,
EdbSegP seg 
)
2441 {
2442  // Core function to check if a basetrack of the specific pattern matches the expectations
2443  // for the desired quality cut (calculated on the estimations in CheckEdbPVRec(). ).
2444  // Implementation for the Cuttype 0: Constant BT Density
2445  // ---
2446  // Note: since the eCutp1[i] values are calculated with
2447  // this pattern->At() scheme labeling,
2448  // it is not necessarily guaranteed that seg->PID gives correct this
2449  // number back. Thats why we have to give the PatternAtNr here again.
2450  //
2451  // And: it is not checked here if seg is contained in this specific
2452  // pattern. It looks only for the quality cut!
2453  if (gEDBDEBUGLEVEL>3) cout << "seg->W()* eCutp1[PatternAtNr] - eCutp0[PatternAtNr] = " << seg->W()* eCutp1[PatternAtNr] - eCutp0[PatternAtNr] << endl;
2454 
2455  // Constant BT density cut:
2456  if (seg->Chi2() >= seg->W()* eCutp1[PatternAtNr] - eCutp0[PatternAtNr]) return kFALSE;
2457 
2458  if (gEDBDEBUGLEVEL>3) cout <<"EdbPVRQuality::CheckSegmentQualityInPattern_ConstBTDens() Segment " << seg << " has passed ConstBTDens cut!" << endl;
2459  return kTRUE;
2460 }
Float_t eCutp1[114]
Definition: EdbPVRQuality.h:110
Float_t eCutp0[114]
Definition: EdbPVRQuality.h:109

◆ CheckSegmentQualityInPattern_ConstQual()

Bool_t EdbPVRQuality::CheckSegmentQualityInPattern_ConstQual ( EdbPVRec ali,
Int_t  PatternAtNr,
EdbSegP seg 
)
2465 {
2466  // Core function to check if a basetrack of the specific pattern matches the expectations
2467  // for the desired quality cut (calculated on the estimations in CheckEdbPVRec(). ).
2468  // Implementation for the Cuttype 1: Constant Quality.
2469  // ---
2470  // See comments in CheckSegmentQualityInPattern_ConstBTDens
2471  // Constant BT quality cut:
2473  if (agreementChi2>eAgreementChi2WDistCut[PatternAtNr]) return kFALSE;
2474 
2475  if (gEDBDEBUGLEVEL>3) cout <<"EdbPVRQuality::CheckSegmentQualityInPattern_ConstQual() Segment " << seg << " has passed ConstQual cut!" << endl;
2476  return kTRUE;
2477 }
Float_t eAgreementChi2CutMeanW
Definition: EdbPVRQuality.h:120
Float_t eAgreementChi2CutMeanChi2
Definition: EdbPVRQuality.h:118
Float_t eAgreementChi2WDistCut[114]
Definition: EdbPVRQuality.h:117
Float_t eAgreementChi2CutRMSChi2
Definition: EdbPVRQuality.h:119
Float_t eAgreementChi2CutRMSW
Definition: EdbPVRQuality.h:121

◆ Chi2WRelation()

Bool_t EdbPVRQuality::Chi2WRelation ( EdbSegP seg,
Float_t  Cutp0,
Float_t  Cutp1,
Int_t  qualitycuttype 
)

HERE ANOTHER FUNCTION ??? WHICH ONE ???

5140  {
5141  if ( qualitycuttype == 0 ) {
5142  // linear cutrelation, default
5143  if (seg->Chi2() < seg->W()*Cutp1-Cutp0) return kTRUE;
5144  return kFALSE;
5145  }
5146  else {
5147  // quadratic cutrelation
5148  if (seg->Chi2() < sqrt(seg->W()*Cutp1-Cutp0)) return kTRUE;
5149  return kFALSE;
5150  }
5151 }

◆ ClassDef()

EdbPVRQuality::ClassDef ( EdbPVRQuality  ,
 
)

◆ CreateEdbPVRec()

EdbPVRec * EdbPVRQuality::CreateEdbPVRec ( )
2483 {
2484  // Creates the cleaned EdbPVRec object, containing only segments that
2485  // satisfied the cutcriteria.
2486  // Attention: the couples structure and the tracking structure will be lost,
2487  // this EdbPVRec object is only useful for the list of segments (shower reco).
2488  // DO NOT USE THIS ROUTINE FOR GENERAL I/O and/or GENERAL EdbPVRec operations!
2489 
2490  cout << "----- void EdbPVRQuality::CreateEdbPVRec() -----" << endl;
2491  if (gEDBDEBUGLEVEL>2) {
2492  cout << "----- " << endl;
2493  cout << "----- This function makes out of the original eAli" << endl;
2494  cout << "----- a new EdbPVRec object having only those seg-" << endl;
2495  cout << "----- ments in it which satisfy the cutcriteria " << endl;
2496  cout << "----- determined in Execute_ConstantBTDensity, Execute_ConstantBTQuality" << endl;
2497  cout << "----- " << endl;
2498  cout << "----- WARNING: the couples structure and the tracking structure" << endl;
2499  cout << "----- will be lost, this PVR object is only useful for the" << endl;
2500  cout << "----- list of Segments (==ShowReco...) ... " << endl;
2501  cout << "----- DO NOT USE THIS ROUTINE FOR GENERAL I/O and/or EdbPVRec operations!" << endl;
2502  cout << "----- " << endl;
2503  cout << "CreateEdbPVRec() Mode 0:" << eCutMethodIsDone[0] << endl;
2504  cout << "CreateEdbPVRec() Mode 1:" << eCutMethodIsDone[1] << endl;
2505  cout << "CreateEdbPVRec() Mode 2:" << eCutMethodIsDone[2] << endl;
2506  cout << "CreateEdbPVRec() Mode 3:" << eCutMethodIsDone[3] << endl;
2507  cout << "CreateEdbPVRec() Mode 4:" << eCutMethodIsDone[4] << endl;
2508  cout << "CreateEdbPVRec() Mode 5:" << eCutMethodIsDone[5] << endl;
2509  cout << "CreateEdbPVRec() Mode 6:" << eCutMethodIsDone[6] << endl;
2510  cout << "CreateEdbPVRec() Mode 7:" << eCutMethodIsDone[7] << endl;
2511  cout << "----- " << endl;
2512  cout << "----- ----------------------------------------------" << endl;
2513  }
2514 
2515  // Checks
2516  if (NULL==eAli_orig || eIsSource==kFALSE) {
2517  cout << "WARNING! EdbPVRQuality::CreateEdbPVRec NULL==eAli_orig || eIsSource==kFALSE return."<<endl;
2518  return NULL;
2519  }
2520  // Checks: ... should be revised, such that the condition reads: "at least one cutmethod had to be done."
2521  Bool_t doStop=kFALSE;
2522  for (int i=0; i<8; i++) if (eCutMethodIsDone[i]==kTRUE) doStop=kTRUE;
2523  if (doStop!=kTRUE) {
2524  cout << "WARNING! EdbPVRQuality::CreateEdbPVRec No eCutMethodIsDone[..] was done. STOP and DONT create a new EdbPVR."<<endl;
2525  return NULL;
2526  }
2527 
2528  // Make a new PVRec object anyway
2529  eAli_modified = new EdbPVRec();
2530 
2531  // These two lines dont compile yet ... (???) ...
2532  // EdbScanCond* scancond = eAli_orig->GetScanCond();
2533  // eAli_modified->SetScanCond(*scancond);
2534 
2535  Float_t agreementChi2;
2536  Int_t angularspacebin=0;
2537 
2538  // Variables needed for Type 4:
2539  Float_t m_chi2,s_chi2,m_WTilde, s_WTilde;
2541 
2542  // This makes pointer copies of patterns with segments list.
2543  // wARNING: the couples structure and the tracking structure
2544  // will be lost, this PVR object is only useful for the
2545  // list of Segments (==ShowReco...) ...
2546 
2547  // Priority has the Execute_ConstantBTQuality cut.
2548  // If this was done we take this...:
2549 
2550  // Loop over patterns
2551  for (int i = 0; i <eAli_orig->Npatterns(); i++ ) {
2552  EdbPattern* pat = eAli_orig->GetPattern(i);
2553  EdbPattern* pt= new EdbPattern();
2554  // SetPattern Values to the parent patterns:
2555  pt->SetID(pat->ID());
2556  pt->SetPID(pat->PID());
2557  pt->SetZ(pat->Z());
2558 
2559  // Loop over segments
2560  for (int j = 0; j <pat->N(); j++ ) {
2561  EdbSegP* seg = pat->GetSegment(j);
2562 
2563  // Put here the cut condition ...
2564  if (eCutMethodIsDone[0]==kTRUE && eCutMethodIsDone[1]==kFALSE) {
2565  // Constant BT density cut:
2566  if (seg->Chi2() >= seg->W()* eCutp1[i] - eCutp0[i]) continue;
2567  }
2568  else if (eCutMethodIsDone[2]==kTRUE) {
2569  // Constant Quality cut
2571  if (agreementChi2>eAgreementChi2WDistCut[i]) continue;
2572  }
2573  else if (eCutMethodIsDone[3]==kTRUE) {
2574  // Constant Quality cut also in angular space:
2575  cout << "WARNING! EdbPVRQuality::CreateEdbPVRec eCutMethodIsDone[2]==kTRUE BUT NOT YET IMPLEMENTED" << endl;
2576  }
2577  else if (eCutMethodIsDone[1]==kTRUE) {
2578  // Constant BT density cut also in angular space:
2579  angularspacebin = GetAngularSpaceBin(seg);
2580  if (seg->Chi2() >= seg->W()* eCutTTp1[i][angularspacebin] - eCutTTp0[i][angularspacebin]) continue;
2581  }
2582  else if (eCutMethodIsDone[4]==kTRUE) {
2583  // Constant X2Hat cut:
2584  m_chi2=eXi2Hat_m_chi2[i];
2585  s_chi2=eXi2Hat_s_chi2[i];
2586  m_WTilde=eXi2Hat_m_WTilde[i];
2587  s_WTilde=eXi2Hat_s_WTilde[i];
2588  // Calculate that Xi2Hat value, since we have now mean and rms of the distribution histograms:
2589  // Given that these histograms were not deleted...
2590  chi2Normalized=TMath::Power((seg->Chi2()-m_chi2)/s_chi2,2);
2591  WTilde=1./(seg->W());
2592  WTildeNormalized=TMath::Power((WTilde-m_WTilde)/s_WTilde,2);
2594  if (X2Hat>eX2HatCut[i]) continue;
2595  }
2596  else if (eCutMethodIsDone[5]==kTRUE) {
2597  // Constant X2Hat cut also in angular space:
2598  angularspacebin = GetAngularSpaceBin(seg);
2599  m_chi2=eXi2HatTT_m_chi2[i][angularspacebin];
2600  s_chi2=eXi2HatTT_s_chi2[i][angularspacebin];
2601  m_WTilde=eXi2HatTT_m_WTilde[i][angularspacebin];
2602  s_WTilde=eXi2HatTT_s_WTilde[i][angularspacebin];
2603 
2604  // Calculate that Xi2Hat value, since we have now mean and rms of the distribution histograms:
2605  chi2Normalized=TMath::Power((seg->Chi2()-m_chi2)/s_chi2,2);
2606  WTilde=1./(seg->W());
2607  WTildeNormalized=TMath::Power((WTilde-m_WTilde)/s_WTilde,2);
2609  if (X2Hat> eCutTTp1[i][angularspacebin]) continue;
2610  }
2611  else if (eCutMethodIsDone[6]==kTRUE) {
2612  // Random Uniform Cut
2613  if (gRandom->Uniform()<eCutp1[i]) continue;
2614  }
2615  else if (eCutMethodIsDone[7]==kTRUE) {
2616  // Random Uniform Cut also in angular space:
2617  angularspacebin = GetAngularSpaceBin(seg);
2618  if (gRandom->Uniform()>eCutTTp1[i][angularspacebin]) continue;
2619  // Nota Bene: the ">" is right here, since it is also in the
2620  // corresponding Execute_EqualizeTanThetaSpace_RandomCut routine.
2621  }
2622  else {
2623  // do nothing;
2624  cout << "WARNING! YOU CHOSE AN INVALID OPTION. DO NO CUT AT ALL! TAKE ALL SEGMENTS!" << endl;
2625  cout << " ..........................................................." << endl;
2626  cout << " ..........................................................." << endl;
2627  cout << " ..........................................................." << endl;
2628  cout << " ..........................................................." << endl;
2629  cout << " BUT I COULD IMPLEMENT HERE THE EXCLUSION SEGMENT LIST OPTION " << endl;
2630  cout << " ..........................................................." << endl;
2631  cout << " ..........................................................." << endl;
2632  cout << " ..........................................................." << endl;
2633  }
2634 
2635  // Add segment:
2636  pt->AddSegment(*seg);
2637  }
2639  }
2640 
2641  eIsTarget=kTRUE;
2642 
2643  //---------------------
2644  cout << "EdbPVRQuality::CreateEdbPVRec()...Created new EdbPVR object at address " << eAli_modified << endl;
2645  cout << "EdbPVRQuality::CreateEdbPVRec()...You can also retrieve this object via ->GetEdbPVRec(1);" << endl;
2646  //---------------------
2647  cout << "EdbPVRQuality::CreateEdbPVRec()...done." << endl;
2648  return eAli_modified;
2649 }
TPaveText * pt
Definition: Canv_SYSTEMATICS_ALLCOMBINED__RMSEnergy__vs__Energy__ELECTRON.C:160
Float_t eXi2Hat_s_WTilde[114]
Definition: EdbPVRQuality.h:133
Float_t eCutTTp1[114][20]
Definition: EdbPVRQuality.h:113
Float_t eXi2Hat_m_chi2[114]
Definition: EdbPVRQuality.h:130
Float_t eXi2HatTT_m_WTilde[114][20]
Definition: EdbPVRQuality.h:138
Bool_t eIsTarget
Definition: EdbPVRQuality.h:49
Float_t eCutTTp0[114][20]
Definition: EdbPVRQuality.h:112
Int_t GetAngularSpaceBin(EdbSegP *seg)
Definition: EdbPVRQuality.cxx:2392
Float_t eXi2Hat_s_chi2[114]
Definition: EdbPVRQuality.h:131
Float_t eXi2Hat_m_WTilde[114]
Definition: EdbPVRQuality.h:132
Float_t eX2HatCut[114]
Definition: EdbPVRQuality.h:129
Float_t eXi2HatTT_m_chi2[114][20]
Definition: EdbPVRQuality.h:136
Bool_t eCutMethodIsDone[8]
Definition: EdbPVRQuality.h:56
Float_t eXi2HatTT_s_chi2[114][20]
Definition: EdbPVRQuality.h:137
Float_t eXi2HatTT_s_WTilde[114][20]
Definition: EdbPVRQuality.h:139
int PID() const
Definition: EdbPattern.h:329
int ID() const
Definition: EdbPattern.h:328
void AddPattern(EdbPattern *pat)
Definition: EdbPattern.cxx:1867
Float_t Z() const
Definition: EdbPattern.h:87
Float_t chi2
Definition: testBGReduction_By_ANN.C:14
Float_t chi2Normalized
Definition: testChi2Ordering.C:17
Float_t WTilde
Definition: testChi2Ordering.C:21
Float_t WTildeNormalized
Definition: testChi2Ordering.C:22

◆ CreateEdbPVRec_TT_Algorithms()

void EdbPVRQuality::CreateEdbPVRec_TT_Algorithms ( )
5584  {
5585  cout << "EdbPVRQuality::CreateEdbPVRec_TT_Algorithms()" << endl;
5586 
5587  // Should be done seperately, since this function
5588  // is not conneected to HighDensBTs removal...
5589  // which only should appear here, or not??
5590  // FindFakeDoubleBTs();
5591  // Can also done before, outside this loop!
5592  // This Code will be Executed in the function
5593  // FindHighDensityBTs();
5594 
5595  // Finally, the Exclusion lists should all be merged
5597 
5598  // Create new volume without the excluded segments from the list
5600 
5601  // Set flag
5602  eIsTarget=1;
5604 
5605  cout << "EdbPVRQuality::CreateEdbPVRec_TT_Algorithms() Created new volume eAli_modified at " << eAli_modified << endl;
5606  cout << "EdbPVRQuality::CreateEdbPVRec_TT_Algorithms()...done." << endl;
5607  return;
5608 }
Float_t eBTDensityLevel
Definition: EdbPVRQuality.h:58
void MergeExclusionLists()
Definition: EdbPVRQuality.cxx:5468
EdbPVRec * CreatePVRWithExcludedSegmentList(EdbPVRec *aliSource, TObjArray *SegmentArray)
Definition: EdbPVRQuality.cxx:2971
Bool_t eNeedModified
Definition: EdbPVRQuality.h:47
TObjArray * eArrayAllExcludedSegments
Definition: EdbPVRQuality.h:174

◆ CreatePVRWithExcludedSegmentList()

EdbPVRec * EdbPVRQuality::CreatePVRWithExcludedSegmentList ( EdbPVRec aliSource,
TObjArray *  SegmentArray 
)
2972 {
2973  // Create a new volume, fill with all tracks from the old volume,
2974  // _except_ those which appear in the excluded segment list.
2975  // Quick and Dirty implementation !
2976  cout << "EdbPVRQuality::CreatePVRWithExcludedSegmentList() " << endl;
2977 
2978 
2979  // Clone the original object, since this will become the target object...
2980  EdbPVRec* aliClone = (EdbPVRec*)aliSource->Clone();
2981 
2982  Int_t SegmentArrayN = SegmentArray->GetEntries();
2983  Bool_t SegmentInSegmentArray=kFALSE;
2984  if (gEDBDEBUGLEVEL>2) cout <<"EdbPVRQuality::CreatePVRWithExcludedSegmentList() SegmentArrayN = " << SegmentArrayN << endl;
2985 
2986  //--------------------------------
2987  // Quick Pre-Trick to make Search Faster:
2988  // Split large SegmentArray into Npatterns() subarrays.
2989  TObjArray *SegmentSubArray[114];
2990  Int_t SegmentSubArrayN[114];
2991  for (Int_t k=0; k<aliSource->Npatterns(); ++k) {
2992  SegmentSubArray[k] = new TObjArray();
2993  for (Int_t iSegArray=0; iSegArray<SegmentArrayN; ++iSegArray) {
2994  EdbSegP* segFromArray = (EdbSegP*)SegmentArray->At(iSegArray);
2995  if (segFromArray->PID()== aliSource->GetPattern(k)->PID()) SegmentSubArray[k]->Add(segFromArray);
2996  }
2997  SegmentSubArrayN[k]=SegmentSubArray[k]->GetEntries() ;
2998  if (gEDBDEBUGLEVEL>2) cout <<"EdbPVRQuality::CreatePVRWithExcludedSegmentList() SegmentSubArray[k]->GetEntries()" << SegmentSubArrayN[k] << endl;
2999  }
3000  //--------------------------------
3001 
3002  for (Int_t i=0; i<aliSource->Npatterns(); ++i) {
3003  cout <<"EdbPVRQuality::CreatePVRWithExcludedSegmentList() Doing Pattern = " << i << endl;
3004 
3005  EdbPattern* patternSource = aliSource->GetPattern(i);
3006  EdbPattern* patternTarget = aliClone->GetPattern(i);
3007  if (gEDBDEBUGLEVEL>2) {
3008  cout <<"EdbPVRQuality::CreatePVRWithExcludedSegmentList() patternSource->GetN()" << patternSource->GetN() << endl;
3009  cout <<"EdbPVRQuality::CreatePVRWithExcludedSegmentList() patternTarget->GetN()" << patternTarget->GetN() << endl;
3010  }
3011  patternTarget->Reset();
3012 
3013  patternTarget->SetID(patternSource->ID());
3014  patternTarget->SetPID(patternSource->PID());
3015  patternTarget->SetX(patternSource->X());
3016  patternTarget->SetY(patternSource->Y());
3017  patternTarget->SetZ(patternSource->Z());
3018 
3019  // Now every basetrack from the original pattern must be compared
3020  // with all basetracks from the exclusion list!
3021  // If the basetrack is not found in the exclusion list, then
3022  // it can be added in the target pattern...
3023  // This function might take a while, especially at large volumes...
3024  // (to be improved)
3025 
3026  for (Int_t j=0; j<patternSource->N(); ++j) {
3027  EdbSegP* seg = patternSource->GetSegment(j);
3028  SegmentInSegmentArray=kFALSE;
3029 
3030  for (Int_t iSegArray=0; iSegArray<SegmentSubArrayN[i]; ++iSegArray) {
3031  EdbSegP* segFromArray = (EdbSegP*)SegmentSubArray[i]->At(iSegArray);
3032  if (seg->IsEqual(segFromArray)) {
3033  if (gEDBDEBUGLEVEL>3) cout << "Segment " << seg->ID() << " is in exclusion List: DO NOT ADD THIS IN patternTarget:" << endl;
3034  if (gEDBDEBUGLEVEL>3) segFromArray->PrintNice();
3035  SegmentInSegmentArray=kTRUE;
3036  }
3037  }
3038  // Add segment now:
3039  if(!SegmentInSegmentArray) patternTarget->AddSegment(*seg);
3040 
3041  }
3042  if (gEDBDEBUGLEVEL>2) cout <<"EdbPVRQuality::CreatePVRWithExcludedSegmentList() patternTarget->GetEntries()" << patternTarget->GetN() << endl;
3043 
3044  } // for (Int_t i=0; i<aliSource->N(); ++i)
3045 
3046  aliClone->Print();
3047 
3048  // Set the new EdbPVRec object now as the target volume:
3049  cout << "EdbPVRQuality::CreatePVRWithExcludedSegmentList() Set the new EdbPVRec object now as the target volume." << endl;
3050  eAli_modified = aliClone;
3051 
3052  // Strange: this crashes, though it should not...
3053  // It is not large in memory, so we leave it just here, orphaned...
3054  // delete[] SegmentSubArray;
3055 
3056  cout << "EdbPVRQuality::CreatePVRWithExcludedSegmentList()...done." << endl;
3057  return aliClone;
3058 }
void Reset()
Definition: EdbPattern.cxx:1632
void SetID(int id)
Definition: EdbPattern.h:318
void SetPID(int pid)
Definition: EdbPattern.h:319
void Print() const
Definition: EdbPattern.cxx:1853
Bool_t IsEqual(const TObject *obj) const
Definition: EdbSegP.cxx:425
Int_t ID() const
Definition: EdbSegP.h:144
void PrintNice() const
Definition: EdbSegP.cxx:418
Int_t PID() const
Definition: EdbSegP.h:145
void SetZ(float z)
Definition: EdbPattern.h:41
void SetY(float y)
Definition: EdbPattern.h:83
Float_t Y() const
Definition: EdbPattern.h:86
Int_t GetN() const
Definition: EdbPattern.h:65
void SetX(float x)
Definition: EdbPattern.h:82
Float_t X() const
Definition: EdbPattern.h:85
EdbSegP * AddSegment(int i, EdbSegP &s)
Definition: EdbPattern.cxx:71

◆ Cut()

void EdbPVRQuality::Cut ( )
5070  {
5071  cout << "EdbPVRQuality::Cut()" << endl;
5072  cout << "EdbPVRQuality::Cut() Generic Cut Routine to find BTs which cause High Density ..." << endl;
5073 
5074  cout << "EdbPVRQuality::Cut() Description: " << endl;
5075  cout << "EdbPVRQuality::Cut() In the specific TT bin we have for Example:" << endl;
5076  cout << "EdbPVRQuality::Cut() eArrayPatternTTSource : . . . . . . . . . . N=10" << endl;
5077  cout << "EdbPVRQuality::Cut() eArrayPatternTTAccepted: x . x x . x . . x x N=06" << endl;
5078  cout << "EdbPVRQuality::Cut() eArrayPatternTTRejected: . o . . o . o o . . N=04" << endl;
5079 
5080  cout << "EdbPVRQuality::Cut() So now we want to cut (whatever cutalgorithm is set before) to acchieve that ..." << endl;
5081  cout << "EdbPVRQuality::Cut() The cutfactor tells us the fraction." << endl;
5082 
5083  // Cut routine different for each TT bin.
5084  // Main Cut is then executed in this subroutine
5085  Int_t nbinsX=10;
5086  for (int i = 0; i <nbinsX+2; i++ ) {
5087  Cut_TTBin(i);
5088  }
5089 
5090  // After the Cuts for finding the HighDensBTs have been done, we merge the
5091  // arrays where all BTs (for this pattern) which are to be excluded are stored:
5092  MergeTTSegments();
5093 
5094  // Now add this (pattern specific) array to the array for all patterns
5096 
5097 
5098  // Set which CutMethod is done:
5100 
5101  cout << "EdbPVRQuality::Cut()...done" << endl;
5102  return;
5103 }
Int_t eCutMethod
Definition: EdbPVRQuality.h:54
void MergeTTSegments()
Definition: EdbPVRQuality.cxx:5389
void MergeHighDensBTsLists()
Definition: EdbPVRQuality.cxx:5444
void Cut_TTBin(Int_t TTbin)
Definition: EdbPVRQuality.cxx:5108
void SetCutMethodIsDone(Int_t CutMethod)
Definition: EdbPVRQuality.h:193

◆ Cut_ConstantBTDensity()

void EdbPVRQuality::Cut_ConstantBTDensity ( )
5154  {
5155  cout << "EdbPVRQuality::Cut_ConstantBTDensity()" << endl;
5156  cout << "EdbPVRQuality::Cut_ConstantBTDensity() ......... UNDER DEVELOPEMT ...... " << endl;
5157 
5158  // Simple Tighting of Chi2-W-Cutrelation until the desired number
5159  // of accepted BTs is acchieved
5160 
5161  TObjArray* ArraySource=eArrayPatternTTSource[eBinTT];
5162  TObjArray* ArrayAccepted=eArrayPatternTTAccepted[eBinTT];
5163  TObjArray* ArrayRejected=eArrayPatternTTRejected[eBinTT];
5164  EdbSegP* seg;
5165  Int_t nMaxAccepted=ArraySource->GetEntries()*eCutTTReductionFactor[eBinTT];
5166  Int_t nArraySource=ArraySource->GetEntries();
5167 
5168 
5169  if (nArraySource==0) {
5170  cout << "EdbPVRQuality::Cut_ConstantBTDensity() ArraySource->GetEntries() = " << nArraySource << " ... Nothing to do here -> return." << endl;
5171  return;
5172  }
5173 
5174  cout << "EdbPVRQuality::Cut_ConstantBTDensity() ArraySource->GetEntries() = " << nArraySource << endl;
5175  cout << "EdbPVRQuality::Cut_ConstantBTDensity() For this eBinTT, cutfactor is = " << eCutTTReductionFactor[eBinTT] << endl;
5176  cout << "EdbPVRQuality::Cut_ConstantBTDensity() and we should accept number of BTs = " << nMaxAccepted << endl;
5177 
5178  // If cutfactor for this bin is 1, then we dont need to do anything in this routine...
5179  if (eCutTTReductionFactor[eBinTT]==1) {
5180  cout << "EdbPVRQuality::Cut_ConstantBTDensity() Cutfactor for this bin is 1: Fill all ArraySource in Array Accepted" << endl;
5181  ArrayAccepted->Clear();
5182  ArrayRejected->Clear();
5183  for (Int_t i=0; i< ArraySource->GetEntries(); ++i) {
5184  seg = (EdbSegP* )ArraySource->At(i);
5185  ArrayAccepted->Add(seg);
5186  }
5187  return;
5188  }
5189 
5190  // Using the linear Cutrelation ( Chi2() < W()*Cutp1-Cutp0 ).
5191  // Keeping Cutp0 at 1, changing Cutp1 from 0.12 down to 0.072
5192  // in steps (20) of Delta Cutp1 = (0.120-0.072)/20 = 2.4E-3
5193  eCutp0[0]=1;
5194  eCutp1[0]=0.12;
5195  Float_t DeltaCutp1=2.4E-3;
5196  // Attention: If the Quadratic Cut mode is used, one has to change these numbers!
5197 
5198  Int_t numberAccepted;
5199  Int_t numberRejected;
5200  Float_t Cutp0 = eCutp0[0];
5201  Float_t Cutp1 = eCutp1[0];
5202 
5203  for (Int_t stepsCutp1=0; stepsCutp1 < 20; ++stepsCutp1) {
5204 
5205  if (ArraySource->GetEntries()==0) continue;
5206 
5207  numberAccepted=0;
5208  numberRejected=0;
5209 
5210  // Clear local arrays which are filled from the last stepsCutp1 loop
5211  ArrayAccepted->Clear();
5212  ArrayRejected->Clear();
5213 
5214  for (Int_t i=0; i< ArraySource->GetEntries(); ++i) {
5215  seg = (EdbSegP* )ArraySource->At(i);
5216 
5217  if (Chi2WRelation(seg, Cutp0, Cutp1, 0)==kTRUE) {
5218  ++numberAccepted;
5219  ArrayAccepted->Add(seg);
5220  }
5221  else {
5222  ++numberRejected;
5223  ArrayRejected->Add(seg);
5224  }
5225 
5226  } // of for (Int_t i=0; i< ArraySource->GetEntries(); ++i)
5227 
5228  cout << "EdbPVRQuality::Cut_ConstantBTDensity() For stepsCutp1 = " << stepsCutp1 << " ( Cutp1 = " << Cutp1 << ") we have numberAccepted = " << numberAccepted << " numberRejected = " << numberRejected << ". " << endl;
5229 
5230  // Check if number is sufficient
5231  // if so, step out of the Cutp1 loop
5232  if (numberAccepted<nMaxAccepted) break;
5233 
5234  // Tighten Cutfactor
5235  Cutp1-=DeltaCutp1;
5236  } // of for (Int_t stepsCutp1=0; stepsCutp1 < 20; ++stepsCutp1)
5237 
5238  cout << "EdbPVRQuality::Cut_ConstantBTDensity() ArraySource->GetEntries() " << ArraySource->GetEntries() << endl;
5239  cout << "EdbPVRQuality::Cut_ConstantBTDensity() ArrayAccepted->GetEntries() " << ArrayAccepted->GetEntries() << endl;
5240  cout << "EdbPVRQuality::Cut_ConstantBTDensity() ArrayRejected->GetEntries() " << ArrayRejected->GetEntries() << endl;
5241 
5242 
5243 
5244  cout << "EdbPVRQuality::Cut_ConstantBTDensity()...done." << endl;
5245  return;
5246 }
Float_t eCutTTReductionFactor[12]
Definition: EdbPVRQuality.h:102
TObjArray * eArrayPatternTTAccepted[12]
Definition: EdbPVRQuality.h:153
Int_t eBinTT
Definition: EdbPVRQuality.h:103
TObjArray * eArrayPatternTTRejected[12]
Definition: EdbPVRQuality.h:152
Bool_t Chi2WRelation(EdbSegP *seg, Float_t Cutp0, Float_t Cutp1, Int_t qualitycuttype)
HERE ANOTHER FUNCTION ??? WHICH ONE ???
Definition: EdbPVRQuality.cxx:5140
TObjArray * eArrayPatternTTSource[12]
Definition: EdbPVRQuality.h:151

◆ Cut_ConstantBTQuality()

void EdbPVRQuality::Cut_ConstantBTQuality ( )
5248  {
5249  cout << "EdbPVRQuality::Cut_ConstantBTQuality()" << endl;
5250  cout << "EdbPVRQuality::Cut_ConstantBTQuality() NOT YET IMPLEMENTED " << endl;
5251  cout << "EdbPVRQuality::Cut_ConstantBTQuality()...done." << endl;
5252  return;
5253 }

◆ Cut_ConstantBTX2Hat()

void EdbPVRQuality::Cut_ConstantBTX2Hat ( )

((/////PPPPPPPPP

5255  {
5256  cout << "EdbPVRQuality::Cut_ConstantBTX2Hat()" << endl;
5257  cout << "EdbPVRQuality::Cut_ConstantBTX2Hat() NOT YET IMPLEMENTED " << endl;
5258 
5259  // More elaborate Tighting of Chi2-W-Cutrelation until the desired number
5260  // of accepted BTs is acchieved
5261  // Build a Chi2 like variable X2Hat = X2normalized + WTildeNormalized .....
5262 
5263 
5264 
5265  cout << " BUILD IN THIS FUNCTION HERE !!! " << endl;
5266  cout << "X2Hat MEAN AND SIGmA VALUES ARE TO BE DETERMINED !!!" << endl;
5267  cout << " B U T W H Y T A K E THE M E A N ? ? ? " << endl;
5268  cout << " Lower values would be better, wouldnt thenm???? " << endl;
5269 
5270 
5272 
5273 
5274  TObjArray* ArraySource=eArrayPatternTTSource[eBinTT];
5275  TObjArray* ArrayAccepted=eArrayPatternTTAccepted[eBinTT];
5276  TObjArray* ArrayRejected=eArrayPatternTTRejected[eBinTT];
5277  EdbSegP* seg;
5278  Int_t nMaxAccepted=ArraySource->GetEntries()*eCutTTReductionFactor[eBinTT];
5279  Int_t nArraySource=ArraySource->GetEntries();
5280 
5281 
5282  if (nArraySource==0) {
5283  cout << "EdbPVRQuality::Cut_ConstantBTX2Hat() ArraySource->GetEntries() = " << nArraySource << " ... Nothing to do here -> return." << endl;
5284  return;
5285  }
5286 
5287  cout << "EdbPVRQuality::Cut_ConstantBTX2Hat() ArraySource->GetEntries() = " << nArraySource << endl;
5288  cout << "EdbPVRQuality::Cut_ConstantBTX2Hat() For this eBinTT, cutfactor is = " << eCutTTReductionFactor[eBinTT] << endl;
5289  cout << "EdbPVRQuality::Cut_ConstantBTX2Hat() and we should accept number of BTs = " << nMaxAccepted << endl;
5290 
5291  // If cutfactor for this bin is 1, then we dont need to do anything in this routine...
5292  if (eCutTTReductionFactor[eBinTT]==1) {
5293  cout << "EdbPVRQuality::Cut_ConstantBTX2Hat() Cutfactor for this bin is 1: Fill all ArraySource in Array Accepted" << endl;
5294  ArrayAccepted->Clear();
5295  ArrayRejected->Clear();
5296  for (Int_t i=0; i< ArraySource->GetEntries(); ++i) {
5297  seg = (EdbSegP* )ArraySource->At(i);
5298  ArrayAccepted->Add(seg);
5299  }
5300  return;
5301  }
5302 
5303 
5304  // Using the cutrelation on the Xi2Hat Value
5305  // Keeping X2Hat_0 at 5, decreasing in 20 steps of 0.1....
5306  Double_t CutValueX2HatInitial=5;
5307  Double_t DeltaCutValueX2Hat=5./20.;
5308  Double_t CutValueX2Hat=5;
5309 
5310  // Need sigma and mean values for the important histograms:
5311  Double_t CutValueX2Hat_Chi2Mean=eHistChi2->GetMean();
5312  Double_t CutValueX2Hat_Chi2Sigma=eHistChi2->GetRMS();
5313  Double_t CutValueX2Hat_WTildeMean=eHistWTilde->GetMean();
5314  Double_t CutValueX2Hat_WTildeSigma=eHistWTilde->GetRMS();
5315 
5316  Int_t numberAccepted;
5317  Int_t numberRejected;
5318 
5319  for (Int_t iSteps=0; iSteps < 20; ++iSteps) {
5320 
5321  if (ArraySource->GetEntries()==0) continue;
5322 
5323  numberAccepted=0;
5324  numberRejected=0;
5325 
5326  // Clear local arrays which are filled from the last stepsCutp1 loop
5327  ArrayAccepted->Clear();
5328  ArrayRejected->Clear();
5329 
5330  for (Int_t i=0; i< ArraySource->GetEntries(); ++i) {
5331  seg = (EdbSegP* )ArraySource->At(i);
5332 
5333  if (X2HatCutRelation(seg, CutValueX2Hat, CutValueX2Hat_Chi2Mean, CutValueX2Hat_Chi2Sigma, CutValueX2Hat_WTildeMean, CutValueX2Hat_WTildeSigma )==kTRUE) {
5334  ++numberAccepted;
5335  ArrayAccepted->Add(seg);
5336  }
5337  else {
5338  ++numberRejected;
5339  ArrayRejected->Add(seg);
5340  }
5341 
5342  } // of for (Int_t i=0; i< ArraySource->GetEntries(); ++i)
5343 
5344  cout << "EdbPVRQuality::Cut_ConstantBTX2Hat() For iSteps = " << iSteps << " ( CutValueX2Hat = " << CutValueX2Hat << ") we have numberAccepted = " << numberAccepted << " numberRejected = " << numberRejected << ". " << endl;
5345 
5346  // Check if number is sufficient
5347  // if so, step out of the Cutp1 loop
5348  if (numberAccepted<nMaxAccepted) break;
5349 
5350  // Tighten Cutfactor
5351  CutValueX2Hat -= DeltaCutValueX2Hat;
5352  } // of for (Int_t stepsCutp1=0; stepsCutp1 < 20; ++stepsCutp1)
5353 
5354  cout << "EdbPVRQuality::Cut_ConstantBTX2Hat() ArraySource->GetEntries() " << ArraySource->GetEntries() << endl;
5355  cout << "EdbPVRQuality::Cut_ConstantBTX2Hat() ArrayAccepted->GetEntries() " << ArrayAccepted->GetEntries() << endl;
5356  cout << "EdbPVRQuality::Cut_ConstantBTX2Hat() ArrayRejected->GetEntries() " << ArrayRejected->GetEntries() << endl;
5357 
5358  cout << "EdbPVRQuality::Cut_ConstantBTX2Hat()...done." << endl;
5359  return;
5360 }
Bool_t X2HatCutRelation(EdbSegP *seg, Double_t CutValueX2Hat, Double_t CutValueX2Hat_Chi2Mean, Double_t CutValueX2Hat_Chi2Sigma, Double_t CutValueX2Hat_WTildeMean, Double_t CutValueX2Hat_WTildeSigma)
Definition: EdbPVRQuality.cxx:5635
TH1F * eHistChi2
Definition: EdbPVRQuality.h:74
TH1F * eHistWTilde
Definition: EdbPVRQuality.h:76

◆ Cut_RandomCut()

void EdbPVRQuality::Cut_RandomCut ( )
5364  {
5365  cout << "EdbPVRQuality::Cut_RandomCut()" << endl;
5366  TObjArray* ArraySource=eArrayPatternTTSource[eBinTT];
5367  TObjArray* ArrayAccepted=eArrayPatternTTAccepted[eBinTT];
5368  TObjArray* ArrayRejected=eArrayPatternTTRejected[eBinTT];
5369  EdbSegP* seg;
5370  Int_t nMaxAccepted=ArraySource->GetEntries()*eCutTTReductionFactor[eBinTT];
5371  cout << "EdbPVRQuality::Cut_RandomCut() eCutTTReductionFactor[eBinTT] = " << eCutTTReductionFactor[eBinTT] << " so we should keep around" << nMaxAccepted << " segments " << endl;
5372  for (Int_t i=0; i< ArraySource->GetEntries(); ++i) {
5373  seg = (EdbSegP* )ArraySource->At(i);
5374  if (gRandom->Uniform() < eCutTTReductionFactor[eBinTT] ) {
5375  ArrayAccepted->Add(seg);
5376  }
5377  else {
5378  ArrayRejected->Add(seg);
5379  }
5380  }
5381  cout << "EdbPVRQuality::Cut_RandomCut() ArraySource->GetEntries() " << ArraySource->GetEntries() << endl;
5382  cout << "EdbPVRQuality::Cut_RandomCut() ArrayAccepted->GetEntries() " << ArrayAccepted->GetEntries() << endl;
5383  cout << "EdbPVRQuality::Cut_RandomCut() ArrayRejected->GetEntries() " << ArrayRejected->GetEntries() << endl;
5384  cout << "EdbPVRQuality::Cut_RandomCut()...done." << endl;
5385 }

◆ Cut_TTBin()

void EdbPVRQuality::Cut_TTBin ( Int_t  TTbin)
5108  {
5109  cout << "EdbPVRQuality::Cut_TTBin(Int_t TTbin)" << endl;
5110  cout << "EdbPVRQuality::Cut_TTBin(Int_t TTbin) Generic Cut Routine for TTbin = " << TTbin << endl;
5111 
5112  eBinTT = TTbin;
5113 
5114  // NOW CHECK WHICH CUT METHOD IS TO BE EXECUTED .....
5115  // for now... only randomcut method working
5116  // for now... and chi2- method working
5117  // = reference algorithm
5118 
5119  // Cut-Algorithms for TT-binning:
5121  if (eCutMethod==3) Cut_ConstantBTQuality(); // NOT YET WORKING
5122  if (eCutMethod==5) Cut_ConstantBTX2Hat(); // NOT YET WORKING // IN DEVELOPEMT (08.08.2016, FWM)
5123  if (eCutMethod==7) Cut_RandomCut();
5124  // The "other" algorithms are still tuned for one single TT-space,
5125  // that means, they work globally.
5126  // TO BE DONE: MAYBE BY REBINNING THE TTHistogram, we can just use these routines for the
5127  // GLObAL CUT ROUTINES
5128 
5129 
5130 
5131 
5132  cout << "EdbPVRQuality::Cut_TTBin(Int_t TTbin)...done." << endl;
5133  return;
5134 }
void Cut_ConstantBTQuality()
Definition: EdbPVRQuality.cxx:5248
void Cut_RandomCut()
Definition: EdbPVRQuality.cxx:5364
void Cut_ConstantBTX2Hat()
Definition: EdbPVRQuality.cxx:5255
void Cut_ConstantBTDensity()
Definition: EdbPVRQuality.cxx:5154

◆ DetermineCutTTReductionFactor()

void EdbPVRQuality::DetermineCutTTReductionFactor ( Int_t  patNR)
4863  {
4864  cout << "EdbPVRQuality::DetermineCutTTReductionFactor(Int_t patNR)" << endl;
4865 
4866  cout << "EdbPVRQuality::DetermineCutTTReductionFactor(Int_t patNR) TO BE DONE: FILL HISTOS PATTERN nPAT before, or at least check if it was done..." << endl;
4867 
4869  FillHistosPattern(eAli_orig, patNR, kTRUE, 1.0);
4871 
4872  cout << "EdbPVRQuality::DetermineCutTTReductionFactor(Int_t patNR) TO BE DONE: FILL FillTanThetaTArrays nPAT before, or at least check if it was done..." << endl;
4873 
4875  FillTanThetaTArrays(patNR);
4877 
4878  cout << "EdbPVRQuality::DetermineCutTTReductionFactor(Int_t patNR) This function will determine the TT Cut reduction factors. According" << endl;
4879  cout << "EdbPVRQuality::DetermineCutTTReductionFactor(Int_t patNR) to the given formula (explained in the manual)..." << endl;
4880  cout << "EdbPVRQuality::DetermineCutTTReductionFactor(Int_t patNR) ... TO BE DONE ... GIVE FORMULA HERE !!! ... " << endl;
4881  cout << "EdbPVRQuality::DetermineCutTTReductionFactor(Int_t patNR) ... Find TT-histogram minimum ..." << endl;
4882 
4883  // // // // // // // // // // // // // //
4884  // Find histogram (TT) minimum:
4885  // Assume, it is at about TT = 0.2..0.3
4886  // Then fit with parabola in range 0.05..0.5
4887  // returns then n_{min}
4888  // To be done:
4889  // Make sure if the returned value is
4890  // in the correct range...
4891  // // // // // // // // // // // // // //
4892  cout << "EdbPVRQuality::DetermineCutTTReductionFactor(Int_t patNR) Find histogram (TT) minimum:" << endl;
4893  cout << "EdbPVRQuality::DetermineCutTTReductionFactor(Int_t patNR) Assume, it is at about TT = 0.2..0.3" << endl;
4894  cout << "EdbPVRQuality::DetermineCutTTReductionFactor(Int_t patNR) Then fit with parabola in range 0.05..0.5" << endl;
4895  cout << "EdbPVRQuality::DetermineCutTTReductionFactor(Int_t patNR) returns then n_{min}" << endl;
4896  cout << "EdbPVRQuality::DetermineCutTTReductionFactor(Int_t patNR) To be done:" << endl;
4897  cout << "EdbPVRQuality::DetermineCutTTReductionFactor(Int_t patNR) Make sure if the returned value is " << endl;
4898  cout << "EdbPVRQuality::DetermineCutTTReductionFactor(Int_t patNR) in the correct range... "<< endl;
4899 
4900  // cout << " LET US SEE IF THE PARABULA FIT STILL WORKS WHEN BIN NUMBERS IS RECUDEC....." << endl;
4901  // No, it does not, so we just choose another simple method:
4902  // if number of bins in tt histogram is smaller 5, (i.e. 1, one global TT bin)
4903  // then we just take the entries in the bin at tt=0.2, which is the only one bin then...
4904 
4905  TH1F* h_TT = eHistTTFillcheck;
4906  TF1* fitFuncParabola = new TF1("fitFuncParabola","pol2",0,1);
4907 
4908  //cout << "h_TT->GetMinimumBin () = " << h_TT->GetMinimumBin () << endl;
4909  //cout << "h_TT->GetMinimumBin ()->GetBinContent(xx) = " << h_TT->GetBinContent(h_TT->GetMinimumBin ()) << endl;
4910 
4911 
4912  Double_t xmin=0;
4913  if (h_TT->GetNbinsX()<5) {
4914  xmin = 0.2;
4915  }
4916  else {
4917  h_TT->Fit("pol2","0","",0.05,0.5);
4918  // option "0", otherwise this will overwrite the plots in an existing canvas...
4919  TF1* fitFuncParabola = h_TT->GetFunction("pol2");
4920  fitFuncParabola->Print();
4921  // Calculate Standard parabola Minimum according to:
4922  // [0]+[1]*x+[2]*x*x*2 -> minimum at x = -[1]/(2*[2])
4923  xmin = -fitFuncParabola->GetParameter(1)/(2*fitFuncParabola->GetParameter(2));
4924  }
4925 
4926  // Get Entries n_min which correspond to this bin, belonging to xmin
4927  Int_t bin_n_min = h_TT->FindBin(xmin);
4928  Int_t n_min = h_TT->GetBinContent(bin_n_min);
4929 
4930  cout << "EdbPVRQuality::DetermineCutTTReductionFactor(Int_t patNR) Find minimum TT-value: TTmin (from parabola fit or manually set at 0.2) = " << xmin << endl;
4931  cout << "EdbPVRQuality::DetermineCutTTReductionFactor(Int_t patNR) GetBinContent at TTmin (from parabola fit or manually set at 0.2) = " << n_min << endl;
4932 
4933  // // // // // // // // // // // // // //
4934  // Calculate the other maximal binentries,
4935  // according to cufactor c = 0..1 given:
4936  // \tilde{n}_i = n_{min} + (1-c) (n_i - n_{min})
4937  // // // // // // // // // // // // // //
4938  cout << "EdbPVRQuality::DetermineCutTTReductionFactor(Int_t patNR) Calculate the other maximal binentries," << endl;
4939  cout << "EdbPVRQuality::DetermineCutTTReductionFactor(Int_t patNR) according to cufactor c = 0..1 given:" << endl;
4940  cout << "EdbPVRQuality::DetermineCutTTReductionFactor(Int_t patNR) tilde{n}_i = n_{min} + (1-c) (n_i - n_{min}) " << endl;
4941  cout << "EdbPVRQuality::DetermineCutTTReductionFactor(Int_t patNR) Pattern BT Density = " << GetBTDensity(patNR) << endl;
4942  cout << "EdbPVRQuality::DetermineCutTTReductionFactor(Int_t patNR) Target BT Density = " << GetBTDensityLevel() << endl;
4943  cout << "EdbPVRQuality::DetermineCutTTReductionFactor(Int_t patNR) Ratio (Target/Pattern density) = " << GetBTDensityLevel()/GetBTDensity(patNR) << endl;
4944 
4945  // // // // // // // // // // // // // //
4946  Int_t nbinsX=10;
4947  Double_t cutfactor=1;
4948 // Double_t cutfactor=0;
4949  Int_t nitilde[nbinsX+2];
4950  Int_t ni[nbinsX+2];
4951 
4952  Int_t Sumni=0;
4953  Int_t Sumnitilde=0;
4954 
4955  Double_t ratio[nbinsX+2];
4956  Double_t ratioSum=0;
4957  Double_t ratioTarget=GetBTDensityLevel()/GetBTDensity(patNR);
4958 
4959  cout << "EdbPVRQuality::DetermineCutTTReductionFactor(Int_t patNR) ratioTarget= " << ratioTarget << endl;
4960 
4961  for (Int_t loopctr =0; loopctr<20; ++loopctr) {
4962  cout << "EdbPVRQuality::DetermineCutTTReductionFactor(Int_t patNR) Doing loop (loopctr = " << loopctr << ") for a cutfactor =" << cutfactor << endl;
4963 
4964  ratioSum=0;
4965  Sumni=0;
4966  Sumnitilde=0;
4967 
4968  // Failsafe check
4969  if (cutfactor>1) {
4970  cout << "Warning: given cutfactor greater 1. Reduce to default value of 0.8 ! " << endl;
4971  cutfactor=0.8;
4972  }
4973 
4974  cout << "EdbPVRQuality::DetermineCutTTReductionFactor(Int_t patNR) cutfactor c = " << cutfactor << endl;
4975  cout << setw(4) << "TT bin i " << " " << setw(12) << " ni[i] " << " " << setw(12) << " nitilde[i] " << " " << setw(12) << " ratio[i] " << endl;
4976  for (int i = 0; i <nbinsX+2; i++ ) {
4977  nitilde[i]=0;
4978  ni[i]=h_TT->GetBinContent(i);
4979  nitilde[i]= n_min + (1-cutfactor) * (ni[i]-n_min);
4980  ratio[i] = (Double_t)nitilde[i] / (Double_t)ni[i];
4981  // Failsafe checks
4982  if (ni[i]==0) {
4983  nitilde[i]=0;
4984  ratio[i] = 1;
4985  }
4986  if (nitilde[i]<n_min) ratio[i] = 1; // should never happen ...
4987 
4988  Sumni+=ni[i];
4989  Sumnitilde+=nitilde[i];
4990 
4991  // Anyway, not to do it twice, fill the cutReduction Factors
4992  eCutTTReductionFactor[i]=ratio[i];
4993 
4994  //cout << setw(4) << i << " " << setw(12) << ni[i] << " " << setw(12) << nitilde[i] << " " << setw(12) << ratio[i] << endl;
4995  }
4996  ratioSum=(Double_t)Sumnitilde/(Double_t)Sumni;
4997  cout << setw(4) << "Sum" << " " << setw(12) << Sumni << " " << setw(12) << Sumnitilde << " " << setw(12) << ratioSum << endl;
4998 
4999 
5000  cout << "EdbPVRQuality::DetermineCutTTReductionFactor(Int_t patNR) End of loop (loopctr = " << loopctr << ") for a cutfactor =" << cutfactor << endl;
5001 
5002  cout << "EdbPVRQuality::DetermineCutTTReductionFactor(Int_t patNR) Now ... should we abort the loop? I.e.: is ratioTarget<ratioSum ? " << endl;
5003  if (ratioTarget<ratioSum) cout << "YES" << endl;
5004  if (ratioTarget>ratioSum) cout << "NO, reduce cutfactor by 0.05 (absolute value)" << endl;
5005 
5006  // In case it is so, the abort now, since cutfactors eCutTTReductionFactor are already filled.
5007  if (ratioTarget<ratioSum) {
5008  cout << setw(4) << "TT bin i " << " " << setw(12) << " ni[i] " << " " << setw(12) << " nitilde[i] " << " " << setw(12) << " ratio[i] " << endl;
5009  for (int i = 0; i <nbinsX+2; i++ ) cout << setw(4) << i << " " << setw(12) << ni[i] << " " << setw(12) << nitilde[i] << " " << setw(12) << ratio[i] << endl;
5010  cout << setw(4) << "Sum" << " " << setw(12) << Sumni << " " << setw(12) << Sumnitilde << " " << setw(12) << ratioSum << endl;
5011  break;
5012  }
5013 
5014 
5015  //cout << "STILL TO CHECK: ... WHAT IF THE BT DENSITY IS GREATER THAN TARGET DENSITY, WHEN EVEN THE MINIMUM BIN IS TOO MUCH ???? " << endl; -> DONE, see below.
5016 
5017  cutfactor-=0.05;
5018 // cutfactor+=0.05;
5019  } // of loopctr
5020 
5021 
5022  cout << "NOW WE ARE AT THE POINT WHERE ratioTarget<ratioSum." << endl;
5023  cout << "print once again Sumni Sumnitilde and compare with BT density:" << endl;
5024  cout << "Sumni = " << Sumni << endl;
5025  cout << "Sumnitilde = " << Sumnitilde << endl;
5026  cout << "GetBTDensityLevel() = " << GetBTDensityLevel() << endl;
5027  cout << "GetBTDensity(patNR) = " << GetBTDensity(patNR) << endl;
5028  cout << "If still at this stage we have the ratio Sumnitilde/Sumni > GetBTDensityLevel()/GetBTDensity(patNR)? " << endl;
5029  cout << "Sumnitilde/Sumni = " << ratioSum << endl;
5030  cout << "GetBTDensityLevel()/GetBTDensity(patNR) = " << GetBTDensityLevel()/GetBTDensity(patNR) << endl;
5031  cout << "Then we need an additional reducing factor of ratioSum/ratioTarget = "<< ratioSum/ratioTarget << endl;
5032 
5033 
5034  eGlobalTTReductionFactorC = ratioSum/ratioTarget;
5035  if (eGlobalTTReductionFactorC>10) {
5036  cout << "EdbPVRQuality::DetermineCutTTReductionFactor(Int_t patNR) eGlobalTTReductionFactorC (=ratioSum/ratioTarget) is greater than 10. This means that even after going to TT bin with the lowest entries, the target background density is still a factor 10 tooooooo large! YOU SHOULD CHECK YOUR INPUT IMMEDIATELY" << endl;
5038  }
5039 
5040 
5041  if (eGlobalTTReductionFactorC>1) {
5042  cout << " eGlobalTTReductionFactorC>1 that means, all TT bin_entries are rescaled with 1/eGlobalTTReductionFactorC " << endl;
5043  cout << setw(4) << "TT bin i " << " " << setw(12) << " ni[i] " << " " << setw(12) << " nitilde[i] " << " " << setw(12) << " ratio[i] " << endl;
5044  for (int i = 0; i <nbinsX+2; i++ ) {
5045  cout << "" << endl;
5046  cout << setw(4) << i << " " << setw(12) << ni[i] << " " << setw(12) << nitilde[i] << " " << setw(12) << ratio[i] << " :Before Rescaling." << endl;
5047 
5048  nitilde[i] = nitilde[i]/eGlobalTTReductionFactorC;
5050 
5051  cout << setw(4) << i << " " << setw(12) << ni[i] << " " << setw(12) << nitilde[i] << " " << setw(12) << eCutTTReductionFactor[i] << " :after Rescaling with nitilde[i] = nitilde[i]/eGlobalTTReductionFactorC" << endl;
5052  }
5053  }
5054 
5055  // Now the cutfactors are set (for this pattern!)...
5056  // and stored. It is now time for the CUTTING Function,
5057  // which implements all the different cutting algorithms!
5058  // void EdbPVRQuality::Cut()
5059 
5060  delete fitFuncParabola;
5061 
5062  cout << "EdbPVRQuality::DetermineCutTTReductionFactor(Int_t patNR)...done" << endl;
5063  return;
5064 }
void FillTanThetaTArrays(Int_t patNR)
Definition: EdbPVRQuality.cxx:4777
Float_t GetBTDensity(Int_t patNR=-1)
Definition: EdbPVRQuality.h:300
Float_t eGlobalTTReductionFactorC
Definition: EdbPVRQuality.h:105
void FillHistosPattern(EdbPVRec *aliSource, Int_t patNR=0, Bool_t DoResetHistos=kTRUE, Float_t weightXY=1)
Definition: EdbPVRQuality.cxx:4599
float xmin
Definition: emthickness.cpp:61

◆ Execute() [1/2]

void EdbPVRQuality::Execute ( )
1313 {
1314  // --------------------------------------------------------------------
1315  // Main Execution Routine.
1316  // Does the following things:
1317  //
1318  // a) Check EdbPVRec object of data.
1319  // b) Remove Fake DoubleBasetracks
1320  // c) Remove passing tracks
1321  // (if any stored, either in .root file or in EdbPVRec object itself)
1322  // d) Execute quality cuts if necessary: default is
1323  // <<Constant BT density>>
1324  // e) Store cleaned object. Can be retrieved via GetPVR().
1325  // --------------------------------------------------------------------
1326 
1327  Log(2,"EdbPVRQuality::Execute","Execute");
1328 
1329  Log(2,"EdbPVRQuality::Execute","Main Execution Routine. TODO... ");
1330  Log(2,"EdbPVRQuality::Execute","Does the following things:");
1331  Log(2,"EdbPVRQuality::Execute"," a) Check EdbPVRec object of data.");
1332  Log(2,"EdbPVRQuality::Execute"," b) Remove Fake DoubleBasetracks");
1333  Log(2,"EdbPVRQuality::Execute"," c) Remove passing tracks (if any stored, either in");
1334  Log(2,"EdbPVRQuality::Execute"," the .root file or in EdbPVRec object itself)");
1335  Log(2,"EdbPVRQuality::Execute"," d) Execute quality cut algorithm if necessary: default is");
1336  Log(2,"EdbPVRQuality::Execute"," <<Constant BT density>>");
1337  Log(2,"EdbPVRQuality::Execute"," e) Store cleaned object. Can be retrieved via GetPVR().");
1338 
1339  cout << " " << endl;
1340  cout << "___________________ TODO _______ AT THE MOMENT NOTHING HAPPENS YET IN THIS FUNCTION !!! ____________" << endl;
1341  cout << " " << endl;
1342 
1343  Log(2,"EdbPVRQuality::Execute","Execute...done.");
1344  return;
1345 }

◆ Execute() [2/2]

void EdbPVRQuality::Execute ( Int_t  CutType)
1350 {
1351  Log(2,"EdbPVRQuality::Execute","Execute");
1352  Log(2,"EdbPVRQuality::Execute","Chosen CutMethod to apply = %d. Set eCutMethod accordingly.",CutMethod);
1353 
1354  SetCutMethod(CutMethod);
1355 
1356  switch (eCutMethod) {
1357  default:
1359  break;
1360  case 0:
1362  break;
1363  case 1:
1365  break;
1366  case 2:
1368  break;
1369  case 3:
1371  break;
1372  case 4:
1374  break;
1375  case 5:
1377  break;
1378  case 6:
1380  break;
1381  case 7:
1383  break;
1384  }
1385 
1386  Log(2,"EdbPVRQuality::Execute","Execute...done.");
1387  return;
1388 }
void Execute_ConstantBTQualityInAngularBins()
Definition: EdbPVRQuality.cxx:2156
void Execute_ConstantBTQuality()
Definition: EdbPVRQuality.cxx:1567
void Execute_RandomCutInAngularBins()
Definition: EdbPVRQuality.cxx:2164
void Execute_ConstantBTX2Hat()
Definition: EdbPVRQuality.cxx:1866
void Execute_ConstantBTX2HatInAngularBins()
Definition: EdbPVRQuality.cxx:2146
void Execute_ConstantBTDensityInAngularBins()
Definition: EdbPVRQuality.cxx:1857
void Execute_ConstantBTDensity()
Definition: EdbPVRQuality.cxx:1393
void Execute_RandomCut()
Definition: EdbPVRQuality.cxx:2174

◆ Execute_ConstantBTDensity()

void EdbPVRQuality::Execute_ConstantBTDensity ( )
1394 {
1395  // Execute the modified cut routines to achieve the basetrack density level,
1396  // after application the specific cut on the segments of the specific plate (pattern).
1397  // The Constant BT Density is defined by the number of BT/mm2 in the histogram.
1398 
1399  for (int i=0; i<80; ++i) cout << "-";
1400  cout << endl;
1401  cout << "-";
1402  cout << endl;
1403  cout << "EdbPVRQuality::Execute_ConstantBTDensity " << endl;
1404  cout << "-";
1405  cout << endl;
1406  for (int i=0; i<80; ++i) cout << "-";
1407  cout << endl;
1408 
1409  Log(2,"EdbPVRQuality::Execute_ConstantBTDensity","Execute_ConstantBTDensity");
1410 
1411 
1412  if (!eIsSource) return;
1413  if (NULL==eAli_orig) return;
1414 
1415  // Check the patterns of the EdbPVRec:
1417  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;
1418  if (eAli_maxNpatterns>114) {
1419  cout << "ERROR! EdbPVRQuality::Execute_ConstantBTDensity 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;
1420  eAli_maxNpatterns=114;
1421  }
1422 
1423  TH1F* histPatternBTDensity = new TH1F("histPatternBTDensity","histPatternBTDensity",200,0,200);
1424 
1425  // Loop over the patterns:
1426  for (int i=0; i<eAli_maxNpatterns; i++) {
1427  if (i>56) {
1428  cout << "WARNING EdbPVRQuality::Execute_ConstantBTDensity() Your EdbPVRec object has more than 57 patterns! " << endl;
1429  cout << "WARNING EdbPVRQuality::Execute_ConstantBTDensity() Check it! " << endl;
1430  }
1431  if (gEDBDEBUGLEVEL>2) cout << "Execute_ConstantBTDensity Doing Pattern " << i << endl;
1432 
1433  // Now the condition loop:
1434  // Loop over 20 steps a 0.15,0.145,0.14 ... down to 0.07
1435  for (int l=0; l<20; l++) {
1436 
1438 
1439 
1441  Int_t npat=pat->N();
1442  EdbSegP* seg=0;
1443  // Loop over the segments.
1444  for (int j=0; j<npat; j++) {
1445  seg=pat->GetSegment(j);
1446  // Very important:
1447  // For the data case, we assume the following:
1448  // Data (MCEvt<0) will be taken for BTdensity calculation
1449  // Sim (MCEvt>0) will NOT be taken for BTdensity calculation
1450  // We take it ONLY and ONLY into account if it is especially wished
1451  // by the user!
1452  // Therefore (s)he needs to know how many Gauge Coupling Parameters
1453  // in the Standard Model exist (at least)...
1454  Bool_t result=kTRUE;
1455  if (seg->MCEvt()>0) {
1457  result = kTRUE;
1458  // cout << "result = kTRUE !! " << endl;
1459  }
1460  else {
1461  result = kFALSE;
1462  }
1463  }
1464 
1465  if (gEDBDEBUGLEVEL>4) cout << "Doing segment " << j << " result for bool query is: " << result << endl;
1466 
1467  // Main decision for segment to be kept or not (seg is of MC or data type).
1468  if ( kFALSE == result ) continue;
1469  // Constant BT density cut:
1470  if (seg->Chi2() >= seg->W()* eCutp1[i] - eCutp0[i]) continue;
1471 
1472  eHistXY->Fill(seg->X(),seg->Y());
1473  eHistWChi2->Fill(seg->W(),seg->Chi2());
1474  eHistTXTY->Fill(seg->TX(),seg->TY());
1475  eHistTT->Fill(seg->Theta());
1476  eHistTTFillcheck->Fill(seg->Theta());
1477  }
1478 
1479  if (gEDBDEBUGLEVEL>2) cout << "I have filled the eHistXY Histogram. Entries = " << eHistXY->GetEntries() << endl;
1480 
1481  int nbins=eHistXY->GetNbinsX()*eHistXY->GetNbinsY();
1482  for (int k=1; k<nbins-1; k++) {
1483  if (eHistXY->GetBinContent(k)==0) continue;
1484  histPatternBTDensity->Fill(eHistXY->GetBinContent(k));
1485  }
1486 
1487  ePatternBTDensity_modified[i]=histPatternBTDensity->GetMean();
1488  if (gEDBDEBUGLEVEL>2) cout <<"Execute_ConstantBTDensity Loop l= " << l << ": for the eCutp1[i] : " << eCutp1[i] << " we have a dens: " << ePatternBTDensity_modified[i] << endl;
1489 
1490  // Now the condition check:
1492  if (gEDBDEBUGLEVEL>2) cout << "Execute_ConstantBTDensity We reached the loop end due to good BT density level ... and break loop." << endl;
1493  break;
1494  }
1495  else {
1496  // Next step, tighten cut:
1497  eCutp1[i] += -0.005;
1498  }
1499 
1500  } // of condition loop...
1501 
1502  // Fill target profile histogram:
1503  Float_t bincontentXY=histPatternBTDensity->GetMean();
1504  eProfileBTdens_vs_PID_target->Fill(i,bincontentXY);
1505 
1506  } // of Npattern loops..
1507 
1508  eCutMethodIsDone[0]=kTRUE;
1509 
1510  // Check if modified or original PVRec object should be returned:
1512  eNeedModified=kTRUE;
1513  cout << "----------void EdbPVRQuality::Execute_ConstantBTDensity() Check if modified or original PVRec object should be returned: " << endl;
1514  cout << "----------void EdbPVRQuality::Execute_ConstantBTDensity() " << eNeedModified << endl;
1515  }
1516 
1517 
1518  // This will be commented when using in batch mode...
1519  // For now its there for clarity reasons.
1520  TCanvas* c1 = new TCanvas();
1521  c1->Divide(3,2);
1522  c1->cd(1);
1523  eHistXY->DrawCopy("colz");
1524  c1->cd(2);
1525  eHistWChi2->DrawCopy("colz");
1526  c1->cd(3);
1527  eHistTXTY->DrawCopy("colz");
1528  c1->cd(4);
1529  histPatternBTDensity->DrawCopy("");
1530  c1->cd(5);
1531  eProfileBTdens_vs_PID_source->Draw("profileZ");
1532  eProfileBTdens_vs_PID_source->GetXaxis()->SetRangeUser(0,eAli_maxNpatterns+2);
1533  eProfileBTdens_vs_PID_target->SetLineStyle(2);
1534  eProfileBTdens_vs_PID_target->Draw("profileZsame");
1535  c1->cd(6);
1536  eHistTT->DrawCopy("");
1537  c1->cd();
1538 
1539 
1540  histPatternBTDensity->Reset();
1541  eHistXY->Reset();
1542  eHistWChi2->Reset();
1543 
1548 
1553 
1554  delete histPatternBTDensity;
1555 
1556  cout << "----------void EdbPVRQuality::Execute_ConstantBTDensity() Cuts are done and saved to obtain desired BT density. " << endl;
1557  cout << "----------void EdbPVRQuality::Execute_ConstantBTDensity() If you want to apply the cuts now, run the CreateEdbPVRec() function now. " << endl;
1558  cout << "----------void EdbPVRQuality::Execute_ConstantBTDensity()....done." << endl;
1559 
1560  Log(2,"EdbPVRQuality::Execute_ConstantBTDensity","Execute_ConstantBTDensity...done.");
1561  return;
1562 }
Float_t eProfileBTdens_vs_PID_target_rmsY
Definition: EdbPVRQuality.h:92
TProfile * eProfileBTdens_vs_PID_target
Definition: EdbPVRQuality.h:90
Float_t eProfileBTdens_vs_PID_target_meanX
Definition: EdbPVRQuality.h:91
Float_t eProfileBTdens_vs_PID_target_rmsX
Definition: EdbPVRQuality.h:92
void ResetHistosSinglePattern()
Definition: EdbPVRQuality.cxx:203
Float_t ePatternBTDensity_modified[114]
Definition: EdbPVRQuality.h:65
Float_t eProfileBTdens_vs_PID_target_meanY
Definition: EdbPVRQuality.h:91
Float_t TX() const
Definition: EdbSegP.h:172
Float_t TY() const
Definition: EdbSegP.h:173

◆ Execute_ConstantBTDensityInAngularBins()

void EdbPVRQuality::Execute_ConstantBTDensityInAngularBins ( )
1858 {
1859  Log(2,"EdbPVRQuality::Execute_ConstantBTDensityInAngularBins","NOT YET IMPLEMENTED...Execute_ConstantBTDensityInAngularBins...done.");
1860  return;
1861 }

◆ Execute_ConstantBTQuality()

void EdbPVRQuality::Execute_ConstantBTQuality ( )

______ now same code as in the function Execute_ConstantBTDensity ___________________

TODO SHOULDNT BE HERE THE CLONE eHistXYClone histogram be IN THERE (eHistXY is not resetted plate by plate ...).

1568 {
1569  // The cut method that compares the passing muon tracks with all scanned segments.
1570  // This may help to improve, since it takes into account the actual segment quality,
1571  // which varies from scan to scan anyway.
1572  // Works for tracks passing the volume to extract their mean chi2/W. Then a distance
1573  // measurement Sqrt{0.5*[ ((chi2-chi2mean)/chi2rms)^2 + ((W-Wmean)/Wrms)^2 )] } is
1574  // build and the value of single basetracks is compared to this variable. Starting from
1575  // dist_max = 3 going down until desired target level is achieved.
1576  // If eAli->Tracks is there we take them from there.
1577  // If not, we try if there is a file linked_tracks.root, and we take tracks from there.
1578  // If that doesnt work either, nothing is done.
1579 
1580  Log(2,"EdbPVRQuality::Execute_ConstantBTQuality","Execute_ConstantBTQuality");
1581 
1582  if (!eIsSource) return;
1583 
1584  for (int i=0; i<80; ++i) cout << "-";
1585  cout << endl;
1586  cout << "-";
1587  cout << endl;
1588  cout << "EdbPVRQuality::Execute_ConstantBTQuality " << endl;
1589  cout << "-";
1590  cout << endl;
1591  for (int i=0; i<80; ++i) cout << "-";
1592  cout << endl;
1593  cout << "---------- Works for tracks passing the volume to extract their mean chi2/W " << endl;
1594  cout << "---------- If eAli->Tracks is there we take them from there." << endl;
1595  cout << "---------- If not, we try if there is a file linked_tracks.root " << endl;
1596  cout << "---------- we take tracks from there. " << endl;
1597  cout << "---------- If that doesnt work either, nothing is done." << endl;
1598  for (int i=0; i<80; ++i) cout << "-";
1599  cout << endl;
1600  cout << "-";
1601  cout << endl;
1602 
1603  cout << "EdbPVRQuality::Execute_ConstantBTQuality() eAli_orig.eTracks :" << eAli_orig->eTracks << endl;
1604 
1605  Float_t meanChi2=0.5;
1606  Float_t rmsChi2=0.2;
1607  Float_t meanW=22;
1608  Float_t rmsW=4;
1609  Float_t agreementChi2=100;
1610 
1611  // No eAli.Tracks ? Look for tracks in linked_track.root:
1612  if (NULL == eAli_orig->eTracks) {
1613  cout << "EdbPVRQuality::Execute_ConstantBTQuality() No eAli.Tracks. Look for tracks in linked_track.root" << endl;
1614  TFile* trackfile = new TFile("linked_tracks.root");
1615  trackfile->ls();
1616  TTree* tracks = (TTree*)trackfile->Get("tracks");
1617  if (NULL == tracks) {
1618  cout << "EdbPVRQuality::Execute_ConstantBTQuality() No tracks in linked_track.root file. Return, leave eAli_orig unchanged and dont do any cleaning. You might try Execute_ConstantBTDensity instead. " << endl;
1619  return;
1620  }
1621  // TH1F* h1; Attention the usage of _npl_ is disvavoured
1622  // because this can cause problems.
1623  tracks->Draw("nseg>>h(60,0,60)","","");
1624  TH1F *h1 = (TH1F*)gPad->GetPrimitive("h");
1625 
1626  // Short implementation of getting the last bin filled:
1627  int lastfilledbin=0;
1628  for (int k=1; k<h1->GetNbinsX()-1; k++) {
1629  if (h1->GetBinContent(k)>0) lastfilledbin=k;
1630  }
1631 
1632  Float_t travellenghtpercentage=Float_t(lastfilledbin)/Float_t(eAli_maxNpatterns);
1633 
1634  TString cutstring = TString(Form("nseg>=%d",int(h1->GetBinCenter(lastfilledbin-3)) ));
1635  tracks->Draw("s.eChi2>>hChi2(100,0,2)",cutstring);
1636  TH1F *hChi2 = (TH1F*)gPad->GetPrimitive("hChi2");
1637 
1638  cout << "EdbPVRQuality::Execute_ConstantBTQuality() Found tracks in the file! Good. Info:" << endl;
1639  cout << "EdbPVRQuality::Execute_ConstantBTQuality() The long tracks in the file have an average percentage length of:" << travellenghtpercentage << endl;
1640  cout << "EdbPVRQuality::Execute_ConstantBTQuality() Mean(RMS) of Chi2 distribution of passing tracks: " << hChi2->GetMean() << "+-" << hChi2->GetRMS() << endl;
1641 
1642 
1643 
1644  TCanvas* c1 = new TCanvas();
1645  c1->cd();
1646  tracks->Draw("s.eW>>hW(50,0,50)",cutstring);
1647  TH1F *hW = (TH1F*)gPad->GetPrimitive("hW");
1648  cout << "EdbPVRQuality::Execute_ConstantBTQuality() Mean(RMS) of W distribution of passing tracks: " << hW->GetMean() << "+-" << hW->GetRMS() << endl;
1649 
1650  meanChi2=hChi2->GetMean();
1651  rmsChi2=hChi2->GetRMS();
1652  meanW=hW->GetMean();
1653  rmsW=hW->GetRMS();
1654 
1655  // Quick check if these values are reasonable:
1656  if (TMath::Abs(meanChi2-0.5)>1 || TMath::Abs(meanW-22)>6) {
1657  cout << "WARNING EdbPVRQuality::Execute_ConstantBTQuality() The tracks might have a strange distribution. You are urgently requested to check these manually!!!"<<endl;
1658  }
1659  else {
1660  cout << "EdbPVRQuality::Execute_ConstantBTQuality() The tracks have reasonable values."<<endl;
1661  }
1662 
1663 
1664  // since the values for the passing tracks are
1665  // calculated for the whole volume, we assume that the cutvalues
1666  // are valid for all plates.
1667  eAgreementChi2CutMeanChi2=meanChi2;
1668  eAgreementChi2CutRMSChi2=rmsChi2;
1669  eAgreementChi2CutMeanW=meanW;
1670  eAgreementChi2CutRMSW=rmsW;
1671  }
1672 
1674 
1675  // Check the patterns of the EdbPVRec:
1677  cout << "EdbPVRQuality::Execute_ConstantBTQuality eAli_orig->Npatterns()= " << eAli_maxNpatterns << endl;
1678  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;
1679  if (eAli_maxNpatterns>114) {
1680  cout << "ERROR! EdbPVRQuality::Execute_ConstantBTQuality 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;
1681  eAli_maxNpatterns=114;
1682  }
1683 
1684  TH1F* histPatternBTDensity = new TH1F("histPatternBTDensity","histPatternBTDensity",100,0,200);
1685  TH1F* histagreementChi2 = new TH1F("histagreementChi2","histagreementChi2",100,0,5);
1686 
1687 
1688  cout << "Execute_ConstantBTQuality Loop over the patterns..." << endl;
1689  for (int i=0; i<eAli_maxNpatterns; i++) {
1690  if (i>56) {
1691  cout << "ERROR EdbPVRQuality::Execute_ConstantBTQuality() Your EdbPVRec object has more than 57 patterns! " << endl;
1692  cout << "ERROR EdbPVRQuality::Execute_ConstantBTQuality() Check it! " << endl;
1693  }
1694 
1695  if (gEDBDEBUGLEVEL>2) cout << "Execute_ConstantBTQuality Doing Pattern " << i << endl;
1696 
1697  // Now the condition loop:
1698  // Loop over 30 steps agreementChi2 step 0.025
1699  for (int l=0; l<30; l++) {
1700 
1701  if (gEDBDEBUGLEVEL>2) cout << "Execute_ConstantBTQuality Doing condition loop = " << l << endl;
1702 
1703  eHistXY->Reset(); // important to clean the histogram
1704  eHistWChi2->Reset(); // important to clean the histogram
1705  histPatternBTDensity->Reset(); // important to clean the histogram
1706 
1708  Int_t npat=pat->N();
1709  EdbSegP* seg=0;
1710 
1711  if (gEDBDEBUGLEVEL>2) cout << "Execute_ConstantBTQuality Loop over segments of pattern " << i << ",Number of segments= " << npat << endl;
1712  for (int j=0; j<npat; j++) {
1713  seg=pat->GetSegment(j);
1714 
1715  if (gEDBDEBUGLEVEL>4) cout << "Execute_ConstantBTQuality Doing segment= " << j << endl;
1716  // Very important:
1717  // For the data case, we assume the following:
1718  // Data (MCEvt<0) will be taken for BTdensity calculation
1719  // Sim (MCEvt>0) will NOT be taken for BTdensity calculation
1720  // We take it ONLY and ONLY into account if it is especially wished
1721  // by the user!
1722  // Therefore (s)he needs to know how many Gauge Coupling Parameters
1723  // in the Standard Model exist (at least)...
1724  Bool_t result=kTRUE;
1725  if (seg->MCEvt()>0) {
1727  result = kTRUE;
1728  // cout << "result = kTRUE !! " << endl;
1729  }
1730  else {
1731  result = kFALSE;
1732  }
1733  }
1734 
1735  if (gEDBDEBUGLEVEL>4) cout << "Doing segment " << j << " result for bool query is: " << result << endl;
1736 
1737  // Main decision for segment to be kept or not (seg is of MC or data type).
1738  if ( kFALSE == result ) continue;
1739 
1740  // Change here to the quality with values obtained from the tracks.
1741  // Constant BT quality cut:
1742  agreementChi2=TMath::Sqrt(0.5 *( (seg->Chi2()-meanChi2)/rmsChi2)*((seg->Chi2()-meanChi2)/rmsChi2) + ((seg->W()-meanW)/rmsW)*((seg->W()-meanW)/rmsW) );
1743  histagreementChi2->Fill(agreementChi2);
1744 
1745 
1746  // Constant BT quality cut:
1747  if (agreementChi2>eAgreementChi2WDistCut[i]) continue;
1748 
1749  eHistXY->Fill(seg->X(),seg->Y());
1750  eHistWChi2->Fill(seg->W(),seg->Chi2());
1751  }
1752 
1753  if (gEDBDEBUGLEVEL>2) cout << "I have filled the eHistXY Histogram. Entries = " << eHistXY->GetEntries() << endl;
1754 
1755  Int_t nbins=eHistXY->GetNbinsX()*eHistXY->GetNbinsY();
1756  Int_t nemptybinsXY=0;
1757  for (int k=1; k<nbins-1; k++) {
1758  if (eHistXY->GetBinContent(k)==0) {
1759  ++nemptybinsXY;
1760  continue;
1761  }
1762  histPatternBTDensity->Fill(eHistXY->GetBinContent(k));
1763  }
1764 
1765  // failsafe warning in case that there are many bins with zero content.
1766  // for now we print a error message: TODO REBIN THE YX HISTOGRA WITH 2.5x2.5 mm!!!!
1770 
1771  ePatternBTDensity_modified[i]=histPatternBTDensity->GetMean();
1772 
1773  if (gEDBDEBUGLEVEL>2) cout <<"Execute_ConstantBTQuality Loop l= " << l << ": for the eAgreementChi2WDistCut : " << eAgreementChi2WDistCut[i] << " we have a dens: " << ePatternBTDensity_modified[i] << endl;
1774 
1775  // Now the condition check:
1777  if (gEDBDEBUGLEVEL>2) cout << "Execute_ConstantBTQuality We reached the loop end due to good BT density level ... and break loop." << endl;
1778  // But dont forget to set values:
1779  eCutDistChi2[i]=meanChi2;
1780  eCutDistW[i]=meanW;
1781  eAgreementChi2CutMeanChi2=meanChi2;
1782  eAgreementChi2CutRMSChi2=rmsChi2;
1783  eAgreementChi2CutMeanW=meanW;
1784  eAgreementChi2CutRMSW=rmsW;
1785  break;
1786  }
1787  else {
1788  // Next step, tighten cut:
1789  eAgreementChi2WDistCut[i]+= -0.025;
1790  }
1791 
1792  } // of condition loop...
1793 
1794  // Fill target profile histogram:
1795  Float_t bincontentXY=histPatternBTDensity->GetMean();
1796  cout << "Execute_ConstantBTQuality histPatternBTDensity->GetMean()." << histPatternBTDensity->GetMean() << endl;
1797  eProfileBTdens_vs_PID_target->Fill(i,bincontentXY);
1798 
1799  } // of Npattern loops..
1800  cout << "Execute_ConstantBTQuality Loop over the patterns...done." << endl;
1801 
1802  // Check if modified or original PVRec object should be returned:
1804  eNeedModified=kTRUE;
1805  cout << "----------void EdbPVRQuality::Execute_ConstantBTQuality() Check if modified or original PVRec object should be returned: " << endl;
1806  cout << "----------void EdbPVRQuality::Execute_ConstantBTQuality() " << eNeedModified << endl;
1807  }
1808 
1809  eCutMethodIsDone[1]=kTRUE;
1810 
1811  // This will be commented when using in batch mode...
1812  // For now its there for clarity reasons.
1813  TCanvas* c1 = new TCanvas();
1814  c1->Divide(2,2);
1815  c1->cd(1);
1816  eHistXY->DrawCopy("colz");
1817  c1->cd(2);
1818  eHistWChi2->DrawCopy("colz");
1819  c1->cd(3);
1820  histPatternBTDensity->DrawCopy("");
1821  c1->cd(4);
1822  eProfileBTdens_vs_PID_source->Draw("profileZ");
1823  eProfileBTdens_vs_PID_source->GetXaxis()->SetRangeUser(0,eAli_maxNpatterns+2);
1824  eProfileBTdens_vs_PID_target->SetLineStyle(2);
1825  eProfileBTdens_vs_PID_target->Draw("profileZsame");
1826  c1->cd();
1827 
1832 
1837 
1838  histPatternBTDensity->Reset();
1839  eHistXY->Reset();
1840  eHistWChi2->Reset();
1841  delete histPatternBTDensity;
1842 
1843  TCanvas* c2 = new TCanvas();
1844  histagreementChi2->Draw();
1845 
1846  cout << "----------void EdbPVRQuality::Execute_ConstantBTQuality() Cuts are done and saved to obtain desired BT density. " << endl;
1847  cout << "----------void EdbPVRQuality::Execute_ConstantBTQuality() If you want to apply the cuts now, run the CreateEdbPVRec() function now. " << endl;
1848 
1849  cout << "----------void EdbPVRQuality::Execute_ConstantBTQuality()....done." << endl;
1850 
1851  Log(2,"EdbPVRQuality::Execute_ConstantBTQuality","Execute_ConstantBTQuality...done.");
1852  return;
1853 }
Float_t eCutDistW[114]
Definition: EdbPVRQuality.h:116
Float_t eCutDistChi2[114]
Definition: EdbPVRQuality.h:115
TObjArray * eTracks
Definition: EdbPVRec.h:161
TH1F * h1
Definition: energy.C:16
TCanvas * c2
Definition: energy.C:26
TTree * tracks
Definition: check_tr.C:19

◆ Execute_ConstantBTQualityInAngularBins()

void EdbPVRQuality::Execute_ConstantBTQualityInAngularBins ( )
2157 {
2158  Log(2,"EdbPVRQuality::Execute_ConstantBTQualityInAngularBins","NOT YET IMPLEMENTED...Execute_ConstantBTQualityInAngularBins...done.");
2159  return;
2160 }

◆ Execute_ConstantBTX2Hat()

void EdbPVRQuality::Execute_ConstantBTX2Hat ( )
1867 {
1868  // Execute the modified cut routines to achieve the basetrack density level,
1869  // after application the specific cut on the segments of the specific plate (pattern).
1870  // The ConstantBTX2Hat is defined by the number of BT/mm2 in the histogram.
1871  // cut on the variable Xi2Hat!
1872 
1873  Log(2,"EdbPVRQuality::Execute_ConstantBTX2Hat","Execute_ConstantBTX2Hat");
1874 
1875  for (int i=0; i<80; ++i) cout << "-";
1876  cout << endl;
1877  cout << "-";
1878  cout << endl;
1879  cout << "EdbPVRQuality::Execute_ConstantBTX2Hat " << endl;
1880  cout << "-";
1881  cout << endl;
1882  for (int i=0; i<80; ++i) cout << "-";
1883  cout << endl;
1884 
1885  if (!eIsSource) return;
1886  if (NULL==eAli_orig) return;
1887 
1888  // Check the patterns of the EdbPVRec:
1890  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;
1891  if (eAli_maxNpatterns>114) {
1892  cout << "ERROR! EdbPVRQuality::Execute_ConstantBTX2Hat 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;
1893  eAli_maxNpatterns=114;
1894  }
1895 
1896 
1897  // Create the temporary needed histograms:
1898  TH1F* histPatternBTDensity = new TH1F("histPatternBTDensity","histPatternBTDensity",200,0,200);
1899  TH1F* h_chi2 = new TH1F("h_chi2","h_chi2",100,0,2);
1900  TH1F* h_chi2Normalized = new TH1F("h_chi2Normalized","h_chi2Normalized",100,0,5);
1901  TH1F* h_WTilde = new TH1F("h_WTilde","h_WTilde",40,0,0.1);
1902  TH1F* h_WTildeNormalized = new TH1F("h_WTildeNormalized","h_WTildeNormalized",100,0,5);
1903  TH1F* h_X2 = new TH1F("h_X2","h_X2",100,0,5);
1904 
1905  // Loop over the patterns:
1906  for (int i=0; i<eAli_maxNpatterns; i++) {
1907  if (i>56) {
1908  cout << "WARNING EdbPVRQuality::Execute_ConstantBTX2Hat() Your EdbPVRec object has more than 57 patterns! " << endl;
1909  cout << "WARNING EdbPVRQuality::Execute_ConstantBTX2Hat() Check it! " << endl;
1910  }
1911  if (gEDBDEBUGLEVEL>2) cout << "Execute_ConstantBTX2Hat Doing Pattern " << i << endl;
1912 
1913 
1914  Float_t chi2Normalized=0;
1915  Float_t WTilde=0;
1916  Float_t WTildeNormalized=0;
1917  Float_t X2Hat=0;
1918  Float_t m_chi2=0;
1919  Float_t s_chi2=0;
1920  Float_t m_WTilde=0;
1921  Float_t s_WTilde=0;
1922 
1923 
1924  // Reset of the original eX2HatCut value:
1925  eX2HatCut[i]=5;
1926 
1927  // Now the condition loop:
1928  // Loop over 20 steps for the eX2HatCut value:
1929  for (int l=0; l<20; l++) {
1930 
1932 
1933 
1935  Int_t npat=pat->N();
1936  EdbSegP* seg=0;
1937  // Loop over the segments.
1938  // Here do it two times, one time to get Mean and RMS of Chi2 and WTilde distribution.
1939  // Do this only for the loopcase l==0:
1940  if (l==0) {
1941  h_chi2->Reset();
1942  h_chi2Normalized->Reset();
1943  h_WTilde->Reset();
1944  h_WTildeNormalized->Reset();
1945  h_X2->Reset();
1946 
1947 
1948  for (int j=0; j<npat; j++) {
1949  seg=pat->GetSegment(j);
1950  // Very important:
1951  // For the data case, we assume the following:
1952  // Data (MCEvt<0) will be taken for BTdensity calculation
1953  // Sim (MCEvt>0) will NOT be taken for BTdensity calculation
1954  // We take it ONLY and ONLY into account if it is especially wished
1955  // by the user!
1956  // Therefore (s)he needs to know how many Gauge Coupling Parameters
1957  // in the Standard Model exist (at least)...
1958  Bool_t result=kTRUE;
1959  if (seg->MCEvt()>0) {
1961  result = kTRUE;
1962  // cout << "result = kTRUE !! " << endl;
1963  }
1964  else {
1965  result = kFALSE;
1966  }
1967  }
1968 
1969  if (gEDBDEBUGLEVEL>4) cout << "Doing segment " << j << " result for bool query is: " << result << endl;
1970 
1971  // Main decision for segment to be kept or not (seg is of MC or data type).
1972  if ( kFALSE == result ) continue;
1973 
1974  // Pre-Fill the Chi2() and W() histograms to get Mean and RMS values right:
1975  h_chi2->Fill(seg->Chi2());
1976  WTilde=1./(seg->W());
1977  h_WTilde->Fill(WTilde);
1978 
1979  } // for (int j=0; j<npat; j++)
1980 
1981  // Calulation of the histograms to get Mean and RMS values right:
1982  m_chi2=h_chi2->GetMean();
1983  s_chi2=h_chi2->GetRMS();
1984  m_WTilde=h_WTilde->GetMean();
1985  s_WTilde=h_WTilde->GetRMS();
1986 
1987 
1988  eXi2Hat_m_chi2[i]=m_chi2;
1989  eXi2Hat_s_chi2[i]=s_chi2;
1990  eXi2Hat_m_WTilde[i]=m_WTilde;
1991  eXi2Hat_s_WTilde[i]=s_WTilde;
1992 
1993  } // if (l==0)
1994 
1995 
1996 
1997  // Loop over the segments.
1998  for (int j=0; j<npat; j++) {
1999  seg=pat->GetSegment(j);
2000  // Very important:
2001  // For the data case, we assume the following:
2002  // Data (MCEvt<0) will be taken for BTdensity calculation
2003  // Sim (MCEvt>0) will NOT be taken for BTdensity calculation
2004  // We take it ONLY and ONLY into account if it is especially wished
2005  // by the user!
2006  // Therefore (s)he needs to know how many Gauge Coupling Parameters
2007  // in the Standard Model exist (at least)...
2008  Bool_t result=kTRUE;
2009  if (seg->MCEvt()>0) {
2011  result = kTRUE;
2012  // cout << "result = kTRUE !! " << endl;
2013  }
2014  else {
2015  result = kFALSE;
2016  }
2017  }
2018 
2019  if (gEDBDEBUGLEVEL>4) cout << "Doing segment " << j << " result for bool query is: " << result << endl;
2020 
2021  // Main decision for segment to be kept or not (seg is of MC or data type).
2022  if ( kFALSE == result ) continue;
2023 
2024  // Calculate that Xi2Hat value, since we have now mean and rms of the distribution histograms:
2025  chi2Normalized=TMath::Power((seg->Chi2()-m_chi2)/s_chi2,2);
2027  WTilde=1./(seg->W());
2028  WTildeNormalized=TMath::Power((WTilde-m_WTilde)/s_WTilde,2);
2031  h_X2->Fill(X2Hat);
2032 
2033  // Constant ConstantBTX2Hat density cut:
2034  if (X2Hat>eX2HatCut[i]) continue;
2035 
2036  eHistXY->Fill(seg->X(),seg->Y());
2037  eHistWChi2->Fill(seg->W(),seg->Chi2());
2038  eHistTXTY->Fill(seg->TX(),seg->TY());
2039  eHistTT->Fill(seg->Theta());
2040  eHistTTFillcheck->Fill(seg->Theta());
2041  }
2042 
2043 
2044  if (gEDBDEBUGLEVEL>2) cout << "I have filled the eHistXY Histogram. Entries = " << eHistXY->GetEntries() << endl;
2045 
2046  int nbins=eHistXY->GetNbinsX()*eHistXY->GetNbinsY();
2047  for (int k=1; k<nbins-1; k++) {
2048  if (eHistXY->GetBinContent(k)==0) continue;
2049  histPatternBTDensity->Fill(eHistXY->GetBinContent(k));
2050  }
2051 
2052  ePatternBTDensity_modified[i]=histPatternBTDensity->GetMean();
2053  if (gEDBDEBUGLEVEL>2) cout <<"Execute_ConstantBTX2Hat Loop l= " << l << ": for the eX2HatCut : " << eX2HatCut << " we have a dens: " << ePatternBTDensity_modified[i] << endl;
2054 
2055  // Now the condition check:
2057  if (gEDBDEBUGLEVEL>2) cout << "Execute_ConstantBTX2Hat We reached the loop end due to good BT density level ... and break loop." << endl;
2058  break;
2059  }
2060  else {
2061  // Next step, tighten cut:
2062  // eCutp1[i] += -0.005;
2063  eX2HatCut[i] += -0.2;
2064  }
2065 
2066  } // of condition loop...
2067 
2068  // Fill target profile histogram:
2069  Float_t bincontentXY=histPatternBTDensity->GetMean();
2070  eProfileBTdens_vs_PID_target->Fill(i,bincontentXY);
2071 
2072  } // of Npattern loops..
2073 
2074  eCutMethodIsDone[4]=kTRUE;
2075 
2076  // Check if modified or original PVRec object should be returned:
2078  eNeedModified=kTRUE;
2079  cout << "----------void EdbPVRQuality::Execute_ConstantBTX2Hat() Check if modified or original PVRec object should be returned: " << endl;
2080  cout << "----------void EdbPVRQuality::Execute_ConstantBTX2Hat() " << eNeedModified << endl;
2081  }
2082 
2083 
2084  // This will be commented when using in batch mode...
2085  // For now its there for clarity reasons.
2086  TCanvas* c1 = new TCanvas();
2087  c1->Divide(3,2);
2088  c1->cd(1);
2089  eHistXY->DrawCopy("colz");
2090  c1->cd(2);
2091  eHistWChi2->DrawCopy("colz");
2092  c1->cd(3);
2093  eHistTXTY->DrawCopy("colz");
2094  c1->cd(4);
2095  histPatternBTDensity->DrawCopy("");
2096  c1->cd(5);
2097  eProfileBTdens_vs_PID_source->Draw("profileZ");
2098  eProfileBTdens_vs_PID_source->GetXaxis()->SetRangeUser(0,eAli_maxNpatterns+2);
2099  eProfileBTdens_vs_PID_target->SetLineStyle(2);
2100  eProfileBTdens_vs_PID_target->Draw("profileZsame");
2101  c1->cd(6);
2102  eHistTT->DrawCopy("");
2103  c1->cd();
2104 
2105 
2106  histPatternBTDensity->Reset();
2107  eHistXY->Reset();
2108  eHistWChi2->Reset();
2109 
2110  TCanvas* c2 = new TCanvas();
2111  c2->Divide(3,1);
2112  c2->cd(1);
2113  h_chi2->Draw();
2114  c2->cd(2);
2115  h_WTilde->Draw();
2116  c2->cd(3);
2117  h_X2->Draw();
2118  c2->cd();
2119 
2124 
2129 
2130  delete histPatternBTDensity;
2131 
2132  cout << "----------void EdbPVRQuality::Execute_ConstantBTX2Hat() Cuts are done and saved to obtain desired BT density. " << endl;
2133  cout << "----------void EdbPVRQuality::Execute_ConstantBTX2Hat() If you want to apply the cuts now, run the CreateEdbPVRec() function now. " << endl;
2134  cout << "----------void EdbPVRQuality::Execute_ConstantBTX2Hat()....done." << endl;
2135 
2136 
2137  PrintCutType4();
2138 
2139  Log(2,"EdbPVRQuality::Execute_ConstantBTX2Hat","Execute_ConstantBTX2Hat...done.");
2140  return;
2141 }
void PrintCutType4()
Definition: EdbPVRQuality.cxx:1245
TH1F * h_WTilde
Definition: testChi2Ordering.C:19
TH1F * h_chi2
Definition: testChi2Ordering.C:15
TH1F * h_WTildeNormalized
Definition: testChi2Ordering.C:20
TH1F * h_chi2Normalized
Definition: testChi2Ordering.C:16
TH1F * h_X2
Definition: testChi2Ordering.C:25

◆ Execute_ConstantBTX2HatInAngularBins()

void EdbPVRQuality::Execute_ConstantBTX2HatInAngularBins ( )
2147 {
2148  Log(2,"EdbPVRQuality::Execute_ConstantBTX2HatInAngularBins","NOT YET IMPLEMENTED...Execute_ConstantBTX2HatInAngularBins...done.");
2149  return;
2150 }

◆ Execute_EqualizeTanThetaSpace()

void EdbPVRQuality::Execute_EqualizeTanThetaSpace ( )

TODO !!! SWITCH HERE BETWEEN THE RIGHT SWITCH !!!

3711 {
3713 // Execute_EqualizeTanThetaSpace_ConstantBTDensity();
3714 // Execute_EqualizeTanThetaSpace_ConstantBTQuality();
3715 // Execute_EqualizeTanThetaSpace_ConstantBTX2Hat();
3716 // Execute_EqualizeTanThetaSpace_RandomCut();
3717 
3719  return;
3720 }
void PrintCutValues(Int_t CutType)
Definition: EdbPVRQuality.cxx:3677

◆ Execute_EqualizeTanThetaSpace_ConstantBTDensity()

void EdbPVRQuality::Execute_EqualizeTanThetaSpace_ConstantBTDensity ( )
3727 {
3728  cout << "EdbPVRQuality::Execute_EqualizeTanThetaSpace_ConstantBTDensity" << endl;
3729 
3731 
3732  if (!eIsSource) return;
3733  if (NULL==eAli_orig) return;
3734 
3735  TH1F* histPatternBTDensity = new TH1F("histPatternBTDensityTT","histPatternBTDensityTT",200,0,200);
3736  TH1F* histPatternBTDensities[10]; // for the angular bins:
3737  for (Int_t angspacecounter=0; angspacecounter<10; angspacecounter++) {
3738  histPatternBTDensities[angspacecounter] = new TH1F(Form("histPatternBTDensities_%d",angspacecounter),Form("histPatternBTDensities_%d",angspacecounter),200,0,200);
3739  }
3740  Double_t angularspacebinningwidth=0.1;
3741  Double_t angularspacebinningstart=0.00;
3742  Double_t angularspacebinningend=0.00;
3743  Double_t angularspacebinningScaleFactor=1;
3744  Double_t tt=0;
3745  Double_t ni[20];
3746  Double_t NumberOfFilledTTbins=0;
3747  TH1F* eHistTTClone = (TH1F*)eHistTT->Clone();
3748  Int_t BTNumberLevelAngularSpace[20];
3749  for (int i=0; i<1; i++) {
3750  BTNumberLevelAngularSpace[i]=0;
3751  }
3752 
3753 
3754 
3755  //---------------------------------------------------------------------
3756  // Loop over the patterns:
3757  for (int i=0; i<eAli_maxNpatterns; i++) {
3758 // for (int i=0; i<1; i++) {
3759 
3761  Int_t npat=pat->N();
3762  cout << "EdbPVRQuality::Execute_EqualizeTanThetaSpace_ConstantBTDensity For this (" << i << ") pattern, I have " << npat << " Edb segments to check..." << endl;
3763 
3764  // Reset eBTDensity levels:
3765  for (Int_t angspacecounter=0; angspacecounter<10; angspacecounter++) {
3767  // Maximum Cut Value for const, BT dens, also in tangens theta space
3768  eCutTTp0[i][angspacecounter]=1.00;
3769  eCutTTp1[i][angspacecounter]=0.15;
3770  }
3771 
3772  // Now do the angular space binning loop:
3773  for (Int_t angspacecounter=0; angspacecounter<10; angspacecounter++) {
3774  cout << endl << "EdbPVRQuality::Execute_EqualizeTanThetaSpace_ConstantBTDensity Doing now the angspacecounter loop: angspacecounter = " << angspacecounter << endl;
3775 
3776  // Calculate right end of angular space bin
3777  angularspacebinningstart=(Double_t)angspacecounter*angularspacebinningwidth;
3778  angularspacebinningend=angularspacebinningstart+angularspacebinningwidth;
3779 
3780  cout << "EdbPVRQuality::Execute_EqualizeTanThetaSpace_ConstantBTDensity Doing TT Bin from " << angularspacebinningstart << " to " << angularspacebinningend << endl;
3781 
3782  // Now the condition loop:
3783  // Loop over 20 ( or 40 ) steps a 0.15,0.145,0.14 ... down to 0.07
3784  Int_t lmax=20;
3785 
3786  for (Int_t l=0; l<lmax; l++) {
3787  // Shorter Handings:
3788  Double_t Cutp0 = eCutTTp0[i][angspacecounter];
3789  Double_t Cutp1 = eCutTTp1[i][angspacecounter];
3790 
3791  cout << "EdbPVRQuality::Execute_EqualizeTanThetaSpace_ConstantBTDensity Doing now the condition loop: l = " << l << ", the cut condition reads: seg->Chi2() >= seg->W()* " << Cutp1 << " - " << Cutp0 << endl;
3792 
3793  // Important to clean the histograms:
3794  eHistXY->Reset(); // important to clean the histogram
3795  eHistXY->SetMinimum(1);
3796  // eHistXY->SetMaximum(250); /// to be calculated accordingly !! ???ß WHY WHY WHY
3797  eHistWChi2->Reset(); // important to clean the histogram
3798  histPatternBTDensity->Reset(); // important to clean the histogram
3799  eHistTT->Reset(); // important to clean the histogram
3800  eHistTTClone->Reset(); // important to clean the histogram
3801  histPatternBTDensities[angspacecounter]->Reset(); // important to clean the histogram
3802 
3803  // Reset Number of Segments Counter
3804  ni[angspacecounter]=0;
3805 
3806  // Now Get Pattern:
3808  Int_t npat=pat->N();
3809  EdbSegP* seg=0;
3810 
3811  // Loop over the segments.
3812  for (int j=0; j<npat; j++) {
3813  seg=pat->GetSegment(j);
3814  Bool_t result=kTRUE;
3815  if (seg->MCEvt()>0) {
3817  result = kTRUE;
3818  }
3819  else {
3820  result = kFALSE;
3821  }
3822  }
3823  // Main decision for segment to be kept or not (seg is of MC or data type).
3824  if ( kFALSE == result ) continue;
3825 
3826  // Calculate Angle
3827  tt=seg->Theta();
3828 
3829  // Fill Clone histo. This is needed for the polynomial fit.
3830  eHistTTClone->Fill(tt);
3831 
3832  // Check if angle is in the desired angular space bin:
3833  Int_t segttspacebin=GetAngularSpaceBin(seg);
3834  if (segttspacebin!=angspacecounter) continue;
3835 
3836  // Constant BT density cut for angular space:
3837  if (seg->Chi2() >= seg->W()* eCutTTp1[i][angspacecounter] - eCutTTp0[i][angspacecounter]) continue;
3838 
3839  // Increase counter for number of taken segments in tan theta bin:
3840  ni[angspacecounter] += 1;
3841  // Fill other histograms anyway
3842  eHistXY->Fill(seg->X(),seg->Y());
3843  eHistTXTY->Fill(seg->TX(),seg->TY());
3844  eHistTT->Fill(tt);
3845  eHistWChi2->Fill(seg->W(),seg->Chi2());
3846  } // Loop over the segments.
3847 
3848  // Do the quadratic fit for the minimumTTBin only at the first time.
3849  if (l==0) {
3850  eHistTTClone->Fit("pol2","0q","0q",0,0.5);
3851  TF1 *myfunc = eHistTTClone->GetFunction("pol2");
3852  Double_t par0 = myfunc->GetParameter(0);
3853  Double_t par1 = myfunc->GetParameter(1);
3854  Double_t par2 = myfunc->GetParameter(2);
3855 
3856  Int_t minimumTTBin = eHistTTClone->FindBin( -par1/(2*par2));
3857  Int_t nEntriesInMinimumBin = eHistTTClone->GetBinContent(minimumTTBin);
3858  BTNumberLevelAngularSpace[angspacecounter] = Int_t(ni[angspacecounter]- eCutTTSqueezeFactor* Float_t(ni[angspacecounter]-nEntriesInMinimumBin));
3859 
3860  cout << "EdbPVRQuality::Execute_EqualizeTanThetaSpace_ConstantBTDensity Minimum should be at TanTheta = " << -par1/(2*par2) << " and it is in bin # " << minimumTTBin << " ; there are so many entries: " << nEntriesInMinimumBin << endl;
3861  cout << "EdbPVRQuality::Execute_EqualizeTanThetaSpace_ConstantBTDensity For bin " << angspacecounter << ", there are at the beginning so many segments: " << ni[angspacecounter] << endl;
3862  cout << "EdbPVRQuality::Execute_EqualizeTanThetaSpace_ConstantBTDensity BTNumberLevelAngularSpace[angspacecounter] = " << BTNumberLevelAngularSpace[angspacecounter] << endl;
3863  } // if (l==0)
3864 
3865  int nbins=eHistXY->GetNbinsX()*eHistXY->GetNbinsY();
3866  int NemptyBins=0;
3867  int NFilledBins=0;
3868  for (int k=1; k<nbins-1; k++) {
3869  if (eHistXY->GetBinContent(k)==0) {
3870  ++NemptyBins;
3871  continue;
3872  }
3873  // due to the changed areasize in eHistXY, adapt the fill weight
3874  histPatternBTDensity->Fill(Double_t(eHistXY->GetBinContent(k))/ 6.25 );
3875  histPatternBTDensities[angspacecounter]->Fill(eHistXY->GetBinContent(k)/ 6.25);
3876  ++NFilledBins;
3877  }
3878  ePatternBTDensity_modified[i]=histPatternBTDensity->GetMean();
3879  Float_t ePatternBTDensityRMS_modified = histPatternBTDensity->GetRMS();
3880 
3881  if (gEDBDEBUGLEVEL>1) {
3882  cout << "EdbPVRQuality::Execute_EqualizeTanThetaSpace_ConstantBTDensity Loop l= " << l << ": for the Cutp1 : " << Cutp1 << " we have #NBT: " << ni[angspacecounter] << "+-" << sqrt(ni[angspacecounter]) <<", target number for this TT space bin = " << BTNumberLevelAngularSpace[angspacecounter] << endl;
3883  }
3884 
3885  // Now the condition check for angular space cut
3886  // This time, we do it in terms of Numbers Of Basetracks instead of BasetrackDensity/mm2
3887 // if (ePatternBTDensity_modified[i]<=eBTDensityLevelAngularSpace[angspacecounter]) {
3888  if (ni[angspacecounter] <=BTNumberLevelAngularSpace[angspacecounter]) {
3889  l=lmax;
3890  // When we passed down _under_ the desired Number of basetrack tracks, we raise
3891  // one last time the cuts, to come out at last one slight value over it....
3892  if (lmax==20) eCutTTp1[i][angspacecounter] = eCutTTp1[i][angspacecounter] +0.005;
3893  if (lmax==40) eCutTTp1[i][angspacecounter] = eCutTTp1[i][angspacecounter] +0.0025;
3894 
3895  cout << "EdbPVRQuality::Execute_EqualizeTanThetaSpace_ConstantBTDensity We reached the loop end due to good BT density level in this angular bin and finish loop. Set l to lmax: " << l << endl;
3896  // break; // no need to brake anymore since we set l to lmax....
3897  }
3898  else {
3899  // Next step, tighten cut:
3900  // lmax=20:
3901  if (lmax==20) {
3902  eCutTTp1[i][angspacecounter] = eCutTTp1[i][angspacecounter] -0.005;
3903  }
3904  // l=40:
3905  if (lmax==40) {
3906  eCutTTp1[i][angspacecounter] = eCutTTp1[i][angspacecounter] -0.0025;
3907  }
3908  if (l==lmax-1) {
3909  cout << "EdbPVRQuality::Execute_EqualizeTanThetaSpace_ConstantBTDensity ATTENTION! No more cuts to tighten up. Restore the last valid cut. Basetrack number wont go below last value!" << endl;
3910  if (lmax==20) eCutTTp1[i][angspacecounter] = eCutTTp1[i][angspacecounter] +0.005;
3911  if (lmax==40) eCutTTp1[i][angspacecounter] = eCutTTp1[i][angspacecounter] +0.0025;
3912  }
3913  }
3914 
3915  } // of condition loop...
3916 
3917  // Fill target profile histogram:
3918  Float_t bincontentXY=histPatternBTDensity->GetMean();
3919  eProfileBTdens_vs_PID_target->Fill(i,bincontentXY);
3920 
3921  angularspacebinningstart+=angularspacebinningwidth;
3922  } // for (int angspacecounter=0; angspacecounter<20; angspacecounter++)
3923 
3924  } // of Npattern loops..
3925  //---------------------------------------------------------------------
3926 
3927  eCutMethodIsDone[1]=kTRUE;
3928 
3929  // Check if modified or original PVRec object should be returned:
3930  cout << "EdbPVRQuality::Execute_EqualizeTanThetaSpace_ConstantBTDensity Check if modified or original PVRec object should be returned: " << endl;
3932  eNeedModified=kTRUE;
3933  cout << "EdbPVRQuality::Execute_EqualizeTanThetaSpace_ConstantBTDensity " << eNeedModified << endl;
3934  }
3935 
3936  delete histPatternBTDensity;
3937  delete eHistTTClone;
3938 
3939  cout << "EdbPVRQuality::Execute_EqualizeTanThetaSpace_ConstantBTDensity Cuts are done and saved to obtain desired BT density. " << endl;
3940  cout << "EdbPVRQuality::Execute_EqualizeTanThetaSpace_ConstantBTDensity If you want to apply the cuts now, run the CreateEdbPVRec() function now. " << endl;
3941  cout << "EdbPVRQuality::Execute_EqualizeTanThetaSpace_ConstantBTDensity...done." << endl;
3942  return;
3943 }
Float_t eBTDensityLevelAngularSpace[20]
Definition: EdbPVRQuality.h:59
void SetHistGeometry_OPERAandMCBinArea625()
Definition: EdbPVRQuality.cxx:1026
Float_t eCutTTSqueezeFactor
Definition: EdbPVRQuality.h:100

◆ Execute_EqualizeTanThetaSpace_ConstantBTQuality()

void EdbPVRQuality::Execute_EqualizeTanThetaSpace_ConstantBTQuality ( )
3957  {
3958  cout << "TODO" << endl;
3959 }

◆ Execute_EqualizeTanThetaSpace_ConstantBTX2Hat()

void EdbPVRQuality::Execute_EqualizeTanThetaSpace_ConstantBTX2Hat ( )

eHistXY->SetMaximum(250); /// to be calculated accordingly !! WHY ???

3994  {
3995  cout << "EdbPVRQuality::Execute_EqualizeTanThetaSpace_ConstantBTX2Hat" << endl;
3996 
3998 
3999  if (!eIsSource) return;
4000  if (NULL==eAli_orig) return;
4001 
4002  TH1F* histPatternBTDensity = new TH1F("histPatternBTDensityTT","histPatternBTDensityTT",200,0,200);
4003  TH1F* histPatternBTDensities[10]; // for the angular bins:
4004  for (Int_t angspacecounter=0; angspacecounter<10; angspacecounter++) {
4005  histPatternBTDensities[angspacecounter] = new TH1F(Form("histPatternBTDensities_%d",angspacecounter),Form("histPatternBTDensities_%d",angspacecounter),200,0,200);
4006  }
4007  Double_t angularspacebinningwidth=0.1;
4008  Double_t angularspacebinningstart=0.00;
4009  Double_t angularspacebinningend=0.00;
4010  Double_t angularspacebinningScaleFactor=1;
4011  Double_t tt=0;
4012  Double_t ni[20];
4013  Double_t NumberOfFilledTTbins=0;
4014  TH1F* eHistTTClone = (TH1F*)eHistTT->Clone();
4015  Int_t BTNumberLevelAngularSpace[20];
4016  for (int i=0; i<1; i++) {
4017  BTNumberLevelAngularSpace[i];
4018  }
4019 
4020 
4021  // Create the temporary needed histograms:
4022  TH1F* h_chi2 = new TH1F("h_chi2","h_chi2",100,0,2);
4023  TH1F* h_chi2Normalized = new TH1F("h_chi2Normalized","h_chi2Normalized",100,0,5);
4024  TH1F* h_WTilde = new TH1F("h_WTilde","h_WTilde",40,0,0.1);
4025  TH1F* h_WTildeNormalized = new TH1F("h_WTildeNormalized","h_WTildeNormalized",100,0,5);
4026  TH1F* h_X2 = new TH1F("h_X2","h_X2",100,0,5);
4027 
4028  //---------------------------------------------------------------------
4029  // Loop over the patterns:
4030  for (int i=0; i<eAli_maxNpatterns; i++) {
4031 // for (int i=0; i<1; i++) {
4032 
4033  Float_t chi2Normalized=0;
4034  Float_t WTilde=0;
4035  Float_t WTildeNormalized=0;
4036  Float_t X2Hat=0;
4037  Float_t m_chi2=0;
4038  Float_t s_chi2=0;
4039  Float_t m_WTilde=0;
4040  Float_t s_WTilde=0;
4041 
4043  Int_t npat=pat->N();
4044  cout << "EdbPVRQuality::Execute_EqualizeTanThetaSpace_ConstantBTX2Hat For this (" << i << ") pattern, I have " << npat << " Edb segments to check..." << endl;
4045 
4046  // Reset eBTDensity levels:
4047  for (Int_t angspacecounter=0; angspacecounter<10; angspacecounter++) {
4049  // Maximum Cut Value for ConstantBTX2Hat , also in tangens theta space
4050  eCutTTp0[i][angspacecounter]=4.00; // not needed here.
4051  eCutTTp1[i][angspacecounter]=4.00; // -> eX2HatCut
4052  }
4053 
4054 
4055  // Now do the angular space binning loop:
4056  for (Int_t angspacecounter=0; angspacecounter<10; angspacecounter++) {
4057 // for (Int_t angspacecounter=0; angspacecounter<1; angspacecounter++) {
4058  cout << endl << "EdbPVRQuality::Execute_EqualizeTanThetaSpace_ConstantBTX2Hat Doing now the angspacecounter loop: angspacecounter = " << angspacecounter << endl;
4059 
4060  // Calculate right end of angular space bin
4061  angularspacebinningstart=(Double_t)angspacecounter*angularspacebinningwidth;
4062  angularspacebinningend=angularspacebinningstart+angularspacebinningwidth;
4063 
4064  cout << "EdbPVRQuality::Execute_EqualizeTanThetaSpace_ConstantBTX2Hat Doing TT Bin from " << angularspacebinningstart << " to " << angularspacebinningend << endl;
4065 
4066  // Now the condition loop:
4067  // Loop over 20 ( or 40 ) steps a 0.15,0.145,0.14 ... down to 0.07
4068  Int_t lmax=20;
4069 
4070  for (Int_t l=0; l<lmax; l++) {
4071  // Shorter Handings:
4072  Double_t Cutp0 = eCutTTp0[i][angspacecounter];
4073  Double_t Cutp1 = eCutTTp1[i][angspacecounter];
4074 
4075  cout << "EdbPVRQuality::Execute_EqualizeTanThetaSpace_ConstantBTX2Hat Doing now the condition loop: l = " << l << ", the cut condition reads: Xi2Hat < " << Cutp1 << endl;
4076 
4077  // Important to clean the histograms:
4078  eHistXY->Reset(); // important to clean the histogram
4079  eHistXY->SetMinimum(1);
4081  eHistWChi2->Reset(); // important to clean the histogram
4082  histPatternBTDensity->Reset(); // important to clean the histogram
4083  eHistTT->Reset(); // important to clean the histogram
4084  eHistTTClone->Reset(); // important to clean the histogram
4085  histPatternBTDensities[angspacecounter]->Reset(); // important to clean the histogram
4086 
4087  // Clean also histograms that are used for the X2Hat variable:
4088  h_chi2->Reset();
4089  h_chi2Normalized->Reset();
4090  h_WTilde->Reset();
4091  h_WTildeNormalized->Reset();
4092  h_X2->Reset();
4093 
4094  // Reset Number of Segments Counter
4095  ni[angspacecounter]=0;
4096 
4097  // Now Get Pattern:
4099  Int_t npat=pat->N();
4100  EdbSegP* seg=0;
4101 
4102  // Loop over the segments.
4103  // Here do it two times, one time to get Mean and RMS of Chi2 and WTilde distribution.
4104 
4105  for (int j=0; j<npat; j++) {
4106  seg=pat->GetSegment(j);
4107  Bool_t result=kTRUE;
4108  if (seg->MCEvt()>0) {
4110  result = kTRUE;
4111  }
4112  else {
4113  result = kFALSE;
4114  }
4115  }
4116 
4117  // Main decision for segment to be kept or not (seg is of MC or data type).
4118  if ( kFALSE == result ) continue;
4119 
4120  // Calculate Angle
4121  tt=seg->Theta();
4122 
4123  // Fill Clone histo. This is needed for the polynomial fit.
4124  eHistTTClone->Fill(tt);
4125 
4126  // Check if angle is in the desired angular space bin:
4127  Int_t segttspacebin=GetAngularSpaceBin(seg);
4128  if (segttspacebin!=angspacecounter) continue;
4129 
4130 
4131  // Pre-Fill the Chi2() and W() histograms to get Mean and RMS values right:
4132  h_chi2->Fill(seg->Chi2());
4133  WTilde=1./(seg->W());
4134  h_WTilde->Fill(WTilde);
4135 
4136 
4137  // Calulation of the histograms to get Mean and RMS values right:
4138  m_chi2=h_chi2->GetMean();
4139  s_chi2=h_chi2->GetRMS();
4140  m_WTilde=h_WTilde->GetMean();
4141  s_WTilde=h_WTilde->GetRMS();
4142  eXi2HatTT_m_chi2[i][angspacecounter]=m_chi2;
4143  eXi2HatTT_s_chi2[i][angspacecounter]=s_chi2;
4144  eXi2HatTT_m_WTilde[i][angspacecounter]=m_WTilde;
4145  eXi2HatTT_s_WTilde[i][angspacecounter]=s_WTilde;
4146 
4147 
4148  } // Loop over the segments. For the first time...
4149 
4150  if (l==0) {
4151  cout << "Loop over the segments. For the first time... done. Information about the histograms:" << endl;
4152  cout << "h_chi2: Mean , Sigma: " << m_chi2 << " " << s_chi2 << endl;
4153  cout << "h_WTilde: Mean , Sigma: " << m_WTilde << " " << s_WTilde << endl;
4154  }
4155 
4156  // Now that we have the mean and sigmas of the Xi2Hat distribution
4157  // We loop over the segments once again.
4158  // Second loop.
4159  for (int j=0; j<npat; j++) {
4160  seg=pat->GetSegment(j);
4161  Bool_t result=kTRUE;
4162  if (seg->MCEvt()>0) {
4164  result = kTRUE;
4165  }
4166  else {
4167  result = kFALSE;
4168  }
4169  }
4170  // Main decision for segment to be kept or not (seg is of MC or data type).
4171  if ( kFALSE == result ) continue;
4172 
4173  // Calculate Angle
4174  tt=seg->Theta();
4175 
4176  // Fill Clone histo. This is needed for the polynomial fit.
4177  // Already done in the first time loop
4178  // eHistTTClone->Fill(tt);
4179 
4180  // Check if angle is in the desired angular space bin:
4181  Int_t segttspacebin=GetAngularSpaceBin(seg);
4182  if (segttspacebin!=angspacecounter) continue;
4183 
4184  // Calculate that Xi2Hat value, since we have now mean and rms of the distribution histograms:
4185  chi2Normalized=TMath::Power((seg->Chi2()-m_chi2)/s_chi2,2);
4187  WTilde=1./(seg->W());
4188  WTildeNormalized=TMath::Power((WTilde-m_WTilde)/s_WTilde,2);
4191  h_X2->Fill(X2Hat);
4192 
4193 
4194  // Cut on the Xi2Hat Value:
4195  if (X2Hat>eCutTTp1[i][angspacecounter]) continue;
4196 
4197  // Increase counter for number of taken segments in tan theta bin:
4198  ni[angspacecounter] += 1;
4199  // Fill other histograms anyway
4200  eHistXY->Fill(seg->X(),seg->Y());
4201  eHistTXTY->Fill(seg->TX(),seg->TY());
4202  eHistTT->Fill(tt);
4203  eHistWChi2->Fill(seg->W(),seg->Chi2());
4204  } // Loop over the segments. For the second time. Done.
4205 
4206 
4207 
4208 
4209 
4210 
4211 
4212  // Do the quadratic fit for the minimumTTBin only at the first time.
4213  if (l==0) {
4214  eHistTTClone->Fit("pol2","0q","0q",0,0.5);
4215  TF1 *myfunc = eHistTTClone->GetFunction("pol2");
4216  Double_t par0 = myfunc->GetParameter(0);
4217  Double_t par1 = myfunc->GetParameter(1);
4218  Double_t par2 = myfunc->GetParameter(2);
4219 
4220  Int_t minimumTTBin = eHistTTClone->FindBin( -par1/(2*par2));
4221  Int_t nEntriesInMinimumBin = eHistTTClone->GetBinContent(minimumTTBin);
4222  BTNumberLevelAngularSpace[angspacecounter] = Int_t(ni[angspacecounter]- eCutTTSqueezeFactor* Float_t(ni[angspacecounter]-nEntriesInMinimumBin));
4223 
4224  cout << "EdbPVRQuality::Execute_EqualizeTanThetaSpace_ConstantBTX2Hat Minimum should be at TanTheta = " << -par1/(2*par2) << " and it is in bin # " << minimumTTBin << " ; there are so many entries: " << nEntriesInMinimumBin << endl;
4225  cout << "EdbPVRQuality::Execute_EqualizeTanThetaSpace_ConstantBTX2Hat For bin " << angspacecounter << ", there are at the beginning so many segments: " << ni[angspacecounter] << endl;
4226  cout << "EdbPVRQuality::Execute_EqualizeTanThetaSpace_ConstantBTX2Hat BTNumberLevelAngularSpace[angspacecounter] = " << BTNumberLevelAngularSpace[angspacecounter] << endl;
4227  } // if (l==0)
4228 
4229  int nbins=eHistXY->GetNbinsX()*eHistXY->GetNbinsY();
4230  int NemptyBins=0;
4231  int NFilledBins=0;
4232  for (int k=1; k<nbins-1; k++) {
4233  if (eHistXY->GetBinContent(k)==0) {
4234  ++NemptyBins;
4235  continue;
4236  }
4237  // due to the changed areasize in eHistXY, adapt the fill weight
4238  histPatternBTDensity->Fill(Double_t(eHistXY->GetBinContent(k))/ 6.25 );
4239  histPatternBTDensities[angspacecounter]->Fill(eHistXY->GetBinContent(k)/ 6.25);
4240  ++NFilledBins;
4241  }
4242  ePatternBTDensity_modified[i]=histPatternBTDensity->GetMean();
4243  Float_t ePatternBTDensityRMS_modified = histPatternBTDensity->GetRMS();
4244 
4245  // leave also if only one entry in the histogram
4246  if (NFilledBins<=1) {
4247  l=lmax;
4248  cout << "Attention! Only one entry in the histogram" << endl;
4249  }
4250 
4251  if (gEDBDEBUGLEVEL>1) {
4252  cout << "EdbPVRQuality::Execute_EqualizeTanThetaSpace_ConstantBTX2Hat Loop l= " << l << ": for the Cutp1 : " << Cutp1 << " we have #NBT: " << ni[angspacecounter] << "+-" << sqrt(ni[angspacecounter]) <<", target number for this TT space bin = " << BTNumberLevelAngularSpace[angspacecounter] << endl;
4253  }
4254 
4255  // Now the condition check for angular space cut
4256  // This time, we do it in terms of Numbers Of Basetracks instead of BasetrackDensity/mm2
4257 // if (ePatternBTDensity_modified[i]<=eBTDensityLevelAngularSpace[angspacecounter]) {
4258  if (ni[angspacecounter] <=BTNumberLevelAngularSpace[angspacecounter]) {
4259  l=lmax;
4260  // When we passed down _under_ the desired Number of basetrack tracks, we raise
4261  // one last time the cuts, to come out at last one slight value over it....
4262  if (lmax==20) eCutTTp1[i][angspacecounter] = eCutTTp1[i][angspacecounter] +0.2;
4263  if (lmax==40) eCutTTp1[i][angspacecounter] = eCutTTp1[i][angspacecounter] +0.1;
4264 
4265  cout << "EdbPVRQuality::Execute_EqualizeTanThetaSpace_ConstantBTX2Hat We reached the loop end due to good BT density level in this angular bin and finish loop. Set l to lmax: " << l << endl;
4266  // break; // no need to brake anymore since we set l to lmax....
4267  }
4268  else {
4269  // Next step, tighten cut:
4270  // lmax=20:
4271  if (lmax==20) {
4272  eCutTTp1[i][angspacecounter] = eCutTTp1[i][angspacecounter] -0.2;
4273  }
4274  // l=40:
4275  if (lmax==40) {
4276  eCutTTp1[i][angspacecounter] = eCutTTp1[i][angspacecounter] -0.1;
4277  }
4278  if (l==lmax-1) {
4279  cout << "EdbPVRQuality::Execute_EqualizeTanThetaSpace_ConstantBTX2Hat ATTENTION! No more cuts to tighten up. Restore the last valid cut. Basetrack number wont go below last value!" << endl;
4280  if (lmax==20) eCutTTp1[i][angspacecounter] = eCutTTp1[i][angspacecounter] +0.2;
4281  if (lmax==40) eCutTTp1[i][angspacecounter] = eCutTTp1[i][angspacecounter] +0.1;
4282  }
4283  }
4284 
4285  } // of condition loop...
4286 
4287  // Fill target profile histogram:
4288  Float_t bincontentXY=histPatternBTDensity->GetMean();
4289  eProfileBTdens_vs_PID_target->Fill(i,bincontentXY);
4290 
4291  angularspacebinningstart+=angularspacebinningwidth;
4292  } // for (int angspacecounter=0; angspacecounter<20; angspacecounter++)
4293 
4294  } // of Npattern loops..
4295  //---------------------------------------------------------------------
4296 
4297  eCutMethodIsDone[5]=kTRUE;
4298 
4299  // Check if modified or original PVRec object should be returned:
4300  cout << "EdbPVRQuality::Execute_EqualizeTanThetaSpace_ConstantBTX2Hat Check if modified or original PVRec object should be returned: " << endl;
4302  eNeedModified=kTRUE;
4303  cout << "EdbPVRQuality::Execute_EqualizeTanThetaSpace_ConstantBTX2Hat " << eNeedModified << endl;
4304  }
4305 
4306  delete histPatternBTDensity;
4307  delete eHistTTClone;
4308 
4309  cout << "EdbPVRQuality::Execute_EqualizeTanThetaSpace_ConstantBTX2Hat Cuts are done and saved to obtain desired BT density. " << endl;
4310  cout << "EdbPVRQuality::Execute_EqualizeTanThetaSpace_ConstantBTX2Hat If you want to apply the cuts now, run the CreateEdbPVRec() function now. " << endl;
4311  cout << "EdbPVRQuality::Execute_EqualizeTanThetaSpace_ConstantBTX2Hat...done." << endl;
4312  return;
4313 }

◆ Execute_EqualizeTanThetaSpace_RandomCut()

void EdbPVRQuality::Execute_EqualizeTanThetaSpace_RandomCut ( )

eHistXY->SetMaximum(250); /// to be calculated accordingly !! WHY ???

4319  {
4320  cout << "EdbPVRQuality::Execute_EqualizeTanThetaSpace_RandomCut" << endl;
4321 
4323 
4324  if (!eIsSource) return;
4325  if (NULL==eAli_orig) return;
4326 
4327  TH1F* histPatternBTDensity = new TH1F("histPatternBTDensityTT","histPatternBTDensityTT",200,0,200);
4328  TH1F* histPatternBTDensities[10]; // for the angular bins:
4329  for (Int_t angspacecounter=0; angspacecounter<10; angspacecounter++) {
4330  histPatternBTDensities[angspacecounter] = new TH1F(Form("histPatternBTDensities_%d",angspacecounter),Form("histPatternBTDensities_%d",angspacecounter),200,0,200);
4331  }
4332 
4333  // Before Starting create the Random Generator:
4334  cout << "EdbPVRQuality::Execute_RandomCutInAngularBins Create the Random Generator with unique Seed" << endl;
4335  cout << "EdbPVRQuality::Execute_RandomCutInAngularBins TRandom3* RandomGenerator = new TRandom3(0);" << endl;
4336  TRandom3* RandomGenerator = new TRandom3(0);
4337 
4338  Double_t angularspacebinningwidth=0.1;
4339  Double_t angularspacebinningstart=0.00;
4340  Double_t angularspacebinningend=0.00;
4341  Double_t angularspacebinningScaleFactor=1;
4342  Double_t tt=0;
4343  Double_t ni[20];
4344  Double_t NumberOfFilledTTbins=0;
4345  TH1F* eHistTTClone = (TH1F*)eHistTT->Clone();
4346  Int_t BTNumberLevelAngularSpace[20];
4347  for (int i=0; i<1; i++) {
4348  BTNumberLevelAngularSpace[i];
4349  }
4350 
4351 
4352 
4353  //---------------------------------------------------------------------
4354  // Loop over the patterns:
4355  for (int i=0; i<eAli_maxNpatterns; i++) {
4356 // for (int i=0; i<1; i++) {
4357 
4359  Int_t npat=pat->N();
4360  cout << "EdbPVRQuality::Execute_EqualizeTanThetaSpace_RandomCut For this (" << i << ") pattern, I have " << npat << " Edb segments to check..." << endl;
4361 
4362  // Reset eBTDensity levels:
4363  for (Int_t angspacecounter=0; angspacecounter<10; angspacecounter++) {
4365  // Maximum Cut Value for const, BT dens, also in tangens theta space
4366  // Uniform from 0..1. This cutroutine uses only the parameter: "eCutTTp1"
4367  eCutTTp0[i][angspacecounter]=1.00;
4368  eCutTTp1[i][angspacecounter]=1.00;
4369  }
4370 
4371  // Now do the angular space binning loop:
4372  for (Int_t angspacecounter=0; angspacecounter<10; angspacecounter++) {
4373 // for (Int_t angspacecounter=0; angspacecounter<1; angspacecounter++) {
4374  cout << endl << "EdbPVRQuality::Execute_EqualizeTanThetaSpace_RandomCut Doing now the angspacecounter loop: angspacecounter = " << angspacecounter << endl;
4375 
4376  // Calculate right end of angular space bin
4377  angularspacebinningstart=(Double_t)angspacecounter*angularspacebinningwidth;
4378  angularspacebinningend=angularspacebinningstart+angularspacebinningwidth;
4379 
4380  cout << "EdbPVRQuality::Execute_EqualizeTanThetaSpace_RandomCut Doing TT Bin from " << angularspacebinningstart << " to " << angularspacebinningend << endl;
4381 
4382  // Now the condition loop:
4383  // Loop over 20 steps a either 5% reduction or 40 steps a 2.5% reduction
4384  Int_t lmax=20;
4385 // Int_t lmax=40;
4386 
4387  for (Int_t l=0; l<lmax; l++) {
4388  // Shorter Handings:
4389  Double_t Cutp0 = eCutTTp0[i][angspacecounter];
4390  Double_t Cutp1 = eCutTTp1[i][angspacecounter];
4391 
4392  cout << "EdbPVRQuality::Execute_EqualizeTanThetaSpace_RandomCut Doing now the condition loop: l = " << l << ", the cut condition reads: RandomGenerator->Uniform() > " << Cutp1 << endl;
4393 
4394  // Important to clean the histograms:
4395  eHistXY->Reset(); // important to clean the histogram
4396  eHistXY->SetMinimum(1);
4398  eHistWChi2->Reset(); // important to clean the histogram
4399  histPatternBTDensity->Reset(); // important to clean the histogram
4400  eHistTT->Reset(); // important to clean the histogram
4401  eHistTTClone->Reset(); // important to clean the histogram
4402  histPatternBTDensities[angspacecounter]->Reset(); // important to clean the histogram
4403 
4404  // Reset Number of Segments Counter
4405  ni[angspacecounter]=0;
4406 
4407  // Now Get Pattern:
4409  Int_t npat=pat->N();
4410  EdbSegP* seg=0;
4411 
4412  // Loop over the segments.
4413  for (int j=0; j<npat; j++) {
4414  seg=pat->GetSegment(j);
4415  Bool_t result=kTRUE;
4416  if (seg->MCEvt()>0) {
4418  result = kTRUE;
4419  }
4420  else {
4421  result = kFALSE;
4422  }
4423  }
4424 
4425  // Main decision for segment to be kept or not (seg is of MC or data type).
4426  if ( kFALSE == result ) continue;
4427 
4428  // Calculate Angle
4429  tt=seg->Theta();
4430 
4431  // Fill Clone histo. This is needed for the polynomial fit.
4432  eHistTTClone->Fill(tt);
4433 
4434  // Check if angle is in the desired angular space bin:
4435  Int_t segttspacebin=GetAngularSpaceBin(seg);
4436  if (segttspacebin!=angspacecounter) continue;
4437 
4438  // Random CutMethod: for angular space:
4439  if (RandomGenerator->Uniform()>eCutTTp1[i][angspacecounter]) continue;
4440 
4441 
4442  // Increase counter for number of taken segments in tan theta bin:
4443  ni[angspacecounter] += 1;
4444  // Fill other histograms anyway
4445  eHistXY->Fill(seg->X(),seg->Y());
4446  eHistTXTY->Fill(seg->TX(),seg->TY());
4447  eHistTT->Fill(tt);
4448  eHistWChi2->Fill(seg->W(),seg->Chi2());
4449  } // Loop over the segments.
4450 
4451  // Do the quadratic fit for the minimumTTBin only at the first time.
4452  if (l==0) {
4453  eHistTTClone->Fit("pol2","0q","0q",0,0.5);
4454  TF1 *myfunc = eHistTTClone->GetFunction("pol2");
4455  Double_t par0 = myfunc->GetParameter(0);
4456  Double_t par1 = myfunc->GetParameter(1);
4457  Double_t par2 = myfunc->GetParameter(2);
4458 
4459  Int_t minimumTTBin = eHistTTClone->FindBin( -par1/(2*par2));
4460  Int_t nEntriesInMinimumBin = eHistTTClone->GetBinContent(minimumTTBin);
4461  BTNumberLevelAngularSpace[angspacecounter] = Int_t(ni[angspacecounter]- eCutTTSqueezeFactor* Float_t(ni[angspacecounter]-nEntriesInMinimumBin));
4462 
4463  cout << "EdbPVRQuality::Execute_EqualizeTanThetaSpace_RandomCut Minimum should be at TanTheta = " << -par1/(2*par2) << " and it is in bin # " << minimumTTBin << " ; there are so many entries: " << nEntriesInMinimumBin << endl;
4464  cout << "EdbPVRQuality::Execute_EqualizeTanThetaSpace_RandomCut For bin " << angspacecounter << ", there are at the beginning so many segments: " << ni[angspacecounter] << endl;
4465  cout << "EdbPVRQuality::Execute_EqualizeTanThetaSpace_RandomCut BTNumberLevelAngularSpace[angspacecounter] = " << BTNumberLevelAngularSpace[angspacecounter] << endl;
4466  } // if (l==0)
4467 
4468  int nbins=eHistXY->GetNbinsX()*eHistXY->GetNbinsY();
4469  int NemptyBins=0;
4470  int NFilledBins=0;
4471  for (int k=1; k<nbins-1; k++) {
4472  if (eHistXY->GetBinContent(k)==0) {
4473  ++NemptyBins;
4474  continue;
4475  }
4476  // due to the changed areasize in eHistXY, adapt the fill weight
4477  histPatternBTDensity->Fill(Double_t(eHistXY->GetBinContent(k))/ 6.25 );
4478  histPatternBTDensities[angspacecounter]->Fill(eHistXY->GetBinContent(k)/ 6.25);
4479  ++NFilledBins;
4480  }
4481  ePatternBTDensity_modified[i]=histPatternBTDensity->GetMean();
4482  Float_t ePatternBTDensityRMS_modified = histPatternBTDensity->GetRMS();
4483 
4484  // leave also if only one entry in the histogram
4485  if (ePatternBTDensity_modified[i]<=1) l=lmax;
4486 
4487  if (gEDBDEBUGLEVEL>1) {
4488  cout << "EdbPVRQuality::Execute_EqualizeTanThetaSpace_RandomCut Loop l= " << l << ": for the Cutp1 : " << Cutp1 << " we have #NBT: " << ni[angspacecounter] << "+-" << sqrt(ni[angspacecounter]) <<", target number for this TT space bin = " << BTNumberLevelAngularSpace[angspacecounter] << endl;
4489  }
4490 
4491  // Now the condition check for angular space cut
4492  // This time, we do it in terms of Numbers Of Basetracks instead of BasetrackDensity/mm2
4493  if (ni[angspacecounter] <=BTNumberLevelAngularSpace[angspacecounter]) {
4494  l=lmax;
4495  // When we passed down _under_ the desired Number of basetrack tracks, we raise
4496  // one last time the cuts, to come out at last one slight value over it....
4497  if (lmax==20) eCutTTp1[i][angspacecounter] = eCutTTp1[i][angspacecounter] +0.05;
4498  if (lmax==40) eCutTTp1[i][angspacecounter] = eCutTTp1[i][angspacecounter] +0.025;
4499 
4500  cout << "EdbPVRQuality::Execute_EqualizeTanThetaSpace_RandomCut We reached the loop end due to good BT density level in this angular bin and finish loop. Set l to lmax: " << l << endl;
4501  // break; // no need to brake anymore since we set l to lmax....
4502  }
4503  else {
4504  // Next step, tighten cut:
4505  // lmax=20:
4506  if (lmax==20) {
4507  eCutTTp1[i][angspacecounter] = eCutTTp1[i][angspacecounter] -0.05;
4508  }
4509  // l=40:
4510  if (lmax==40) {
4511  eCutTTp1[i][angspacecounter] = eCutTTp1[i][angspacecounter] -0.025;
4512  }
4513  if (l==lmax-1) {
4514  cout << "EdbPVRQuality::Execute_EqualizeTanThetaSpace_RandomCut ATTENTION! No more cuts to tighten up. Restore the last valid cut. Basetrack number wont go below last value!" << endl;
4515  if (lmax==20) eCutTTp1[i][angspacecounter] = eCutTTp1[i][angspacecounter] +0.05;
4516  if (lmax==40) eCutTTp1[i][angspacecounter] = eCutTTp1[i][angspacecounter] +0.025;
4517  }
4518  }
4519 
4520  } // of condition loop...
4521 
4522  // Fill target profile histogram:
4523  Float_t bincontentXY=histPatternBTDensity->GetMean();
4524  eProfileBTdens_vs_PID_target->Fill(i,bincontentXY);
4525 
4526  angularspacebinningstart+=angularspacebinningwidth;
4527  } // for (int angspacecounter=0; angspacecounter<20; angspacecounter++)
4528 
4529  } // of Npattern loops..
4530  //---------------------------------------------------------------------
4531 
4532  eCutMethodIsDone[7]=kTRUE;
4533 
4534  // Check if modified or original PVRec object should be returned:
4535  cout << "EdbPVRQuality::Execute_EqualizeTanThetaSpace_RandomCut Check if modified or original PVRec object should be returned: " << endl;
4537  eNeedModified=kTRUE;
4538  cout << "EdbPVRQuality::Execute_EqualizeTanThetaSpace_RandomCut " << eNeedModified << endl;
4539  }
4540 
4541  delete histPatternBTDensity;
4542  delete eHistTTClone;
4543 
4544  cout << "EdbPVRQuality::Execute_EqualizeTanThetaSpace_RandomCut Cuts are done and saved to obtain desired BT density. " << endl;
4545  cout << "EdbPVRQuality::Execute_EqualizeTanThetaSpace_RandomCut If you want to apply the cuts now, run the CreateEdbPVRec() function now. " << endl;
4546  cout << "EdbPVRQuality::Execute_EqualizeTanThetaSpace_RandomCut...done." << endl;
4547  return;
4548 }

◆ Execute_RandomCut()

void EdbPVRQuality::Execute_RandomCut ( )
2175 {
2176  // EdbPVRQuality::Execute_RandomCut()
2177  // Execute the modified cut routines to achieve arbitrary basetrack density level.
2178  // Basically used for control curposes.
2179  Log(2,"EdbPVRQuality::Execute_RandomCut","Execute_RandomCut");
2180 
2181 
2182  for (int i=0; i<80; ++i) cout << "-";
2183  cout << endl;
2184  cout << "-";
2185  cout << endl;
2186  cout << "EdbPVRQuality::Execute_RandomCut " << endl;
2187  cout << "-";
2188  cout << endl;
2189  for (int i=0; i<80; ++i) cout << "-";
2190  cout << endl;
2191 
2192  if (!eIsSource) return;
2193  if (NULL==eAli_orig) return;
2194 
2195  // Check the patterns of the EdbPVRec:
2197  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;
2198  if (eAli_maxNpatterns>114) {
2199  cout << "ERROR! EdbPVRQuality::Execute_RandomCut 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;
2200  eAli_maxNpatterns=114;
2201  }
2202 
2203  TH1F* histPatternBTDensity = new TH1F("histPatternBTDensity","histPatternBTDensity",200,0,200);
2204 
2205  // Before Starting Create the Random Generator:
2206  cout << "EdbPVRQuality::Execute_RandomCut Create the Random Generator with unique Seed" << endl;
2207  cout << "EdbPVRQuality::Execute_RandomCut TRandom3* RandomGenerator = new TRandom3(0);" << endl;
2208  TRandom3* RandomGenerator = new TRandom3(0);
2209 
2210 
2211  // Loop over the patterns:
2212  for (int i=0; i<eAli_maxNpatterns; i++) {
2213  if (i>56) {
2214  cout << "WARNING EdbPVRQuality::Execute_RandomCut Your EdbPVRec object has more than 57 patterns! " << endl;
2215  cout << "WARNING EdbPVRQuality::Execute_RandomCut Check it! " << endl;
2216  }
2217 
2218  cout << "EdbPVRQuality::Execute_RandomCut Set eCutp1[i] to the initial eRandomCutThreshold = " << eRandomCutThreshold << endl;
2220 
2221  if (gEDBDEBUGLEVEL>2) cout << "Execute_RandomCut Doing Pattern " << i << endl;
2222 
2223  // Now the condition loop:
2224  // Loop over 50 steps to determine new BG rate....
2225  for (int l=0; l<50; l++) {
2226 
2228 
2230  Int_t npat=pat->N();
2231  EdbSegP* seg=0;
2232  // Loop over the segments.
2233  for (int j=0; j<npat; j++) {
2234  seg=pat->GetSegment(j);
2235  // Very important:
2236  // For the data case, we assume the following:
2237  // Data (MCEvt<0) will be taken for BTdensity calculation
2238  // Sim (MCEvt>0) will NOT be taken for BTdensity calculation
2239  // We take it ONLY and ONLY into account if it is especially wished
2240  // by the user!
2241  // Therefore (s)he needs to know how many Gauge Coupling Parameters
2242  // in the Standard Model exist (at least)...
2243  Bool_t result=kTRUE;
2244  if (seg->MCEvt()>0) {
2246  result = kTRUE;
2247  }
2248  else {
2249  result = kFALSE;
2250  }
2251  }
2252 
2253  if (gEDBDEBUGLEVEL>4) cout << "Doing segment " << j << " result for bool query is: " << result << endl;
2254 
2255  // Main decision for segment to be kept or not (seg is of MC or data type).
2256  if ( kFALSE == result ) continue;
2257 
2258  // Random CutMethod:
2259  if (RandomGenerator->Uniform()>eCutp1[i]) continue;
2260 
2261  // For the check, fill the histograms in any case:
2262  eHistXY->Fill(seg->X(),seg->Y());
2263  eHistTXTY->Fill(seg->TX(),seg->TY());
2264  eHistTT->Fill(seg->Theta());
2265  eHistTTFillcheck->Fill(seg->Theta());
2266  eHistWChi2->Fill(seg->W(),seg->Chi2());
2267  }
2268 
2269  if (gEDBDEBUGLEVEL>2) cout << "I have filled the eHistXY Histogram. Entries = " << eHistXY->GetEntries() << endl;
2270 
2271  int nbins=eHistXY->GetNbinsX()*eHistXY->GetNbinsY();
2272  for (int k=1; k<nbins-1; k++) {
2273  if (eHistXY->GetBinContent(k)==0) continue;
2274  histPatternBTDensity->Fill(eHistXY->GetBinContent(k));
2275  }
2276 
2277  ePatternBTDensity_modified[i]=histPatternBTDensity->GetMean();
2278  if (gEDBDEBUGLEVEL>2) cout <<"Execute_ConstantBTDensity Loop l= " << l << ": for the eCutp1[i] : " << eCutp1[i] << " we have a dens: " << ePatternBTDensity_modified[i] << endl;
2279 
2280  // Now the condition check:
2282  if (gEDBDEBUGLEVEL>2) cout << "Execute_RandomCut We reached the loop end due to random cut based condition ... ... and break loop." << endl;
2283  break;
2284  }
2285  else {
2286  // Next step, tighten cut:
2287  eCutp1[i] += -0.02;
2288  }
2289 
2290  } // of condition loop...
2291 
2292  // Fill target profile histogram:
2293  Float_t bincontentXY=histPatternBTDensity->GetMean();
2294  eProfileBTdens_vs_PID_target->Fill(i,bincontentXY);
2295 
2296  } // of Npattern loops..
2297 
2298  eCutMethodIsDone[6]=kTRUE;
2299 
2300  // Check if modified or original PVRec object should be returned:
2302  eNeedModified=kTRUE;
2303  cout << "----------void EdbPVRQuality::Execute_ConstantBTDensity() Check if modified or original PVRec object should be returned: " << endl;
2304  cout << "----------void EdbPVRQuality::Execute_ConstantBTDensity() " << eNeedModified << endl;
2305  }
2306 
2307  // This will be commented when using in batch mode...
2308  // For now its there for clarity reasons.
2309  TCanvas* c1 = new TCanvas();
2310  c1->Divide(3,2);
2311  c1->cd(1);
2312  eHistXY->DrawCopy("colz");
2313  c1->cd(2);
2314  eHistWChi2->DrawCopy("colz");
2315  c1->cd(3);
2316  eHistTXTY->DrawCopy("colz");
2317  c1->cd(4);
2318  histPatternBTDensity->DrawCopy("");
2319  c1->cd(5);
2320  eProfileBTdens_vs_PID_source->Draw("profileZ");
2321  eProfileBTdens_vs_PID_source->GetXaxis()->SetRangeUser(0,eAli_maxNpatterns+2);
2322  c1->cd(6);
2323  eHistTT->DrawCopy("");
2324  c1->cd();
2325 
2326  eHistXY->Reset();
2327  eHistTXTY->Reset();
2328  eHistTT->Reset();
2329  eHistWChi2->Reset();
2330 
2335 
2340 
2341  delete histPatternBTDensity;
2342 
2343  cout << "----------void EdbPVRQuality::Execute_ConstantBTDensity() Cuts are done and saved to obtain desired BT density. " << endl;
2344  cout << "----------void EdbPVRQuality::Execute_ConstantBTDensity() If you want to apply the cuts now, run the CreateEdbPVRec() function now. " << endl;
2345  cout << "----------void EdbPVRQuality::Execute_ConstantBTDensity()....done." << endl;
2346 
2347  Log(2,"EdbPVRQuality::Execute_RandomCut","Execute_RandomCut...done.");
2348  return;
2349 }
Float_t eRandomCutThreshold
Definition: EdbPVRQuality.h:141

◆ Execute_RandomCutInAngularBins()

void EdbPVRQuality::Execute_RandomCutInAngularBins ( )
2165 {
2166  cout << "void EdbPVRQuality::Execute_RandomCutInAngularBins() TO BE DONE ! ATTENTION WARNING " << endl;
2167  cout << "SWTICH TO :: Execute_EqualizeTanThetaSpace_RandomCut() " << endl;
2168  return;
2169 }

◆ ExtractDataVolume()

EdbPVRec * EdbPVRQuality::ExtractDataVolume ( EdbPVRec pvr,
EdbSegP seg,
Float_t  tolerance[4] 
)

594 {
595  Log(2,"EdbPVRQuality::ExtractDataVolume","Fill new pattern volume...");
596 
597  // Note: there is a similar implementation of this function already in the EdbDataProc class:
598  // EdbPVRec *EdbDataProc::ExtractDataVolume()
599  // But then we would have to link in this class again and create a new proc object...
600  // so it is easier to reimplement it here again.
601  //
602  // To Test a method which returns a modified EdbPVRec Volume.
603  // Either in Angular Space (default), or in coordinate space.
604  // (Or both?)
605  // Input: EdbSegP, Delta TanTheta max, EdbPVRec, Tolerances
606  // Output: EdbPVRec reduced in (angular,coordinate) space.
607 
608  // The returned EdbPVRec volume is propagated along the given input segment
609  // (yes, it is true....) for the given segment angle.
610 
611  if(!pvr) return 0;
612  int npat = pvr->Npatterns();
613  EdbPVRec *ali = new EdbPVRec();
614 
615  Log(2,"EdbPVRQuality::ExtractDataVolume","Select Data in EdbPVRec with %d patterns:", npat);
616  Log(2,"EdbPVRQuality::ExtractDataVolume","Print tolerance values (+-X,+-Y, +-TX, +-TY)");
617  Log(2,"EdbPVRQuality::ExtractDataVolume","Print tolerance values: +-X = %.01f",tolerance[0]);
618  Log(2,"EdbPVRQuality::ExtractDataVolume","Print tolerance values: +-Y = %.01f",tolerance[1]);
619  Log(2,"EdbPVRQuality::ExtractDataVolume","Print tolerance values: +-TX = %.02f",tolerance[2]);
620  Log(2,"EdbPVRQuality::ExtractDataVolume","Print tolerance values: +-TY = %.02f",tolerance[3]);
621 
622  if (NULL==tolerance) {
623  Log(1,"EdbPVRQuality::ExtractDataVolume","Warning: No tolerance values given. Dont cut.");
624  Log(1,"EdbPVRQuality::ExtractDataVolume","Warning: Tolerance values (+-X, +-Y, +-TX, +-TY)");
625  Log(1,"EdbPVRQuality::ExtractDataVolume","Warning: Will put (2e18,2e18,2,2),i.e. no cut is done.");
626  tolerance[0]=2e18;
627  tolerance[1]=2e18;
628  tolerance[2]=2;
629  tolerance[3]=2;
630  }
631  // But be aware: if one forgets to set the tolerance values by hand,
632  // then uninitialised values may screw up everything!
633  // Test for undeterminate behaviour of the Float_t tolerance array
634  // (in case of being forgotten initializing)
635  Bool_t IsInderterminated=kFALSE;
636  for (Int_t i=0; i<4; ++i) if (tolerance[i]<2e-5) IsInderterminated=kTRUE;
637  if (IsInderterminated) {
638  Log(1,"EdbPVRQuality::ExtractDataVolume","Warning: Tolerance values strange! (%.06f, %.06f,%.06f,%.06f)",tolerance[0],tolerance[1],tolerance[2],tolerance[3]);
639  Log(1,"EdbPVRQuality::ExtractDataVolume","Warning: Have you forgotten initializing them?");
640  Log(1,"EdbPVRQuality::ExtractDataVolume","Warning: Tolerance values (+-X, +-Y, +-TX, +-TY)");
641  Log(1,"EdbPVRQuality::ExtractDataVolume","Warning: Will put (2e18,2e18,2,2),i.e. no cut is done.");
642  tolerance[0]=2e18;
643  tolerance[1]=2e18;
644  tolerance[2]=2;
645  tolerance[3]=2;
646  }
647 
648  Float_t dz, min[5], max[5];
649  EdbPattern *pat=0;
650  Float_t xmean,ymean,zmean;
651  xmean=ymean=zmean=0;
652 
653 
654  for(int i=0; i<npat; i++) {
655 
656  pat = pvr->GetPattern(i);
657  if(!pat) continue;
658  Log(3,"EdbPVRQuality::ExtractDataVolume","Got pattern with %d segments in it.",pat->N());
659 
660  // Difference z-values of segment and current pattern.
661  dz = pat->Z() - seg->Z();
662 
663  // Maximum Difference in Delta X and Delta Y,
664  // projected along segment axis!
665  min[0] = seg->X() + dz*seg->TX() - tolerance[0];
666  min[1] = seg->Y() + dz*seg->TY() - tolerance[1];
667  max[0] = seg->X() + dz*seg->TX() + tolerance[0];
668  max[1] = seg->Y() + dz*seg->TY() + tolerance[1];
669 
670  // Maximum Difference in Delta Tan ThetaX and Delta Tan ThetaY.
671  // Needs to calculated to a Delta Tan Theta ...
672  min[2] = seg->TX()-tolerance[2];
673  max[2] = seg->TX()+tolerance[2];
674  min[3] = seg->TY()-tolerance[3];
675  max[3] = seg->TY()+tolerance[3];
676 
677  // W. No cut on W is done in this routine.
678  min[4] = 0.;
679  max[4] = 100.;
680 
681  Log(3,"EdbPVRQuality::ExtractDataVolume","Cut values for pattern %d:", i);
682  Log(3,"EdbPVRQuality::ExtractDataVolume"," X: %.01f .. %.01f", min[0],max[0]);
683  Log(3,"EdbPVRQuality::ExtractDataVolume"," Y: %.01f .. %.01f", min[1],max[1]);
684  Log(3,"EdbPVRQuality::ExtractDataVolume","TX: %.01f .. %.01f", min[2],max[2]);
685  Log(3,"EdbPVRQuality::ExtractDataVolume","TY: %.01f .. %.01f", min[3],max[3]);
686 
687  EdbPattern* patNew = pat->ExtractSubPattern(min,max);
688  // When X() and Y() values for pattern are not set initially,
689  // then they cannot be set ab initio. So we have to set them afterwards from
690  // the segments data.
691  patNew->SetX(pat->Xmean());
692  patNew->SetY(pat->Ymean());
693 
694  Int_t patNewN = patNew->N();
695  ali->AddPattern( patNew );
696 
697  // For calulation of X() and Z() of the PVR volume:
698  xmean+=patNew->Xmean();
699  ymean+=patNew->Ymean();
700  zmean+=patNew->Z();
701 
702  // Set ID() and PID() of the new pattern...
703  // done in ExtractSubPattern function.
704 
705  Log(3,"EdbPVRQuality::ExtractDataVolume","Added pattern with %d segments:", patNewN);
706  }
707 
708  // Add X and Y mean values of the patterns to the Patterns Volume Reconstructed Object
709  // (not perfect, since an integer division is made)
710  ali->SetXYZ(xmean/npat,ymean/npat,zmean/npat);
711 
712  //ali->Print();
713  Log(2,"EdbPVRQuality::ExtractDataVolume","Fill new pattern volume...done.");
714  return ali;
715 }
brick dz
Definition: RecDispMC.C:107
float min(TClonesArray *t)
Definition: bitview.cxx:275
int max
Definition: check_shower.C:41
float Xmean()
Definition: EdbPattern.cxx:1640
float Ymean()
Definition: EdbPattern.cxx:1687
EdbPattern * ExtractSubPattern(float min[5], float max[5], int MCevt=-1)
Definition: EdbPattern.cxx:1593
void SetXYZ(float x, float y, float z)
Definition: EdbPattern.h:375
Float_t Z() const
Definition: EdbSegP.h:150

◆ FillHistosPattern()

void EdbPVRQuality::FillHistosPattern ( EdbPVRec aliSource,
Int_t  patNR = 0,
Bool_t  DoResetHistos = kTRUE,
Float_t  weightXY = 1 
)
4599  {
4600 
4601  if (!eIsSource) {
4602  cout << "WARNING EdbPVRQuality::FillHistosPattern eIsSource = " << eIsSource << ". This means no source set. Return!" << endl;
4603  return;
4604  }
4605  if (NULL==aliSource) {
4606  cout << "WARNING EdbPVRQuality::FillHistosPattern aliSource==NULL. Nothing to fill. Return." << endl;
4607  }
4608 
4609  TProfile* histProfileBTdens_vs_PID=eProfileBTdens_vs_PID_source;
4610  if (aliSource == eAli_modified) {
4611  histProfileBTdens_vs_PID=eProfileBTdens_vs_PID_target;
4612  }
4613  if (aliSource == eAli_orig) {
4614  histProfileBTdens_vs_PID=eProfileBTdens_vs_PID_source;
4615  }
4616 
4617  // Float_t weightXY is needed, when this function is called
4618  // more than one time, as it is in FillHistosVolume();
4619  // (// update: not needed anymore! leave it to 1.) ??? REALLY???
4620 
4621  // Better work with a clone, otherwise reset and addition stuff
4622  // is not working well
4623  TH2F* eHistXYClone = (TH2F*)eHistXY->Clone();
4624 
4625  // Clone is always reseted, since it is responsible for the BT density calculation,
4626  // which is pattern by pattern based
4627  eHistXYClone->Reset();
4628 
4629  // kTRUE is default, since the cut-algorithms work per pattern,
4630  // instead per volume...
4631  if (DoResetHistos==kTRUE) ResetHistosSinglePattern();
4632 
4633  EdbPattern* pat = (EdbPattern*)aliSource->GetPattern(patNR);
4634  Int_t npat=pat->N();
4635 
4636  // cout << "EdbPVRQuality::FillHistosPattern()" << endl;
4637  // cout << "patNR= " << patNR << " pat->GetSize(0) = " << pat->GetSize(0) << " pat->GetSize(1) = " << pat->GetSize(0) << " npat= " << npat << endl;
4638 
4639 
4640  EdbSegP* seg=0;
4641  // Loop over the segments of the pattern
4642  for (Int_t j=0; j<npat; j++) {
4643  seg=pat->GetSegment(j);
4644  // Very important:
4645  // For the data case, we assume the following:
4646  // Data (MCEvt<0) will be taken for BTdensity calculation
4647  // Sim (MCEvt>0) will NOT be taken for BTdensity calculation
4648  // We take it ONLY and ONLY into account if it is especially wished
4649  // by the user!
4650  // Therefore (s)he needs to know how many Gauge Coupling Parameters
4651  // in the Standard Model exist (at least)... (Hardcoded).
4652  Bool_t result=kTRUE;
4653  if (seg->MCEvt()>0) {
4655  result = kTRUE;
4656  }
4657  else {
4658  result = kFALSE;
4659  }
4660  }
4661 
4662  if (gEDBDEBUGLEVEL>4) cout << "EdbPVRQuality::FillHistosPattern Doing segment " << j << " result for bool query is: " << result << endl;
4663 
4664  // Main decision for segment to be kept or not (seg is of MC or data type).
4665  if ( kFALSE == result ) continue;
4666 
4667  // For the check, fill the histograms in any case:
4668  eHistXYClone->Fill(seg->Y(),seg->X());
4669 
4670  eHistXY->Fill(seg->X(),seg->Y());
4671  eHistTXTY->Fill(seg->TX(),seg->TY());
4672  eHistTT->Fill(seg->Theta());
4673  eHistTTFillcheck->Fill(seg->Theta());
4674  eHistWChi2->Fill(seg->W(),seg->Chi2());
4675 
4676  eHistChi2->Fill(seg->Chi2());
4677  eHistW->Fill(seg->W());
4678  eHistWTilde->Fill(1/seg->W());
4679 
4680  } // for (Int_t j=0; j<npat; j++)
4681 
4682  if (gEDBDEBUGLEVEL>2) cout << "EdbPVRQuality::FillHistosPattern I have filled the eHistXY Histogram. Entries = " << eHistXY->GetEntries() << endl;
4683 
4684  // Important to reset (pattern) histogram before it is filled.
4685  eHistBTDensityPattern->Reset();
4686 
4687  // Search for empty bins, because they can spoil the overall calulation
4688  // of the mean value.
4689  // Important: work on the clone, because the original is not reseted.
4690  // Then conversion into area of millimeter squared
4691  Int_t nbins=eHistXYClone->GetNbinsX()*eHistXYClone->GetNbinsY();
4692  Double_t eHistXYBinArea = eHistXYClone->GetXaxis()->GetBinWidth(1)*eHistXYClone->GetYaxis()->GetBinWidth(1);
4693  Double_t eHistXYBinAreamm2 = eHistXYBinArea/1000/1000;
4694 
4695  /*
4696  cout << "EdbPVRQuality::FillHistosPattern eHistXYClone->GetNbinsX() = " << eHistXYClone->GetNbinsX() << endl;
4697  cout << "EdbPVRQuality::FillHistosPattern eHistXYClone->GetNbinsY() = " << eHistXYClone->GetNbinsY() << endl;
4698  cout << "EdbPVRQuality::FillHistosPattern eHistXYBinArea = " << eHistXYBinArea << endl;
4699  cout << "EdbPVRQuality::FillHistosPattern eHistXYBinAreamm2 = " << eHistXYBinAreamm2 << endl;
4700  */
4701 
4702  Double_t bincontentXY=0;
4703  Double_t bincontentXYNormalizedMillimeterSquared=0;
4704 
4705  // Loop over all bins of the eHistXYClone histogram and fill
4706  // the density histograms with nonempty entries of eHistXYClone:
4707 
4708  for (int k=1; k<nbins-1; k++) {
4709 
4710  // Take only filled bins into account for the
4711  // track density calculation.
4712  if (eHistXYClone->GetBinContent(k)==0) continue;
4713 
4714  bincontentXY=eHistXYClone->GetBinContent(k);
4715 // cout << "Bin k= " << k << " Bincontent = " << bincontentXY << endl;
4716 
4717  // Important here! Filling the BT density histograms, binsize
4718  // must be normalized to 1x1 mm2
4719  bincontentXYNormalizedMillimeterSquared = bincontentXY/eHistXYBinAreamm2;
4720 
4721 // cout << "Bin k= " << k << " Bincontent Normalized = " << bincontentXY << endl;
4722 
4723  eHistBTDensityPattern->Fill(bincontentXYNormalizedMillimeterSquared);
4724  eHistBTDensityVolume->Fill(bincontentXYNormalizedMillimeterSquared);
4725  histProfileBTdens_vs_PID->Fill(patNR,bincontentXYNormalizedMillimeterSquared);
4726  }
4727 
4728 
4729  // KOMMENTAR // FOR TESTING PURPOSES
4730 // cout << "For the eHistXYClone histogram for this pattern, nemptybinsXY = " << nemptybinsXY << endl;
4731 // cout << "For the eHistXYClone histogram for this pattern, nbins = " << nbins << endl;
4732 // if (patNR<1) {
4733 // cout << "EdbPVRQuality::FillHistosPattern Draw eHistXYClone in new Canvas" << endl;
4734 // new TCanvas();
4735 // eHistXYClone->DrawClone("colz");
4736 // }
4737 // cout << "EdbPVRQuality::FillHistosPattern patNR= " << patNR << " eHistBTDensityPattern->GetMean() = " << eHistBTDensityPattern->GetMean() << endl;
4738 // cout << "EdbPVRQuality::FillHistosPattern patNR= " << patNR << " eHistBTDensityPattern->GetRMS() = " << eHistBTDensityPattern->GetRMS() << endl;
4739  // KOMMENTAR ENDE
4740 
4741 
4742  // failsafe warning in case that there are many bins with zero content.
4743  // for now we print a error message: tODO REBIN THE YX HISTOGRA WITH 2.5x2.5 mm!!!!
4744  // switch to default histogram with 2x2 mm2 bin size, see if its better (june2,17)
4745  // well, the distribution of entries in the 2x2 mm2 histogram is still largely
4746  // spreading, especially when looked at specific angular space, but that is all we
4747  // can do for now (july17)
4748  // and we have more bins at the edges, which are populated less dense, which spoils
4749  // overall calculation, so we actually dont take the rebinning into account anymore.
4750  CheckFilledXYSize(eHistXYClone);
4751 
4752  // Save the density in the corresponding variable
4753  if (aliSource == eAli_modified) {
4755  }
4756  if (aliSource == eAli_orig) {
4758  }
4759 
4760  // Do not reset the histograms, since the filled histos will be needed in
4761  // the DetermineCutTTReductionFactor function.
4762  // dont...eHistXY->Reset();
4763  // dont...eHistTXTY->Reset();
4764  // dont...eHistTT->Reset();
4765  // dont...eHistWChi2->Reset();
4766 
4767  // Memory Management: delete the cloned histogram.
4768  delete eHistXYClone;
4769 
4770  //cout << "EdbPVRQuality::FillHistosPattern(Int_t patNR)...done" << endl;
4771  return;
4772 }
TH1F * eHistW
Definition: EdbPVRQuality.h:75

◆ FillHistosVolume()

void EdbPVRQuality::FillHistosVolume ( EdbPVRec aliSource)
4555  {
4556  cout << "EdbPVRQuality::FillHistosVolume(EdbPVRec* aliSource)" << endl;
4557 
4558  cout << "EdbPVRQuality::FillHistosVolume() Call FillHistosPattern for all patterns" << endl;
4559  cout << "EdbPVRQuality::FillHistosVolume() Histograms eHistXY, eHistWChi2, eHistTXTY, eHistTT and profile histo " << endl;
4560  cout << "EdbPVRQuality::FillHistosVolume() are then filled with all segments from the volume." << endl;
4561  cout << "EdbPVRQuality::FillHistosVolume() Routine can be called with source or target volume" << endl;
4562 
4563  if (NULL==aliSource) {
4564  cout << "EdbPVRQuality::FillHistosVolume() aliSource==NULL. Nothing to fill. Return." << endl;
4565  }
4566 
4567  // Reset Histograms:
4568  ResetHistos();
4569 
4570  //-------------------------------------------------------------------
4571  Float_t weight=1;
4572  // First filling is _always_ resetting the histograms,
4573  // afterwards not, because we want to have histograms for full volume filled.
4574  FillHistosPattern(aliSource,0,kTRUE,weight);
4575  for (int i=1; i< aliSource->Npatterns(); ++i) FillHistosPattern(aliSource,i,kFALSE,weight);
4576  //-------------------------------------------------------------------
4577 
4578  if (aliSource == eAli_modified) {
4584  }
4585  if (aliSource == eAli_orig) {
4591  }
4592 
4593  cout << "EdbPVRQuality::FillHistosVolume(EdbPVRec* aliSource)...done." << endl;
4594  return;
4595 }
void ResetHistos()
Definition: EdbPVRQuality.cxx:185
TProfile * eProfileBTdens_vs_PID_generic
Definition: EdbPVRQuality.h:94

◆ FillTanThetaTArrays()

void EdbPVRQuality::FillTanThetaTArrays ( Int_t  patNR)
4777  {
4778  cout << "EdbPVRQuality::FillTanThetaTArrays(Int_t patNR)" << endl;
4779 
4780  int nbinsX=10;
4781  TH1F* h_TT = (TH1F*)eHistTTFillcheck->Clone();
4782  int filledBin=0;
4783  EdbSegP* BTSegment;
4784  EdbSegP* seg;
4785 
4786  // Important! Clear Histograms!
4787  // Clear arrays for stored BTs in TT space
4788  for (int i = 0; i <nbinsX+2; i++ ) {
4789  eArrayPatternTTSource[i]->Clear();
4790  eArrayPatternTTRejected[i]->Clear();
4791  eArrayPatternTTAccepted[i]->Clear();
4792  }
4793  // Clear arrays for stored BTs in All TT space
4794  eArrayPatternAllTTSource->Clear();
4795  eArrayPatternAllTTRejected->Clear();
4796  eArrayPatternAllTTAccepted->Clear();
4797 
4798  EdbPattern* pat = (EdbPattern*)eAli_orig->GetPattern(patNR);
4799  Int_t npat=pat->N();
4800  cout << "EdbPVRQuality::FillTanThetaTArrays(Int_t patNR) For this pattern (" << patNR << "), I have " << npat << " Edb segments to check..." << endl;
4801 
4802  /*
4803  cout << "i BINCENTER BINWIDTH" << endl;
4804  for (int i = 0; i <nbinsX; i++ ) {
4805  cout << i << " " << h_TT-> GetBinCenter(i) << " " << h_TT-> GetBinWidth(i) << endl;
4806  }
4807  */
4808 
4809  // TT Histogram Filling part.
4810  // Important: Again, for the BTdensity calculation, MCEvt will not be taken into account,
4811  // (because, normally in a simulated EdbPVrec Volumen all MCEvt numbers are mixed, and
4812  // and therefore the calculation would not make sense)
4813  // (only sense could be in the case of Testbeam data... to be checked...)
4814  // And also, the number of MC Events compared to BG real data is negligible, so that the
4815  // BTdensity calculation error is very small.
4816 
4817  for (int j = 0; j < npat; j++ ) {
4818  BTSegment = pat->GetSegment(j);
4819  seg=pat->GetSegment(j);
4820  // Very important:
4821  // For the data case, we assume the following:
4822  // Data (MCEvt<0) will be taken for BTdensity calculation
4823  // Sim (MCEvt>0) will NOT be taken for BTdensity calculation
4824  // We take it ONLY and ONLY into account if it is especially wished
4825  // by the user!
4826  // Therefore (s)he needs to know how many Gauge Coupling Parameters
4827  // in the Standard Model exist (at least)...
4828  Bool_t result=kTRUE;
4829  if (seg->MCEvt()>0) {
4831  result = kTRUE;
4832  }
4833  else {
4834  result = kFALSE;
4835  }
4836  }
4837 
4838  if (gEDBDEBUGLEVEL>4) cout << "EdbPVRQuality::FillTanThetaTArrays(Int_t patNR) Doing segment " << j << " result for bool query is: " << result << endl;
4839 
4840  // Main decision for segment to be kept or not (seg is of MC or data type).
4841  if ( kFALSE == result ) continue;
4842 
4843  // Fill the h_TT histo to know which Array index is the right one:
4844  filledBin=h_TT->Fill(BTSegment->Theta());
4845  eArrayPatternTTSource[filledBin]->Add(BTSegment);
4846 
4847  } // of for (int j = 0; j < npat; j++ )
4848 
4849 
4850  for (int i = 0; i <nbinsX; i++ ) {
4851  cout << "EdbPVRQuality::FillTanThetaTArrays(Int_t patNR) Number of Segments in TT Array " << i << " : " << eArrayPatternTTSource[i]->GetEntries() << endl;
4852  }
4853 
4854  delete h_TT;
4855  cout << "EdbPVRQuality::FillTanThetaTArrays(Int_t patNR)...done" << endl;
4856  return;
4857 }
TObjArray * eArrayPatternAllTTSource
Definition: EdbPVRQuality.h:155
TObjArray * eArrayPatternAllTTRejected
Definition: EdbPVRQuality.h:156
TObjArray * eArrayPatternAllTTAccepted
Definition: EdbPVRQuality.h:157

◆ FindEventRelatedBTs()

void EdbPVRQuality::FindEventRelatedBTs ( )
5573  {
5574  cout << "EdbPVRQuality::FindEventRelatedBTs()" << endl;
5575 
5576  //FindEventRelatedBTs();
5577 
5578  cout << "EdbPVRQuality::FindEventRelatedBTs()...NOTHING DONE YET ... " << endl;
5579  return;
5580 }

◆ FindFakeDoubleBTs()

TObjArray * EdbPVRQuality::FindFakeDoubleBTs ( EdbPVRec aliSource = NULL)
2809 {
2810  // Find double counted basetracks.
2811  // More explanation in Remove_DoubleBT() function.
2812  // Cutvalues used are the same.
2813  // (See also upcoming note on BG-reduction)
2814 
2815  // ArrayAllExcluded[0] is the list of FakeDoubleBTs
2816  // which are to be excluded in the Create...Function
2817 
2818  cout << "EdbPVRQuality::FindFakeDoubleBTs() " << endl;
2819  cout << "EdbPVRQuality::FindFakeDoubleBTs() Check pattern volume for (fake) BT pairs." << endl;
2820  cout << "EdbPVRQuality::FindFakeDoubleBTs() aliSource = " << aliSource << endl;
2821  cout << "EdbPVRQuality::FindFakeDoubleBTs() eAli_orig = " << eAli_orig << endl;
2822 
2823  if (NULL==aliSource) {
2824  cout << "WARNING! EdbPVRQuality::FindFakeDoubleBTs() Source EdbPVRec is NULL. Try to change to object eAli_orig: " << eAli_orig << endl;
2825  if (NULL==eAli_orig) {
2826  cout << "WARNING! EdbPVRQuality::FindFakeDoubleBTs() Also eAli_orig EdbPVRec is NULL. Do nothing and return NULL pointer!" << endl;
2827  return NULL;
2828  }
2829  else {
2830  aliSource=eAli_orig;
2831  }
2832  }
2833 
2834  Bool_t seg_seg_close=kFALSE;
2835  EdbSegP* seg=0;
2836  EdbSegP* seg1=0;
2837  Int_t NdoubleFoundSeg=0;
2838  Int_t NSegTotal=aliSource->NSeg();
2839  TObjArray* DoubleBTArray = new TObjArray();
2840 
2841  // Bool variables for the different "regions" of the FakeBT Doublets
2842  Bool_t IsRegion0;
2843  Bool_t IsRegion1;
2844  Bool_t IsRegion2;
2845 
2846  //gEDBDEBUGLEVEL=3;
2847  cout << "EdbPVRQuality::FindFakeDoubleBTs() Start looping now. Attention, this might take a while!" << endl;
2848 
2849  if (aliSource->Npatterns()==0) return NULL;
2850 
2851  for (int i = 0; i <aliSource->Npatterns(); i++ ) {
2852 
2853  // Get Target Pattern:
2854  EdbPattern* pat = aliSource->GetPattern(i);
2855  // Helper Variable for cout purpose
2856  Int_t nPat=pat->N();
2857 
2858  if (gEDBDEBUGLEVEL>1) cout << "EdbPVRQuality::FindFakeDoubleBTs() Looping over Ali_source->Pat()=" << i << " (PID=" << pat->PID() << ") with N= " << nPat << " segs. Until now double Candidates found: " << NdoubleFoundSeg << endl;
2859 
2860  for (int j = 0; j < nPat; j++ ) {
2861 
2862  // condition due avoid floating point exception (divide by zero)
2863  if (gEDBDEBUGLEVEL>2) if (nPat>10) if (j%(nPat/10)==0) cout << "." << flush;
2864 
2865  seg = pat->GetSegment(j);
2866  seg_seg_close=kFALSE;
2867 
2868  for (int k = j; k < nPat; k++ ) {
2869  if (k==j) continue;
2870 
2871 
2872  if (seg_seg_close) continue;
2873 
2874  if (gEDBDEBUGLEVEL>3) cout << "Looping over pattern for segment pair nr=" << j << "," << k << endl;
2875  seg1 = pat->GetSegment(k);
2876 
2877  // Here decide f.e. which segments to check...
2878  Bool_t toKeep=kFALSE;
2879 
2880  // Skip already large distances
2881  if (TMath::Abs(seg->X()-seg1->X())>20.1) continue;
2882  if (TMath::Abs(seg->Y()-seg1->Y())>20.1) continue;
2883  if (TMath::Abs(seg->TX()-seg1->TX())>0.1) continue;
2884  if (TMath::Abs(seg->TY()-seg1->TY())>0.1) continue;
2885  //
2886  // Segment Pairs can fall into three regions:
2887  //
2888  // region 0) all BT pairings within dT<->dR line
2889  //
2890  // region 1) all BT parings within a dR,dT rectangle at the origin
2891  //
2892  // region 2) all BT parings within a dR,dT rectangle at (0,6)
2893  //
2894  Float_t dR_allowed=0;
2895  Float_t deltaR=0;
2896  Float_t deltaTheta=0;
2897  Float_t dR_allowed_m_deltaR=0;
2898 
2899  // Calculate cut values:
2900  deltaTheta=TMath::Sqrt( TMath::Power(seg->TX()-seg1->TX(),2)+TMath::Power(seg->TY()-seg1->TY(),2) );
2901  if (deltaTheta>0.1) continue;
2902  deltaR=TMath::Sqrt( TMath::Power(seg->X()-seg1->X(),2)+TMath::Power(seg->Y()-seg1->Y(),2) );
2903 
2904  // line defined by experimental values (by some arbitrary bricks and my own BG-bricks)
2905  // dR_allowed = 10.75/0.1*deltaTheta; // old
2906  dR_allowed = 14.0/0.13*deltaTheta; // better description of the line
2907  dR_allowed_m_deltaR=TMath::Abs(deltaR-dR_allowed);
2908 
2909  // Region check of the (Fake-)BTPair
2910  IsRegion0=kFALSE;
2911  IsRegion1=kFALSE;
2912  IsRegion2=kFALSE;
2913 
2914  // Set flags for region
2915  if (dR_allowed_m_deltaR<0.5) IsRegion0=kTRUE;
2916  if (deltaR<3.0 && deltaTheta<0.01) IsRegion1=kTRUE;
2917  if (abs(deltaR-6.0)<2 && deltaTheta<0.01) IsRegion2=kTRUE;
2918 
2919  // For this function now -in contrary to Remove_DoubleBT- we
2920  // ONLY keep double basetrack pairings within the line
2921  if (IsRegion0) toKeep=kTRUE;
2922  // or within the small square at the origin
2923  if (IsRegion1) toKeep=kTRUE;
2924  // or within the small square at the dR value
2925  if (IsRegion2) toKeep=kTRUE;
2926 
2927  if (!toKeep) continue;
2928 
2929  if (gEDBDEBUGLEVEL>2) cout << "EdbPVRQuality::FindFakeDoubleBTs() Found segment compatible close to another one: seg (" <<seg->PID() << ","<< seg->ID() << ") is close to seg (" << seg1->PID()<< ","<< seg1->ID() << ")." << endl;
2930 
2931  if (gEDBDEBUGLEVEL>3) cout << "EdbPVRQuality::FindFakeDoubleBTs() Do last check if both are MCEvt segments of different event number! " << endl;
2932  if ((seg->MCEvt()!=seg1->MCEvt())&&(seg->MCEvt()>0&&seg1->MCEvt()>0)) continue;
2933  // I have doubts if I shall take MC events also out, but I guess Yes, because if
2934  // in data these small pairings appear, then they will fall also under the
2935  // category "fake doublet" and then be removed, even if they are real double BT
2936  // from a signal.
2937 
2938  seg_seg_close=kTRUE;
2939  ++NdoubleFoundSeg;
2940  } // for (int k = j+1; k <pat->N(); k++ )
2941 
2942  // Add segment:
2943  if (gEDBDEBUGLEVEL>3) cout << "// Add segment:" << endl;
2944  if (seg_seg_close) DoubleBTArray->Add(seg);
2945  seg_seg_close=kFALSE;
2946  } // of for (int j = 0; j < nPat-1; j++ )
2947  } // for (int i = 0; i <aliSource->Npatterns(); i++ )
2948 
2949 
2950  Double_t ratioFakeDoubleBTsNSegTotal = (Double_t)DoubleBTArray->GetEntries()/NSegTotal;
2951 
2952  cout << "EdbPVRQuality::FindFakeDoubleBTs() Statistics: " << endl;
2953  cout << "EdbPVRQuality::FindFakeDoubleBTs() Statistics: We found " << DoubleBTArray->GetEntries() << " double segments too close to each other to be different basetracks." << endl;
2954  cout << "EdbPVRQuality::FindFakeDoubleBTs() Statistics: Out of in total a ratio of: " << ratioFakeDoubleBTsNSegTotal << endl;
2955 
2956  // Set the found array as Exclusion List:
2957  // Array at 0 is reserved for the FakeDoubleBTs
2958  // Nota bene: this array is filled with BTs over all paterns of the volume!
2959  cout << "EdbPVRQuality::FindFakeDoubleBTs() Set the found array as Exclusion List: Array at 0 is reserved for the FakeDoubleBTs." << endl;
2960  eArrayPatternAllExcluded[0]=DoubleBTArray;
2961 
2962  cout << "EdbPVRQuality::FindFakeDoubleBTs()...done." << endl;
2963  return DoubleBTArray;
2964 
2965 }
TObjArray * eArrayPatternAllExcluded[4]
Definition: EdbPVRQuality.h:163
Int_t NSeg()
Definition: EdbPVRec.cxx:2909

◆ FindFirstBinAbove()

Int_t EdbPVRQuality::FindFirstBinAbove ( TH1 *  hist,
Double_t  threshold,
Int_t  axis 
)
3485  {
3486  // The TH1 function FindFirstBinAbove is only implemented in
3487  // root version >= 5.24. But since many scanning labs use old root
3488  // versions persistently, I had to copy the TH1 function as a
3489  // memberfunction of EdbPVRQuality
3490  // Code taken from
3491  // http://root.cern.ch/root/html/src/TH1.cxx.html#biA7FC
3492  //
3493  // Correction, June, 2nd 2017:
3494  // This was the code for the OneDimensional Histogram!
3495  // In Our Case (histXY) we need the have the code for the TwoDimensional Histogram!
3496  TAxis* ax=0;
3497  if (axis==1) ax = hist->GetXaxis();
3498  if (axis==2) ax = hist->GetYaxis();
3499  if (axis==3) ax = hist->GetZaxis();
3500  int nb = ax->GetNbins();
3501  for (Int_t i=1; i<=nb; i++) {
3502  if (hist->GetBinContent(i)>threshold) return i;
3503  }
3504  return 0;
3505 }
void hist()
Definition: init.C:23

◆ FindFirstBinAboveTH2()

Int_t EdbPVRQuality::FindFirstBinAboveTH2 ( TH2 *  hist,
Double_t  threshold,
Int_t  axis 
)
3531  {
3532  // June, 2nd 2017:
3533  // The TH2 function FindFirstBinAbove is only implemented in
3534  // root version >= 5.24. But since many scanning labs use old root
3535  // versions persistently, I had to copy the TH1 function as a
3536  // memberfunction of EdbPVRQuality
3537  // Code taken from
3538  // https://root.cern.ch/root/html526/src/TH2.cxx.html#LmA7FC
3539  //find first bin with content > threshold for axis (1=x, 2=y, 3=z)
3540  //if no bins with content > threshold is found the function returns -1.
3541  if (axis < 1 || axis > 2) {
3542  printf("EdbPVRQuality::FindFirstBinAboveTH2 Invalid axis number : %d, axis x assumed\n",axis);
3543  axis = 1;
3544  }
3545  TAxis* ax=0;
3546  TAxis* axX=hist->GetXaxis();
3547  TAxis* axY=hist->GetYaxis();
3548  if (axis==1) ax = hist->GetXaxis();
3549  if (axis==2) ax = hist->GetYaxis();
3550  if (axis==3) ax = hist->GetZaxis();
3551  int nb = ax->GetNbins();
3552 
3553  Int_t nbinsx = axX->GetNbins();
3554  Int_t nbinsy = axY->GetNbins();
3555  Int_t binx, biny;
3556  if (axis == 1) {
3557  for (binx=1; binx<=nbinsx; binx++) {
3558  for (biny=1; biny<=nbinsy; biny++) {
3559  if (hist->GetBinContent(binx,biny) > threshold) return binx;
3560  }
3561  }
3562  } else {
3563  for (biny=1; biny<=nbinsy; biny++) {
3564  for (binx=1; binx<=nbinsx; binx++) {
3565  if (hist->GetBinContent(binx,biny) > threshold) return biny;
3566  }
3567  }
3568  }
3569  return -1;
3570 }

◆ FindHighDensityBTs()

void EdbPVRQuality::FindHighDensityBTs ( )
5544  {
5545  cout << "EdbPVRQuality::FindHighDensityBTs()" << endl;
5546 
5547  // Main Cut Routine for reducing HighDensBTs
5548  for (int i=0; i< eAli_orig->Npatterns(); ++i) {
5549 // cout << "///for (int i=0; i< eAli_orig->Npatterns(); ++i) {"<< endl;
5550  //for (int i=0; i< 1; ++i) {
5551 
5554  Cut();
5555  //MergeExclusionLists(); // moved to CreateEdbPVRec_TT_Algorithms routine
5556  }
5557 
5558  cout << "EdbPVRQuality::FindHighDensityBTs()...done. " << endl;
5559  return;
5560 }
void DetermineCutTTReductionFactor(Int_t patNR)
Definition: EdbPVRQuality.cxx:4863
void Cut()
Definition: EdbPVRQuality.cxx:5070

◆ FindLastBinAbove()

Int_t EdbPVRQuality::FindLastBinAbove ( TH1 *  hist,
Double_t  threshold,
Int_t  axis 
)
3509  {
3510  // The TH1 function FindFirstBinAbove is only implemented in
3511  // root version >= 5.24. But since many scanning labs use old root
3512  // versions persistently, I had to copy the TH1 function as a
3513  // memberfunction of EdbPVRQuality
3514  // Code taken from
3515  // http://root.cern.ch/root/html/src/TH1.cxx.html#biA7FC
3516  TAxis* ax=0;
3517  if (axis==1) ax = hist->GetXaxis();
3518  if (axis==2) ax = hist->GetYaxis();
3519  if (axis==3) ax = hist->GetZaxis();
3520  int nb = ax->GetNbins();
3521  for (Int_t i=nb; i>=1; i--) {
3522  if (hist->GetBinContent(i)>threshold) return i;
3523  }
3524  return 0;
3525 }

◆ FindLastBinAboveTH2()

Int_t EdbPVRQuality::FindLastBinAboveTH2 ( TH2 *  hist,
Double_t  threshold,
Int_t  axis 
)
3574  {
3575  // June, 2nd 2017:
3576  // The TH2 function FindLastBinAbove is only implemented in
3577  // root version >= 5.24. But since many scanning labs use old root
3578  // versions persistently, I had to copy the TH1 function as a
3579  // memberfunction of EdbPVRQuality
3580  // Code taken from
3581  // https://root.cern.ch/root/html526/src/TH2.cxx.html#dq5cSC
3582  //find last bin with content > threshold for axis (1=x, 2=y, 3=z)
3583  //if no bins with content > threshold is found the function returns -1.
3584  if (axis < 1 || axis > 2) {
3585  printf("EdbPVRQuality::FindFirstBinAboveTH2 Invalid axis number : %d, axis x assumed\n",axis);
3586  axis = 1;
3587  }
3588  TAxis* ax=0;
3589  TAxis* axX=hist->GetXaxis();
3590  TAxis* axY=hist->GetYaxis();
3591  if (axis==1) ax = hist->GetXaxis();
3592  if (axis==2) ax = hist->GetYaxis();
3593  if (axis==3) ax = hist->GetZaxis();
3594  int nb = ax->GetNbins();
3595 
3596  Int_t nbinsx = axX->GetNbins();
3597  Int_t nbinsy = axY->GetNbins();
3598  Int_t binx, biny;
3599 
3600  if (axis == 1) {
3601  for (binx=nbinsx; binx>=1; binx--) {
3602  for (biny=1; biny<=nbinsy; biny++) {
3603  if (hist->GetBinContent(binx,biny) > threshold) return binx;
3604  }
3605  }
3606  } else {
3607  for (biny=nbinsy; biny>=1; biny--) {
3608  for (binx=1; binx<=nbinsx; binx++) {
3609  if (hist->GetBinContent(binx,biny) > threshold) return biny;
3610  }
3611  }
3612  }
3613  return -1;
3614 }

◆ FindPassingBTs()

void EdbPVRQuality::FindPassingBTs ( )
5563  {
5564  cout << "EdbPVRQuality::FindPassingBTs()" << endl;
5565 
5566 // FindPassingBTs();
5567 
5568  cout << "EdbPVRQuality::FindPassingBTs()...NOTHING DONE YET ... " << endl;
5569  return;
5570 }

◆ GetagreementChi2Cut() [1/2]

Float_t* EdbPVRQuality::GetagreementChi2Cut ( )
inline
350  {
351  return eAgreementChi2WDistCut;
352  }

◆ GetagreementChi2Cut() [2/2]

Float_t EdbPVRQuality::GetagreementChi2Cut ( Int_t  patNR)
inline
353  {
354  return eAgreementChi2WDistCut[patNR];
355  }

◆ GetagreementChi2CutMeanChi2()

Float_t EdbPVRQuality::GetagreementChi2CutMeanChi2 ( )
inline
337  {
339  }

◆ GetagreementChi2CutMeanW()

Float_t EdbPVRQuality::GetagreementChi2CutMeanW ( )
inline
343  {
344  return eAgreementChi2CutMeanW;
345  }

◆ GetagreementChi2CutRMSChi2()

Float_t EdbPVRQuality::GetagreementChi2CutRMSChi2 ( )
inline
340  {
342  }

◆ GetagreementChi2CutRMSW()

Float_t EdbPVRQuality::GetagreementChi2CutRMSW ( )
inline
346  {
347  return eAgreementChi2CutRMSW;
348  }

◆ GetAngularSpaceBin()

Int_t EdbPVRQuality::GetAngularSpaceBin ( EdbSegP seg)
2393 {
2394  // Returns the number of bin for which the Basetrack corresponds to in tangens theta space.
2395  // Goes from 0 to 10.
2396 
2397  // ATTENTION and TODO :
2398  // Make the values in GetAngularSpaceBin() and Execute_ConstantBTDensityInAngularBins() equal !
2399  // done by hand... should by donesomehow automatic
2400 
2401 
2402  // ---------------------------
2403  cout << "GEHT DAS HIER NICHT EINFACHER ???" << endl;
2404  cout << " KANN ICH NICHT EINFACH EIN DUMMY eHISTTT HISTOGRAMM FÜLLEN ????" << endl;
2405  cout << " WAERE DOCH VIEL EINFACHER, ODER?????" << endl;
2406 
2407  // GEHT DAS HIER NICHT EINFACHER ???
2408  // KANN ICH NICHT EINFACH EIN DUMMY eHISTTT HISTOGRAMM FÜLLEN ????
2409  // WAERE DOCH VIEL EINFACHER, ODER?????
2410 
2411  // TODO: MOVE THIS FUNCTION TO A HISTOGRAM FUNCTION DUMMY
2412 
2413  Double_t angularspacebinningwidth=0.1;
2414  Double_t angularspacebinningstart=0.00;
2415  Double_t angularspacebinningend=0.00;
2416 
2417  // Calculate Angle
2418  Double_t tt=seg->Theta();
2419  // cout << "Int_t EdbPVRQuality::GetAngularSpaceBin(EdbSegP* seg) tt= " << tt << endl;
2420 
2421  // Now the angular space binning loop:
2422  for (Int_t angspacecounter=0; angspacecounter<10; angspacecounter++) {
2423 
2424  // Calculate right end of angular space bin
2425  angularspacebinningstart=(Double_t)angspacecounter*angularspacebinningwidth;
2426  angularspacebinningend=angularspacebinningstart+angularspacebinningwidth;
2427 
2428  // Check if angle is in the desired angular space bin
2429  if (tt<angularspacebinningstart) continue;
2430  if (tt>=angularspacebinningend) continue;
2431 // cout << "Int_t EdbPVRQuality::GetAngularSpaceBin(EdbSegP* seg) return angspacecounter = " << angspacecounter << " now." << endl;
2432  return angspacecounter;
2433  }
2434  // failsafe value, should never be given back:
2435  return 0;
2436 }

◆ GetArrayAllExcludedSegments()

TObjArray* EdbPVRQuality::GetArrayAllExcludedSegments ( )
inline
357  {
359  }

◆ GetBTDensity()

Float_t EdbPVRQuality::GetBTDensity ( Int_t  patNR = -1)
inline
300  {
301  return GetBTDensity_orig(patNR);
302  }
Float_t GetBTDensity_orig(Int_t patNR=-1)
Definition: EdbPVRQuality.h:303

◆ GetBTDensity_modified()

Float_t EdbPVRQuality::GetBTDensity_modified ( Int_t  patNR = -1)
inline
307  {
308  if (patNR==-1) return eProfileBTdens_vs_PID_target_meanY;
309  return ePatternBTDensity_modified[patNR];
310  }

◆ GetBTDensity_orig()

Float_t EdbPVRQuality::GetBTDensity_orig ( Int_t  patNR = -1)
inline
303  {
304  if (patNR==-1) return eProfileBTdens_vs_PID_source_meanY;
305  return ePatternBTDensity_orig[patNR];
306  }

◆ GetBTDensityLevel()

Float_t EdbPVRQuality::GetBTDensityLevel ( )
inline
320  {
321  return eBTDensityLevel;
322  }

◆ GetBTDensityLevelCalcMethodMC()

Bool_t EdbPVRQuality::GetBTDensityLevelCalcMethodMC ( )
inline
220  {
222  }

◆ GetBTDensityLevelCalcMethodMCConfirmation()

Int_t EdbPVRQuality::GetBTDensityLevelCalcMethodMCConfirmation ( )
inline
223  {
225  }

◆ GetCutMethod()

Int_t EdbPVRQuality::GetCutMethod ( )
inline
313  {
314  return eCutMethod;
315  }

◆ GetCutMethodIsDone()

Bool_t EdbPVRQuality::GetCutMethodIsDone ( Int_t  type)
inline
316  {
317  if (type>7) return 0;
318  return eCutMethodIsDone[type];
319  }
Int_t type
Definition: testBGReduction_By_ANN.C:15

◆ GetCutp0() [1/2]

Float_t* EdbPVRQuality::GetCutp0 ( )
inline
324  {
325  return eCutp0;
326  }

◆ GetCutp0() [2/2]

Float_t EdbPVRQuality::GetCutp0 ( Int_t  patNR)
inline
330  {
331  return eCutp0[patNR];
332  }

◆ GetCutp1() [1/2]

Float_t* EdbPVRQuality::GetCutp1 ( )
inline
327  {
328  return eCutp1;
329  }

◆ GetCutp1() [2/2]

Float_t EdbPVRQuality::GetCutp1 ( Int_t  patNR)
inline
333  {
334  return eCutp1[patNR];
335  }

◆ GetCutTTReductionFactor()

Float_t EdbPVRQuality::GetCutTTReductionFactor ( Int_t  binTT)
inline
209  {
210  return eCutTTReductionFactor[binTT];
211  }

◆ GetCutTTSqueezeFactor()

Float_t EdbPVRQuality::GetCutTTSqueezeFactor ( )
inline
202  {
203  return eCutTTSqueezeFactor;
204  }

◆ GetEdbPVRec() [1/3]

EdbPVRec* EdbPVRQuality::GetEdbPVRec ( )
inline
229  {
230  return GetEdbPVRec(eNeedModified);
231  }
EdbPVRec * GetEdbPVRec()
Definition: EdbPVRQuality.h:229

◆ GetEdbPVRec() [2/3]

EdbPVRec* EdbPVRQuality::GetEdbPVRec ( Bool_t  NeedModified)
inline
241  {
242  cout << "Inline EdbPVRecType= " << NeedModified << endl;
243  if (NeedModified==1) {
244  return eAli_modified;
245  }
246  else {
247  return eAli_orig;
248  }
249  }

◆ GetEdbPVRec() [3/3]

EdbPVRec* EdbPVRQuality::GetEdbPVRec ( Int_t  EdbPVRecType)
inline
232  {
233  cout << "Inline EdbPVRecType= " << EdbPVRecType << endl;
234  if (EdbPVRecType==1) {
235  return eAli_modified;
236  }
237  else {
238  return eAli_orig;
239  }
240  }

◆ GetEdbPVRec_modified()

EdbPVRec* EdbPVRQuality::GetEdbPVRec_modified ( )
inline
254  {
255  return GetEdbPVRec(1);
256  }

◆ GetEdbPVRec_orig()

EdbPVRec* EdbPVRQuality::GetEdbPVRec_orig ( )
inline
251  {
252  return GetEdbPVRec(0);
253  }

◆ GetEdbPVRecNew()

EdbPVRec * EdbPVRQuality::GetEdbPVRecNew ( )
5510  {
5511  cout << "EdbPVRQuality::GetEdbPVRecNew()" << endl;
5512  cout << "EdbPVRQuality::GetEdbPVRecNew() ASSUMING THAT NO CUT HAS BEEN DONE YET." << endl;
5513 
5514  cout << "EdbPVRQuality::GetEdbPVRecNew() MAYBE ADD ALSO SWITCH, WHAT TO DO OR NOT...." << endl;
5515 
5516  cout << "EdbPVRQuality::GetEdbPVRecNew() for Example: doFindFakeDoubleBTs = ... " << endl;
5517  cout << "EdbPVRQuality::GetEdbPVRecNew() for Example: doFindHighDensityBTs = ... " << endl;
5518  cout << "EdbPVRQuality::GetEdbPVRecNew() for Example: doFindPassingBTs = ... " << endl;
5519  cout << "EdbPVRQuality::GetEdbPVRecNew() for Example: doFindEventRelatedBTs = ... " << endl;
5520 
5523  //FindPassingBTs(); // NOT YET IMPLEMENTED !
5524  //FindEventRelatedBTs(); // NOT YET IMPLEMENTED !
5525 
5526  // Merge source volume and segments from the exclusion lists together
5527  // for the new volume which is stored as eAli_modified
5529 
5530  // Finally, since we have now the target volume,
5531  // we fill histos for target EdbPVRec
5533 
5534  Print();
5535 
5536  cout << "EdbPVRQuality::GetEdbPVRecNew() Created new volume at " << eAli_modified << endl;
5537  cout << "EdbPVRQuality::GetEdbPVRecNew()...done" << endl;
5538  return eAli_modified;
5539 }
TObjArray * FindFakeDoubleBTs(EdbPVRec *aliSource=NULL)
Definition: EdbPVRQuality.cxx:2808
void Print()
Definition: EdbPVRQuality.cxx:1076
void FindHighDensityBTs()
Definition: EdbPVRQuality.cxx:5544
void CreateEdbPVRec_TT_Algorithms()
Definition: EdbPVRQuality.cxx:5584

◆ GetHistChi2()

TH1F* EdbPVRQuality::GetHistChi2 ( )
inline
276  {
277  return eHistChi2;
278  }

◆ GetHistChi2W()

TH2F* EdbPVRQuality::GetHistChi2W ( )
inline
271  {
272  return eHistWChi2;
273  }

◆ GetHistTT()

TH1F* EdbPVRQuality::GetHistTT ( )
inline
289  {
290  return eHistTT;
291  }

◆ GetHistTTFillcheck()

TH1F* EdbPVRQuality::GetHistTTFillcheck ( )
inline
295  {
296  return eHistTTFillcheck;
297  }

◆ GetHistTYTX()

TH2F* EdbPVRQuality::GetHistTYTX ( )
inline
292  {
293  return eHistTXTY;
294  }

◆ GetHistW()

TH1F* EdbPVRQuality::GetHistW ( )
inline
279  {
280  return eHistW;
281  }

◆ GetHistWTilde()

TH1F* EdbPVRQuality::GetHistWTilde ( )
inline
282  {
283  return eHistWTilde;
284  }

◆ GetHistYX()

TH2F* EdbPVRQuality::GetHistYX ( )
inline
286  {
287  return eHistXY;
288  }

◆ GetQualityPlots()

TCanvas * EdbPVRQuality::GetQualityPlots ( Int_t  CountNr = 0,
Int_t  aliSourceType = 0 
)
492 {
493  // Get a canvas containing basetrack information about the given volume.
494  cout << "EdbPVRQuality::GetQualityPlots CountNr=" << CountNr << " aliSourceType=" << aliSourceType << endl;
495 
496  if (!eIsSource) {
497  cout << "WARNING EdbPVRQuality::GetQualityPlots eIsSource = " << eIsSource << ". This means no source set. Return!" << endl;
498  return NULL;
499  }
500  if (aliSourceType==1 && !eIsTarget) {
501  cout << "WARNING EdbPVRQuality::GetQualityPlots eIsTarget = " << eIsTarget << ". This means no target set. Return!" << endl;
502  return NULL;
503  }
504 
505  if (aliSourceType==1) {
507  }
508  else {
510  }
511 
512  TCanvas* c1 = new TCanvas(Form("CanvasQualityPlots_%d_%d",CountNr,aliSourceType),Form("CanvasQualityPlots_%d_%d",CountNr,aliSourceType),1600,1000);
513  c1->Divide(3,2);
514 
515  for (int i=0; i<6; ++i) {
516  c1->cd(i+1); GetQualityPlotsSingle(CountNr,aliSourceType,i);
517  }
518  c1->cd();
519 
520  cout << "EdbPVRQuality::GetQualityPlots...done." << endl;
521  return c1;
522 }
TPad * GetQualityPlotsSingle(Int_t CountNr=0, Int_t aliSourceType=0, Int_t Plottype=-1)
Definition: EdbPVRQuality.cxx:525

◆ GetQualityPlotsSingle()

TPad * EdbPVRQuality::GetQualityPlotsSingle ( Int_t  CountNr = 0,
Int_t  aliSourceType = 0,
Int_t  Plottype = -1 
)
526 {
527  // Get a pad containing basetrack information about the given volume.
528  // One of the six specific plots from GetQualityPlots is returned (plot 0..5)
529  // Usually this pad is then integrated in the canvas from GetQualityPlots() function.
530  // cout << "EdbPVRQuality::GetQualityPlotsSingle CountNr=" << CountNr << " aliSourceType=" << aliSourceType << " Plottype= " << Plottype << endl;
531 
532  TPad* pad = new TPad();
533 
534  // remember: switch statements need a "break" at the end of each "case"
535  // remember: need to use "DrawCopy" here, otherwise, when histo is reseted,
536  // no graph will appear
537  switch(Plottype) {
538  case 0: {
539  eHistXY->Draw("colz"); // first draw due to resizing
540  eHistXY->GetXaxis()->SetRangeUser(eHistXY->GetMean(1)-eHistXY->GetRMS(1)*3,eHistXY->GetMean(1)+eHistXY->GetRMS(1)*3);
541  eHistXY->GetYaxis()->SetRangeUser(eHistXY->GetMean(2)-eHistXY->GetRMS(2)*3,eHistXY->GetMean(2)+eHistXY->GetRMS(2)*3);
542  eHistXY->GetXaxis()->SetTitle("X /#mum");
543  eHistXY->GetYaxis()->SetTitle("Y /#mum");
544  eHistXY->GetYaxis()->SetLabelSize(0.03);
545  eHistXY->GetXaxis()->SetLabelSize(0.03);
546  eHistXY->DrawCopy("colz"); // then redraw with different boundaries
547  break;
548  }
549  case 1: {
550  eHistWChi2->GetXaxis()->SetTitle("W");
551  eHistWChi2->GetYaxis()->SetTitle("#chi^{2}");
552  eHistWChi2->DrawCopy("colz");
553  break;
554  }
555  case 2: {
556  eHistTXTY->GetXaxis()->SetTitle("tan #theta_{X}");
557  eHistTXTY->GetYaxis()->SetTitle("tan #theta_{Y}");
558  eHistTXTY->DrawCopy("colz");
559  break;
560  }
561  case 3: {
562  eHistBTDensityVolume->GetXaxis()->SetTitle("basetrack density /mm^{-2}");
563  eHistBTDensityVolume->GetYaxis()->SetTitle("entries");
564  eHistBTDensityVolume->GetXaxis()->SetRangeUser(0,eHistBTDensityVolume->GetMean()+eHistBTDensityVolume->GetRMS()*3);
565  eHistBTDensityVolume->DrawCopy("");
566  break;
567  }
568  case 4: {
569  eProfileBTdens_vs_PID_generic->GetXaxis()->SetTitle("plate");
570  eProfileBTdens_vs_PID_generic->GetYaxis()->SetTitle("basetrack density /mm^{-2}");
571  eProfileBTdens_vs_PID_generic->GetXaxis()->SetRangeUser(0,eAli_maxNpatterns+2);
572  eProfileBTdens_vs_PID_generic->DrawCopy("profileZ");
573  break;
574  }
575  case 5: {
576  eHistTT->GetXaxis()->SetTitle("tan #theta");
577  eHistTT->GetYaxis()->SetTitle("entries");
578  eHistTT->DrawCopy("");
579  break;
580  }
581  default:
582  cout << "WARNING EdbPVRQuality::GetQualityPlotsSingle Plottype is out of range. Return empty pad." << endl;
583  break;
584  }
585 
586 // return canvas;
587  return pad;
588 }

◆ GetTracksFromLinkedTracksRootFile()

TObjArray * EdbPVRQuality::GetTracksFromLinkedTracksRootFile ( )
3619 {
3620  cout << "EdbPVRQuality::GetTracksFromLinkedTracksRootFile()" << endl;
3621 // cout << "___TODO___ STEP 1 : Check if linked_tracks.root exists " << endl;
3622 // cout << "___TODO___ STEP 2 : Open linked_tracks " << endl;
3623 // cout << "___TODO___ STEP 3 : Check if there are tracks inside " << endl;
3624 // cout << "___TODO___ STEP 4 : Get Tracks as this TObjArray " << endl;
3625 
3626  // Array containing EdbTrackP objects:
3627  TObjArray* trackarray = new TObjArray();
3628 
3629  TFile* file = new TFile("linked_tracks.root");
3630  TTree* tr= (TTree*)file->Get("tracks");
3631  TClonesArray *seg= new TClonesArray("EdbSegP",60);
3632  EdbSegP* segment=0;
3633  EdbSegP* s2=0;
3634  EdbSegP* t=0;
3635 
3636  int nentr = int(tr->GetEntries());
3637  // check if tracks has entries: if so then ok, otherwise return directly:
3638  if (nentr>0) {
3639  cout << "EdbPVRQuality::GetTracksFromLinkedTracksRootFile() " << nentr << " entries Total"<<endl;
3640  }
3641  else {
3642  cout << "EdbPVRQuality::GetTracksFromLinkedTracksRootFile() linked_tracks.root file has NO entries...Return NULL." << endl;
3643  return NULL;
3644  }
3645 
3646  int nseg,n0,npl;
3647  tr->SetBranchAddress("t." , &t );
3648  tr->SetBranchAddress("s" , &seg );
3649  tr->SetBranchAddress("nseg" , &nseg );
3650  tr->SetBranchAddress("n0" , &n0 );
3651  tr->SetBranchAddress("npl" , &npl );
3652 
3653  for (int i=0; i<nentr; i++ ) {
3654  tr->GetEntry(i);
3655  EdbTrackP* realTrack = new EdbTrackP(t);
3656  for (int j=0; j<nseg; j++ ) {
3657  s2=(EdbSegP*) seg->At(j);
3658  segment=(EdbSegP*)s2->Clone();
3659  realTrack->AddSegment(segment);
3660  }
3661  //realTrack->PrintNice();
3662  realTrack->SetNpl(); // Necessary otherwise these variables are not filled.
3663  realTrack->SetN0(); // Necessary otherwise these variables are not filled.
3664  trackarray->Add(realTrack);
3665  }
3666  delete tr;
3667  file->Close();
3668  delete file;
3669  cout << "EdbPVRQuality::GetTracksFromLinkedTracksRootFile()...done." << endl;
3670  return trackarray;
3671 }
TTree * tr
Definition: Shower_E_FromShowerRoot.C:5
TTree * t
Definition: check_shower.C:4
Definition: EdbPattern.h:118
void SetN0(int n0)
Definition: EdbPattern.h:166
void AddSegment(EdbSegP *s)
Definition: EdbPattern.h:219
void SetNpl(int npl)
Definition: EdbPattern.h:173
EdbSegP * s2
Definition: tlg2pattern.C:31

◆ Help()

void EdbPVRQuality::Help ( )
2768 {
2769  // Basic Help Function. Of course to be extended from time to time.
2770 
2771  cout << "----------------------------------------------" << endl;
2772  cout << "----- void EdbPVRQuality::Help() -----" << endl;
2773  cout << "-----" << endl;
2774  cout << "----- This class helps you to determine the Quality Cut Plate by Plate" << endl;
2775  cout << "----- for suited BG level for shower reco." << endl;
2776  cout << "----- You use it like this:" << endl;
2777  cout << "----- EdbPVRQuality* QualityClass = new EdbPVRQuality(gAli)" << endl;
2778  cout << "----- where gAli is an EdbPVRec object pointer (usually the one" << endl;
2779  cout << "----- from the cp files). Then you can get the CutValues with" << endl;
2780  cout << "----- GetCutp0() (for each//all plate) back." << endl;
2781  cout << "-----" << endl;
2782  cout << "----- On TODO list: to be interfaced with the libShower reconstruction mode." << endl;
2783  cout << "-----" << endl;
2784  cout << "-----" << endl;
2785  cout << "----- Constant" << endl;
2786  cout << "----- BT Density Method: ..." << endl;
2787  cout << "-----" << endl;
2788  cout << "----- Constant" << endl;
2789  cout << "----- BT Quality Method: ..." << endl;
2790  cout << "-----" << endl;
2791  cout << "----- Constant" << endl;
2792  cout << "----- Xi2Hat Method: Fill a Chi2() and a Wtilde=1/W() histogram. Get Mean and Sigma" << endl;
2793  cout << "----- : of the two Histograms. Then construct a chi-square like" << endl;
2794  cout << "----- : variable: Xi2Hat=((Chi2-meanChi2)/sigmaChi2)^2 " << endl;
2795  cout << "----- : variable: +((Wtilde-meanWtilde)/sigmaWtilde)^2 " << endl;
2796  cout << "----- : Cut is then done by reducing the Xi2Hat limit by 0.1" << endl;
2797  cout << "----- : starting from an initial value of 5.0" << endl;
2798  cout << "-----" << endl;
2799  cout << "----- " << endl;
2800 
2801  cout << "----- void EdbPVRQuality::Help() -----" << endl;
2802  cout << "----------------------------------------------" << endl;
2803 }

◆ Init()

void EdbPVRQuality::Init ( void  )
protected
319 {
320  // Basic Init function that creates objects in the memory which have
321  // to be created only ONE time per class instance.
322 
323  Log(2,"EdbPVRQuality::Init","Init");
324 
325  // Create all the needed histograms:
326  eProfileBTdens_vs_PID_source = new TProfile("eProfileBTdens_vs_PID_source","eProfileBTdens_vs_PID_source",114,-0.5,113.5,0,200);
327  eProfileBTdens_vs_PID_target = new TProfile("eProfileBTdens_vs_PID_target","eProfileBTdens_vs_PID_target",114,-0.5,113.5,0,200);
328 
329  // Filled with EdbSegP::W(),Chi2() value
330  eHistWChi2 = new TH2F("eHistWChi2","eHistWChi2",21,10.5,31.5,100,0,2);
331  // Filled with EdbSegP::Chi2(), W(); WTilde(=1/W) value
332  eHistChi2 = new TH1F("eHistChi2","eHistChi2",100,0,2);
333  eHistW = new TH1F("eHistW","eHistW",21,10.5,31.5);
334  eHistWTilde = new TH1F("h_WTilde","h_WTilde",50,0,0.1);
335 
336  // Filled with EdbSegP::X(),Y() value
337  // Boundaries will be set in the SetHistGeometry... Function.
338  eHistXY = new TH2F("eHistXY","eHistXY",200,0,1,200,0,1);
339 
340  // Filled with EdbSegP::TX(),TY() value
341  eHistTXTY = new TH2F("eHistTXTY","eHistTXTY",70,-0.7,0.7,70,-0.7,0.7);
342 
343  // If tangens theta binning histogram is too fine grained,
344  // there is the danger of being to few entries in the histogram.
345  eHistTT = new TH1F("eHistTT","eHistTT",14,0,0.7);
346  // Filled with EdbSegP::TT() value
347  // eHistTTFillcheck is only used for determing the TT bin of the segment,
348  // also when rebinning this histogram
349  eHistTTFillcheck = new TH1F("eHistTTFillcheck","eHistTTFillcheck",14,0,0.7);
350 
351  eHistBTDensityPattern = new TH1F("eHistBTDensityPattern","eHistBTDensityPattern",200,0,200);
352  eHistBTDensityVolume = new TH1F("eHistBTDensityVolume","eHistBTDensityVolume",200,0,200);
353 
354  // Create arrays for tracks/segments which are to be
355  // removed after cleaning/ are to be kept:
356  // Arrays for stored BTs in TT space
357  for (int i = 0; i <12; i++ ) {
358  eArrayPatternTTSource[i] = new TObjArray();
359  eArrayPatternTTRejected[i] = new TObjArray();
360  eArrayPatternTTAccepted[i] = new TObjArray();
361  }
362  eArrayPatternAllTTSource = new TObjArray();
363  eArrayPatternAllTTRejected = new TObjArray();
364  eArrayPatternAllTTAccepted = new TObjArray();
365 
366  for (int i = 0; i <4; i++ ) eArrayPatternAllExcluded[i] = new TObjArray();
367  eArrayAllExcludedSegments = new TObjArray();
368 
369  // TEMPORARY, later the Standard Geometry should default be OPERA.
370  // For now we use a very large histogram that can contain both case
371  // x-y ranges. This takes slightly more memory but it shouldnt matter.
372  //if (eHistGeometry==0) SetHistGeometry_OPERA();
374 // SetHistGeometry_OPERAandMCBinArea625();
375 // SetHistGeometry_OPERAandMCBinArea4mm2();
376 
377  Log(2,"EdbPVRQuality::Init","Init...done.");
378  return;
379 }
void SetHistGeometry_OPERAandMC()
Definition: EdbPVRQuality.cxx:1011

◆ MergeExclusionLists()

void EdbPVRQuality::MergeExclusionLists ( )
5468  {
5469  cout << "EdbPVRQuality::MergeExclusionLists()" << endl;
5470 
5471  // Merge all different exclusion arrays together as one big exclusion array for the volume
5472  cout << "EdbPVRQuality::MergeExclusionLists() Merge all different exclusion arrays together as one big exclusion array for the volume" << endl;
5473 
5474  EdbSegP* seg;
5475  TObjArray* ArraySegments;
5476 
5477  // This array will be cleared, since with each
5478  // plate, it is filled new:
5479  eArrayAllExcludedSegments ->Clear();
5480 
5481  // Merge the 4 exclusion Lists into one great one.
5482  // That makes it easier for the Create... function to
5483  // create a new PVRec Object at one time...
5484 
5485  // Array Source Segments: 0 (FakeDoubleBTs)
5486  // Array Source Segments: 1 (HighDensBTs)
5487  // Array Source Segments: 2 (TracksPassingBTs)
5488  // Array Source Segments: 3 (EventRelatedBTs)
5489 
5490  for (int i=0; i<4; ++i) {
5491  ArraySegments=eArrayPatternAllExcluded[i];
5492  if (i==2) cout << "Attention: Exclusion lists 2 has NOT YET BEEN IMPLEMENTED AT THE MOMENT" << endl;
5493  if (i==3) cout << "Attention: Exclusion lists 3 has NOT YET BEEN IMPLEMENTED AT THE MOMENT" << endl;
5494  cout << "i= " << i << " ArraySegments->GetEntries() " << ArraySegments->GetEntries() << endl;
5495  for (Int_t j=0; j< ArraySegments->GetEntries(); ++j) {
5496  seg = (EdbSegP* )ArraySegments->At(j);
5497 
5498  // Add segmets for the whole exclusion array:
5499  eArrayAllExcludedSegments->Add(seg);
5500  }
5501  }
5502 
5503  cout << "EdbPVRQuality::MergeExclusionLists() eArrayAllExcludedSegments->GetEntries() " << eArrayAllExcludedSegments->GetEntries() << endl;
5504  cout << "EdbPVRQuality::MergeExclusionLists()...done." << endl;
5505  return;
5506 }

◆ MergeHighDensBTsLists()

void EdbPVRQuality::MergeHighDensBTsLists ( )
5444  {
5445  cout << "EdbPVRQuality::MergeHighDensBTsLists()" << endl;
5446 
5447  // Merge all arrays per patter together as array for the volume
5448  cout << "EdbPVRQuality::MergeHighDensBTsLists() Merge all arrays per pattern together as array for the volume" << endl;
5449 
5450  EdbSegP* seg;
5451  TObjArray* sourceArraySegments=eArrayPatternAllTTRejected;
5452  TObjArray* targetArraySegments=eArrayPatternAllExcluded[1];
5453 
5454  for (Int_t j=0; j< sourceArraySegments->GetEntries(); ++j) {
5455  seg = (EdbSegP* )sourceArraySegments->At(j);
5456  targetArraySegments->Add(seg);
5457  }
5458 
5459  cout << "EdbPVRQuality::MergeHighDensBTsLists() eArrayPatternAllExcluded[1]->GetEntries() " << eArrayPatternAllExcluded[1]->GetEntries() << endl;
5460  cout << "EdbPVRQuality::MergeHighDensBTsLists()...done." << endl;
5461  return;
5462 }

◆ MergeTTSegments()

void EdbPVRQuality::MergeTTSegments ( )
5389  {
5390  cout << "EdbPVRQuality::MergeTTSegments()" << endl;
5391  Int_t nbinsX=10;
5392  EdbSegP* seg;
5393  TObjArray* ArraySegments;
5394  Int_t nSegments=0;
5395  nSegments=0;
5396  // Loop over TT bins and merge Source, Accepted and Rejected Arrays into each one:
5397 
5398  for (int i = 0; i <nbinsX+2; i++ ) {
5399 
5400  cout << " Doing TT bin: " << i << endl;
5401 
5402  // Array Source Segments
5403  ArraySegments=eArrayPatternTTSource[i];
5404  nSegments=ArraySegments->GetEntries();
5405  if (nSegments>0) cout << "EdbPVRQuality::MergeTTSegments() ArraySegments->GetEntries() " << nSegments << endl;
5406  for (Int_t j=0; j< ArraySegments->GetEntries(); ++j) {
5407  seg = (EdbSegP* )ArraySegments->At(j);
5408  eArrayPatternAllTTSource->Add(seg);
5409  }
5410  // Array Accepted Segments
5411  ArraySegments=eArrayPatternTTAccepted[i];
5412  nSegments=ArraySegments->GetEntries();
5413  if (nSegments>0) cout << "EdbPVRQuality::MergeTTSegments() ArrayAccepted->GetEntries() " << nSegments << endl;
5414  for (Int_t j=0; j< ArraySegments->GetEntries(); ++j) {
5415  seg = (EdbSegP* )ArraySegments->At(j);
5416  eArrayPatternAllTTAccepted->Add(seg);
5417  }
5418  // Array Rejected Segments
5419  ArraySegments=eArrayPatternTTRejected[i];
5420  nSegments=ArraySegments->GetEntries();
5421  if (nSegments>0) cout << "EdbPVRQuality::MergeTTSegments() ArrayRejected->GetEntries() " << nSegments << endl;
5422  for (Int_t j=0; j< ArraySegments->GetEntries(); ++j) {
5423  seg = (EdbSegP* )ArraySegments->At(j);
5424  eArrayPatternAllTTRejected->Add(seg);
5425  }
5426 
5427  } // of for (int i = 0; i <nbinsX+2; i++ )
5428 
5429  cout << "EdbPVRQuality::MergeTTSegments() Merging done. Statistics after all TTbins:" << endl;
5430  cout << "EdbPVRQuality::MergeTTSegments() eArrayPatternAllTTSource->GetEntries() " << eArrayPatternAllTTSource->GetEntries() << endl;
5431  cout << "EdbPVRQuality::MergeTTSegments() eArrayPatternAllTTAccepted->GetEntries() " << eArrayPatternAllTTAccepted->GetEntries() << endl;
5432  cout << "EdbPVRQuality::MergeTTSegments() eArrayPatternAllTTRejected->GetEntries() " << eArrayPatternAllTTRejected->GetEntries() << endl;
5433 
5434 
5435  // Now the function MergeHighDensBTsLists() has to follow...
5436  // See the parent routine (Cut()...) , where this routine is called.
5437  cout << "EdbPVRQuality::MergeTTSegments()...done." << endl;
5438  return;
5439 }

◆ Print()

void EdbPVRQuality::Print ( )
1077 {
1078  Log(2,"EdbPVRQuality::Print","Print");
1079  for (int i=0; i<80; ++i) cout << "-";
1080  cout << endl;
1081  cout << "-";
1082  cout << endl;
1083  cout << "EdbPVRQuality::Print() --- SETTINGS GENERAL: ---" << endl;
1084  cout << "EdbPVRQuality::Print() --- " << setw(40) << "eCutMethod = " << eCutMethod << endl;
1085  cout << "EdbPVRQuality::Print() --- " << setw(40) << "eCutMethodString = " << eCutMethodString.Data() << endl;
1086  cout << "EdbPVRQuality::Print() --- " << setw(40) << "eCutMethodIsDone[0] = " << eCutMethodIsDone[0] << endl;
1087  cout << "EdbPVRQuality::Print() --- " << setw(40) << "eCutMethodIsDone[1] = " << eCutMethodIsDone[1] << endl;
1088  cout << "EdbPVRQuality::Print() --- " << setw(40) << "eCutMethodIsDone[2] = " << eCutMethodIsDone[2] << endl;
1089  cout << "EdbPVRQuality::Print() --- " << setw(40) << "eCutMethodIsDone[3] = " << eCutMethodIsDone[3] << endl;
1090  cout << "EdbPVRQuality::Print() --- " << setw(40) << "eCutMethodIsDone[4] = " << eCutMethodIsDone[4] << endl;
1091  cout << "EdbPVRQuality::Print() --- " << setw(40) << "eCutMethodIsDone[5] = " << eCutMethodIsDone[5] << endl;
1092  cout << "EdbPVRQuality::Print() --- " << setw(40) << "eCutMethodIsDone[6] = " << eCutMethodIsDone[6] << endl;
1093  cout << "EdbPVRQuality::Print() --- " << setw(40) << "eBTDensityLevel = " << eBTDensityLevel << endl;
1094  cout << "EdbPVRQuality::Print() --- " << setw(40) << "eCutTTSqueezeFactor = " << eCutTTSqueezeFactor << endl;
1095  cout << "EdbPVRQuality::Print() --- " << setw(40) << "eCutTTReductionFactor[1] = " << eCutTTReductionFactor[1] << endl;
1096 
1097  cout << "EdbPVRQuality::Print() --- " << setw(40) << "eBTDensityLevelCalcMethodMC = " << eBTDensityLevelCalcMethodMC << endl;
1098  //cout << "EdbPVRQuality::Print() --- " << setw(40) << "eBTDensityLevelCalcMethodMCConfirmationNumber = " << eBTDensityLevelCalcMethodMCConfirmationNumber << endl;
1099  cout << "EdbPVRQuality::Print() --- " << setw(40) << "eHistGeometry = " << eHistGeometry << endl;
1100  cout << "-" << endl;
1101  cout << "EdbPVRQuality::Print() --- SETTINGS: Input data:" << endl;
1102  cout << "EdbPVRQuality::Print() --- " << setw(40) << "eAli_orig = " << eAli_orig << endl;
1103  cout << "EdbPVRQuality::Print() --- " << setw(40) << "eAli_maxNpatterns = " << eAli_maxNpatterns << endl;
1104  cout << "EdbPVRQuality::Print() --- " << setw(40) << "eIsSource = " << eIsSource << endl;
1105  cout << "EdbPVRQuality::Print() --- " << setw(40) << "eProfileBTdens_vs_PID_source_meanX = " << eProfileBTdens_vs_PID_source_meanX << endl;
1106  cout << "EdbPVRQuality::Print() --- " << setw(40) << "eProfileBTdens_vs_PID_source_meanY = " << eProfileBTdens_vs_PID_source_meanY << endl;
1107  cout << "EdbPVRQuality::Print() --- " << setw(40) << "eProfileBTdens_vs_PID_source_rmsX = " << eProfileBTdens_vs_PID_source_rmsX << endl;
1108  cout << "EdbPVRQuality::Print() --- " << setw(40) << "eProfileBTdens_vs_PID_source_rmsY = " << eProfileBTdens_vs_PID_source_rmsY << endl;
1109  cout << "-" << endl;
1110  cout << "EdbPVRQuality::Print() --- SETTINGS: Output data:" << endl;
1111  cout << "EdbPVRQuality::Print() --- " << setw(40) << "eAli_modified = " << eAli_modified << endl;
1112  cout << "EdbPVRQuality::Print() --- " << setw(40) << "eAli_maxNpatterns = " << eAli_maxNpatterns << endl;
1113  cout << "EdbPVRQuality::Print() --- " << setw(40) << "eIsTarget = " << eIsTarget << endl;
1114  cout << "EdbPVRQuality::Print() --- " << setw(40) << "eProfileBTdens_vs_PID_target_meanX = " << eProfileBTdens_vs_PID_target_meanX << endl;
1115  cout << "EdbPVRQuality::Print() --- " << setw(40) << "eProfileBTdens_vs_PID_target_meanY = " << eProfileBTdens_vs_PID_target_meanY << endl;
1116  cout << "EdbPVRQuality::Print() --- " << setw(40) << "eProfileBTdens_vs_PID_target_rmsX = " << eProfileBTdens_vs_PID_target_rmsX << endl;
1117  cout << "EdbPVRQuality::Print() --- " << setw(40) << "eProfileBTdens_vs_PID_target_rmsY = " << eProfileBTdens_vs_PID_target_rmsY << endl;
1118  cout << "EdbPVRQuality::Print() --- " << setw(40) << "eNeedModified = " << eNeedModified << endl;
1119  cout << "-" << endl;
1120  for (int i=0; i<80; ++i) cout << "-";
1121  cout << endl;
1122 
1123  Log(2,"EdbPVRQuality::Print","Print...done.");
1124  return;
1125 }
Int_t eHistGeometry
Definition: EdbPVRQuality.h:50
TString eCutMethodString
Definition: EdbPVRQuality.h:55

◆ PrintBTDensities()

void EdbPVRQuality::PrintBTDensities ( )
1129 {
1130  // Prints BT densities for all patterns in the source.
1131  Log(2,"EdbPVRQuality::PrintBTDensities","PrintBTDensities");
1132  if (!eIsSource) return;
1133  cout << "PrintBTDensities for object EdbPVRec at " << eAli_orig << endl;
1134  for (int i=0; i<eAli_orig->Npatterns(); ++i) cout << "BT density for pattern " << i << " = " << GetBTDensity(i) << endl;
1135  cout << "BT density averaged = " << GetBTDensity(-1) << endl;
1136  Log(2,"EdbPVRQuality::PrintBTDensities","PrintBTDensities...done.");
1137  return;
1138 }

◆ PrintCutType()

void EdbPVRQuality::PrintCutType ( )
1057 {
1058  // Print PrintCutType data for this class.
1059  cout << "EdbPVRQuality::Print() " << endl;
1060  for (int i=0; i<8; i++) {
1061  cout << "EdbPVRQuality::Print() eCutMethodIsDone["<<i<<"] " << eCutMethodIsDone[i] << endl;
1062  }
1063  if (eCutMethodIsDone[0]) PrintCutType0();
1064  if (eCutMethodIsDone[1]) PrintCutType1();
1065  if (eCutMethodIsDone[2]) PrintCutType2();
1066  if (eCutMethodIsDone[3]) PrintCutType3();
1067  if (eCutMethodIsDone[4]) PrintCutType4();
1068  if (eCutMethodIsDone[5]) PrintCutType5();
1069  if (eCutMethodIsDone[6]) PrintCutType6();
1070  if (eCutMethodIsDone[7]) PrintCutType7();
1071  return;
1072 }
void PrintCutType0()
Definition: EdbPVRQuality.cxx:1141
void PrintCutType2()
Definition: EdbPVRQuality.cxx:1226
void PrintCutType3()
Definition: EdbPVRQuality.cxx:1236
void PrintCutType1()
Definition: EdbPVRQuality.cxx:1183
void PrintCutType5()
Definition: EdbPVRQuality.cxx:1288
void PrintCutType7()
Definition: EdbPVRQuality.cxx:1304
void PrintCutType6()
Definition: EdbPVRQuality.cxx:1296

◆ PrintCutType0()

void EdbPVRQuality::PrintCutType0 ( )
1142 {
1143  // Prints quality cut values for each plate of the original EdbPVRec object that were
1144  // applied to achieve the basetrack density level, after application the specific cut
1145  // on the segments of the specific plate (=pattern).
1146 
1147  if (!eIsSource) return;
1148 
1149  if (!eCutMethodIsDone[0]) {
1150  cout << "--- EdbPVRQuality::PrintCutType0()----------" << endl;
1151  cout << "--- This CutType has not been done. Run Execute_ConstantBTDensity() ---" << endl;
1152  cout << "--- to see the results (return now). ---" << endl;
1153  return;
1154  }
1155 
1156  cout << "----------void EdbPVRQuality::PrintCutType0()----------" << endl;
1157  cout << "Pattern || Z() || Nseg || eCutp0[i] || eCutp1[i] || BTDensity_orig ||...|| Nseg_modified || BTDensity_modified ||"<< endl;
1158 
1159  if (NULL==eAli_modified) {
1161  cout << "WARNING eAli_modified==NULL ==>> Take eAli_orig instead. To build eAli_modified please run CreateEdbPVRec(eAli_orig)" << endl;
1162  }
1163 
1164  int Npat_orig = eAli_orig->Npatterns();
1165  for (int i=0; i<Npat_orig; i++) {
1166  EdbPattern* pat_orig = (EdbPattern*)eAli_orig->GetPattern(i);
1167  Int_t npatO=pat_orig->N();
1168  EdbPattern* pat_modified = (EdbPattern*)eAli_modified->GetPattern(i);
1169  Int_t npatM=pat_modified->N();
1170  //
1171  cout << i;
1172  cout << " ";
1173  printf("%.1f %d %.3f %.3f %.2f",pat_orig->Z(),npatO, eCutp0[i], eCutp1[i] , ePatternBTDensity_orig[i]);
1174  cout << " ... ";
1175  printf("%.1f %d %.3f %.3f %.2f",pat_modified->Z(),npatM, eCutp0[i] ,eCutp1[i], ePatternBTDensity_modified[i]);
1176  cout << endl;
1177  }
1178 
1179  return;
1180 }

◆ PrintCutType1()

void EdbPVRQuality::PrintCutType1 ( )
1184 {
1185  // Prints quality cut values for each plate of the original EdbPVRec object that were
1186  // applied to achieve the basetrack density level, after application the specific cut
1187  // on the segments of the specific plate (=pattern).
1188 
1189  if (!eIsSource) return;
1190  if (!eCutMethodIsDone[1]) {
1191  cout << "--- EdbPVRQuality::PrintCutType1()----------" << endl;
1192  cout << "--- This CutType has not been done. Run Execute_ConstantBTQuality() ---" << endl;
1193  cout << "--- to see the results (return now). ---" << endl;
1194  return;
1195  }
1196 
1197  cout << "----------void EdbPVRQuality::PrintCutType1()----------" << endl;
1198 
1199  cout << "Pattern || Z() || Nseg || BTDensity_orig || Chi2CutMeanChi2 || Chi2CutRMSChi2 || Chi2CutMeanW || Chi2CutRMSW || Chi2Cut[i] || BTDensity_modified ||"<< endl;
1200 
1201  if (NULL==eAli_modified) {
1203  cout << "WARNING eAli_modified==NULL ==>> Take eAli_orig instead. To build eAli_modified please run CreateEdbPVRec(eAli_orig)" << endl;
1204  }
1205 
1206  int Npat_orig = eAli_orig->Npatterns();
1207  for (int i=0; i<Npat_orig; i++) {
1208  EdbPattern* pat_orig = (EdbPattern*)eAli_orig->GetPattern(i);
1209  Int_t npatO=pat_orig->N();
1210  EdbPattern* pat_modified = (EdbPattern*)eAli_modified->GetPattern(i);
1211  Int_t npatM=pat_modified->N();
1212  cout << i;
1213  cout << " ";
1214  printf("%.1f %d %.2f %.2f %.2f %.2f %.2f %.2f",pat_orig->Z(),npatO, eAgreementChi2CutMeanChi2 , eAgreementChi2CutRMSChi2, eAgreementChi2CutMeanW , eAgreementChi2CutRMSW, eAgreementChi2WDistCut[i], ePatternBTDensity_orig[i]);
1215  cout << " ... ";
1216  printf("%.1f %d %.2f %.2f %.2f %.2f %.2f %.2f",pat_modified->Z(),npatM, eAgreementChi2CutMeanChi2 , eAgreementChi2CutRMSChi2, eAgreementChi2CutMeanW , eAgreementChi2CutRMSW, eAgreementChi2WDistCut[i], ePatternBTDensity_modified[i]);
1217  cout << endl;
1218  }
1219  return;
1220 }

◆ PrintCutType2()

void EdbPVRQuality::PrintCutType2 ( )
1227 {
1228  cout << "TODO void EdbPVRQuality::PrintCutType2() NOT YET IMPLEMENTED" << endl;
1229  return;
1230 }

◆ PrintCutType3()

void EdbPVRQuality::PrintCutType3 ( )
1237 {
1238  cout << "TODO void EdbPVRQuality::PrintCutType3() NOT YET IMPLEMENTED" << endl;
1239  return;
1240 }

◆ PrintCutType4()

void EdbPVRQuality::PrintCutType4 ( )
1246 {
1247  // Prints quality cut values for each plate of the original EdbPVRec object that were
1248  // applied to achieve the basetrack density level, after application the specific cut
1249  // on the segments of the specific plate (=pattern).
1250 
1251  if (!eIsSource) return;
1252  if (!eCutMethodIsDone[4]) {
1253  cout << "--- EdbPVRQuality::PrintCutType4()----------" << endl;
1254  cout << "--- This CutType has not been done. Run Execute_ConstantBTQuality() ---" << endl;
1255  cout << "--- to see the results (return now). ---" << endl;
1256  return;
1257  }
1258 
1259  cout << "----------void EdbPVRQuality::PrintCutType4()----------" << endl;
1260 
1261  cout << "Pattern || Z() || Nseg || BTDensity_orig || eXi2Hat_m_chi2 || eXi2Hat_s_chi2 || eXi2Hat_m_WTilde || eXi2Hat_s_WTilde || eXi2HatCut[i] || BTDensity_modified ||"<< endl;
1262 
1263  if (NULL==eAli_modified) {
1265  cout << "WARNING eAli_modified==NULL ==>> Take eAli_orig instead. To build eAli_modified please run CreateEdbPVRec(eAli_orig)" << endl;
1266  }
1267 
1268  int Npat_orig = eAli_orig->Npatterns();
1269  for (int i=0; i<Npat_orig; i++) {
1270  EdbPattern* pat_orig = (EdbPattern*)eAli_orig->GetPattern(i);
1271  Int_t npatO=pat_orig->N();
1272  EdbPattern* pat_modified = (EdbPattern*)eAli_modified->GetPattern(i);
1273  Int_t npatM=pat_modified->N();
1274  cout << i;
1275  cout << " ";
1276  printf("%.1f %d %.2f %.2f %.2f %.2f %.2f %.2f",pat_orig->Z(),npatO, eXi2Hat_m_chi2[i] , eXi2Hat_s_chi2[i], eXi2Hat_m_WTilde[i] , eXi2Hat_s_WTilde[i], eX2HatCut[i], ePatternBTDensity_orig[i]);
1277  cout << " ... ";
1278  printf("%.1f %d %.2f %.2f %.2f %.2f %.2f %.2f",pat_orig->Z(),npatM, eXi2Hat_m_chi2[i] , eXi2Hat_s_chi2[i], eXi2Hat_m_WTilde[i] , eXi2Hat_s_WTilde[i], eX2HatCut[i], ePatternBTDensity_modified[i]);
1279  cout << endl;
1280  }
1281  return;
1282 }

◆ PrintCutType5()

void EdbPVRQuality::PrintCutType5 ( )
1289 {
1290  cout << "TODO void EdbPVRQuality::PrintCutType5() NOT YET IMPLEMENTED" << endl;
1291  return;
1292 }

◆ PrintCutType6()

void EdbPVRQuality::PrintCutType6 ( )
1297 {
1298  cout << "TODO void EdbPVRQuality::PrintCutType6() NOT YET IMPLEMENTED" << endl;
1299  return;
1300 }

◆ PrintCutType7()

void EdbPVRQuality::PrintCutType7 ( )
1305 {
1306  cout << "TODO void EdbPVRQuality::PrintCutType6() NOT YET IMPLEMENTED" << endl;
1307  return;
1308 }

◆ PrintCutValues()

void EdbPVRQuality::PrintCutValues ( Int_t  CutType)
3677  {
3678  cout <<"-----------------------------------------------------------------------------------------------------------------------" << endl;
3679  cout <<"EdbPVRQuality::PrintCutValues for CutType= " << CutType << endl;
3680  cout <<"-----------------------------------------------------------------------------------------------------------------------" << endl;
3681  if (CutType==1 || CutType==5 || CutType==7 ) {
3682  cout << "#plate #tt[0.0,0.1], #tt[0.1,0.2], #tt[0.2,0.3], #tt[0.3,0.4], #tt[0.4,0.5], #tt[0.5,0.6], #tt[0.6,0.7], #tt[0.7,0.8]" << endl;
3683  cout <<"-----------------------------------------------------------------------------------------------------------------------" << endl;
3684  for (int i=0; i<eAli_maxNpatterns; i++) {
3685  cout << i << " ";
3686  // npatterns of eali...
3687  for (int angspacecounter=0; angspacecounter<8; angspacecounter++) {
3688  printf(" %1.3f ", eCutTTp1[i][angspacecounter]);
3689  }
3690  cout << endl;
3691 
3692  if (CutType==5) {
3693  cout << i << " ";
3694  // npatterns of eali...
3695  for (int angspacecounter=0; angspacecounter<8; angspacecounter++) {
3696  printf(" %1.3f ", eCutTTp0[i][angspacecounter]);
3697  }
3698  cout << endl;
3699  }
3700  }
3701  cout <<"-----------------------------------------------------------------------------------------------------------------------" << endl;
3702  } // if (CutType==...)
3703  cout <<"EdbPVRQuality::PrintCutTypeDetailed...done." << endl;
3704  return;
3705 }

◆ RebinTTHistogram()

void EdbPVRQuality::RebinTTHistogram ( Int_t  nbins = 5)
5613  {
5614  cout << "EdbPVRQuality::RebinTTHistogram(Int_t nbins)" << endl;
5615 
5616  if (nbins>10 || nbins<1) {
5617  cout << "WARNING EdbPVRQuality::RebinTTHistogram() Value nbins = " << nbins << " not supported ([1..10])." << endl;
5618  cout << "WARNING EdbPVRQuality::RebinTTHistogram() Set back to default value of 5." << endl;
5619  nbins=5;
5620  }
5621  eHistTTFillcheck->Reset();
5622  // Reduce number of bins (same boundaries):
5623  // 10 ->ok; // 05 ->ok;
5624  // 02 ->??; // Fit doesnt work, so set then the number of binentries manually...
5625  // see code in the function CreateEdbPVRec_TT_Algorithms()
5626  eHistTTFillcheck->SetBins(nbins,0,1);
5627  cout <<"EdbPVRQuality::RebinTTHistogram() eHistTT->SetBins(" << nbins << ",0,1);" << endl;
5628 
5629  cout << "EdbPVRQuality::RebinTTHistogram()...done." << endl;
5630  return;
5631 }

◆ Remove_DoubleBT()

EdbPVRec * EdbPVRQuality::Remove_DoubleBT ( EdbPVRec aliSource)
3065 {
3066  // Remove double counted basetracks. This is a scanning induced error, at the
3067  // edges of the objective field, corrections are different, thus one
3068  // basetrack is seen differently in two different views.
3069  // In Bern data, we do see clearly this double bump, that is characterized by
3070  // _very_ close values of two BTs in X,Y,TX,TY (and also Chi2 and W).
3071  // Separation threshold values are 2 microns in postion and 10 mrad in angle.
3072  // (again obtained from Bern data).
3073 
3074  // Quick and Dirty implementation !
3075  cout << "EdbPVRQuality::Remove_DoubleBT()" << endl;
3076  cout << "EdbPVRQuality::Remove_DoubleBT() aliSource = " << aliSource << endl;
3077  cout << "EdbPVRQuality::Remove_DoubleBT() eAli_orig = " << eAli_orig << endl;
3078 
3079  if (NULL==aliSource) {
3080  cout << "WARNING! EdbPVRQuality::Remove_DoubleBT() Source EdbPVRec is NULL. Try to change to object eAli_orig: " << eAli_orig << endl;
3081  if (NULL==eAli_orig) {
3082  cout << "WARNING! EdbPVRQuality::Remove_DoubleBT() Also eAli_orig EdbPVRec is NULL. Do nothing and return NULL pointer!" << endl;
3083  return NULL;
3084  }
3085  else {
3086  aliSource=eAli_orig;
3087  }
3088  }
3089 
3090  // Make a new PVRec object anyway
3091  EdbPVRec* aliTarget = new EdbPVRec();
3092  // aliTarget->Print();
3093 
3094  Bool_t seg_seg_close=kFALSE;
3095  EdbSegP* seg=0;
3096  EdbSegP* seg1=0;
3097  Int_t NdoubleFoundSeg=0;
3098  Int_t NdoubleFoundSegPatterns[114];
3099 
3100  // Bool variables for the different "regions" of the FakeBT Doublets
3101  Bool_t IsRegion0;
3102  Bool_t IsRegion1;
3103  Bool_t IsRegion2;
3104 
3105  //gEDBDEBUGLEVEL=3;
3106  cout << "EdbPVRQuality::Remove_DoubleBT() Start looping now. Attention, this might take a while!" << endl;
3107 
3108  if (aliSource->Npatterns()==0) return aliSource;
3109  for (int i = 0; i <aliSource->Npatterns(); i++ ) {
3110  NdoubleFoundSegPatterns[i]=0;
3111  }
3112 
3113 
3114  for (int i = 0; i <aliSource->Npatterns(); i++ ) {
3115 
3116  // Create Target Pattern:
3117  EdbPattern* pat = aliSource->GetPattern(i);
3118  EdbPattern* pt= new EdbPattern();
3119  // SetPattern Values to the parent patterns:
3120  pt->SetID(pat->ID());
3121  pt->SetPID(pat->PID());
3122  pt->SetZ(pat->Z());
3123  // Helper Variable for cout purpose
3124  Int_t nPat=pat->N();
3125 
3126  if (gEDBDEBUGLEVEL>1) cout << "EdbPVRQuality::Remove_DoubleBT() Looping over Ali_source->Pat()=" << i << " (PID=" << pat->PID() << ") with N= " << nPat << " segs. Until now double Candidates found: " << NdoubleFoundSeg << endl;
3127 
3128 
3129  for (int j = 0; j < nPat; j++ ) {
3130 
3131  // condition due avoid floating point exception (divide by zero)
3132  if (gEDBDEBUGLEVEL>2) if (nPat>10) if (j%(nPat/10)==0) cout << "." << flush;
3133 
3134  seg = pat->GetSegment(j);
3135  seg_seg_close=kFALSE;
3136 
3137  for (int k = j; k < nPat; k++ ) {
3138  if (k==j) continue;
3139 
3140 
3141  if (seg_seg_close) continue;
3142 
3143  if (gEDBDEBUGLEVEL>3) cout << "EdbPVRQuality::Remove_DoubleBT() Doing segment pair nr=" << j << "," << k << endl;
3144  seg1 = pat->GetSegment(k);
3145 
3146  // Here decide f.e. which segments to check...
3147  Bool_t toContinue=kTRUE;
3148  // Here decide f.e. which segments to check...
3149  Bool_t toKeep=kFALSE;
3150 
3151 
3152  // Skip already large distances
3153  if (TMath::Abs(seg->X()-seg1->X())>20.1) continue;
3154  if (TMath::Abs(seg->Y()-seg1->Y())>20.1) continue;
3155  if (TMath::Abs(seg->TX()-seg1->TX())>0.1) continue;
3156  if (TMath::Abs(seg->TY()-seg1->TY())>0.1) continue;
3157  //
3158  // Segment Pairs can fall into three regions:
3159  //
3160  // region 0) all BT pairings within dT<->dR line
3161  //
3162  // region 1) all BT parings within a dR,dT rectangle at the origin
3163  //
3164  // region 2) all BT parings within a dR,dT rectangle at (0,6)
3165  //
3166  Float_t dR_allowed=0;
3167  Float_t deltaR=0;
3168  Float_t deltaTheta=0;
3169  Float_t dR_allowed_m_deltaR=0;
3170 
3171  deltaTheta=TMath::Sqrt( TMath::Power(seg->TX()-seg1->TX(),2)+TMath::Power(seg->TY()-seg1->TY(),2) );
3172  if (deltaTheta>0.1) continue;
3173 
3174  deltaR=TMath::Sqrt( TMath::Power(seg->X()-seg1->X(),2)+TMath::Power(seg->Y()-seg1->Y(),2) );
3175 
3176 
3177  // line defined by experimental values (by some arbitrary bricks and my own BG-bricks)
3178  // dR_allowed = 10.75/0.1*deltaTheta; // old
3179  dR_allowed = 14.0/0.13*deltaTheta; // better description of the line
3180  dR_allowed_m_deltaR=TMath::Abs(deltaR-dR_allowed);
3181 
3182  // Region check of the (Fake-)BTPair
3183  IsRegion0=kFALSE;
3184  IsRegion1=kFALSE;
3185  IsRegion2=kFALSE;
3186 
3187  // Set flags for region
3188  if (dR_allowed_m_deltaR<0.5) IsRegion0=kTRUE;
3189  if (deltaR<3.0 && deltaTheta<0.01) IsRegion1=kTRUE;
3190  if (abs(deltaR-6.0)<2 && deltaTheta<0.01) IsRegion2=kTRUE;
3191 
3192  // For this function now -in contrary to Remove_DoubleBT- we
3193  // ONLY keep double basetrack pairings within the line
3194  if (IsRegion0) toKeep=kTRUE;
3195  // or within the small square at the origin
3196  if (IsRegion1) toKeep=kTRUE;
3197  // or within the small square at the dR value
3198  if (IsRegion2) toKeep=kTRUE;
3199 
3200  if (!toKeep) continue;
3201 
3202  if (gEDBDEBUGLEVEL>3) cout << "EdbPVRQuality::Remove_DoubleBT() Found incompatible segment for dR_dT line condition: " << endl;
3203 
3204  // if (gEDBDEBUGLEVEL>3) cout << "EdbPVRQuality::Remove_DoubleBT() Do last check if both are MCEvt segments of different event number! " << endl;
3205  if ((seg->MCEvt()!=seg1->MCEvt())&&(seg->MCEvt()>0&&seg1->MCEvt()>0)) continue;
3206  // I have doubts if I shall take MC events also out, but I guess Yes, because if
3207  // in data these small pairings appear, then they will fall also under the
3208  // category "fake doublet" and then be removed, even if they are real double BT
3209  // from a signal.
3210 
3211 
3212  ++NdoubleFoundSeg;
3213  ++NdoubleFoundSegPatterns[i];
3214  seg_seg_close=kTRUE;
3215  } // for (int k = j+1; k <pat->N(); k++ )
3216 
3217  if (seg_seg_close) continue;
3218 
3219  // Add segment:
3220  if (gEDBDEBUGLEVEL>3) cout << "// Add segment at " << seg << endl;
3221  pt->AddSegment(*seg);
3222 
3223  }// for (int k)
3224 
3225  if (gEDBDEBUGLEVEL>2) cout << "// Add Pattern at " << pt << endl;
3226  aliTarget->AddPattern(pt);
3227  } // for (int j)
3228 
3229  if (gEDBDEBUGLEVEL>1) aliSource->Print();
3230  if (gEDBDEBUGLEVEL>1) aliTarget->Print();
3231 
3232  if (gEDBDEBUGLEVEL>1) {
3233  cout << "EdbPVRQuality::Remove_DoubleBT() Statistics: " << endl;
3234  cout << "EdbPVRQuality::Remove_DoubleBT() We found " << NdoubleFoundSeg << " double segments too close to each other to be different BTracks." << endl;
3235  cout << "EdbPVRQuality::Remove_DoubleBT() DoubleBT Statistics per pattern: " << endl;
3236  cout << setw(14) << "Pattern ID" << setw(14) << "#Segments = " << setw(14) << " #DoubleBT " << setw(14) << " Overhead(%) " << endl;
3237 
3238  for (int i = 0; i <aliSource->Npatterns(); i++ ) {
3239  EdbPattern* pat = aliSource->GetPattern(i);
3240  cout << setw(14) << pat->ID() << setw(14) << pat->N() << setw(14) << NdoubleFoundSegPatterns[i] << setw(14) << Double_t(NdoubleFoundSegPatterns[i])/(pat->N()+1) << endl;
3241  }
3242  }
3243 
3244  cout << "EdbPVRQuality::Remove_DoubleBT()...done." << endl;
3245  return aliTarget;
3246 }

◆ Remove_Passing()

EdbPVRec * EdbPVRQuality::Remove_Passing ( EdbPVRec aliSource)
3251 {
3252  // Removes Passing Tracks from the EdbPVRec source object.
3253  // Unfortunately, there does NOT exist an easy function like
3254  // ->RemoveSegment from EdbPVRec object. That makes implementation complicated
3255  // and we have to go via the intermediate step of creating a new
3256  // EdbPVRec volume.
3257 
3258  cout << "EdbPVRQuality::Remove_Passing()." << endl;
3259  cout << "EdbPVRQuality::Remove_Passing() aliSource = " << aliSource << endl;
3260  cout << "EdbPVRQuality::Remove_Passing() eAli_orig = " << eAli_orig << endl;
3261 
3262  if (NULL==aliSource) {
3263  cout << "WARNING!----EdbPVRQuality::Remove_Passing() Source EdbPVRec is NULL. Try to change to object eAli_orig: " << eAli_orig << endl;
3264  if (NULL==eAli_orig) {
3265  cout << "WARNING!----EdbPVRQuality::Remove_Passing() Also eAli_orig EdbPVRec is NULL. Do nothing and return NULL pointer!" << endl;
3266  return NULL;
3267  }
3268  else {
3269  aliSource=eAli_orig;
3270  }
3271  }
3272 
3273  // Get the tracks from the source object:
3274  TObjArray* Tracks=aliSource->eTracks;
3275 
3276  // If eAli source has no tracks, we return here and stop.
3277  if (NULL == Tracks) {
3278  cout << "WARNING!----EdbPVRQuality::Remove_Passing() NULL == eTracks." << endl;
3279  cout << "EdbPVRQuality::Remove_Passing() Read tracks from a linked_tracks.root file if there is any." << endl;
3281 
3282  if (NULL == Tracks) {
3283  cout << "WARNING!----EdbPVRQuality::GetTracksFromLinkedTracksRootFile() NULL == eTracks." << endl;
3284  cout << "WARNING!----EdbPVRQuality::Remove_Passing() Reading tracks from a linked_tracks.root file failed." << endl;
3285  cout << "WARNING!----EdbPVRQuality::Remove_Passing() Return the original object back." << endl;
3286  return aliSource;
3287  }
3288  }
3289 
3290  // Now the object array Tracks should be filled anyway, either from the source EdbPVR
3291  // or from the linked_tracks.root file:
3292  Int_t TracksN=Tracks->GetEntries();
3293  EdbTrackP* track;
3294  EdbSegP* trackseg;
3295 
3296  if (gEDBDEBUGLEVEL>1) {
3297  cout << "EdbPVRQuality::Remove_Passing() aliSource/linked_tracks.root has Tracks N=" << TracksN << endl;
3298  }
3299 
3300  // Make a new PVRec object anyway
3301  EdbPVRec* aliTarget = new EdbPVRec();
3302  Bool_t seg_in_eTracks=kFALSE;
3303  Int_t totallyRemovedSegments=0;
3304  Int_t totallyAddedSegments=0;
3305  Int_t aliSourceNPat=aliSource->Npatterns();
3306 
3307  for (int i = 0; i < aliSourceNPat; i++ ) {
3308  cout << "EdbPVRQuality::Remove_Passing() Looping over aliSource->Pat()=" << i << endl;
3309 
3310  EdbPattern* pat = aliSource->GetPattern(i);
3311  EdbPattern* pt= new EdbPattern();
3312  // SetPattern Values to the parent patterns:
3313  pt->SetID(pat->ID());
3314  pt->SetPID(pat->PID());
3315  pt->SetZ(pat->Z());
3316 
3317  for (int j = 0; j <pat->N(); j++ ) {
3318  EdbSegP* seg = pat->GetSegment(j);
3319  seg_in_eTracks=kFALSE;
3320 
3321  if (gEDBDEBUGLEVEL>3) cout << "Checking segment j= " << j << " and loop over tracks to check correspondance." <<endl;
3322 
3323  for (int ll = 0; ll<TracksN; ll++ ) {
3324  track=(EdbTrackP*)Tracks->At(ll);
3325  Int_t TrackSegN=track->N();
3326 
3327  // Compare if this track is regarded as "passing"
3328  // when its less than5 plates than the original pvr object
3329  if (track->Npl()<aliSourceNPat-5) continue;
3330 // cout << track->Npl() << " " << aliSourceNPat << endl;
3331 
3332  // Here decide f.e. which tracks to check...
3333  // On cosmics it would be nice that f.e. Npl()>=Npatterns-4 ...
3334  // if ....()....
3335  // Since addresses of objects can vary, its better to compare them
3336  // by absolute positions.
3337 
3338  for (int kk = 0; kk<TrackSegN; kk++ ) {
3339  if (seg_in_eTracks) continue;
3340  trackseg=track->GetSegment(kk);
3341  if (TMath::Abs(seg->Z()-trackseg->Z())>10.1) continue;
3342  if (TMath::Abs(seg->X()-trackseg->X())>5.1) continue;
3343  if (TMath::Abs(seg->Y()-trackseg->Y())>5.1) continue;
3344  if (TMath::Abs(seg->TX()-trackseg->TX())>0.05) continue;
3345  if (TMath::Abs(seg->TY()-trackseg->TY())>0.05) continue;
3346  //cout << "Found compatible segment!! " << endl;
3347  totallyRemovedSegments++;
3348  seg_in_eTracks=kTRUE;
3349  }
3350  if (seg_in_eTracks) continue;
3351  }
3352  if (seg_in_eTracks) continue;
3353 // // Arrived here then the segment has no equivalent in any segments
3354  // of the tracks array.
3355 
3356  // Add segment:
3357  if (gEDBDEBUGLEVEL>3) cout << "EdbPVRQuality::Remove_Passing() Add segment:" << endl;
3358  pt->AddSegment(*seg);
3359  totallyAddedSegments++;
3360  }
3361  if (gEDBDEBUGLEVEL>2) cout << "EdbPVRQuality::Remove_Passing() TotallyAddedSegments (up to now) = " << totallyAddedSegments << " // Add Pattern:" << endl;
3362  aliTarget->AddPattern(pt);
3363  }
3364 
3365  if (gEDBDEBUGLEVEL>1) aliSource->Print();
3366  if (gEDBDEBUGLEVEL>1) aliTarget->Print();
3367 
3368  cout << "EdbPVRQuality::Remove_Passing() Totally removed segments= " << totallyRemovedSegments << endl;
3369  cout << "EdbPVRQuality::Remove_Passing()...done." << endl;
3370  return aliTarget; // Warning, cppcheck says here:
3371  // [EdbPVRQuality.cxx:3281]: (error) Memory leak: Track
3372  // Dont know why yet ...
3373 }
TObjArray * GetTracksFromLinkedTracksRootFile()
Definition: EdbPVRQuality.cxx:3618
Definition: bitview.h:14

◆ Remove_Segment()

EdbPVRec * EdbPVRQuality::Remove_Segment ( EdbSegP seg,
EdbPVRec aliSource = NULL,
Int_t  Option = 0 
)
3424  {
3425  // Remove one segment (EdbSegP* seg type).
3426  // Return a new EdbPVRec* with previous element removed.
3427  cout << "EdbPVRQuality::Remove_Segment():" << endl;
3428  TObjArray* segArray= new TObjArray();
3429  segArray->Add(seg);
3430  Remove_SegmentArray(segArray,aliSource,Option);
3431  delete segArray;
3432  cout << "EdbPVRQuality::Remove_Segment()...done." << endl;
3433  return NULL;
3434 }
EdbPVRec * Remove_SegmentArray(TObjArray *segarray, EdbPVRec *aliSource=NULL, Int_t Option=0)
Definition: EdbPVRQuality.cxx:3378

◆ Remove_SegmentArray()

EdbPVRec * EdbPVRQuality::Remove_SegmentArray ( TObjArray *  segarray,
EdbPVRec aliSource = NULL,
Int_t  Option = 0 
)
3379 {
3380  // Every "Remove_XXY()" function will call Remove_SegmentArray() since the removal of
3381  // a segment array is easiest to implement. As said earlier, there is no easy function
3382  // to remove tracks from a EdbPVRec object directly. So instead we have to create a
3383  // new EdbPVRec object, fill with all basetracks from the old one, except where the
3384  // segments of the SegmentArray coincide with those which are in the source EdbPVRec.
3385 
3386  cout << "EdbPVRQuality::Remove_SegmentArray():" << endl;
3387 
3388  if (NULL==aliSource) {
3389  cout << "EdbPVRQuality::Remove_SegmentArray() ERROR aliSource=NULL pointer. I cannot" << endl;
3390  cout << "EdbPVRQuality::Remove_SegmentArray() ERROR do something here and I will return a NULL pointer now. Stop." << endl;
3391  return NULL;
3392  }
3393 
3394  if (gEDBDEBUGLEVEL>2) {
3395  cout << "EdbPVRQuality::Remove_SegmentArray() INFO " << endl;
3396  cout << "EdbPVRQuality::Remove_SegmentArray() segarray = " << segarray << " with " << segarray->GetEntries() << " entries." << endl;
3397  cout << "EdbPVRQuality::Remove_SegmentArray() aliSource = " << aliSource << " with " << aliSource->Npatterns() << " patterns." << endl;
3398  cout << "EdbPVRQuality::Remove_SegmentArray() Option = " << Option << "." << endl;
3399  }
3400 
3401 
3402  cout << "WARNING!!! THIS FUNCTION IS NOT YET IMPLEMENTED!!!"<<endl;
3403 
3404  cout << "EdbPVRQuality::Remove_SegmentArray()...done." << endl;
3405  return NULL;
3406 }

◆ Remove_Track()

EdbPVRec * EdbPVRQuality::Remove_Track ( EdbTrackP track,
EdbPVRec aliSource = NULL,
Int_t  Option = 0 
)
3438  {
3439  // Remove one track (EdbTrackP* track type).
3440  // Return a new EdbPVRec* with previous element removed.
3441  cout << "EdbPVRQuality::Remove_Track():" << endl;
3442  TObjArray* segArray= new TObjArray();
3443  segArray= TrackToSegmentArray(track);
3444  Remove_SegmentArray(segArray,aliSource,Option);
3445  delete segArray;
3446  cout << "EdbPVRQuality::Remove_Track()...done." << endl;
3447  return NULL;
3448 }
TObjArray * TrackToSegmentArray(EdbTrackP *track)
Definition: EdbPVRQuality.cxx:3452

◆ Remove_TrackArray()

EdbPVRec * EdbPVRQuality::Remove_TrackArray ( TObjArray *  trackArray,
EdbPVRec aliSource = NULL,
Int_t  Option = 0 
)
3410  {
3411  // Remove a whole track array (Array of EdbTrackP type).
3412  // Return a new EdbPVRec* with previous element removed.
3413  cout << "EdbPVRQuality::Remove_TrackArray():" << endl;
3414  TObjArray* segArray= new TObjArray();
3415  segArray= TrackArrayToSegmentArray(trackArray);
3416  Remove_SegmentArray(segArray,aliSource,Option);
3417  delete segArray;
3418  cout << "EdbPVRQuality::Remove_TrackArray()...done." << endl;
3419  return NULL;
3420 }
TObjArray * TrackArrayToSegmentArray(TObjArray *trackArray)
Definition: EdbPVRQuality.cxx:3467

◆ ResetHistos()

void EdbPVRQuality::ResetHistos ( )
protected
186 {
187  // Reset Default Histograms
188  Log(2,"EdbPVRQuality::ResetHistos","ResetHistos");
189 
190  // Reset histos for all patterns:
192 
193  // Reset other histos for volume
194  eHistBTDensityVolume->Reset();
197 
198  Log(2,"EdbPVRQuality::ResetHistos","ResetHistos...done.");
199 }

◆ ResetHistosSinglePattern()

void EdbPVRQuality::ResetHistosSinglePattern ( )
protected
204 {
205  // Reset Histograms which are filled for one pattern
206  Log(3,"EdbPVRQuality::ResetHistosSinglePattern","ResetHistosSinglePattern");
207  eHistXY->Reset();
208  eHistTXTY->Reset();
209  eHistWChi2->Reset();
210  eHistTT->Reset();
211  eHistChi2->Reset();
212  eHistW->Reset();
213  eHistWTilde->Reset();
214  eHistTTFillcheck->Reset();
215  eHistBTDensityPattern->Reset();
216  Log(3,"EdbPVRQuality::ResetHistosSinglePattern","ResetHistosSinglePattern...done.");
217 }

◆ Set0()

void EdbPVRQuality::Set0 ( )
protected
222 {
223  // Reset Values
224  Log(2,"EdbPVRQuality::Set0","Set0");
225 
226  eAli_orig=NULL;
228  eNeedModified=kFALSE;
229  eIsSource=kFALSE;
230  eIsTarget=kFALSE;
232  for (int i=0; i<7; i++) eCutMethodIsDone[i]=kFALSE;
233  eCutMethod=1;
234  eCutMethodString="ConstantBTDensityInAngularBins";
235 
236  // Default BT density level for which the standard cutroutine
237  // will be put. This is for all tangens theta values integrated.
238  eBTDensityLevel=20; // #BT/mm2
239 
240  // Default factor for equalizing the tan theta space:
241  // soon to be deprecated... in favour of ... (???)
242  eCutTTSqueezeFactor = 0.5;
243  for (int i=0; i<12; i++) eCutTTReductionFactor[i] = 0.5;
244 
245  // Default BT density level will use only Data-segments for
246  // data calculation and segments of the same MC-event number.
249 
250  // Reset Default Geometry: 0 OperaGeometry, 1: MC Geometry
251  eHistGeometry=0;
252 
253  //Reset Default Histograms
254  ResetHistos();
255 
256  for (int i=0; i<114; i++) {
259  eCutp1[i]=0.15;
260  eCutp0[i]=1.0; // Maximum Cut Value for const, BT dens
261  eAgreementChi2WDistCut[i]=5.0; // Maximum Cut Value for const, BT dens
262  // Variables for the angular space also:
263  for (int j=0; j<20; j++) {
264  eCutTTp0[i][j]=1.00;
265  eCutTTp1[i][j]=0.15;
266  eXi2HatTT_m_chi2[i][j]=0;
267  eXi2HatTT_s_chi2[i][j]=0;
268  eXi2HatTT_m_WTilde[i][j]=0;
269  eXi2HatTT_s_WTilde[i][j]=0;
270  }
271  eXi2Hat_m_chi2[i]=0;
272  eXi2Hat_s_chi2[i]=0;
273  eXi2Hat_m_WTilde[i]=0;
274  eXi2Hat_s_WTilde[i]=0;
275  }
276 
277  // Random Reduction of all BTs by a factor of 2
279 
280  // Additional GlobalTTReductionFactorC in case the TT cutting still yields a too high BG density
282 
291 
292  // Default values for cosmics, taken from a brick data:
293  // (I cant remember which one, I hope it does not matter)
298 
299  // Clear arrays for stored BTs in TT space
300  for (int i = 0; i <12; i++ ) {
301  eArrayPatternTTSource[i]->Clear();
302  eArrayPatternTTRejected[i]->Clear();
303  eArrayPatternTTAccepted[i]->Clear();
304  }
305  eArrayPatternAllTTSource->Clear();
308 
309  for (int i = 0; i <4; i++ ) eArrayPatternAllExcluded[i]->Clear();
310  eArrayAllExcludedSegments->Clear();
311 
312  Log(2,"EdbPVRQuality::Set0","Set0...done.");
313  return;
314 }

◆ SetBTDensityLevel()

void EdbPVRQuality::SetBTDensityLevel ( Float_t  BTDensityLevel)
inline
196  {
197  eBTDensityLevel=BTDensityLevel;
198  }

◆ SetBTDensityLevelCalcMethodMC()

void EdbPVRQuality::SetBTDensityLevelCalcMethodMC ( Bool_t  BTDensityLevelCalcMethodMC)
inline
214  {
215  eBTDensityLevelCalcMethodMC=BTDensityLevelCalcMethodMC;
216  }

◆ SetBTDensityLevelCalcMethodMCConfirmation()

void EdbPVRQuality::SetBTDensityLevelCalcMethodMCConfirmation ( Int_t  BTDensityLevelCalcMethodMCConfirmationNumber)
inline
217  {
218  eBTDensityLevelCalcMethodMCConfirmationNumber=BTDensityLevelCalcMethodMCConfirmationNumber;
219  }

◆ SetCutMethod()

void EdbPVRQuality::SetCutMethod ( Int_t  CutMethod)
384 {
385  // Set Cut Method of the background reduction:
386 
387  // 0: (option ): Do cut based on the linear relation: seg.Chi2()<seg.eW*a-b
388  // 1: (default): Do cut based on the linear relation: seg.Chi2()<seg.eW*a-b In Angular Bins
389  // 2: (testing): Do cut based on a chi2-variable that compares with passing tracks (if available), i.e. cosmics.
390  // 3: (testing): Do cut based on a chi2-variable that compares with passing tracks (if available), i.e. cosmics. In Angular Bins
391  // 4: (testing): Do cut based Xi2Hat relation.
392  // 5: (testing): Do cut based Xi2Hat relation. In Angular Bins
393  // 6: (testing): Do random cut based relation --> Just for quick test purposes and crosschecks
394  // 7: (option) : Do random cut based relation In Angular Bins --> Just for quick test purposes and crosschecks
395 
396  Log(2,"EdbPVRQuality::SetCutMethod","SetCutMethod");
397 
398  eCutMethod=CutMethod;
399 
400  switch (eCutMethod) {
401  default:
402  eCutMethodString = "ConstantBTDensityInAngularBins";
403  break;
404  case 0:
405  eCutMethodString = "ConstantBTDensity";
406  cout << "// 0: (option ): Do cut based on the linear relation: seg.Chi2()<seg.eW*a-b " << endl;
407  break;
408  case 1:
409  eCutMethodString = "ConstantBTDensityInAngularBins";
410  cout << "// 1: (default): Do cut based on the linear relation: seg.Chi2()<seg.eW*a-b In Angular Bins " << endl;
411  break;
412  case 2:
413  eCutMethodString = "ConstantBTQuality";
414  cout << "// 2: (testing): Do cut based on a chi2-variable that compares with passing tracks (if available), i.e. cosmics. " << endl;
415  break;
416  case 3:
417  eCutMethodString = "ConstantBTQualityInAngularBins";
418  cout << "// 3: (testing): Do cut based on a chi2-variable that compares with passing tracks (if available), i.e. cosmics. In Angular Bins " << endl;
419  break;
420  case 4:
421  eCutMethodString = "ConstantBTX2Hat";
422  cout << "// 4: (testing): Do cut based Xi2Hat relation. " << endl;
423  break;
424  case 5:
425  eCutMethodString = "ConstantBTX2HatInAngularBins";
426  cout << "// 5: (testing): Do cut based Xi2Hat relation. In Angular Bins " << endl;
427  break;
428  case 6:
429  eCutMethodString = "RandomCut";
430  cout << "// 6: (option ): Do random cut based relation --> Just for quick test purposes and crosschecks " << endl;
431  break;
432  case 7:
433  eCutMethodString = "RandomCutInAngularBins";
434  cout << "// 7: (option ): Do random cut based relation In Angular Bins --> Just for quick test purposes and crosschecks. " << endl;
435  break;
436  }
437 
438  if (CutMethod>7) {
439  eCutMethod=0;
440  cout << "WARNING EdbPVRQuality::SetCutMethod eCutMethod invalid, Set back to default eCutMethod = " << eCutMethod << endl;
441  }
442 
443  Log(2,"EdbPVRQuality::SetCutMethod","Chosen Method (eCutMethod) = %d", eCutMethod);
444  Log(2,"EdbPVRQuality::SetCutMethod","SetCutMethod...done.");
445  return;
446 }

◆ SetCutMethodIsDone()

void EdbPVRQuality::SetCutMethodIsDone ( Int_t  CutMethod)
inline
193  {
194  eCutMethodIsDone[CutMethod]=kTRUE;
195  }

◆ SetCutTTReductionFactor()

void EdbPVRQuality::SetCutTTReductionFactor ( Int_t  binTT,
Float_t  CutTTReductionFactor 
)
inline
206  {
207  eCutTTReductionFactor[binTT]=CutTTReductionFactor;
208  }

◆ SetCutTTSqueezeFactor()

void EdbPVRQuality::SetCutTTSqueezeFactor ( Float_t  CutTTSqueezeFactor)
inline
199  {
200  eCutTTSqueezeFactor=CutTTSqueezeFactor;
201  }

◆ SetEdbPVRec()

void EdbPVRQuality::SetEdbPVRec ( EdbPVRec Ali_orig)
inline
260  {
261  eAli_orig=Ali_orig;
262  eIsSource=kTRUE;
263  eAli_maxNpatterns=Ali_orig->Npatterns();
264  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;
265  if (eAli_maxNpatterns>114) {
266  cout << "WARNING EdbPVRQuality::SetEdbPVRec eAli_orig->Npatterns() = " << eAli_maxNpatterns << " is greater than possible basetrack data of two bricks. This class does (not yet) work with this large number of patterns. Set maximum patterns to 114 !!!" << endl;
267  eAli_maxNpatterns=114;
268  }
269  }

◆ SetHistGeometry_MC()

void EdbPVRQuality::SetHistGeometry_MC ( )
998 {
999  // Set the geometry of the basetrack density evaluation using simulation case,
1000  // MC ORFEO size conventions: x=-xmax..0..+xmax;y=-ymax..0..ymax).
1001  // BinArea is 1mmx1mm
1002  Log(3,"EdbPVRQuality::SetHistGeometry_MC","SetHistGeometry_MC");
1003  eHistXY->Reset();
1004  eHistXY->SetBins(100,-50000,50000,100,-50000,50000);
1005  Log(3,"EdbPVRQuality::SetHistGeometry_MC","Binwidth (micron)= %.01f.", eHistXY->GetXaxis()->GetBinWidth(1));
1006  Log(3,"EdbPVRQuality::SetHistGeometry_MC","SetHistGeometry_MC...done");
1007  return;
1008 }

◆ SetHistGeometry_OPERA()

void EdbPVRQuality::SetHistGeometry_OPERA ( )
984 {
985  // Set the geometry of the basetrack density evaluation using OPERA case,
986  // European Scanning System size conventions: x=0..125000;y=0..100000).
987  // BinArea is 1mmx1mm.
988  Log(3,"EdbPVRQuality::SetHistGeometry_OPERA","SetHistGeometry_OPERA");
989  eHistXY->Reset();
990  eHistXY->SetBins(120,0,120000,100,0,100000);
991  Log(3,"EdbPVRQuality::SetHistGeometry_OPERA","Binwidth (micron)= %.01f.", eHistXY->GetXaxis()->GetBinWidth(1));
992  Log(3,"EdbPVRQuality::SetHistGeometry_OPERA","SetHistGeometry_OPERA...done");
993  return;
994 }

◆ SetHistGeometry_OPERAandMC()

void EdbPVRQuality::SetHistGeometry_OPERAandMC ( )
1012 {
1013  // Set the geometry of the basetrack density evaluation covering MC and DATA case,
1014  // size conventions: x=-125000..0..+125000;y=-125000..0..125000).
1015  // BinArea is 1mmx1mm
1016 
1017  Log(3,"EdbPVRQuality::SetHistGeometry_OPERAandMC","SetHistGeometry_OPERAandMC");
1018  eHistXY->Reset();
1019  eHistXY->SetBins(250,-125000,125000,250,-125000,125000);
1020  Log(3,"EdbPVRQuality::SetHistGeometry_OPERAandMC","Binwidth (micron)= %.01f.", eHistXY->GetXaxis()->GetBinWidth(1));
1021  Log(3,"EdbPVRQuality::SetHistGeometry_OPERAandMC","SetHistGeometry_OPERAandMC...done");
1022  return;
1023 }

◆ SetHistGeometry_OPERAandMCBinArea4mm2()

void EdbPVRQuality::SetHistGeometry_OPERAandMCBinArea4mm2 ( )
1042 {
1043  // Set the geometry of the basetrack density evaluation covering MC and DATA case,
1044  // size conventions: x=-125000..0..+125000;y=-125000..0..125000).
1045  // BinArea is 2 mm x 2 mm
1046 
1047  Log(3,"EdbPVRQuality::SetHistGeometry_OPERAandMCBinArea4mm2","SetHistGeometry_OPERAandMCBinArea4mm2");
1048  eHistXY->Reset();
1049  eHistXY->SetBins(125,-125000,125000,125,-125000,125000);
1050  Log(3,"EdbPVRQuality::SetHistGeometry_OPERAandMCBinArea4mm2","Binwidth (micron)= %.01f.", eHistXY->GetXaxis()->GetBinWidth(1));
1051  Log(3,"EdbPVRQuality::SetHistGeometry_OPERAandMCBinArea4mm2","SetHistGeometry_OPERAandMCBinArea4mm2...done");
1052  return;
1053 }

◆ SetHistGeometry_OPERAandMCBinArea625()

void EdbPVRQuality::SetHistGeometry_OPERAandMCBinArea625 ( )
1027 {
1028  // Set the geometry of the basetrack density evaluation covering MC and DATA case,
1029  // size conventions: x=-125000..0..+125000;y=-125000..0..125000).
1030  // BinArea is 2.5mmx2.5mm
1031 
1032  Log(3,"EdbPVRQuality::SetHistGeometry_OPERAandMCBinArea625","SetHistGeometry_OPERAandMCBinArea625");
1033  eHistXY->Reset();
1034  eHistXY->SetBins(100,-125000,125000,100,-125000,125000);
1035  Log(3,"EdbPVRQuality::SetHistGeometry_OPERAandMCBinArea625","Binwidth (micron)= %.01f.", eHistXY->GetXaxis()->GetBinWidth(1));
1036  Log(3,"EdbPVRQuality::SetHistGeometry_OPERAandMCBinArea625","SetHistGeometry_OPERAandMCBinArea625...done");
1037  return;
1038 }

◆ TrackArrayToSegmentArray()

TObjArray * EdbPVRQuality::TrackArrayToSegmentArray ( TObjArray *  trackArray)
3467  {
3468  // Convert segments of tracks of a track array into an TObjArray containing segments.
3469  TObjArray* segArray= new TObjArray();
3470  Int_t nSegTotal=0;
3471  for (int j=0; j<trackArray->GetEntries(); j++) {
3472  EdbTrackP* track = (EdbTrackP*)trackArray->At(j);
3473  for (int i=0; i<track->N(); i++) {
3474  EdbSegP* seg = track->GetSegment(i);
3475  segArray->Add(seg);
3476  ++nSegTotal;
3477  }
3478  }
3479  if (gEDBDEBUGLEVEL>3) cout << "EdbPVRQuality::TrackArrayToSegmentArray() Totally added: " << nSegTotal << " segments from the track array."<<endl;
3480  return segArray;
3481 }

◆ TrackToSegmentArray()

TObjArray * EdbPVRQuality::TrackToSegmentArray ( EdbTrackP track)
3452  {
3453  // Convert segments of a track into an TObjArray containing segments.
3454  TObjArray* segArray= new TObjArray();
3455  Int_t nSegTotal=0;
3456  for (int i=0; i<track->N(); i++) {
3457  EdbSegP* seg = track->GetSegment(i);
3458  segArray->Add(seg);
3459  ++nSegTotal;
3460  }
3461  if (gEDBDEBUGLEVEL>3) cout << "EdbPVRQuality::TrackToSegmentArray() Totally added: " << nSegTotal << " segments from the track."<<endl;
3462  return segArray;
3463 }

◆ X2HatCutRelation()

Bool_t EdbPVRQuality::X2HatCutRelation ( EdbSegP seg,
Double_t  CutValueX2Hat,
Double_t  CutValueX2Hat_Chi2Mean,
Double_t  CutValueX2Hat_Chi2Sigma,
Double_t  CutValueX2Hat_WTildeMean,
Double_t  CutValueX2Hat_WTildeSigma 
)
5635  {
5636 
5637  Double_t Wtilde=1./seg->W();
5638  Double_t Chi2=seg->Chi2();
5639 
5640  Double_t X2Hat= TMath::Power( ( Chi2 - CutValueX2Hat_Chi2Mean ) / (CutValueX2Hat_Chi2Sigma) , 2 ) + TMath::Power( ( Wtilde - CutValueX2Hat_WTildeMean ) / (CutValueX2Hat_WTildeSigma) , 2 ) ;
5641 
5642  if (X2Hat<CutValueX2Hat) return kTRUE;
5643  return kFALSE;
5644 }

Member Data Documentation

◆ eAgreementChi2CutMeanChi2

Float_t EdbPVRQuality::eAgreementChi2CutMeanChi2
private

◆ eAgreementChi2CutMeanW

Float_t EdbPVRQuality::eAgreementChi2CutMeanW
private

◆ eAgreementChi2CutRMSChi2

Float_t EdbPVRQuality::eAgreementChi2CutRMSChi2
private

◆ eAgreementChi2CutRMSW

Float_t EdbPVRQuality::eAgreementChi2CutRMSW
private

◆ eAgreementChi2WDistCut

Float_t EdbPVRQuality::eAgreementChi2WDistCut[114]
private

◆ eAli_maxNpatterns

Int_t EdbPVRQuality::eAli_maxNpatterns
private

◆ eAli_modified

EdbPVRec* EdbPVRQuality::eAli_modified
private

◆ eAli_orig

EdbPVRec* EdbPVRQuality::eAli_orig
private

◆ eAli_pointer

EdbPVRec* EdbPVRQuality::eAli_pointer
private

◆ eArrayAllExcludedSegments

TObjArray* EdbPVRQuality::eArrayAllExcludedSegments
private

◆ eArrayPatternAllExcluded

TObjArray* EdbPVRQuality::eArrayPatternAllExcluded[4]
private

◆ eArrayPatternAllTTAccepted

TObjArray* EdbPVRQuality::eArrayPatternAllTTAccepted
private

◆ eArrayPatternAllTTRejected

TObjArray* EdbPVRQuality::eArrayPatternAllTTRejected
private

◆ eArrayPatternAllTTSource

TObjArray* EdbPVRQuality::eArrayPatternAllTTSource
private

◆ eArrayPatternTTAccepted

TObjArray* EdbPVRQuality::eArrayPatternTTAccepted[12]
private

◆ eArrayPatternTTRejected

TObjArray* EdbPVRQuality::eArrayPatternTTRejected[12]
private

◆ eArrayPatternTTSource

TObjArray* EdbPVRQuality::eArrayPatternTTSource[12]
private

◆ eBinTT

Int_t EdbPVRQuality::eBinTT
private

◆ eBTDensityLevel

Float_t EdbPVRQuality::eBTDensityLevel
private

◆ eBTDensityLevelAngularSpace

Float_t EdbPVRQuality::eBTDensityLevelAngularSpace[20]
private

◆ eBTDensityLevelCalcMethodMC

Bool_t EdbPVRQuality::eBTDensityLevelCalcMethodMC
private

◆ eBTDensityLevelCalcMethodMCConfirmationNumber

Int_t EdbPVRQuality::eBTDensityLevelCalcMethodMCConfirmationNumber
private

◆ eCutDistChi2

Float_t EdbPVRQuality::eCutDistChi2[114]
private

◆ eCutDistW

Float_t EdbPVRQuality::eCutDistW[114]
private

◆ eCutMethod

Int_t EdbPVRQuality::eCutMethod
private

◆ eCutMethodIsDone

Bool_t EdbPVRQuality::eCutMethodIsDone[8]
private

◆ eCutMethodString

TString EdbPVRQuality::eCutMethodString
private

◆ eCutp0

Float_t EdbPVRQuality::eCutp0[114]
private

◆ eCutp1

Float_t EdbPVRQuality::eCutp1[114]
private

◆ eCutTTp0

Float_t EdbPVRQuality::eCutTTp0[114][20]
private

◆ eCutTTp1

Float_t EdbPVRQuality::eCutTTp1[114][20]
private

◆ eCutTTReductionFactor

Float_t EdbPVRQuality::eCutTTReductionFactor[12]
private

◆ eCutTTSqueezeFactor

Float_t EdbPVRQuality::eCutTTSqueezeFactor
private

◆ eGlobalTTReductionFactorC

Float_t EdbPVRQuality::eGlobalTTReductionFactorC
private

◆ eHistBTDensityPattern

TH1F* EdbPVRQuality::eHistBTDensityPattern
private

◆ eHistBTDensityVolume

TH1F* EdbPVRQuality::eHistBTDensityVolume
private

◆ eHistChi2

TH1F* EdbPVRQuality::eHistChi2
private

◆ eHistGeometry

Int_t EdbPVRQuality::eHistGeometry
private

◆ eHistTT

TH1F* EdbPVRQuality::eHistTT
private

◆ eHistTTFillcheck

TH1F* EdbPVRQuality::eHistTTFillcheck
private

◆ eHistTXTY

TH2F* EdbPVRQuality::eHistTXTY
private

◆ eHistW

TH1F* EdbPVRQuality::eHistW
private

◆ eHistWChi2

TH2F* EdbPVRQuality::eHistWChi2
private

◆ eHistWTilde

TH1F* EdbPVRQuality::eHistWTilde
private

◆ eHistXY

TH2F* EdbPVRQuality::eHistXY
private

◆ eIsSource

Bool_t EdbPVRQuality::eIsSource
private

◆ eIsTarget

Bool_t EdbPVRQuality::eIsTarget
private

◆ eNeedModified

Bool_t EdbPVRQuality::eNeedModified
private

◆ ePatternBTDensity_modified

Float_t EdbPVRQuality::ePatternBTDensity_modified[114]
private

◆ ePatternBTDensity_orig

Float_t EdbPVRQuality::ePatternBTDensity_orig[114]
private

◆ eProfileBTdens_vs_PID_generic

TProfile* EdbPVRQuality::eProfileBTdens_vs_PID_generic
private

◆ eProfileBTdens_vs_PID_source

TProfile* EdbPVRQuality::eProfileBTdens_vs_PID_source
private

◆ eProfileBTdens_vs_PID_source_meanX

Float_t EdbPVRQuality::eProfileBTdens_vs_PID_source_meanX
private

◆ eProfileBTdens_vs_PID_source_meanY

Float_t EdbPVRQuality::eProfileBTdens_vs_PID_source_meanY
private

◆ eProfileBTdens_vs_PID_source_rmsX

Float_t EdbPVRQuality::eProfileBTdens_vs_PID_source_rmsX
private

◆ eProfileBTdens_vs_PID_source_rmsY

Float_t EdbPVRQuality::eProfileBTdens_vs_PID_source_rmsY
private

◆ eProfileBTdens_vs_PID_target

TProfile* EdbPVRQuality::eProfileBTdens_vs_PID_target
private

◆ eProfileBTdens_vs_PID_target_meanX

Float_t EdbPVRQuality::eProfileBTdens_vs_PID_target_meanX
private

◆ eProfileBTdens_vs_PID_target_meanY

Float_t EdbPVRQuality::eProfileBTdens_vs_PID_target_meanY
private

◆ eProfileBTdens_vs_PID_target_rmsX

Float_t EdbPVRQuality::eProfileBTdens_vs_PID_target_rmsX
private

◆ eProfileBTdens_vs_PID_target_rmsY

Float_t EdbPVRQuality::eProfileBTdens_vs_PID_target_rmsY
private

◆ eRandomCutThreshold

Float_t EdbPVRQuality::eRandomCutThreshold
private

◆ eX2Hat

Float_t EdbPVRQuality::eX2Hat
private

TO BE IMPLEMENTED HERE ... ... ... ... ... ... ... ... ... ...

◆ eX2HatCut

Float_t EdbPVRQuality::eX2HatCut[114]
private

◆ eXi2Hat_m_chi2

Float_t EdbPVRQuality::eXi2Hat_m_chi2[114]
private

◆ eXi2Hat_m_WTilde

Float_t EdbPVRQuality::eXi2Hat_m_WTilde[114]
private

◆ eXi2Hat_s_chi2

Float_t EdbPVRQuality::eXi2Hat_s_chi2[114]
private

◆ eXi2Hat_s_WTilde

Float_t EdbPVRQuality::eXi2Hat_s_WTilde[114]
private

◆ eXi2HatTT_m_chi2

Float_t EdbPVRQuality::eXi2HatTT_m_chi2[114][20]
private

◆ eXi2HatTT_m_WTilde

Float_t EdbPVRQuality::eXi2HatTT_m_WTilde[114][20]
private

◆ eXi2HatTT_s_chi2

Float_t EdbPVRQuality::eXi2HatTT_s_chi2[114][20]
private

◆ eXi2HatTT_s_WTilde

Float_t EdbPVRQuality::eXi2HatTT_s_WTilde[114][20]
private

◆ maxX

Float_t EdbPVRQuality::maxX
private

◆ maxY

Float_t EdbPVRQuality::maxY
private

◆ minX

Float_t EdbPVRQuality::minX
private

◆ minY

Float_t EdbPVRQuality::minY
private

◆ NbinsX

Int_t EdbPVRQuality::NbinsX
private

◆ NbinsY

Int_t EdbPVRQuality::NbinsY
private

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