FEDRA emulsion software from the OPERA Collaboration
ShowRec.cpp File Reference
Include dependency graph for ShowRec.cpp:

Functions

Bool_t AddBTToArrayWithCeck (EdbSegP *tryAttachedSegment, TObjArray *GLOBAL_ShowerSegArray)
 
void BuildParametrizationsMCInfo_PGun (TString MCInfoFilename)
 
EdbSegPBuildShowerAxis (TObjArray *ShowerSegArray)
 
Bool_t CalcConeOrTubeDistanceToInBT (EdbSegP *sa, EdbSegP *InBT, Double_t CylinderRadius, Double_t ConeAngle)
 
void CalcEfficencyNumbers (EdbPattern *pat_interim, Int_t MCCheck, Int_t &NBT_Neff, Int_t &NBTMC_Neff, Int_t &NBTMCe_Neff)
 
void CalcEffPurOfShower (TObjArray *arr, Int_t &NBT, Int_t &NBTMC, Int_t &NBTallMC, Int_t &NBTeMC, Double_t &purall, Double_t &pure)
 
void CalcEffPurOfShower2 (TObjArray *arr, Int_t &NBT, Int_t &NBTMC, Int_t &NBTallMC, Int_t &NBTeMC, Double_t &purall, Double_t &pure, Int_t NBT_Neff, Int_t NBTMC_Neff, Int_t NBTMCe_Neff)
 
void CalcTrackDensity (EdbPattern *pat_interim, Float_t pat_interim_halfsize, Int_t &npat_int, Int_t &npat_total, Int_t &npatN)
 
void CreateOutPutStructures ()
 
TTree * CreateTreeBranchShowerTree (Int_t ParaSetNr)
 
void DoBGTargetCleaning ()
 
void Fill2GlobalInBTArray ()
 
void FillOutPutStructures ()
 
void Finalize ()
 
Bool_t FindFollowingBTs (EdbSegP *s, EdbSegP *InBT, EdbPVRec *local_gAli, TObjArray *showersegarray)
 
Bool_t FindPrecedingBTs (EdbSegP *s, EdbSegP *InBT, EdbPVRec *gAli, TObjArray *showersegarray)
 
Bool_t FindPrecedingBTs_local_gAli (EdbSegP *s, EdbSegP *InBT, EdbPVRec *local_gAli, TObjArray *showersegarray)
 
Bool_t FindPrecedingBTsSingleThetaAngle (EdbSegP *s, EdbSegP *InBT, EdbPVRec *gAli, TObjArray *showersegarray)
 
Bool_t FindPrecedingBTsSingleThetaAngleTCDEBUG (EdbSegP *s, EdbSegP *InBT, EdbPVRec *gAli, TObjArray *showersegarray)
 
Bool_t GetConeOrTubeDistanceToBTOfShowerArray (EdbSegP *sa, EdbSegP *InBT, TObjArray *showersegarray, Double_t CylinderRadius, Double_t ConeAngle)
 
Bool_t GetConeOrTubeDistanceToInBT (EdbSegP *sa, EdbSegP *InBT, Double_t CylinderRadius, Double_t ConeAngle)
 
Double_t GetdeltaRNoPropagation (EdbSegP *s, EdbSegP *stest)
 
Double_t GetdeltaRWithPropagation (EdbSegP *s, EdbSegP *stest)
 
Double_t GetdeltaTheta (EdbSegP *s1, EdbSegP *s2)
 
Double_t GetdeltaThetaSingleAngles (EdbSegP *s1, EdbSegP *s2)
 
void GetEvent_ParasetDefinitionTree (Int_t nr)
 
Int_t GetMeansBeforeAndAfter (Float_t &mean_dT, Float_t &mean_dR, EdbPVRec *local_gAli, Int_t patterloop_cnt, EdbSegP *seg, Int_t n_patterns, Int_t BeforeOrAfter)
 
Int_t GetMinsBeforeAndAfter (Float_t &min_dT, Float_t &min_dR, EdbPVRec *local_gAli, Int_t patterloop_cnt, EdbSegP *seg, Int_t n_patterns, Int_t BeforeOrAfter)
 
Int_t GetNSegBeforeAndAfter (EdbPVRec *local_gAli, Int_t patterloop_cnt, EdbSegP *seg, Int_t n_patterns, Int_t BeforeOrAfter)
 
Double_t GetSpatialDist (EdbSegP *s1, EdbSegP *s2)
 
Bool_t IsShowerSortedZ (TObjArray *showerarray)
 
int main (int argc, char *argv[])
 
void MakeTracksTree (TTree *treebranch)
 
Int_t Open_ParasetDefinitionFile ()
 
void Read_ParasetDefinitionTree ()
 
EdbPVRecReadEdbPVRecObjectFromCurrentDirectory ()
 
Int_t Reco_CL_AssignZValueToGroup (Double_t z, Double_t z0, Int_t NGroupedPLATES, Int_t PLATESPerGroup)
 
void Reco_CL_BuildGlobalHistogramsOnHeap ()
 
void ReconstructShowers (Int_t nr)
 
void ReconstructShowers_AG ()
 
void ReconstructShowers_BW ()
 
void ReconstructShowers_CA ()
 
void ReconstructShowers_CL ()
 
void ReconstructShowers_CT ()
 
void ReconstructShowers_GS ()
 
void ReconstructShowers_OI ()
 void ReconstructShowers_CL() /// Still Missing in the Implementation !!! More...
 
void ReconstructShowers_OI2 ()
 
void ReconstructShowers_OPENMP ()
 
void ReconstructShowers_OPENMP_TEST (EdbSegP *InBT, TObjArray array)
 DEBUG OPENMP TEST!!!!!!! More...
 
void ReconstructShowers_RC ()
 
void ReconstructShowers_SA ()
 
void ReconstructShowers_TC ()
 
void SetDefaultValues_CommandLine ()
 
void SetPresetParameters (Int_t cmd_PRESET)
 
void SortShowerZ (TObjArray *showerarray)
 
void TransferShowerObjectArrayIntoEntryOfTreebranchShowerTree (TTree *treebranchtree, TObjArray *segarray)
 
EdbPVRecTransformEdbPVRec (EdbPVRec *gAli, EdbSegP *InitiatorBT)
 DEBUG OPENMP TEST!!!!!!! More...
 
EdbPVRecTransformEdbPVRec_BackWard (EdbPVRec *gAli, EdbSegP *InitiatorBT)
 
EdbPVRecTransformEdbPVRec_SA (EdbPVRec *gAli, EdbSegP *InitiatorBT)
 
void Write_Alg_GS_Histograms ()
 

Function Documentation

◆ AddBTToArrayWithCeck()

Bool_t AddBTToArrayWithCeck ( EdbSegP tryAttachedSegment,
TObjArray *  GLOBAL_ShowerSegArray 
)
4823{
4824 // We add by comparison with X,Y,TX,TY values, since this seems to be more failsafe
4825 // than adding by adresses.
4826 // This function returns kTRUE if BT is already in the shower array
4827 // This function returns kFALSE if BT is not yet in the shower array
4828
4829 int nent=GLOBAL_ShowerSegArray->GetEntries();
4830 EdbSegP* ComparingSegment;
4831
4832
4833 if (gEDBDEBUGLEVEL>3) cout << "AddBTToArrayWithCeck() Check: "<< tryAttachedSegment << " with all "<< nent << " entries of GLOBAL_ShowerSegArray "<< endl;
4834
4835 Bool_t IsContained=kFALSE;
4836
4837 for (int i=0; i<nent; ++i) {
4838 ComparingSegment=(EdbSegP*)GLOBAL_ShowerSegArray->At(i);
4839 if (TMath::Abs(tryAttachedSegment->X()-ComparingSegment->X())>0.1) continue;
4840 if (TMath::Abs(tryAttachedSegment->Y()-ComparingSegment->Y())>0.1) continue;
4841
4842 if (TMath::Abs(tryAttachedSegment->TX()-ComparingSegment->TX())>0.01) continue;
4843 if (TMath::Abs(tryAttachedSegment->TY()-ComparingSegment->TY())>0.01) continue;
4844
4845 IsContained=kTRUE;
4846 }
4847
4848
4849 if (gEDBDEBUGLEVEL>3) cout << "AddBTToArrayWithCeck DO WE ADD THIS BT ?? "<< !IsContained << endl;
4850
4851 if (!IsContained) {
4852 GLOBAL_ShowerSegArray->Add(tryAttachedSegment);
4853 }
4854
4855 return !IsContained;
4856}
TObjArray * GLOBAL_ShowerSegArray
Definition: ShowRec.h:76
Definition: EdbSegP.h:21
Float_t TX() const
tangens = deltaX/deltaZ
Definition: EdbSegP.h:175
Float_t X() const
Definition: EdbSegP.h:173
Float_t Y() const
Definition: EdbSegP.h:174
Float_t TY() const
tangens = deltaY/deltaZ
Definition: EdbSegP.h:176
gEDBDEBUGLEVEL
Definition: energy.C:7

◆ BuildParametrizationsMCInfo_PGun()

void BuildParametrizationsMCInfo_PGun ( TString  MCInfoFilename)
7106 {
7107
7108 Log(2, "ShowRec.cpp", "--- void BuildParametrizationsMCInfo_PGun() ---");
7109
7110 // Monte-Carlo Information on the event, take from the
7111 // pre-prepared root-file MCInfoFilename
7112
7113 //Declare Tree Variables
7114 Int_t MCEvt, PDGId;
7115 Float_t energy, tantheta,dirx,diry,dirz,vtxposx,vtxposy,vtxposz;
7116 Float_t TX,TY,Y,X,Z;
7117
7118 // Assume
7120
7121 // Read Tree with File:
7122 TTree* PGunTree = new TTree();
7123 Int_t ReadSuccess = PGunTree->ReadFile(MCInfoFilename,"MCEvt/I:energy/F:tantheta/F:dirx/F:diry/F:dirz/F:vtxposx/F:vtxposy/F:vtxposz/F:TX/F:TY/F:X/F:Y/F:Z/F:PDGId/I");
7124
7125 // Check if File exists:
7126 cout << "BuildParametrizationsMCInfo_PGun ReadSuccess = PGunTree->ReadFile(MCInfoFilename) " << ReadSuccess << endl;
7127 cout << "BuildParametrizationsMCInfo_PGun 0: File / Tree Reading was not successful " << endl;
7128 cout << "BuildParametrizationsMCInfo_PGun 1: File / Tree Reading was successful " << endl;
7129
7130 // If tree reading was not successful, we must return here.
7131 if (ReadSuccess==0) {
7132 cout << "BuildParametrizationsMCInfo_PGun() ReadSuccess==0. return. " << endl;
7133 return;
7134 }
7135
7136 PGunTree->SetBranchAddress("MCEvt",&MCEvt);
7137 PGunTree->SetBranchAddress("PDGId",&PDGId);
7138 PGunTree->SetBranchAddress("energy",&energy);
7139 PGunTree->SetBranchAddress("tantheta",&tantheta);
7140 PGunTree->SetBranchAddress("dirx",&dirx);
7141 PGunTree->SetBranchAddress("diry",&diry);
7142 PGunTree->SetBranchAddress("dirz",&dirz);
7143 PGunTree->SetBranchAddress("vtxposx",&vtxposx);
7144 PGunTree->SetBranchAddress("vtxposy",&vtxposy);
7145 PGunTree->SetBranchAddress("vtxposz",&vtxposz);
7146 PGunTree->SetBranchAddress("TX",&TX);
7147 PGunTree->SetBranchAddress("TY",&TY);
7148 PGunTree->SetBranchAddress("X",&X);
7149 PGunTree->SetBranchAddress("Z",&Z);
7150 PGunTree->SetBranchAddress("Y",&Y);
7151
7152 // If the PGunTree is not filled, this can be a hint that the
7153 // MCInfoFilename might not be there. This is important for alorithms that
7154 // rely on Vertex Informations, like the _GS() alg.
7155 if (PGunTree->GetEntries()==0) {
7156 cout << "BuildParametrizationsMCInfo_PGun ATTENTION! PGunTree->GetEntries()==0" << endl;
7157 cout << "BuildParametrizationsMCInfo_PGun Bool_t GLOBAL_IsBrickTreePGunInfo=kFALSE;" << endl;
7159 }
7160 else {
7162 }
7163
7164 if (gEDBDEBUGLEVEL>2) PGunTree->Print();
7165 cout << "BuildParametrizationsMCInfo_PGun() PGunTree->GetEntries(); " << PGunTree->GetEntries() << endl;
7166
7167 if (cmd_GBMC>0) {
7168 cout << " BuildParametrizationsMCInfo_PGun() cmd_GBMC>0 Show entry (cmd_GBMC):" << endl;
7169 PGunTree->Show(cmd_GBMC);
7170 }
7171
7172 // --------------------------------
7173 // The number 69999 comes from my (frank) maximal number of mc Events
7174 // I have put in a simulation file.
7175 if (!GLOBAL_VtxArray) GLOBAL_VtxArray=new TObjArray(69999);
7176 GLOBAL_VtxArrayX[0]=0;
7177 GLOBAL_VtxArrayZ[0]=0;
7178 GLOBAL_VtxArrayY[0]=0;
7179
7180 //------------------
7181 // PGunTreeEntry_MCEvt_Correspondance[0]=TreeEntry(0)->MC()
7182 Int_t PGunTreeEntry_MCEvt_Correspondance[69999];
7183 for (Int_t i=0; i<PGunTree->GetEntries(); ++i) {
7184 PGunTree->GetEntry(i);
7185 PGunTreeEntry_MCEvt_Correspondance[MCEvt]=i;
7186 EdbVertex* vtx=new EdbVertex();
7187 // Why are these numbers the way they are (2018_07_04) ???
7188 // I cannot remember anymore, unfortunately.
7189 vtx->SetXYZ(vtxposx*1000,vtxposy*1000,(vtxposz+40.0)*1000);
7190 vtx->SetMC(MCEvt);
7191 // vtx->Print(); // Gives Crash!
7192 GLOBAL_VtxArray->Add(vtx);
7193 GLOBAL_VtxArrayX[MCEvt]=vtxposx*1000;
7194 GLOBAL_VtxArrayY[MCEvt]=vtxposy*1000;
7195 GLOBAL_VtxArrayZ[MCEvt]=(vtxposz+40.0)*1000;
7196// vtx->Print();
7197// gSystem->Exit(1);
7198 GLOBAL_EvtBT_EArray[MCEvt]=energy;
7199 GLOBAL_EvtBT_TanThetaArray[MCEvt]=tantheta;
7200 GLOBAL_EvtBT_FlagArray[MCEvt]=0;
7201 GLOBAL_EvtBT_MCArray[MCEvt]=MCEvt;
7202 GLOBAL_EvtBT_ZArray[MCEvt]=(vtxposz+40.0)*1000;
7203 }
7204 //------------------
7205 cout << "BuildParametrizationsMCInfo_PGun.... done." << endl;
7206 return;
7207}
bool Log(int level, const char *location, const char *fmt,...)
Definition: EdbLog.cxx:75
Float_t GLOBAL_VtxArrayY[99999]
Definition: ShowRec.h:56
Int_t GLOBAL_EvtBT_ZArray[99999]
Definition: ShowRec.h:51
Int_t GLOBAL_EvtBT_FlagArray[99999]
Definition: ShowRec.h:51
Float_t GLOBAL_VtxArrayX[99999]
Definition: ShowRec.h:55
TObjArray * GLOBAL_VtxArray
Definition: ShowRec.h:54
Double_t GLOBAL_EvtBT_EArray[99999]
Definition: ShowRec.h:52
Int_t GLOBAL_EvtBT_MCArray[99999]
Definition: ShowRec.h:51
Float_t GLOBAL_VtxArrayZ[99999]
Definition: ShowRec.h:57
Double_t GLOBAL_EvtBT_TanThetaArray[99999]
Definition: ShowRec.h:52
Bool_t GLOBAL_IsBrickTreePGunInfo
Definition: ShowRec.h:82
Int_t cmd_GBMC
Definition: ShowRec.h:28
Definition: EdbVertex.h:69
void SetMC(int mEvt=0)
Definition: EdbVertex.h:159
void SetXYZ(float x, float y, float z)
Definition: EdbVertex.h:157
Double_t X
Definition: tlg2couples.C:76
Double_t Y
Definition: tlg2couples.C:76
Double_t TY
Definition: tlg2couples.C:78
Double_t TX
Definition: tlg2couples.C:78
Double_t Z
Definition: tlg2couples.C:104

◆ BuildShowerAxis()

EdbSegP * BuildShowerAxis ( TObjArray *  ShowerSegArray)

MNORMINERUNG !!!! STILL NOT AN IMPROVEMENT FOR GAMMAS.....

Differene NOW FOR DEBUG TESTS !!!!

6884{
6885 Int_t eNBT= ShowerSegArray->GetEntries();
6886 if (eNBT==0) return NULL;
6887 if (eNBT==1) return (EdbSegP*)ShowerSegArray->At(0);
6888 Double_t eNBT_float=(Double_t)eNBT;
6889// cout << "eNBT= " << eNBT << " eNBT_float= " << eNBT_float << endl;
6890
6891 // Code taken from EdbMath::LFIT3 to fit line to a collection of points in spce!
6892 //int EdbMath::LFIT3( float *X, float *Y, float *Z, float *W, int L,
6893 //float &X0, float &Y0, float &Z0, float &TX, float &TY, float &EX, float &EY )
6894 // Linar fit in 3-d case (microtrack-like)
6895 // Input: X,Y,Z - coords, W -weight - arrays of the lengh >=L
6896 // Note that X,Y,Z modified by function
6897 // Output: X0,Y0,Z0 - center of gravity of segment
6898 // TX,TY : tangents in respect to Z axis
6899
6900 Float_t X0,Y0,Z0;
6901 Float_t TX,TY;
6902 Float_t EX,EY;
6903 // Float_t x[eNBT]; Float_t z[eNBT]; Float_t y[eNBT]; Float_t W[eNBT];
6904 // Compiled with -pedantic -Wall -W -Wstrict-prototypes this gives error message: Fehler: ISO-C++ verbietet Feld »x« variabler Länge
6905 // So we take it as fixed length:
6906 // As before we take the global maximum of 5k BT /shower.
6907 Float_t x[5000];
6908 Float_t z[5000];
6909 Float_t y[5000];
6910 Float_t W[5000];
6911
6912
6913 // SUM UP TANGES VALUES OF ALL BTS SO FAR TO GET tx and TY of SHOWERCENTER ???
6914 Float_t sumX=0;
6915 Float_t sumY=0;
6916 Float_t sumTX=0;
6917 Float_t sumTY=0;
6918 Float_t sumW=0;
6919//
6920 // The weighting of the segments is a crucial point here, since it influences
6921 // the fitting to the shower axis!
6922 int eNBTMAX=TMath::Min(5000,eNBT);
6923 for (int i=0; i<eNBTMAX; i++) {
6924 EdbSegP* TestBT = (EdbSegP*)ShowerSegArray->At(i);
6925 x[i]=TestBT->X();
6926 y[i]=TestBT->Y();
6927 z[i]=TestBT->Z();
6928 // Choose weighting to be one!
6929 W[i]=1;
6930 W[i]=1.0/(TMath::Abs(z[i]-z[0])/1300.0*TMath::Abs(z[i]-z[0])/1300.0+1);
6931 // W[i]=1.0/TMath::Sqrt((TMath::Abs(z[i]-z[0])/1300.0*TMath::Abs(z[i]-z[0])/1300.0+1));
6932 if (TMath::Abs(z[i]-z[0])/1300.0>4) W[i]=0;
6933 // chose this,....could be that this will lead to something different results....
6934 sumX+=W[i]*TestBT->X();
6935 sumY+=W[i]*TestBT->Y();
6936 sumTX+=W[i]*TestBT->TX();
6937 sumTY+=W[i]*TestBT->TY();
6938 sumW+=W[i];
6939 }
6940 //cout << " Set all others to zero...." << endl;
6941 if (eNBT<5000) {
6942 for (int i=eNBT; i<5000; i++) {
6943 W[i]=0;
6944 x[i]=0;
6945 y[i]=0;
6946 z[i]=0;
6947 }
6948 }
6949
6950
6951 //cout << "BuildShowerAxis Invoke fit function:" << endl;
6952 // Invoke fit function:
6953 EdbMath::LFIT3( x,y,z,W,eNBTMAX,X0,Y0,Z0,TX,TY,EX,EY);
6954
6955 //cout <<"AfterLinefit: x=" << x << " y=" << y << " z=" << z << " W=" << W << " eNBTMAX=" << eNBTMAX << " X0=" << X0 << " Y0=" << Y0 << " Z0=" << Z0 << " TX=" << TX << " TY= " << TY << endl;
6956
6957 sumTX=sumTX/sumW;
6958 sumTY=sumTY/sumW;
6959 sumX=sumTX/sumW;
6960 sumY=sumTY/sumW;
6963
6964 //==C== In few cases "nan" can happen, then we put val to -1;
6965 if (TMath::IsNaN(X0)) {
6966 //cout << "EdbShowerP::BuildShowerAxis WARNING! FIT DID NOT CONVVERGE, RETURN FIRST SEGMENT! " << endl;
6967 EdbSegP* seg0=(EdbSegP*)ShowerSegArray->At(0);
6968 EdbSegP* eShowerAxisCenterGravityBT = new EdbSegP(0,seg0->X(),seg0->Y(),seg0->TX(),seg0->TY(),0,0);
6969 eShowerAxisCenterGravityBT -> SetZ(((EdbSegP*)ShowerSegArray->At(0))->Z());
6970 //eShowerAxisCenterGravityBT->PrintNice();
6971 return eShowerAxisCenterGravityBT;
6972 }
6973
6974 //cout << "EdbShowerP::BuildShowerAxis Axis X0,Y0,Z0, TX, TY " << X0 << " " << Y0 << " " << Z0 << " " << TX << " " << TY << " " << endl;
6975 //cout << "sumTX= " << sumTX << " sumTY= " << sumTY << " sumW= " << sumW << endl;
6976
6977 EdbSegP* eShowerAxisCenterGravityBT = 0;
6978 if (!eShowerAxisCenterGravityBT) eShowerAxisCenterGravityBT = new EdbSegP(-1,X0,Y0,sumTX,sumTY,0,0); // with linefit
6979// if (!eShowerAxisCenterGravityBT) eShowerAxisCenterGravityBT = new EdbSegP(-1,sumX,sumY,sumTX,sumTY,0,0); // without linefit
6980 eShowerAxisCenterGravityBT -> SetZ(((EdbSegP*)ShowerSegArray->At(0))->Z());
6981
6982
6984 // Bool_t UseOnlyFirstBT=kTRUE;
6985 Bool_t UseOnlyFirstBT=kFALSE;
6986 if (UseOnlyFirstBT) {
6987 cout << "Attention: UseOnlyFirstBT"<< endl;
6988 eShowerAxisCenterGravityBT -> SetX(((EdbSegP*)ShowerSegArray->At(0))->X());
6989 eShowerAxisCenterGravityBT -> SetY(((EdbSegP*)ShowerSegArray->At(0))->Y());
6990 eShowerAxisCenterGravityBT -> SetZ(((EdbSegP*)ShowerSegArray->At(0))->Z());
6991 eShowerAxisCenterGravityBT -> SetTX(((EdbSegP*)ShowerSegArray->At(0))->TX());
6992 eShowerAxisCenterGravityBT -> SetTY(((EdbSegP*)ShowerSegArray->At(0))->TY());
6993 }
6994
6995 //eShowerAxisCenterGravityBT->Print();
6996 return eShowerAxisCenterGravityBT;
6997}
brick X0
Definition: RecDispMC.C:112
static int LFIT3(float *X, float *Y, float *Z, float *W, int L, float &X0, float &Y0, float &Z0, float &TX, float &TY, float &EX, float &EY)
Definition: EdbMath.cxx:313
Float_t Z() const
Definition: EdbSegP.h:153
float Z0
Definition: hwinit.C:67
#define NULL
Definition: nidaqmx.h:84
Int_t W
Definition: testBGReduction_By_ANN.C:15

◆ CalcConeOrTubeDistanceToInBT()

Bool_t CalcConeOrTubeDistanceToInBT ( EdbSegP sa,
EdbSegP InBT,
Double_t  CylinderRadius,
Double_t  ConeAngle 
)

Outside if angle greater than ConeAngle (to be fulfilled for Cone and Tube in both cases)

if angle smaller than ConeAngle, then you can differ between Tuberadius and CylinderRadius

5687{
5688 Log(4,"ShowRec.cpp", "--- Bool_t CalcConeOrTubeDistanceToInBT() ---");
5689
5690 TVector3 x1(InBT->X(),InBT->Y(),InBT->Z());
5691 TVector3 x2(sa->X(),sa->Y(),sa->Z());
5692 TVector3 direction_x1(InBT->TX()*1300,InBT->TY()*1300,1300);
5693 TVector3 direction_x2(sa->TX()*1300,sa->TY()*1300,1300);
5694 TVector3 u1=x2-x1;
5695
5696 Double_t direction_x1_norm= direction_x1.Mag();
5697 Double_t cosangle= (direction_x1*u1)/(u1.Mag()*direction_x1_norm);
5698 Double_t angle = TMath::ACos(cosangle);
5699 // NO THIS IS NOT THE CONE ANGLE!!
5700
5701 TVector3 direction_1(InBT->TX()*1300,InBT->TY()*1300,1300);
5702 TVector3 direction_2(sa->TX()*1300,sa->TY()*1300,1300);
5703
5704 angle=u1.Angle(direction_x1);
5705
5706
5707 // For the case where the two basetracks have same z position
5708 // the angle is about 90 degree so it makes no sense to calculate it...
5709 // therefore we set it artificially to zero:
5710 if (TMath::Abs(InBT->Z()-sa->Z())<5.0 ) {
5711 angle=0.0;
5712 //if (gEDBDEBUGLEVEL>3) //cout << "same z position, set angle artificially to zero" << endl;
5713 }
5714
5715
5716
5717 // If this InBT is in z position AFTER the testBT, the cone goes in the other direction and therefore, we have
5718 // to mirror the angle by 180 degree:
5719 if (angle>TMath::Pi()/2.0) {
5720 angle=TMath::Abs(TMath::Pi()-angle);
5721 //cout << "reverse angle: " << angle << endl;
5722 }
5723
5725 if (angle>ConeAngle) {
5726 return kFALSE;
5727 }
5728
5730 Double_t TubeDistance = 1.0/direction_x1_norm * ( (x2-x1).Cross(direction_x1) ).Mag();
5731 // cout << "CylinderRadius= " << CylinderRadius << " TubeDistance= " << TubeDistance << endl;
5732 if (TubeDistance>CylinderRadius) {
5733 return kFALSE;
5734 }
5735
5736
5737
5738 //cout << "--- Bool_t CalcConeOrTubeDistanceToInBT() ---"<<endl;
5739 //InBT->PrintNice();
5740 //sa->PrintNice();
5741 //cout << "angle= " << angle << " ConeAngle= " << ConeAngle << endl;
5742 //cout << "CylinderRadius= " << CylinderRadius << " TubeDistance= " << TubeDistance << endl;
5743
5744 return kTRUE;
5745}

◆ CalcEfficencyNumbers()

void CalcEfficencyNumbers ( EdbPattern pat_interim,
Int_t  MCCheck,
Int_t &  NBT_Neff,
Int_t &  NBTMC_Neff,
Int_t &  NBTMCe_Neff 
)
7026{
7027 if (gEDBDEBUGLEVEL>3) cout << "-------------void CalcEfficencyNumbers()"<<endl;
7028 Int_t npat_int=pat_interim->GetN();
7029 if (npat_int<=0) return;
7030
7031 for (int i=0; i<pat_interim->N(); ++i) {
7032 EdbSegP* seg=(EdbSegP* )pat_interim->GetSegment(i);
7033 if (seg->MCEvt()<0||seg->MCEvt()==MCCheck) ++NBT_Neff;
7034 if (seg->MCEvt()==MCCheck) ++NBTMC_Neff;
7035 if (seg->MCEvt()==MCCheck&&TMath::Abs(seg->Flag())==11) ++NBTMCe_Neff;
7036 }
7037 if (gEDBDEBUGLEVEL>3) {
7038 cout << "npat_int = " << npat_int << endl;
7039 cout << "NBT_Neff = " << NBT_Neff << endl;
7040 cout << "NBTMC_Neff = " << NBTMC_Neff << endl;
7041 cout << "NBTMCe_Neff = " << NBTMCe_Neff << endl;
7042 }
7043 return;
7044}
Int_t MCEvt() const
Definition: EdbSegP.h:145
Int_t Flag() const
Definition: EdbSegP.h:149
Int_t N() const
Definition: EdbPattern.h:86
Int_t GetN() const
Definition: EdbPattern.h:65
EdbSegP * GetSegment(int i) const
Definition: EdbPattern.h:66

◆ CalcEffPurOfShower()

void CalcEffPurOfShower ( TObjArray *  arr,
Int_t &  NBT,
Int_t &  NBTMC,
Int_t &  NBTallMC,
Int_t &  NBTeMC,
Double_t &  purall,
Double_t &  pure 
)
6092{
6093 Log(3, "ShowRec.cpp", "--- void CalcEffPurOfShower() ---");
6094 EdbSegP* seg;
6095 for (int i=0; i<arr->GetEntries(); ++i) {
6096 seg=(EdbSegP*)arr->At(i);
6097 ++NBT;
6098 if (seg->MCEvt()>0) {
6099 ++NBTMC; //NBTMC is kept for backward compability
6100 ++NBTallMC;
6101 }
6102 if (seg->MCEvt()>0 && TMath::Abs(seg->Flag())==11) {
6103 ++NBTeMC;
6104 }
6105 }
6106
6107 purall=-1;
6108 pure=-1;
6109 if (NBT!=0) purall=(Double_t)NBTallMC/(Double_t)NBT;
6110 if (NBT!=0) pure=(Double_t)NBTeMC/(Double_t)NBT;
6111
6112 if (gEDBDEBUGLEVEL>2) {
6113 cout << "CalcEffPurOfShower---------------- NBT,NBTallMC,NBTeMC,purall,pure= "<< NBT <<" " << NBTallMC <<" " << NBTeMC <<" " << purall <<" " << pure <<" " <<endl;
6114 }
6115
6116 GLOBAL_NBT=NBT;
6117 GLOBAL_NBTallMC=NBTallMC;
6118 GLOBAL_NBTMC=NBTallMC; // kept for backward compability
6119 GLOBAL_NBTeMC=NBTeMC;
6120 GLOBAL_purall=purall;
6121 GLOBAL_pure=pure;
6122 return;
6123}
Double_t GLOBAL_purall
Definition: ShowRec.h:37
Int_t GLOBAL_NBTMC
Definition: ShowRec.h:36
Int_t GLOBAL_NBT
Definition: ShowRec.h:36
Int_t GLOBAL_NBTeMC
Definition: ShowRec.h:36
Int_t GLOBAL_NBTallMC
Definition: ShowRec.h:36
Double_t GLOBAL_pure
Definition: ShowRec.h:37

◆ CalcEffPurOfShower2()

void CalcEffPurOfShower2 ( TObjArray *  arr,
Int_t &  NBT,
Int_t &  NBTMC,
Int_t &  NBTallMC,
Int_t &  NBTeMC,
Double_t &  purall,
Double_t &  pure,
Int_t  NBT_Neff,
Int_t  NBTMC_Neff,
Int_t  NBTMCe_Neff 
)
6126{
6127 Log(3, "ShowRec.cpp", "--- void CalcEffPurOfShower2() ---");
6128 EdbSegP* seg;
6129
6130 for (int i=0; i<arr->GetEntries(); ++i) {
6131 seg=(EdbSegP*)arr->At(i);
6132 ++NBT;
6133 if (seg->MCEvt()>0) {
6134 ++NBTMC; //NBTMC is kept for backward compability
6135 ++NBTallMC;
6136 }
6137 if (seg->MCEvt()>0 && TMath::Abs(seg->Flag())==11) {
6138 ++NBTeMC;
6139 }
6140 }
6141
6142 purall=-1;
6143 pure=-1;
6144 if (NBT!=0) purall=(Double_t)NBTallMC/(Double_t)NBT;
6145 if (NBT!=0) pure=(Double_t)NBTeMC/(Double_t)NBT;
6146
6147 // eff_all = NBTMC_SHOWER/NBTMC_VOLUME
6148 // eff_e = NBTMCe_SHOWER/NBTMCe_VOLUME
6149
6150 Double_t effall=0;
6151 if (NBTMC_Neff!=0) effall = (Double_t)NBTMC/(Double_t)NBTMC_Neff;
6152 Double_t effe=0;
6153 if (NBTMC_Neff!=0) effe = (Double_t)NBTeMC/(Double_t)NBTMCe_Neff;
6154
6155 if (gEDBDEBUGLEVEL>2) {
6156 cout << "CalcEffPurOfShower2---------------- NBT,NBTallMC,NBTeMC,purall,pure, effall, effe= "<< NBT <<" " << NBTallMC;
6157 cout <<" " << NBTeMC <<" " << purall <<" " << pure <<" " << effall <<" " << effe <<" " << endl;
6158 }
6159
6160 GLOBAL_NBT=NBT;
6161 GLOBAL_NBTallMC=NBTallMC;
6162 GLOBAL_NBTMC=NBTallMC; // kept for backward compability
6163 GLOBAL_NBTeMC=NBTeMC;
6164 GLOBAL_purall=purall;
6165 GLOBAL_pure=pure;
6166 GLOBAL_effall=effall;
6167 GLOBAL_effe=effe;
6168
6169 Log(3, "ShowRec.cpp", "--- void CalcEffPurOfShower2() done.");
6170 return;
6171}
Double_t GLOBAL_effall
Definition: ShowRec.h:38
Double_t GLOBAL_effe
Definition: ShowRec.h:38

◆ CalcTrackDensity()

void CalcTrackDensity ( EdbPattern pat_interim,
Float_t  pat_interim_halfsize,
Int_t &  npat_int,
Int_t &  npat_total,
Int_t &  npatN 
)
7004{
7005 if (gEDBDEBUGLEVEL>3) cout << "-------------void CalcTrackDensity(&pat_interim,pat_interim_halfsize,&npat_int,&npat_total)"<<endl;
7006 npat_int=pat_interim->GetN();
7007 if (npat_int<=0) return;
7008 npat_total+=npat_int;
7009 ++npatN;
7010 if (npatN>0) shower_trackdensb=(Float_t)npat_total/(Float_t)npatN/local_halfpatternsize/local_halfpatternsize/4.0*1000.0*1000.0; // BT/mm2 // contains SG and BG tracks!
7011
7012 if (gEDBDEBUGLEVEL>3) {
7013 cout << "pat_interim->Z() = " << pat_interim->Z() << endl;
7014 cout << "pat_interim->GetN() = " << pat_interim->GetN() << endl;
7015 cout << "npat_int = " << npat_int << endl;
7016 cout << "npat_total = " << npat_total << endl;
7017 cout << "npatN = " << npatN << endl;
7018 cout << "shower_trackdensb = " << shower_trackdensb << endl;
7019 }
7020 return;
7021}
Float_t local_halfpatternsize
Definition: ShowRec.h:146
Float_t shower_trackdensb
Definition: ShowRec.h:395
Float_t Z() const
Definition: EdbPattern.h:84

◆ CreateOutPutStructures()

void CreateOutPutStructures ( )
544 {
545
546 Log(2, "ShowRec.cpp", "--- void CreateOutPutStructures() ---");
547
548 // Create unique Outputfile where efficencies and purities are written in:
549 //-----------------------------------
550 STREAM_ShowRecEffName="ShowRecEff__PADI_"+TString(Form("%d",cmd_PADI))+"_BTPA_"+TString(Form("%d",cmd_BTPA))+"_BGTP_"+TString(Form("%d",cmd_BGTP))+"_ALTP_"+TString(Form("%d",cmd_ALTP))+"_FP_"+TString(Form("%d",cmd_FP))+"_MP_"+TString(Form("%d",cmd_MP))+"_NP_"+TString(Form("%d",cmd_NP))+"_LT_"+TString(Form("%d",cmd_LT))+"_MC_"+TString(Form("%d",cmd_MC))+"_HPLZ_"+TString(Form("%d",cmd_HPLZ))+"__ParaSet_"+TString(Form("%d",cmd_PASTART))+"_To_"+TString(Form("%d",cmd_PAEND))+".txt";
551 //------------------
552 STRING_ShowShowerName="ShowRecShower__PADI_"+TString(Form("%d",cmd_PADI))+"_BTPA_"+TString(Form("%d",cmd_BTPA))+"_BGTP_"+TString(Form("%d",cmd_BGTP))+"_ALTP_"+TString(Form("%d",cmd_ALTP))+"_FP_"+TString(Form("%d",cmd_FP))+"_MP_"+TString(Form("%d",cmd_MP))+"_NP_"+TString(Form("%d",cmd_NP))+"_LT_"+TString(Form("%d",cmd_LT))+"_MC_"+TString(Form("%d",cmd_MC))+"_HPLZ_"+TString(Form("%d",cmd_HPLZ))+"__ParaSet_"+TString(Form("%d",cmd_PASTART))+"_To_"+TString(Form("%d",cmd_PAEND))+".txt";
553 FILE_ShowShower = new TFile(STRING_ShowShowerName+".root","RECREATE");
554 //------------------
555 STRING_ShowTracksName="ShowRecTracks__PADI_"+TString(Form("%d",cmd_PADI))+"_BTPA_"+TString(Form("%d",cmd_BTPA))+"_BGTP_"+TString(Form("%d",cmd_BGTP))+"_ALTP_"+TString(Form("%d",cmd_ALTP))+"_FP_"+TString(Form("%d",cmd_FP))+"_MP_"+TString(Form("%d",cmd_MP))+"_NP_"+TString(Form("%d",cmd_NP))+"_LT_"+TString(Form("%d",cmd_LT))+"_MC_"+TString(Form("%d",cmd_MC))+"_HPLZ_"+TString(Form("%d",cmd_HPLZ))+"__ParaSet_"+TString(Form("%d",cmd_PASTART))+"_To_"+TString(Form("%d",cmd_PAEND))+".txt";
556 FILE_ShowTracks = new TFile(STRING_ShowTracksName+".root","RECREATE");
557 //------------------
558 TString HistoOutputFile="ShowRecHistos__PADI_"+TString(Form("%d",cmd_PADI))+"_BTPA_"+TString(Form("%d",cmd_BTPA))+"_BGTP_"+TString(Form("%d",cmd_BGTP))+"_ALTP_"+TString(Form("%d",cmd_ALTP))+"_FP_"+TString(Form("%d",cmd_FP))+"_MP_"+TString(Form("%d",cmd_MP))+"_NP_"+TString(Form("%d",cmd_NP))+"_LT_"+TString(Form("%d",cmd_LT))+"_MC_"+TString(Form("%d",cmd_MC))+"_HPLZ_"+TString(Form("%d",cmd_HPLZ))+"__ParaSet_"+TString(Form("%d",cmd_PASTART))+"_To_"+TString(Form("%d",cmd_PAEND))+".txt";
559 FILE_ShowRecHistos = new TFile(HistoOutputFile+".root","RECREATE");
560 //------------------
561
562 cout << "--- void CreateOutPutStructures() --- Root Files Recreated."<<endl;
563
564 NBTeMC_pure = new TProfile("NBTeMCvspure","NBTeMCvspure",100,0,1.05,0,300);
565 NBTallMC_purall = new TProfile("NBTallMCvspurall","NBTallMCvspurall",100,0,1.05,0,300);
566 NBTeMC_NBTMC = new TProfile("NBTeMCvsNBTMC","NBTeMCvsNBTMC",100,0,200,0,300);
567 NBTeMC_NBT = new TProfile("NBTeMCvsNBT","NBTeMCvsNBT",100,0,200,0,300);
568 NBT_InBTE = new TProfile("NBTvsInBTE","NBTvsInBTE",100,0,30,0,300);
569 NBTeMC_InBTE = new TProfile("NBTeMCvsInBTE","NBTeMCvsInBTE",100,0,30,0,300);
570 pure_InBTE = new TProfile("pure_InBTE","pure_InBTE",100,0,30,0,1.05);
571 purall_InBTE = new TProfile("purall_InBTE","purall_InBTE",100,0,30,0,1.05);
572
573 Hist_NBTeMC_pure = new TH2F("Hist_NBTeMC_pure","Hist_NBTeMC_pure",105,0,1.05,200,0,400);
574 Hist_NBTallMC_purall = new TH2F("Hist_NBTallMC_purall","Hist_NBTallMC_purall",105,0,1.05,200,0,400);
575 Hist_NBTeMC_NBTMC = new TH2F("Hist_NBTeMC_NBTMC","Hist_NBTeMC_NBTMC",200,0,400,200,0,200);
576 Hist_NBTeMC_NBT = new TH2F("Hist_NBTeMC_NBT","Hist_NBTeMC_NBT",200,0,400,200,0,200);
577 Hist_NBT_InBTE = new TH2F("Hist_NBT_InBTE","Hist_NBT_InBTE",120,0,30,200,0,200);
578 Hist_NBTeMC_InBTE = new TH2F("Hist_NBTeMC_InBTE","Hist_NBTeMC_InBTE",120,0,30,200,0,200);
579 Hist_pure_InBTE = new TH2F("Hist_pure_InBTE","Hist_pure_InBTE",120,0,30,100,0,1.05);
580 Hist_purall_InBTE = new TH2F("Hist_purall_InBTE","Hist_purall_InBTE",120,0,30,100,0,1.05);
581
582 cout << "--- void CreateOutPutStructures() --- Histos Recreated."<<endl;
583 //------------------
584 FILE_ShowRecEff = new TFile(STREAM_ShowRecEffName+".root","RECREATE");
585 TREE_ShowRecEff = new TTree("TreeSTREAM_ShowRecEff","TreeWithvaluesEqualToSTREAM_ShowRecEffTextFile");
586 TREE_ShowRecEff->SetDirectory(FILE_ShowRecEff);
587 cout << "--- void CreateOutPutStructures() --- Tree Recreated."<<endl;
588 //-----------------------------------
589 TREE_ShowRecEff->Branch("PADI", &cmd_PADI, "PADI/I");
590 TREE_ShowRecEff->Branch("BTPA", &cmd_BTPA, "BTPA/I");
591 TREE_ShowRecEff->Branch("BGTP", &cmd_BGTP, "BGTP/I");
592 TREE_ShowRecEff->Branch("ALTP", &cmd_ALTP, "ALTP/I");
593
594 TREE_ShowRecEff->Branch("FP", &cmd_FP, "FP/I");
595 TREE_ShowRecEff->Branch("MP", &cmd_MP, "MP/I");
596 TREE_ShowRecEff->Branch("LP", &cmd_LP, "LP/I");
597 TREE_ShowRecEff->Branch("NP", &cmd_NP, "NP/I");
598
599 TREE_ShowRecEff->Branch("LT", &cmd_LT, "LT/I");
600 TREE_ShowRecEff->Branch("MC", &cmd_MC, "MC/I");
601
602 TREE_ShowRecEff->Branch("PARASETNR", &GLOBAL_PARASETNR, "PARASETNR/I");
603 TREE_ShowRecEff->Branch("ShowerNr", &GLOBAL_INBTSHOWERNR, "ShowerNr/I");
604
605 TREE_ShowRecEff->Branch("EvtBT_E", &GLOBAL_EvtBT_E, "EvtBT_E/D");
606 TREE_ShowRecEff->Branch("EvtBT_TanTheta", &GLOBAL_EvtBT_TanTheta, "EvtBT_TanTheta/D");
607 TREE_ShowRecEff->Branch("EvtBT_Flag", &GLOBAL_EvtBT_Flag, "EvtBT_Flag/I");
608 TREE_ShowRecEff->Branch("EvtBT_MC", &GLOBAL_EvtBT_MC, "EvtBT_MC/I");
609
610 TREE_ShowRecEff->Branch("InBT_E", &GLOBAL_InBT_E, "InBT_E/D");
611 TREE_ShowRecEff->Branch("InBT_TanTheta", &GLOBAL_InBT_TanTheta, "InBT_TanTheta/D");
612 TREE_ShowRecEff->Branch("InBT_Flag", &GLOBAL_InBT_Flag, "InBT_Flag/I");
613 TREE_ShowRecEff->Branch("InBT_MC", &GLOBAL_InBT_MC, "InBT_MC/I");
614
615 TREE_ShowRecEff->Branch("NBT", &GLOBAL_NBT, "NBT/I");
616 TREE_ShowRecEff->Branch("NBTMC", &GLOBAL_NBTMC, "NBTMC/I"); // kept for backward compability
617 TREE_ShowRecEff->Branch("NBTallMC", &GLOBAL_NBTallMC, "NBTallMC/I");
618 TREE_ShowRecEff->Branch("NBTeMC", &GLOBAL_NBTeMC, "NBTeMC/I");
619 TREE_ShowRecEff->Branch("purall", &GLOBAL_purall, "purall/D");
620 TREE_ShowRecEff->Branch("pure", &GLOBAL_pure, "pure/D");
621 TREE_ShowRecEff->Branch("effall", &GLOBAL_effall, "effall/D");
622 TREE_ShowRecEff->Branch("effe", &GLOBAL_effe, "effe/D");
623
624 TREE_ShowRecEff->Branch("trckdens", &GLOBAL_trckdens, "trckdens/D");
625 //-----------------------------------
626
627
628
629 //-----------------------------------
630 // Histograms and TTree ONLY RELEVANT FOR GS Algo
631 cout << "Create Objects ONLY RELEVANT FOR GS Algo" << endl;
632 f_GSNN = new TFile("f_GSNN.root","RECREATE");
633 t_GSNN = new TTree("t_GSNN","t_GSNN");
634 t_GSNN->Branch("value_GSNN_varInput",&value_GSNN_varInput,"value_GSNN_varInput/F");
635 t_GSNN->Branch("value_GSNN_var00",&value_GSNN_var00,"value_GSNN_var00/F");
636 t_GSNN->Branch("value_GSNN_var01",&value_GSNN_var01,"value_GSNN_var01/F");
637 t_GSNN->Branch("value_GSNN_var02",&value_GSNN_var02,"value_GSNN_var02/F");
638 t_GSNN->Branch("value_GSNN_var03",&value_GSNN_var03,"value_GSNN_var03/F");
639 t_GSNN->Branch("value_GSNN_var04",&value_GSNN_var04,"value_GSNN_var04/F");
640 t_GSNN->Branch("value_GSNN_var05",&value_GSNN_var05,"value_GSNN_var05/F");
641 t_GSNN->Branch("value_GSNN_var06",&value_GSNN_var06,"value_GSNN_var06/F");
642 h_GSNN_var00=new TH1F("h_GSNN_var00","h_GSNN_var00",1000,0,1000);
643 h_GSNN_var01=new TH1F("h_GSNN_var01","h_GSNN_var01",1000,0,1000);
644 h_GSNN_var02=new TH1F("h_GSNN_var02","h_GSNN_var02",1000,0,1000);
645 h_GSNN_var03=new TH1F("h_GSNN_var03","h_GSNN_var03",100,0,70000);
646 h_GSNN_var04=new TH1F("h_GSNN_var04","h_GSNN_var04",1000,0,1);
647 h_GSNN_var05=new TH1F("h_GSNN_var05","h_GSNN_var05",10,0,10);
648 h_GSNN_var06=new TH1F("h_GSNN_var06","h_GSNN_var06",1100,-1000,100);
649 cout << "Create Objects ONLY RELEVANT FOR GS Algo...done." << endl;
650 //-----------------------------------
651
652
653
654 //-----------------------------------
655 Log(2, "ShowRec.cpp", "--- void CreateOutPutStructures() ---done.");
656 return;
657}
TProfile * NBT_InBTE
Definition: ShowRec.h:96
TH1F * h_GSNN_var04
Definition: ShowRec.h:415
TProfile * pure_InBTE
Definition: ShowRec.h:100
Int_t cmd_PADI
Definition: ShowRec.h:8
TH2F * Hist_pure_InBTE
Definition: ShowRec.h:101
Int_t GLOBAL_INBTSHOWERNR
Definition: ShowRec.h:80
TH1F * h_GSNN_var03
Definition: ShowRec.h:414
Double_t GLOBAL_trckdens
Definition: ShowRec.h:39
TH2F * Hist_NBTeMC_NBTMC
Definition: ShowRec.h:93
TFile * FILE_ShowRecEff
Definition: ShowRec.h:61
Int_t GLOBAL_PARASETNR
Definition: ShowRec.h:79
Float_t value_GSNN_var01
Definition: ShowRec.h:419
TFile * FILE_ShowTracks
Definition: ShowRec.h:71
Int_t cmd_BTPA
Definition: ShowRec.h:9
TFile * f_GSNN
Definition: ShowRec.h:427
Int_t cmd_ALTP
Definition: ShowRec.h:11
Float_t value_GSNN_var02
Definition: ShowRec.h:420
TH2F * Hist_NBT_InBTE
Definition: ShowRec.h:97
Int_t cmd_PAEND
Definition: ShowRec.h:13
Int_t cmd_BGTP
Definition: ShowRec.h:10
Float_t value_GSNN_varInput
Definition: ShowRec.h:425
Int_t GLOBAL_InBT_MC
Definition: ShowRec.h:43
TFile * FILE_ShowRecHistos
Definition: ShowRec.h:63
TProfile * NBTeMC_InBTE
Definition: ShowRec.h:98
Int_t cmd_PASTART
Definition: ShowRec.h:12
TH2F * Hist_purall_InBTE
Definition: ShowRec.h:103
TH1F * h_GSNN_var05
Definition: ShowRec.h:416
TString STRING_ShowShowerName
Definition: ShowRec.h:67
TString STREAM_ShowRecEffName
Definition: ShowRec.h:66
Int_t cmd_LT
Definition: ShowRec.h:19
TH1F * h_GSNN_var02
Definition: ShowRec.h:413
Int_t cmd_FP
Definition: ShowRec.h:15
TH2F * Hist_NBTeMC_InBTE
Definition: ShowRec.h:99
Float_t value_GSNN_var06
Definition: ShowRec.h:424
TTree * TREE_ShowRecEff
Definition: ShowRec.h:62
TH1F * h_GSNN_var06
Definition: ShowRec.h:417
TProfile * purall_InBTE
Definition: ShowRec.h:102
TH2F * Hist_NBTeMC_pure
Definition: ShowRec.h:89
TProfile * NBTeMC_NBTMC
Definition: ShowRec.h:92
TString STRING_ShowTracksName
Definition: ShowRec.h:70
Int_t GLOBAL_InBT_Flag
Definition: ShowRec.h:43
Double_t GLOBAL_EvtBT_E
Definition: ShowRec.h:50
TH2F * Hist_NBTeMC_NBT
Definition: ShowRec.h:95
TFile * FILE_ShowShower
Definition: ShowRec.h:69
TH2F * Hist_NBTallMC_purall
Definition: ShowRec.h:91
Double_t GLOBAL_InBT_TanTheta
Definition: ShowRec.h:44
Float_t value_GSNN_var03
Definition: ShowRec.h:421
Double_t GLOBAL_InBT_E
Definition: ShowRec.h:44
Int_t GLOBAL_EvtBT_MC
Definition: ShowRec.h:49
Int_t cmd_MP
Definition: ShowRec.h:17
Int_t cmd_NP
Definition: ShowRec.h:18
TProfile * NBTeMC_NBT
Definition: ShowRec.h:94
Float_t value_GSNN_var00
Definition: ShowRec.h:418
TH1F * h_GSNN_var01
Definition: ShowRec.h:412
TH1F * h_GSNN_var00
Definition: ShowRec.h:411
Float_t value_GSNN_var05
Definition: ShowRec.h:423
TProfile * NBTallMC_purall
Definition: ShowRec.h:90
Int_t cmd_LP
Definition: ShowRec.h:16
TProfile * NBTeMC_pure
Definition: ShowRec.h:88
TTree * t_GSNN
Definition: ShowRec.h:426
Double_t GLOBAL_EvtBT_TanTheta
Definition: ShowRec.h:50
Float_t value_GSNN_var04
Definition: ShowRec.h:422
Int_t GLOBAL_EvtBT_Flag
Definition: ShowRec.h:49
Int_t cmd_MC
Definition: ShowRec.h:20
Int_t cmd_HPLZ
Definition: ShowRec.h:26

◆ CreateTreeBranchShowerTree()

TTree * CreateTreeBranchShowerTree ( Int_t  ParaSetNr)
6365{
6366 Log(2, "ShowRec.cpp", "--- TTree* CreateTreeBranchShowerTree() ---");
6367
6368
6369 // ParasetNr == -1 (no paraset from the paradefinition.root file is given and the
6370 // standard built in parasets are used: "treebranch" instead of "treebranch_-1"
6371 // ParasetNr != -1 ( paraset from the paradefinition.root file is given)
6372
6373 TString treenname;
6374 if (ParaSetNr==-1) {
6375 treenname="treebranch";
6376 }
6377 else {
6378 treenname=TString(Form("treebranch_%d",ParaSetNr));
6379 }
6380
6381 TTree* eShowerTree = new TTree(treenname,treenname);
6382 eShowerTree->Branch("number_eventb",&shower_number_eventb,"number_eventb/I");
6383 eShowerTree->Branch("sizeb",&shower_sizeb,"sizeb/I");
6384 eShowerTree->Branch("sizeb15",&shower_sizeb15,"sizeb15/I");
6385 eShowerTree->Branch("sizeb20",&shower_sizeb20,"sizeb20/I");
6386 eShowerTree->Branch("sizeb30",&shower_sizeb30,"sizeb30/I");
6387 eShowerTree->Branch("isizeb",&shower_isizeb,"isizeb/I");
6388 eShowerTree->Branch("xb",shower_xb,"xb[sizeb]/F");
6389 eShowerTree->Branch("yb",shower_yb,"yb[sizeb]/F");
6390 eShowerTree->Branch("zb",shower_zb,"zb[sizeb]/F");
6391 eShowerTree->Branch("txb",shower_txb,"txb[sizeb]/F");
6392 eShowerTree->Branch("tyb",shower_tyb,"tyb[sizeb]/F");
6393 eShowerTree->Branch("nfilmb",shower_nfilmb,"nfilmb[sizeb]/I");
6394 eShowerTree->Branch("ntrace1simub",shower_ntrace1simub,"ntrace1simu[sizeb]/I",128000); // s.eMCEvt
6395 eShowerTree->Branch("ntrace2simub",shower_ntrace2simub,"ntrace2simu[sizeb]/I",128000); // s.eW
6396 eShowerTree->Branch("ntrace3simub",shower_ntrace3simub,"ntrace3simu[sizeb]/F",128000); // s.eP
6397 eShowerTree->Branch("ntrace4simub",shower_ntrace4simub,"ntrace4simu[sizeb]/I",128000); // s.eFlag
6398 eShowerTree->Branch("chi2btkb",shower_chi2btkb,"chi2btkb[sizeb]/F");
6399 eShowerTree->Branch("deltarb",shower_deltarb,"deltarb[sizeb]/F");
6400 eShowerTree->Branch("deltathetab",shower_deltathetab,"deltathetab[sizeb]/F");
6401 eShowerTree->Branch("deltaxb",shower_deltaxb,"deltaxb[sizeb]/F");
6402 eShowerTree->Branch("deltayb",shower_deltayb,"deltayb[sizeb]/F");
6403 eShowerTree->Branch("tagprimary",shower_tagprimary,"tagprimary[sizeb]/F");
6404 eShowerTree->Branch("energy_shot_particle",&shower_energy_shot_particle,"energy_shot_particle/F");
6405 eShowerTree->Branch("E_MC",&shower_energy_shot_particle,"E_MC/F");
6406 eShowerTree->Branch("showerID",&shower_showerID,"showerID/I");
6407 eShowerTree->Branch("idb",shower_idb,"idb/I");
6408 eShowerTree->Branch("plateb",shower_plateb,"plateb[sizeb]/I");
6409 eShowerTree->Branch("deltasigmathetab",shower_deltasigmathetab,"deltasigmathetab[59]/F");
6410 eShowerTree->Branch("lengthfilmb",&shower_numberofilms,"lengthfilmb/I",128000);
6411 eShowerTree->Branch("purityb",&shower_purb,"purityb/F",128000); // shower purity
6412 eShowerTree->Branch("trackdensb",&shower_trackdensb,"trackdensb/F",128000); // track density _around_ the shower (not _in_ shower)
6413 eShowerTree->Branch("nholesb",&shower_numberofholes,"nholesb/I",128000); // #of (single) empty plates
6414 eShowerTree->Branch("nholesmaxb",&shower_numberofholesconseq,"nholesmaxb/I",128000); // #of (consecutive) empty plates
6415
6416 eShowerTree->Branch("axis_xb",&shower_axis_xb,"shower_axis_xb/F"); // Shower Axis Values...
6417 eShowerTree->Branch("axis_yb",&shower_axis_yb,"shower_axis_yb/F");
6418 eShowerTree->Branch("axis_zb",&shower_axis_zb,"shower_axis_zb/F");
6419 eShowerTree->Branch("axis_txb",&shower_axis_txb,"shower_axis_txb/F");
6420 eShowerTree->Branch("axis_tyb",&shower_axis_tyb,"shower_axis_tyb/F");
6421
6422 // distuingish variable for more than one kind of showers merged into treebranch
6423 eShowerTree->Branch("filetype",&shower_filetype,"filetype/I");
6424
6425 eShowerTree->SetDirectory(FILE_ShowShower);
6426
6427 if (gEDBDEBUGLEVEL>2) {
6428 cout << "--- CreateTreeBranchShowerTree: eShowerTree: Name, Entries:"<<endl;
6429 cout << eShowerTree->GetName() << " " << eShowerTree->GetEntries() <<endl;
6430 cout << "------eShowerTree-----------------------------------------"<<endl;
6431 }
6432 return eShowerTree;
6433}
Int_t ParaSetNr
Definition: CreateParaset_BW_Alg.C:23
Float_t shower_axis_tyb
Definition: ShowRec.h:400
Int_t shower_filetype
Definition: ShowRec.h:402
Int_t shower_nfilmb[5000]
Definition: ShowRec.h:382
Float_t shower_axis_zb
Definition: ShowRec.h:398
Float_t shower_yb[5000]
Definition: ShowRec.h:374
Int_t shower_showerID
Definition: ShowRec.h:370
Int_t shower_numberofholesconseq
Definition: ShowRec.h:404
Float_t shower_ntrace3simub[5000]
Definition: ShowRec.h:387
Float_t shower_deltaxb[5000]
Definition: ShowRec.h:380
Int_t shower_sizeb20
Definition: ShowRec.h:371
Float_t shower_purb
Definition: ShowRec.h:394
Float_t shower_tyb[5000]
Definition: ShowRec.h:377
Int_t shower_numberofholes
Definition: ShowRec.h:405
Float_t shower_deltathetab[5000]
Definition: ShowRec.h:379
Int_t shower_numberofilms
Definition: ShowRec.h:393
Int_t shower_ntrace2simub[5000]
Definition: ShowRec.h:386
Float_t shower_energy_shot_particle
Definition: ShowRec.h:372
Int_t shower_idb[5000]
Definition: ShowRec.h:390
Int_t shower_number_eventb
Definition: ShowRec.h:370
Float_t shower_axis_txb
Definition: ShowRec.h:399
Int_t shower_sizeb15
Definition: ShowRec.h:371
Float_t shower_deltasigmathetab[58]
Definition: ShowRec.h:392
Float_t shower_tagprimary[5000]
Definition: ShowRec.h:389
Int_t shower_isizeb
Definition: ShowRec.h:370
Float_t shower_deltayb[5000]
Definition: ShowRec.h:381
Int_t shower_sizeb30
Definition: ShowRec.h:371
Int_t shower_ntrace4simub[5000]
Definition: ShowRec.h:388
Int_t shower_sizeb
Definition: ShowRec.h:370
Float_t shower_chi2btkb[5000]
Definition: ShowRec.h:384
Float_t shower_zb[5000]
Definition: ShowRec.h:375
Float_t shower_deltarb[5000]
Definition: ShowRec.h:378
Float_t shower_xb[5000]
Definition: ShowRec.h:373
Float_t shower_txb[5000]
Definition: ShowRec.h:376
Float_t shower_axis_yb
Definition: ShowRec.h:397
Int_t shower_plateb[5000]
Definition: ShowRec.h:391
Float_t shower_axis_xb
Definition: ShowRec.h:396
Int_t shower_ntrace1simub[5000]
Definition: ShowRec.h:385

◆ DoBGTargetCleaning()

void DoBGTargetCleaning ( )
7288 {
7289
7290 // Clean the input data Objects if necessary:
7291 Float_t BGTargetDensity=0;
7292 // cout << "--- \t\t : -CLEAN InputData BG Cleaning: 0: No, 1:20BT/mm2 2: 40BT/mm2 3:10BT/mm2 4:60BT/mm2 \n";
7293 // cout << "--- \t\t : InputData BG Cleaning: 10: Remove DoubleBT and Passing, No dens cut, 11: &&10BT/mm2 12: &&20BT/mm2 13: &&30BT/mm2 ... \n";
7294 if (cmd_CLEAN==1) BGTargetDensity=20;
7295 if (cmd_CLEAN==2) BGTargetDensity=40;
7296 if (cmd_CLEAN==3) BGTargetDensity=10;
7297 if (cmd_CLEAN==4) BGTargetDensity=60;
7298 if (cmd_CLEAN==0) BGTargetDensity=1000;
7299 EdbPVRQuality* PVRQualCheck;
7300 EdbPVRec* new_GLOBAL_gAli;
7301 EdbPVRec* newnew_GLOBAL_gAli;
7302
7303
7304 // Just density cleaning, no double or passing removal.
7305 if (cmd_CLEAN!=0&&cmd_CLEAN<10) {
7306 cout << "Just density cleaning, no double or passing removal. " << endl;
7307 PVRQualCheck = new EdbPVRQuality(GLOBAL_gAli,BGTargetDensity);
7308 new_GLOBAL_gAli = PVRQualCheck->GetEdbPVRec(1);
7309 PVRQualCheck->Print();
7310 GLOBAL_gAli=new_GLOBAL_gAli;
7311 }
7312
7313 // Density cleaning, with double and passing removal.
7314 // Additional BG cleaning, depending on the last number of the number switch:
7315 if (cmd_CLEAN>=10&&cmd_CLEAN<=20) {
7316 cout << "Density cleaning, with double and passing removal." << endl;
7317 cout << " THIS WILL BE THE PART WHERE REMOVE PASSING IS IMPLEMENTED !!! " << endl;
7318 cout << " THIS WILL BE THE PART WHERE REMOVE DOUBLE BT IS IMPLEMENTED !!! " << endl;
7319 Int_t rest=cmd_CLEAN-10;
7320 Float_t BGTargetDensity=rest*10;
7321 if (rest==0) BGTargetDensity=100000;
7322 //cout << "BGTargetDensity " << BGTargetDensity << endl;
7323 PVRQualCheck = new EdbPVRQuality(GLOBAL_gAli,BGTargetDensity);
7324 new_GLOBAL_gAli = PVRQualCheck->GetEdbPVRec(1);
7325 GLOBAL_gAli=new_GLOBAL_gAli;
7326 GLOBAL_gAli->Print();
7327 newnew_GLOBAL_gAli=PVRQualCheck->Remove_DoubleBT(GLOBAL_gAli);
7328 GLOBAL_gAli=newnew_GLOBAL_gAli;
7329 new_GLOBAL_gAli=PVRQualCheck->Remove_Passing(GLOBAL_gAli);
7330 GLOBAL_gAli=new_GLOBAL_gAli;
7331 }
7332
7333 return;
7334} // of void DoBGTargetCleaning()
EdbPVRec * GLOBAL_gAli
Definition: ShowRec.h:73
Int_t cmd_CLEAN
Definition: ShowRec.h:26
Root Class Definition for EdbPVRQuality.
Definition: EdbPVRQuality.h:38
void Print()
Definition: EdbPVRQuality.cxx:1076
EdbPVRec * GetEdbPVRec()
Definition: EdbPVRQuality.h:232
EdbPVRec * Remove_Passing(EdbPVRec *aliSource)
Definition: EdbPVRQuality.cxx:3250
EdbPVRec * Remove_DoubleBT(EdbPVRec *aliSource)
Definition: EdbPVRQuality.cxx:3064
Definition: EdbPVRec.h:148
void Print() const
Definition: EdbPattern.cxx:1693

◆ Fill2GlobalInBTArray()

void Fill2GlobalInBTArray ( )
7211 {
7212
7213 // if we have a vertex file we can cut for InBT tracks with a given vertex (to pure up the starting inbt sample)
7214 // (for now 100micron ip). (electrons,pi+-);
7215 // (for now 250micron ip). (photons.);
7216 // (for now 300micron ip). (other.);
7217// if (cmd_vtx!=1) return;
7218 if (cmd_vtx==0) return;
7219// if (cmd_MC!=1) return; // why did we say that we wanna have only starting mc inbts?
7220 // also it can be possible that we wanna seacrh all in bt from the volume to an given
7221 // vertex, for a mc event (but not necessarily for mc In BTs).
7222 // better comment it out?... ah, i know why because otherwise, we do not know which mc event vtx to take... so what to do???
7223
7224 Float_t cutIPMax=100;
7225 if (cmd_vtx==2) cutIPMax=250;
7226 if (cmd_vtx==3) cutIPMax=500;
7227 if (cmd_vtx==4) cutIPMax=1000;
7228 if (cmd_vtx==5) cutIPMax=5000;
7229
7230 Float_t cutZVtxDist=999999;
7231
7232 TObjArray* GLOBAL_InBTArray2 = new TObjArray();
7233 cout << "Fill2GlobalInBTArray Calc IPs for the " << GLOBAL_InBTArray->GetEntries() << " entries" << endl;
7234
7235 for (Int_t i=0; i<GLOBAL_InBTArray->GetEntries(); ++i) {
7236 if (i%1000==0) cout << "." << flush;
7238 // Calculate IP:
7239 // in case InBT is of BGType, we check for the GBMC variable set.
7240 Int_t MCEvt=s1->MCEvt();
7241 if (MCEvt<0 && cmd_GBMC>0) MCEvt=cmd_GBMC;
7242
7243 Double_t ip=CalcIP(s1,Double_t(GLOBAL_VtxArrayX[MCEvt]),Double_t(GLOBAL_VtxArrayY[MCEvt]),Double_t(GLOBAL_VtxArrayZ[MCEvt]));
7244
7245 if (ip>cutIPMax) continue;
7246
7247 cutZVtxDist=s1->Z()-Double_t(GLOBAL_VtxArrayZ[MCEvt]);
7248 if (i==0||i==GLOBAL_InBTArray->GetEntries()-1) {
7249 cout << "INBT " << i << " :VTX:X:Y:Z: " << GLOBAL_VtxArrayX[MCEvt] << " " << GLOBAL_VtxArrayY[MCEvt] << " " << GLOBAL_VtxArrayZ[MCEvt] << " ip= " << ip << " ZdistVtx= " << cutZVtxDist << " MCEvt= " << MCEvt << endl;
7250 }
7251
7252 if (ip<cutIPMax) GLOBAL_InBTArray2->Add(s1);
7253 }
7254
7255 cout << endl;
7256 cout << "Fill2GlobalInBTArray::Before IP cut " << GLOBAL_InBTArray->GetEntries() << endl;
7257 cout << "Fill2GlobalInBTArray::After IP cut("<<cutIPMax<<") " << GLOBAL_InBTArray2->GetEntries() << endl;
7258 // Swap Arrays:
7259 GLOBAL_InBTArray= GLOBAL_InBTArray2;
7260 cout << GLOBAL_InBTArray->GetEntries() <<endl;
7261 return;
7262}
Double_t CalcIP(EdbSegP *s, EdbVertex *v)
Definition: ShowRec.cpp:8872
Int_t cmd_vtx
Definition: ShowRec.h:25
TObjArray * GLOBAL_InBTArray
Definition: ShowRec.h:74
EdbSegP * s1
Definition: tlg2couples.C:29

◆ FillOutPutStructures()

void FillOutPutStructures ( )
6177{
6178 if (cmd_OUTPUTLEVEL==1) return;
6179
6180 Log(2, "ShowRec.cpp", "--- void FillOutPutStructures() ---");
6181
6182 STREAM_ShowRecEff.open(STREAM_ShowRecEffName,ios::app); // Fill Later, Open now :-)
6184
6185 Int_t PARASETNR,INBTSHOWERNR;
6186 Double_t EvtBT_E,EvtBT_TanTheta;
6187 Int_t EvtBT_Flag,EvtBT_MC;
6188 Double_t InBT_E,InBT_TanTheta;
6189 Int_t InBT_Flag,InBT_MC;
6190 Int_t NBT,NBTMC,NBTallMC,NBTeMC;
6191 Double_t purall,pure;
6192 Double_t effall,effe;
6193 Double_t trckdens;
6194
6195 TREE_ShowRecEff->SetBranchAddress("PARASETNR", &PARASETNR);
6196 TREE_ShowRecEff->SetBranchAddress("ShowerNr", &INBTSHOWERNR);
6197
6198 TREE_ShowRecEff->SetBranchAddress("EvtBT_E", &EvtBT_E);
6199 TREE_ShowRecEff->SetBranchAddress("EvtBT_TanTheta", &EvtBT_TanTheta);
6200 TREE_ShowRecEff->SetBranchAddress("EvtBT_Flag", &EvtBT_Flag);
6201 TREE_ShowRecEff->SetBranchAddress("EvtBT_MC", &EvtBT_MC);
6202
6203 TREE_ShowRecEff->SetBranchAddress("InBT_E", &InBT_E);
6204 TREE_ShowRecEff->SetBranchAddress("InBT_TanTheta", &InBT_TanTheta);
6205 TREE_ShowRecEff->SetBranchAddress("InBT_Flag", &InBT_Flag);
6206 TREE_ShowRecEff->SetBranchAddress("InBT_MC", &InBT_MC);
6207
6208 TREE_ShowRecEff->SetBranchAddress("NBT", &NBT);
6209 TREE_ShowRecEff->SetBranchAddress("NBTMC", &NBTMC);
6210 TREE_ShowRecEff->SetBranchAddress("NBTallMC", &NBTallMC);
6211 TREE_ShowRecEff->SetBranchAddress("NBTeMC", &NBTeMC);
6212 TREE_ShowRecEff->SetBranchAddress("purall", &purall);
6213 TREE_ShowRecEff->SetBranchAddress("pure", &pure);
6214
6215 TREE_ShowRecEff->SetBranchAddress("effall", &effall);
6216 TREE_ShowRecEff->SetBranchAddress("effe", &effe);
6217 TREE_ShowRecEff->SetBranchAddress("trckdens", &trckdens);
6218
6219 for (int i=0; i<TREE_ShowRecEff->GetEntries(); ++i) {
6220
6221 if (gEDBDEBUGLEVEL>3) TREE_ShowRecEff->Show(i);
6222 TREE_ShowRecEff->GetEntry(i);
6223
6224 STREAM_ShowRecEff << setw(10) << cmd_PADI;
6225 STREAM_ShowRecEff << setw(10) << cmd_BTPA;
6226 STREAM_ShowRecEff << setw(10) << cmd_BGTP;
6227 STREAM_ShowRecEff << setw(10) << cmd_ALTP;
6228 STREAM_ShowRecEff << setw(10) << cmd_FP;
6229 STREAM_ShowRecEff << setw(10) << cmd_MP;
6230 STREAM_ShowRecEff << setw(10) << cmd_LP;
6231 STREAM_ShowRecEff << setw(10) << cmd_NP;
6232
6233 STREAM_ShowRecEff << setw(10) << cmd_LT;
6234 STREAM_ShowRecEff << setw(10) << cmd_MC;
6235
6236 STREAM_ShowRecEff << setw(14) << PARASETNR;
6237 STREAM_ShowRecEff << setw(14) << INBTSHOWERNR;
6238
6239 STREAM_ShowRecEff << setw(10) << EvtBT_E;
6240 STREAM_ShowRecEff << setw(14) << EvtBT_TanTheta;
6241 STREAM_ShowRecEff << setw(14) << EvtBT_Flag;
6242 STREAM_ShowRecEff << setw(10) << EvtBT_MC;
6243
6244 STREAM_ShowRecEff << setw(10) << InBT_E;
6245 STREAM_ShowRecEff << setw(14) << InBT_TanTheta;
6246 STREAM_ShowRecEff << setw(14) << InBT_Flag;
6247 STREAM_ShowRecEff << setw(10) << InBT_MC;
6248
6249 STREAM_ShowRecEff << setw(10) << NBT;
6250 STREAM_ShowRecEff << setw(10) << NBTallMC;
6251 STREAM_ShowRecEff << setw(10) << NBTeMC;
6252 STREAM_ShowRecEff << setw(10) << purall;
6253 STREAM_ShowRecEff << setw(10) << pure;
6254 STREAM_ShowRecEff << setw(10) << effall;
6255 STREAM_ShowRecEff << setw(10) << effe;
6256 STREAM_ShowRecEff << setw(10) << trckdens;
6257 STREAM_ShowRecEff << endl;
6258
6259 // ---------
6260 NBTeMC_pure->Fill(pure,NBTeMC);
6261 NBTallMC_purall->Fill(purall,NBTallMC);
6262
6263 NBTeMC_NBTMC->Fill(NBTallMC,NBTeMC);
6264 NBTeMC_NBT->Fill(NBT,NBTeMC);
6265
6266 NBT_InBTE->Fill(InBT_E/1000.0,NBT);
6267 NBTeMC_InBTE->Fill(InBT_E/1000.0,NBTeMC);
6268
6269 pure_InBTE->Fill(InBT_E/1000.0,pure);
6270 purall_InBTE->Fill(InBT_E/1000.0,purall);
6271 // ---------
6272 Hist_NBTeMC_pure->Fill(pure,NBTeMC);
6273 Hist_NBTallMC_purall->Fill(purall,NBTallMC);
6274
6275 Hist_NBTeMC_NBTMC->Fill(NBTallMC,NBTeMC);
6276 Hist_NBTeMC_NBT->Fill(NBT,NBTeMC);
6277
6278 Hist_NBT_InBTE->Fill(InBT_E/1000.0,NBT);
6279 Hist_NBTeMC_InBTE->Fill(InBT_E/1000.0,NBTeMC);
6280
6281 Hist_pure_InBTE->Fill(InBT_E/1000.0,pure);
6282 Hist_purall_InBTE->Fill(InBT_E/1000.0,purall);
6283
6284 }
6285
6286 FILE_ShowRecEff->cd();
6287 TREE_ShowRecEff->Write();
6288
6289 FILE_ShowRecHistos->cd();
6290 TCanvas* ShowRecEffPlots= new TCanvas("ShowRecEffPlots","ShowRecEffPlots",1200,1200);
6291 ShowRecEffPlots->Divide(2,4);
6292 ShowRecEffPlots->cd(1);
6293 NBTeMC_pure->Draw();
6294 ShowRecEffPlots->cd(2);
6295 NBTallMC_purall->Draw();
6296 ShowRecEffPlots->cd(3);
6297 NBTeMC_NBTMC->Draw();
6298 ShowRecEffPlots->cd(4);
6299 NBTeMC_NBT->Draw();
6300 ShowRecEffPlots->cd(5);
6301 NBT_InBTE->Draw();
6302 ShowRecEffPlots->cd(6);
6303 NBTeMC_InBTE->Draw();
6304 ShowRecEffPlots->cd(7);
6305 pure_InBTE->Draw();
6306 ShowRecEffPlots->cd(7);
6307 purall_InBTE->Draw();
6308 TCanvas* ShowRecEffPlots2= new TCanvas("ShowRecEffPlots2","ShowRecEffPlots2",1200,1200);
6309 ShowRecEffPlots2->Divide(2,4);
6310 ShowRecEffPlots2->cd(1);
6311 Hist_NBTeMC_pure->Draw("colz");
6312 ShowRecEffPlots2->cd(2);
6313 Hist_NBTallMC_purall->Draw("colz");
6314 ShowRecEffPlots2->cd(3);
6315 Hist_NBTeMC_NBTMC->Draw("colz");
6316 ShowRecEffPlots2->cd(4);
6317 Hist_NBTeMC_NBT->Draw("colz");
6318 ShowRecEffPlots2->cd(5);
6319 Hist_NBT_InBTE->Draw("colz");
6320 ShowRecEffPlots2->cd(6);
6321 Hist_NBTeMC_InBTE->Draw("colz");
6322 ShowRecEffPlots2->cd(7);
6323 Hist_pure_InBTE->Draw("colz");
6324 ShowRecEffPlots2->cd(8);
6325 Hist_purall_InBTE->Draw("colz");
6326
6327 NBTeMC_pure->Write();
6328 NBTallMC_purall->Write();
6329 NBTeMC_NBTMC->Write();
6330 NBTeMC_NBT->Write();
6331 NBT_InBTE->Write();
6332 NBTeMC_InBTE->Write();
6333 Hist_NBTeMC_pure->Write();
6334 Hist_NBTallMC_purall->Write();
6335 Hist_NBTeMC_NBTMC->Write();
6336 Hist_NBTeMC_NBT->Write();
6337 Hist_NBT_InBTE->Write();
6338 Hist_NBTeMC_InBTE->Write();
6339 Hist_pure_InBTE->Write();
6340 Hist_purall_InBTE->Write();
6341
6342 ShowRecEffPlots->Write();
6343 ShowRecEffPlots2->Write();
6344
6345 STREAM_ShowRecEff.close();
6346 FILE_ShowRecEff->Close();
6347
6348 delete ShowRecEffPlots;
6349 delete ShowRecEffPlots2;
6350 return;
6351}
void InitCutParameters()
Definition: ShowRec.cpp:7546
Int_t cmd_OUTPUTLEVEL
Definition: ShowRec.h:33
ofstream STREAM_ShowRecEff
Definition: ShowRec.h:59
new TCanvas()

◆ Finalize()

void Finalize ( )
498 {
499
500 Log(2, "ShowRec.cpp", "--- void Finalize() ---");
501 cout << "Do some rest of the GSNN Algorithm, to be packed in extrafunction" << endl;
502 cout << "for some later time...." << endl;
504
505}
void Write_Alg_GS_Histograms()
Definition: ShowRec.cpp:7267

◆ FindFollowingBTs()

Bool_t FindFollowingBTs ( EdbSegP s,
EdbSegP InBT,
EdbPVRec local_gAli,
TObjArray *  showersegarray 
)

if (dZ<30) continue; // Exclude the case of same Zpositions...

5164{
5165 Log(4, "ShowRec.cpp", "--- Bool_t FindFollowingBTs() ---");
5166 cout << "WARNING::WARNING Bool_t FindFollowingBTs() ... IS NOT SUPPORTED ANYMORE. RETURN kFALSE now !!!"<<endl;
5167 return kFALSE;
5168
5169 // ATTENTION NEW CUT CONDITION ITRODUCED...
5170 // SIGMA OF DTHETA CUT IS DEPENDING AN DIFERNECE TO INBT PLATE....
5171 // CUT_dtheta=1.5,2.0,2.5*CUT_dtheta_original
5172 int diff_pid=0;
5173 Float_t CUTFACTOR=1.0;
5174 if (TMath::Abs(InBT->PID()-s->PID()) <3) CUTFACTOR=1.0;
5175 if (TMath::Abs(InBT->PID()-s->PID()) >2) CUTFACTOR=1.5;
5176 if (TMath::Abs(InBT->PID()-s->PID()) >5) CUTFACTOR=2.0;
5177 // cout << TMath::Abs(InBT->PID()-s->PID()) << " " << CUTFACTOR << endl;
5178 //NORMAL:
5179 CUTFACTOR=1.0;
5180
5181 EdbSegP* s_TestBT;
5182 EdbSegP* seg;
5183 Int_t nentries=showersegarray->GetEntries();
5184 Double_t dZ;
5185
5186 // For the very first Z position we do not test
5187 // if testBT has Preceeders, only if it it has a BT around (case for e+e- coming from gammma):
5188 // Take 50microns and 80mrad in (dR/dT) around.
5189 // This does not affect the normal results, but helps for
5190 // events which may have a second BT close to InBT (like in e+e-)
5191 if (s->Z()==InBT->Z()) {
5192 //cout << "Test here..."<<endl;
5193 //cout << "GetdeltaTheta(s, InBT)= " << GetdeltaTheta(s, InBT) << endl;
5194 //cout << "GetdeltaRWithPropagation(s, InBT)= " << GetdeltaRWithPropagation(s, InBT) << endl;
5195 if (GetdeltaTheta(s, InBT) < 0.08 && GetdeltaRWithPropagation(s, InBT) < 50.0) {
5196 return kTRUE;
5197 }
5198 //cout << "Test here...done. Not fullfilled condition."<<endl;
5199 }
5200
5201
5202 // it is true to use local_gAli since this is given over in the function head as local_gAli ...
5203 Int_t local_gAli_npat=local_gAli->Npatterns();
5204 //if (gEDBDEBUGLEVEL>2)
5205 // cout << "--- local_gAli_npat= " << local_gAli_npat << endl;
5206
5207 // Loop over all plates of local_gAli, since this is already
5208 // extracted with the right numbers of plates...
5209 for (Int_t patterloop_cnt=local_gAli_npat-1; patterloop_cnt>=0; --patterloop_cnt) {
5210 if (gEDBDEBUGLEVEL>3) cout << "--- --- Doing patterloop_cnt= " << patterloop_cnt << endl;
5211
5212 //cout << local_gAli->GetPattern(patterloop_cnt)->Z() << " " << InBT->Z() << endl;
5213 if (local_gAli->GetPattern(patterloop_cnt)->Z()<InBT->Z()) continue;
5214 if (TMath::Abs(local_gAli->GetPattern(patterloop_cnt)->Z()-s->Z())>4.0*1300.0+50.0) continue;// Exclude the case of more than 4 plates after..
5215
5216 for (Int_t btloop_cnt=0; btloop_cnt<local_gAli->GetPattern(patterloop_cnt)->GetN(); ++btloop_cnt) {
5217 s_TestBT = (EdbSegP*)local_gAli->GetPattern(patterloop_cnt)->GetSegment(btloop_cnt);
5218 if (gEDBDEBUGLEVEL>3) seg->PrintNice();
5219
5220
5221 dZ=TMath::Abs(s_TestBT->Z()-s->Z());
5223 if (dZ<0.1&&TMath::Abs(s_TestBT->X()-s->X())<1.0) continue; // Exclude the case of same Basetracks:
5224 if (dZ>(4*1300.0)+30.0) continue; // Exclude the case of more than 4 plates after...
5225
5226
5227 if (GetdeltaThetaSingleAngles(s, s_TestBT) > CUTFACTOR*CUT_PARAMETER[3] ) continue;
5228 if (GetdeltaRWithPropagation(s, s_TestBT) > CUT_PARAMETER[2]) continue;
5229 return kTRUE;
5230 }
5231
5232 }
5233
5234 //---------------------------------------------
5235 return kFALSE;
5236}
Double_t GetdeltaThetaSingleAngles(EdbSegP *s1, EdbSegP *s2)
Definition: ShowRec.cpp:7258
Double_t GetdeltaRWithPropagation(EdbSegP *s, EdbSegP *stest)
Definition: ShowRec.cpp:7211
Double_t GetdeltaTheta(EdbSegP *s1, EdbSegP *s2)
Definition: ShowRec.cpp:7239
Double_t CUT_PARAMETER[10]
Definition: ShowRec.h:78
Int_t Npatterns() const
Definition: EdbPattern.h:366
EdbPattern * GetPattern(int id) const
Definition: EdbPattern.cxx:1721
void PrintNice() const
Definition: EdbSegP.cxx:392
Int_t PID() const
Definition: EdbSegP.h:148
int nentries
Definition: check_shower.C:40
s
Definition: check_shower.C:55

◆ FindPrecedingBTs()

Bool_t FindPrecedingBTs ( EdbSegP s,
EdbSegP InBT,
EdbPVRec gAli,
TObjArray *  showersegarray 
)
5328{
5329 Log(4, "ShowRec.cpp", "--- Bool_t FindPrecedingBTs() ---");
5330
5331 int diff_pid=0;
5332 Float_t CUTFACTOR=1.0;
5333 if (TMath::Abs(InBT->PID()-s->PID()) <3) CUTFACTOR=1.0;
5334 if (TMath::Abs(InBT->PID()-s->PID()) >2) CUTFACTOR=1.0;
5335 if (TMath::Abs(InBT->PID()-s->PID()) >5) CUTFACTOR=2.0;
5336
5337 EdbSegP* s_TestBT;
5338 Int_t nentries=showersegarray->GetEntries();
5339 Double_t dZ;
5340
5341 // Dont check the BT before the InBT position:
5342 if (s->Z()<InBT->Z()) {
5343 return kFALSE;
5344 }
5345
5346 // For the very first Z position we do not test
5347 // if testBT has Preceeders, only if it it has a BT around (case for e+e- coming from gammma):
5348 // Take 50microns and 80mrad in (dR/dT) around.
5349 // This does not affect the normal results, but helps for
5350 // events which may have a second BT close to InBT (like in e+e-)
5351 if (s->Z()==InBT->Z()) {
5352 //cout << "Test here..."<<endl;
5353 //cout << "GetdeltaTheta(s, InBT)= " << GetdeltaTheta(s, InBT) << endl;
5354 //cout << "GetdeltaRWithPropagation(s, InBT)= " << GetdeltaRWithPropagation(s, InBT) << endl;
5355 if (GetdeltaTheta(s, InBT) < 0.08 && GetdeltaRWithPropagation(s, InBT) < 50.0) {
5356 return kTRUE;
5357 }
5358 //cout << "Test here...done. Not fullfilled condition."<<endl;
5359 }
5360
5361 for (Int_t i=nentries-1; i>=0; --i) {
5362 s_TestBT = (EdbSegP*)( showersegarray->At(i) );
5363
5364 if (gEDBDEBUGLEVEL>3) cout << "--- --- Do "<< s_TestBT->ID() << " " << s_TestBT->PID() << " " << s_TestBT->MCEvt() <<" " << s_TestBT->Z() << endl;
5365
5366 dZ=TMath::Abs(s_TestBT->Z()-s->Z());
5367 if (dZ<30) continue; // Exclude the case of same Zpositions...
5368 if (dZ>(3*1300.0)+30.0) continue; // Exclude the case of more than 4 plates before...
5369
5370 if (gEDBDEBUGLEVEL>3) cout << "--- --- Checking dT,dR and dZ for i: " << i << " " << GetdeltaTheta(s, s_TestBT) << " " << GetdeltaRWithPropagation(s, s_TestBT) << " "<<dZ << endl;
5371
5372 if (GetdeltaTheta(s, s_TestBT) > CUTFACTOR*CUT_PARAMETER[3] ) continue;
5373 if (GetdeltaRWithPropagation(s, s_TestBT) > CUT_PARAMETER[2]) continue;
5374
5375 if (gEDBDEBUGLEVEL>3) cout << "--- --- Checking dT,dR and dZ for i: " << i << " " << GetdeltaTheta(s, s_TestBT) << " " << GetdeltaRWithPropagation(s, s_TestBT) << " "<<dZ << " ok!"<<endl;
5376 return kTRUE;
5377 }
5378 //---------------------------------------------
5379 return kFALSE;
5380}
Int_t ID() const
Definition: EdbSegP.h:147

◆ FindPrecedingBTs_local_gAli()

Bool_t FindPrecedingBTs_local_gAli ( EdbSegP s,
EdbSegP InBT,
EdbPVRec local_gAli,
TObjArray *  showersegarray 
)
5245{
5246 Log(4, "ShowRec.cpp", "--- Bool_t FindPrecedingBTs_local_gAli() ---");
5247
5248 int diff_pid=0;
5249 Float_t CUTFACTOR=1.0;
5250 if (TMath::Abs(InBT->PID()-s->PID()) <3) CUTFACTOR=1.0;
5251 if (TMath::Abs(InBT->PID()-s->PID()) >2) CUTFACTOR=1.0;
5252 if (TMath::Abs(InBT->PID()-s->PID()) >5) CUTFACTOR=2.0;
5253
5254 EdbSegP* s_TestBT;
5255 EdbSegP* seg;
5256 Int_t nentries=showersegarray->GetEntries();
5257 Double_t dZ;
5258
5259
5260 // Dont check the BT before the InBT position:
5261 if (s->Z()<InBT->Z()) {
5262 return kFALSE;
5263 }
5264
5265 // For the very first Z position we do not test
5266 // if testBT has Preceeders, only if it it has a BT around (case for e+e- coming from gammma):
5267 // Take 50microns and 80mrad in (dR/dT) around.
5268 // This does not affect the normal results, but helps for
5269 // events which may have a second BT close to InBT (like in e+e-)
5270 if (s->Z()==InBT->Z()) {
5271 //cout << "Test here..."<<endl;
5272 //cout << "GetdeltaThetaSingleAngles(s, InBT)= " << GetdeltaThetaSingleAngles(s, InBT) << endl;
5273 //cout << "GetdeltaRWithPropagation(s, InBT)= " << GetdeltaRWithPropagation(s, InBT) << endl;
5274 if (GetdeltaThetaSingleAngles(s, InBT) < 0.08 && GetdeltaRWithPropagation(s, InBT) < 50.0) {
5275 return kTRUE;
5276 }
5277 //cout << "Test here...done. Not fullfilled condition."<<endl;
5278 }
5279
5280
5281 // it is true to use local_gAli since this is given over in the function head as local_gAli ...
5282 Int_t local_gAli_npat=local_gAli->Npatterns();
5283 //if (gEDBDEBUGLEVEL>2)
5284 // cout << "--- local_gAli_npat= " << local_gAli_npat << endl;
5285
5286 // Loop over all plates of local_gAli, since this is already
5287 // extracted with the right numbers of plates...
5288 for (Int_t patterloop_cnt=local_gAli_npat-1; patterloop_cnt>=0; --patterloop_cnt) {
5289 if (gEDBDEBUGLEVEL>3) cout << "--- --- Doing patterloop_cnt= " << patterloop_cnt << endl;
5290
5291 //cout << local_gAli->GetPattern(patterloop_cnt)->Z() << " " << InBT->Z() << endl;
5292 if (local_gAli->GetPattern(patterloop_cnt)->Z()<InBT->Z()) continue;
5293 if (TMath::Abs(local_gAli->GetPattern(patterloop_cnt)->Z()-s->Z())>3.0*1300.0+50.0) continue;// Exclude the case of more than 4 plates after/before..
5294
5295 for (Int_t btloop_cnt=0; btloop_cnt<local_gAli->GetPattern(patterloop_cnt)->GetN(); ++btloop_cnt) {
5296 s_TestBT = (EdbSegP*)local_gAli->GetPattern(patterloop_cnt)->GetSegment(btloop_cnt);
5297
5298 dZ=TMath::Abs(s_TestBT->Z()-s->Z());
5299
5300 // test only BTs which have LOWER Z (so they are before)....
5301 if (s_TestBT->Z()-s->Z()>=0) continue;
5302
5303 if (dZ<30) continue; // Exclude the case of same Zpositions...
5304 if (dZ<0.1&&TMath::Abs(s_TestBT->X()-s->X())<1.0) continue; // Exclude the case of same Basetracks:
5305
5306 // but why not search in both directions foreward and afterward ???
5307 if (dZ>(3.0*1300.0+30.0)) continue; // Exclude the case of more than 4 plates after...
5308
5309 if (GetdeltaThetaSingleAngles(s, s_TestBT) > CUTFACTOR*CUT_PARAMETER[3] ) continue;
5310 if (GetdeltaRWithPropagation(s, s_TestBT) > CUT_PARAMETER[2]) continue;
5311 return kTRUE;
5312 }
5313
5314 }
5315
5316 //---------------------------------------------
5317 return kFALSE;
5318}

◆ FindPrecedingBTsSingleThetaAngle()

Bool_t FindPrecedingBTsSingleThetaAngle ( EdbSegP s,
EdbSegP InBT,
EdbPVRec gAli,
TObjArray *  showersegarray 
)

11.06.2010: New including case:

5389{
5390 Log(4, "ShowRec.cpp", "--- Bool_t FindPrecedingBTsSingleThetaAngle() ---");
5391
5392 int diff_pid=0;
5393 Float_t CUTFACTOR=1.0;
5394 if (TMath::Abs(InBT->PID()-s->PID()) <3) CUTFACTOR=1.0;
5395 if (TMath::Abs(InBT->PID()-s->PID()) >2) CUTFACTOR=1.0;
5396
5397 EdbSegP* s_TestBT;
5398 Int_t nentries=showersegarray->GetEntries();
5399 Double_t dZ;
5400
5401 // Dont check the BT before the InBT position:
5402 if (s->Z()<InBT->Z()) {
5403 return kFALSE;
5404 }
5405
5406 // For the very first Z position we do not test
5407 // if testBT has Preceeders, only if it it has a BT around (case for e+e- coming from gammma):
5408 // Take 50microns and 80mrad in (dR/dT) around.
5409 // This does not affect the normal results, but helps for
5410 // events which may have a second BT close to InBT (like in e+e-)
5411 if (s->Z()==InBT->Z()) {
5412 /*
5413 cout << "Bool_t FindPrecedingBTsSingleThetaAngle(EdbSegP* s, EdbSegP* InBT, EdbPVRec *gAli, TObjArray* showersegarray)" << endl;
5414 cout << "Test here... for s ( " << s << " ) and InBT ( " << InBT << " ) :" << endl;
5415 s->PrintNice();
5416 InBT->PrintNice();
5417 cout << "GetdeltaThetaSingleAngles(s, InBT)= " << GetdeltaThetaSingleAngles(s, InBT) << endl;
5418 cout << "GetdeltaRWithPropagation(s, InBT)= " << GetdeltaRWithPropagation(s, InBT) << endl;
5419 */
5420 if (GetdeltaThetaSingleAngles(s, InBT) < 0.08 && GetdeltaRWithPropagation(s, InBT) < 50.0) {
5421 return kTRUE;
5422 }
5423 //cout << "Test here...done. Not fullfilled condition."<<endl;
5424 }
5425
5426
5428 Float_t nmaxholes=3.0;
5429 if (CUT_PARAMETER[4]==3) nmaxholes=3.0;
5430 if (CUT_PARAMETER[4]==5) nmaxholes=5.0;
5431 if (CUT_PARAMETER[4]==9) nmaxholes=9.0;
5432// cout << "DEBUG CUT_PARAMETER[4] = " << CUT_PARAMETER[4] << endl;
5433// cout << "DEBUG nmaxholes = " << nmaxholes << endl;
5434
5435 for (Int_t i=nentries-1; i>=0; --i) {
5436 s_TestBT = (EdbSegP*)( showersegarray->At(i) );
5437
5438 if (gEDBDEBUGLEVEL>3) cout << "--- --- Do "<< s_TestBT->ID() << " " << s_TestBT->PID() << " " << s_TestBT->MCEvt() <<" " << s_TestBT->Z() << endl;
5439
5440 dZ=TMath::Abs(s_TestBT->Z()-s->Z());
5441 if (dZ<30) continue; // Exclude the case of same Zpositions...
5442 if (dZ>(nmaxholes*1300.0)+30.0) continue; // Exclude the case of more than 4 plates before...
5443
5444 if (gEDBDEBUGLEVEL>3) cout << "--- --- Checking dT,dR and dZ for i: " << i << " " << GetdeltaThetaSingleAngles(s, s_TestBT) << " " << GetdeltaRWithPropagation(s, s_TestBT) << " "<<dZ << endl;
5445
5446 if (GetdeltaThetaSingleAngles(s, s_TestBT) > CUTFACTOR*CUT_PARAMETER[3] ) continue;
5447 if (GetdeltaRWithPropagation(s, s_TestBT) > CUT_PARAMETER[2]) continue;
5448
5449 if (gEDBDEBUGLEVEL>3) {
5450 cout << "--- --- Checking dT,dR and dZ for i: " << i << " " << GetdeltaThetaSingleAngles(s, s_TestBT) << " " << GetdeltaRWithPropagation(s, s_TestBT) << " "<<dZ << ". ok! Print segment to check and the shower segment which maches:"<<endl;
5451 s->PrintNice();
5452 s_TestBT->PrintNice();
5453 }
5454 return kTRUE;
5455 }
5456 //---------------------------------------------
5457
5458 return kFALSE;
5459}

◆ FindPrecedingBTsSingleThetaAngleTCDEBUG()

Bool_t FindPrecedingBTsSingleThetaAngleTCDEBUG ( EdbSegP s,
EdbSegP InBT,
EdbPVRec gAli,
TObjArray *  showersegarray 
)
5467{
5468 Log(4, "ShowRec.cpp", "--- Bool_t FindPrecedingBTsSingleThetaAngleTCDEBUG() ---");
5469
5470 Float_t CUTFACTOR=1.0;
5471
5472 EdbSegP* s_TestBT;
5473 Int_t nentries=showersegarray->GetEntries();
5474 Double_t dZ;
5475
5476 // Dont check the BT before the InBT position:
5477 if (s->Z()<InBT->Z()) {
5478 return kFALSE;
5479 }
5480
5481
5482
5483 // For the very first Z position we do not test
5484 // if testBT has Preceeders, only if it it has a BT around (case for e+e- coming from gammma):
5485 // Take 50microns and 80mrad in (dR/dT) around.
5486 // This does not affect the normal results, but helps for
5487 // events which may have a second BT close to InBT (like in e+e-)
5488 if (TMath::Abs(s->Z()-InBT->Z())<5.0) {
5489 //cout << "Test here..."<<endl;
5490 //cout << "GetdeltaThetaSingleAngles(s, InBT)= " << GetdeltaThetaSingleAngles(s, InBT) << endl;
5491 //cout << "GetdeltaRWithPropagation(s, InBT)= " << GetdeltaRWithPropagation(s, InBT) << endl;
5492 if (GetdeltaThetaSingleAngles(s, InBT) < 0.08 && GetdeltaRWithPropagation(s, InBT) < 50.0) {
5493 return kTRUE;
5494 }
5495
5496
5497 //cout << "Test here...done. Not fullfilled condition."<<endl;
5498 }
5499
5500
5501 for (Int_t i=nentries-1; i>=0; --i) {
5502 s_TestBT = (EdbSegP*)( showersegarray->At(i) );
5503
5504 // cout << "--- --- FindPrecedingBTsSingleThetaAngleTCDEBUG Do "<< s_TestBT->ID() << " " << s_TestBT->PID() << " " << s_TestBT->MCEvt() <<" " << s_TestBT->Z() << endl;
5505
5506 dZ=TMath::Abs(s_TestBT->Z()-s->Z());
5507 if (dZ<30) continue; // Exclude the case of same Zpositions...
5508 if (dZ>(3*1300.0)+30.0) continue; // Exclude the case of more than 4 plates before...
5509
5510 Float_t interim_dT=GetdeltaThetaSingleAngles(s, s_TestBT);
5511 Float_t interim_dRProp=GetdeltaRWithPropagation(s, s_TestBT);
5512
5513 // cout << "--- --- FindPrecedingBTsSingleThetaAngleTCDEBUG Checking dT,dR and dZ for i: " << i << " " << interim_dT << " " << interim_dRProp << " "<<dZ << endl;
5514
5515 if (GetdeltaThetaSingleAngles(s, s_TestBT) > CUTFACTOR*CUT_PARAMETER[3] ) continue;
5516 if (GetdeltaRWithPropagation(s, s_TestBT) > CUT_PARAMETER[2]) continue;
5517
5518 // cout << "--- --- Checking dT,dR and dZ: ok!"<<endl;
5519 return kTRUE;
5520 }
5521 //---------------------------------------------
5522
5523 return kFALSE;
5524}

◆ GetConeOrTubeDistanceToBTOfShowerArray()

Bool_t GetConeOrTubeDistanceToBTOfShowerArray ( EdbSegP sa,
EdbSegP InBT,
TObjArray *  showersegarray,
Double_t  CylinderRadius,
Double_t  ConeAngle 
)
5615{
5616
5617 Bool_t isTrueForBT=kFALSE;
5618 Int_t lastI=0;
5619 Double_t factor=1.0;
5620
5621 EdbSegP* s_TestBT;
5622 Int_t nentries=showersegarray->GetEntries();
5623 //cout << "nentries=showersegarray->GetEntries(); " << nentries << endl;
5624
5625 // Now call GetConeOrTubeDistanceToInBT for every BT which was reconstructed up to now in the shower:
5626 for (Int_t i=0; i<nentries; i++) {
5627 s_TestBT = (EdbSegP*)( showersegarray->At(i) );
5628 // Dont check the BT which is before or same Z as the BaseTrack(i) position:
5629 // But ---not--- for the first Basetrack. There we allow it!
5630 //if (s_TestBT->Z()>=sa->Z() && i>0) continue;
5631 if (s_TestBT->Z()>sa->Z() ) continue;
5632
5633 lastI=i;
5634
5635 if (i==0) {
5636 factor=1.0;
5637 }
5638 else {
5639 factor=3.0;
5640 }
5641
5642
5643 if (GetConeOrTubeDistanceToInBT(sa, s_TestBT, factor*CylinderRadius, factor*ConeAngle)==kTRUE) {
5644 isTrueForBT=kTRUE;
5645 break;
5646 }
5647
5648 //if (i>0) cout << "GetConeOrTubeDistanceToBTOfShowerArray:: i="<<i<<endl;
5649
5650 }
5651
5652
5653 if (isTrueForBT) {
5654 //if (lastI>0) cout <<"for i= " << lastI<< " return true with factor "<< factor << endl;
5655 return kTRUE;
5656 }
5657
5658 return kFALSE;
5659}
Bool_t GetConeOrTubeDistanceToInBT(EdbSegP *sa, EdbSegP *InBT, Double_t CylinderRadius, Double_t ConeAngle)
Definition: ShowRec.cpp:6990

◆ GetConeOrTubeDistanceToInBT()

Bool_t GetConeOrTubeDistanceToInBT ( EdbSegP sa,
EdbSegP InBT,
Double_t  CylinderRadius,
Double_t  ConeAngle 
)

Outside if angle greater than ConeAngle (to be fulfilled for Cone and Tube in both cases)

if angle smaller than ConeAngle, then you can differ between Tuberadius and CylinderRadius

5533{
5534 Log(4,"ShowRec.cpp", "--- Bool_t GetConeOrTubeDistanceToInBT() ---");
5535
5536 TVector3 x1(InBT->X(),InBT->Y(),InBT->Z());
5537 TVector3 x2(sa->X(),sa->Y(),sa->Z());
5538 TVector3 direction_x1(InBT->TX()*1300,InBT->TY()*1300,1300);
5539 TVector3 direction_x2(sa->TX()*1300,sa->TY()*1300,1300);
5540 TVector3 u1=x2-x1;
5541
5542 Double_t direction_x1_norm= direction_x1.Mag();
5543 Double_t cosangle= (direction_x1*u1)/(u1.Mag()*direction_x1_norm);
5544 Double_t angle = TMath::ACos(cosangle);
5545 // NO THIS IS NOT THE CONE ANGLE!!
5546
5547 TVector3 direction_1(InBT->TX()*1300,InBT->TY()*1300,1300);
5548 TVector3 direction_2(sa->TX()*1300,sa->TY()*1300,1300);
5549
5550 /*
5551 cout <<"------"<<endl;
5552 cout << "angle = " << angle << endl;
5553 cout << "angle V2 = " << x1.Angle(x2) << endl;
5554 cout << "angle V3 = " << direction_x1.Angle(direction_x2) << endl;
5555 cout << "angle V4 = " << direction_1.Angle(direction_2) << " " << direction_1.Angle(direction_2)/3.14*180.0 << endl;
5556
5557 cout << "angle V5 direction_x1.Angle(u1 = " << direction_x1.Angle(u1) << endl;
5558 cout << "angle V5 u1.Angle(direction_x1 = " << u1.Angle(direction_x1) << endl;
5559 */
5560 angle=u1.Angle(direction_x1);
5561
5562
5563 // For the case where the two basetracks have same z position
5564 // the angle is about 90 degree so it makes no sense to calculate it...
5565 // therefore we set it artificially to zero:
5566 if (TMath::Abs(InBT->Z()-sa->Z())<5.0 ) {
5567 angle=0.0;
5568 //if (gEDBDEBUGLEVEL>3) //cout << "same z position, set angle artificially to zero" << endl;
5569 }
5570
5571 // cout << "--- Bool_t GetConeOrTubeDistanceToInBT() ---"<<endl;
5572 // InBT->PrintNice();
5573 // sa->PrintNice();
5574 // cout << "angle= " << angle << " ConeAngle= " << ConeAngle << endl;
5575
5576
5577 // If this InBT is in z position AFTER the testBT, the cone goes in the other direction and therefore, we have
5578 // to mirror the angle by 180 degree:
5579 if (angle>TMath::Pi()/2.0) {
5580 angle=TMath::Abs(TMath::Pi()-angle);
5581 //cout << "reverse angle: " << angle << endl;
5582 }
5583
5585 if (angle>ConeAngle) {
5586 return kFALSE;
5587 }
5588
5590 Double_t TubeDistance = 1.0/direction_x1_norm * ( (x2-x1).Cross(direction_x1) ).Mag();
5591 // cout << "CylinderRadius= " << CylinderRadius << " TubeDistance= " << TubeDistance << endl;
5592 if (TubeDistance>CylinderRadius) {
5593 return kFALSE;
5594 }
5595
5596 return kTRUE;
5597}

◆ GetdeltaRNoPropagation()

Double_t GetdeltaRNoPropagation ( EdbSegP s,
EdbSegP stest 
)
5772{
5773 Log(4, "ShowRec.cpp", "--- Bool_t GetdeltaRNoPropagation() ---");
5774 return TMath::Sqrt((s->X()-stest->X())*(s->X()-stest->X())+(s->Y()-stest->Y())*(s->Y()-stest->Y()));
5775}

◆ GetdeltaRWithPropagation()

Double_t GetdeltaRWithPropagation ( EdbSegP s,
EdbSegP stest 
)
5754{
5755 Log(4, "ShowRec.cpp", "--- Bool_t GetdeltaRWithPropagation() ---");
5756 // Propagate s to z-position of stest:
5757 Double_t zorig;
5758 Double_t dR;
5759 zorig=s->Z();
5760 s->PropagateTo(stest->Z());
5761 dR=(s->X()-stest->X())*(s->X()-stest->X())+(s->Y()-stest->Y())*(s->Y()-stest->Y());
5762 dR=TMath::Sqrt(dR);
5763 s->PropagateTo(zorig);
5764 return dR;
5765}

◆ GetdeltaTheta()

Double_t GetdeltaTheta ( EdbSegP s1,
EdbSegP s2 
)
5782{
5783 Log(4, "ShowRec.cpp", "--- Bool_t GetdeltaTheta() ---");
5784
5785 Double_t tx1,tx2,ty1,ty2;
5786 tx1=s1->TX();
5787 tx2=s2->TX();
5788 ty1=s1->TY();
5789 ty2=s2->TY();
5790 // Double_t dt= TMath::Sqrt(tx1*tx1+ty1*ty1) - TMath::Sqrt(tx2*tx2+ty2*ty2); // version which was used for all studies up to now...
5791 //Double_t dt= TMath::Sqrt( (tx1-tx2)*(tx1-tx2) + (ty1-ty2)*(ty1-ty2) ); // new version to test... => implemented in GetdeltaThetaSingleAngles
5792 Double_t dt= TMath::Abs(TMath::Sqrt(tx1*tx1+ty1*ty1) - TMath::Sqrt(tx2*tx2+ty2*ty2)); // version which was used for all studies up to now... NOW mit abs()
5793 return dt;
5794}
EdbSegP * s2
Definition: tlg2couples.C:30

◆ GetdeltaThetaSingleAngles()

Double_t GetdeltaThetaSingleAngles ( EdbSegP s1,
EdbSegP s2 
)
5801{
5802 Log(4, "ShowRec.cpp", "--- Bool_t GetdeltaThetaSingleAngles() ---");
5803
5804 Double_t tx1,tx2,ty1,ty2;
5805 tx1=s1->TX();
5806 tx2=s2->TX();
5807 ty1=s1->TY();
5808 ty2=s2->TY();
5809 //Double_t dt= TMath::Sqrt(tx1*tx1+ty1*ty1) - TMath::Sqrt(tx2*tx2+ty2*ty2); // version which was used for all studies up to now...
5810 Double_t dt= TMath::Sqrt( (tx1-tx2)*(tx1-tx2) + (ty1-ty2)*(ty1-ty2) ); // new version to test...
5811 return dt;
5812}

◆ GetEvent_ParasetDefinitionTree()

void GetEvent_ParasetDefinitionTree ( Int_t  nr)
1128{
1129 Log(2, "ShowRec.cpp", "--- void GetEvent_ParasetDefinitionTree( Int_t %d) ---", nr);
1130
1131 // Get the Parameter set definition variables for all the possible algorithms.
1132 // We need to distinguish the parameter values from the TreeDefinition file
1133 // for each algorithm.
1134
1135 // ALTP 1..9: diverse algorithm cut parameter values.
1136 Double_t dr_max,dt_max,coneangle,tubedist;
1137 Int_t nholes_max;
1138 Double_t ann_output;
1139 Int_t ann_inputneurons;
1140 Double_t distMin_max;
1141 Int_t tracksegs_max;
1142 Double_t distMin_dt_max;
1144
1145 // ALTP 10: GS from libShowRec
1146 Double_t cut_gs_cut_dip=150;
1147 Double_t cut_gs_cut_dmin=40;
1148 Double_t cut_gs_cut_dr=60;
1149 Double_t cut_gs_cut_dz=19000;
1150 Double_t cut_gs_cut_dtheta=0.06;
1151 Double_t cut_gs_cut_piddiff=1;
1153
1154 // ALTP 11: N3 Alg
1155 Double_t ANN_OUTPUT;
1156 Int_t ANN_INPUTLEVEL;
1157 Int_t ANN_PLATEN;
1158 Int_t ANN_PLATEDIRECTION;
1159 Int_t ANN_HIDDENLAYER;
1160 Int_t ANN_INPUTNEURONS;
1161
1162
1163 // Reset Cut Paramters, just for safety reasons,
1164 // not to leave them uninitialized!
1165 for (int i=0; i<10; i++ ) {
1166 CUT_PARAMETER[i]=0.0;
1167 }
1168
1169 // If the "nr" equals -1, then there is no given TREE_ParaSetDefinitions
1170 // That means, the default set of values is taken, i.e. entry zero.
1171 // So nr is set to 0:
1172 if (nr==-1) {
1173 nr=0;
1174// TREE_ParaSetDefinitions->GetEntry(nr);
1175 cout << "--- Got TREE_ParaSetDefinitions->GetEntry(0) instead of -1 due to no given PARAMETERSET_DEFINITIONFILE.root file."<<endl;
1176// TREE_ParaSetDefinitions->Show(nr);
1177
1178 }
1179
1180 //TREE_ParaSetDefinitions->Print();
1181
1182 // Switches Statements would be nicer, but anyway.
1183 if (cmd_ALTP==0) {
1184 TREE_ParaSetDefinitions->SetBranchAddress("CUT_ZYLINDER_R_MAX",&tubedist);
1185 TREE_ParaSetDefinitions->SetBranchAddress("CUT_ZYLINDER_ANGLE_MAX",&coneangle);
1186 TREE_ParaSetDefinitions->SetBranchAddress("CUT_SHOWERFOLLOWERBT_DR_MAX",&dr_max);
1187 TREE_ParaSetDefinitions->SetBranchAddress("CUT_SHOWERFOLLOWERBT_DTAN_MAX",&dt_max);
1188
1189 TREE_ParaSetDefinitions->GetEntry(nr);
1190
1191 CUT_PARAMETER[0]=tubedist;
1192 CUT_PARAMETER[1]=coneangle;
1193 CUT_PARAMETER[2]=dr_max;
1194 CUT_PARAMETER[3]=dt_max;
1195 }
1196 else if (cmd_ALTP==1) {
1197 cout << "cmd_ALTP==1 TODO"<<endl;
1198 }
1199 else if (cmd_ALTP==2) {
1200 TREE_ParaSetDefinitions->SetBranchAddress("CUT_ZYLINDER_R_MAX",&tubedist);
1201 TREE_ParaSetDefinitions->SetBranchAddress("CUT_ZYLINDER_ANGLE_MAX",&coneangle);
1202 TREE_ParaSetDefinitions->SetBranchAddress("CUT_SHOWERFOLLOWERBT_DR_MAX",&dr_max);
1203 TREE_ParaSetDefinitions->SetBranchAddress("CUT_SHOWERFOLLOWERBT_DTAN_MAX",&dt_max);
1204
1205 TREE_ParaSetDefinitions->GetEntry(nr);
1206
1207 CUT_PARAMETER[0]=tubedist;
1208 CUT_PARAMETER[1]=coneangle;
1209 CUT_PARAMETER[2]=dr_max;
1210 CUT_PARAMETER[3]=dt_max;
1211 }
1212 else if (cmd_ALTP==3) {
1213 TREE_ParaSetDefinitions->SetBranchAddress("CUT_ANN_OUTPUT",&ann_output);
1214 TREE_ParaSetDefinitions -> SetBranchAddress("CUT_ANN_INPUTNEURONS",&ann_inputneurons);
1215
1216 TREE_ParaSetDefinitions->GetEntry(nr);
1217
1218 CUT_PARAMETER[0]=ann_output;
1219 CUT_PARAMETER[1]=ann_inputneurons;
1220
1221 cout << "TODO"<<endl;
1222 // I DONT KNOW WHY I HAVE THAT WRITTEN, BUT AT SOME POINT MUST HAVE MADE SOME SENSE .....
1223
1224 }
1225 else if (cmd_ALTP==4) {
1226 TREE_ParaSetDefinitions->SetBranchAddress("CUT_ZYLINDER_R_MAX",&tubedist);
1227 TREE_ParaSetDefinitions->SetBranchAddress("CUT_ZYLINDER_ANGLE_MAX",&coneangle);
1228 TREE_ParaSetDefinitions->SetBranchAddress("CUT_SHOWERFOLLOWERBT_DR_MAX",&dr_max);
1229 TREE_ParaSetDefinitions->SetBranchAddress("CUT_SHOWERFOLLOWERBT_DTAN_MAX",&dt_max);
1230 TREE_ParaSetDefinitions->SetBranchAddress("CUT_NHOLES_MAX",&nholes_max);
1231
1232 TREE_ParaSetDefinitions->GetEntry(nr);
1233
1234 CUT_PARAMETER[0]=tubedist;
1235 CUT_PARAMETER[1]=coneangle;
1236 CUT_PARAMETER[2]=dr_max;
1237 CUT_PARAMETER[3]=dt_max;
1238 CUT_PARAMETER[4]=nholes_max;
1239
1240 }
1241 else if (cmd_ALTP==5) {
1242 Double_t CUT_P; // s->P()
1243 Double_t CUT_ALISUBSIZE; // eAli_local_half_size
1244
1245 TREE_ParaSetDefinitions->SetBranchAddress("CUT_P",&CUT_P);
1246 TREE_ParaSetDefinitions->SetBranchAddress("CUT_ALISUBSIZE",&CUT_ALISUBSIZE);
1247
1248 TREE_ParaSetDefinitions->GetEntry(nr);
1249
1252 }
1253 else if (cmd_ALTP==6) {
1254 TREE_ParaSetDefinitions->SetBranchAddress("CUT_ZYLINDER_R_MAX",&tubedist);
1255 TREE_ParaSetDefinitions->SetBranchAddress("CUT_ZYLINDER_ANGLE_MAX",&coneangle);
1256 TREE_ParaSetDefinitions->SetBranchAddress("CUT_SHOWERFOLLOWERBT_DR_MAX",&dr_max);
1257 TREE_ParaSetDefinitions->SetBranchAddress("CUT_SHOWERFOLLOWERBT_DTAN_MAX",&dt_max);
1258 TREE_ParaSetDefinitions->SetBranchAddress("CUT_TRACKATTACH_DISTMIN",&distMin_max);
1259 TREE_ParaSetDefinitions->SetBranchAddress("CUT_TRACKATTACH_DTAN_MAX",&distMin_dt_max);
1260 TREE_ParaSetDefinitions->SetBranchAddress("CUT_TRACKATTACH_NTRACKSEG",&tracksegs_max);
1261
1262 TREE_ParaSetDefinitions->GetEntry(nr);
1263
1264 CUT_PARAMETER[0]=tubedist;
1265 CUT_PARAMETER[1]=coneangle;
1266 CUT_PARAMETER[2]=dr_max;
1267 CUT_PARAMETER[3]=dt_max;
1268 CUT_PARAMETER[4]=distMin_max;
1269 CUT_PARAMETER[5]=distMin_dt_max;
1270 CUT_PARAMETER[6]=tracksegs_max;
1271 }
1272 else if (cmd_ALTP==7||cmd_ALTP==9) {
1273 TREE_ParaSetDefinitions->SetBranchAddress("CUT_ZYLINDER_R_MAX",&tubedist);
1274 TREE_ParaSetDefinitions->SetBranchAddress("CUT_ZYLINDER_ANGLE_MAX",&coneangle);
1275 TREE_ParaSetDefinitions->SetBranchAddress("CUT_SHOWERFOLLOWERBT_DR_MAX",&dr_max);
1276 TREE_ParaSetDefinitions->SetBranchAddress("CUT_SHOWERFOLLOWERBT_DTAN_MAX",&dt_max);
1277
1278 TREE_ParaSetDefinitions->GetEntry(nr);
1279
1280 CUT_PARAMETER[0]=tubedist;
1281 CUT_PARAMETER[1]=coneangle;
1282 CUT_PARAMETER[2]=dr_max;
1283 CUT_PARAMETER[3]=dt_max;
1284 }
1285 else if (cmd_ALTP==8) {
1286 TREE_ParaSetDefinitions->SetBranchAddress("CUT_BACK_DMIN",&cut_back_dmin);
1287 TREE_ParaSetDefinitions->SetBranchAddress("CUT_BACK_DTHETA",&cut_back_dtheta);
1288 TREE_ParaSetDefinitions->SetBranchAddress("CUT_BACK_DR",&cut_back_dr);
1289 TREE_ParaSetDefinitions->SetBranchAddress("CUT_BACK_DZ",&cut_back_dz);
1290 TREE_ParaSetDefinitions->SetBranchAddress("CUT_FOR_DMIN",&cut_for_dmin);
1291 TREE_ParaSetDefinitions->SetBranchAddress("CUT_FOR_DTHETA",&cut_for_dtheta);
1292 TREE_ParaSetDefinitions->SetBranchAddress("CUT_FOR_DR",&cut_for_dr);
1293 TREE_ParaSetDefinitions->SetBranchAddress("CUT_FOR_DZ",&cut_for_dz);
1294
1295 TREE_ParaSetDefinitions->GetEntry(nr);
1296
1305 }
1306 else if (cmd_ALTP==10) {
1314
1315 TREE_ParaSetDefinitions->GetEntry(nr);
1316
1324 }
1325 else if (cmd_ALTP==11) {
1332
1333 TREE_ParaSetDefinitions->GetEntry(nr);
1334
1338 CUT_PARAMETER[3]=N3_ANN_INPUTNEURONS; // not used in input, but anywy set here.
1341 }
1342
1343
1345
1346 cout << "--- CUT_PARAMETER 0 1 2 3: " << CUT_PARAMETER[0] <<" "<<CUT_PARAMETER[1]<<" "<< CUT_PARAMETER[2] <<" "<< CUT_PARAMETER[3] <<endl;
1347 cout << "--- CUT_PARAMETER 4 5 6 7: " << CUT_PARAMETER[4] <<" "<<CUT_PARAMETER[5]<<" "<< CUT_PARAMETER[6]<< " "<< CUT_PARAMETER[7]<<" "<<endl;
1348 return;
1349}
Double_t cut_for_dmin
Definition: CreateParaset_BW_Alg.C:11
Double_t cut_back_dz
Definition: CreateParaset_BW_Alg.C:11
Double_t cut_for_dz
Definition: CreateParaset_BW_Alg.C:11
Double_t cut_back_dmin
Definition: CreateParaset_BW_Alg.C:1
Double_t cut_back_dtheta
Definition: CreateParaset_BW_Alg.C:11
Double_t cut_for_dr
Definition: CreateParaset_BW_Alg.C:11
Double_t cut_for_dtheta
Definition: CreateParaset_BW_Alg.C:11
Double_t cut_back_dr
Definition: CreateParaset_BW_Alg.C:11
Double_t cut_gs_cut_dtheta
Definition: CreateParaset_GS_Alg.C:17
Double_t cut_gs_cut_dip
Definition: CreateParaset_GS_Alg.C:13
Int_t cut_gs_cut_oppositeflag
Definition: CreateParaset_GS_Alg.C:19
Double_t cut_gs_cut_piddiff
Definition: CreateParaset_GS_Alg.C:18
Double_t cut_gs_cut_dr
Definition: CreateParaset_GS_Alg.C:15
Double_t cut_gs_cut_dmin
Definition: CreateParaset_GS_Alg.C:14
Double_t cut_gs_cut_dz
Definition: CreateParaset_GS_Alg.C:16
Int_t ANN_INPUTNEURONS
Definition: CreateParaset_N3_Alg.C:23
Double_t CUT_P
Definition: CreateParaset_SA_Alg.C:1
Double_t CUT_ALISUBSIZE
Definition: CreateParaset_SA_Alg.C:18
Int_t N3_ANN_NHIDDENLAYER
Definition: ShowRec_Alg_N3.h:23
Int_t N3_ANN_INPUTNEURONS
Definition: ShowRec_Alg_N3.h:29
Double_t N3_ANN_OUTPUTTHRESHOLD
Definition: ShowRec_Alg_N3.h:24
Int_t N3_ANN_EQUALIZESGBG
Definition: ShowRec_Alg_N3.h:25
Int_t N3_ANN_PLATE_DELTANMAX
Definition: ShowRec_Alg_N3.h:20
Int_t N3_ANN_NTRAINEPOCHS
Definition: ShowRec_Alg_N3.h:22
TTree * TREE_ParaSetDefinitions
Definition: ShowRec.h:65
t SetBranchAddress("sizeb", &sizeb)

◆ GetMeansBeforeAndAfter()

Int_t GetMeansBeforeAndAfter ( Float_t &  mean_dT,
Float_t &  mean_dR,
EdbPVRec local_gAli,
Int_t  patterloop_cnt,
EdbSegP seg,
Int_t  n_patterns,
Int_t  BeforeOrAfter 
)
5926{
5927 // cout << "GetMeansBeforeAndAfter( XX, " << patterloop_cnt << " , Seg, " << n_patterns << ", " << BeforeOrAfter << endl;
5928 mean_dT=-1;
5929 mean_dR=-1;
5930
5931 float Z_minus1=0;
5932 float Z_normal=local_gAli->GetPattern(patterloop_cnt)->Z();
5933 float Z_plus1=0;
5934
5935 int npat=local_gAli->Npatterns();
5936 Bool_t edge_npat_upper=kFALSE;
5937 Bool_t edge_npat_lower=kFALSE;
5938 Int_t Factor=-1;
5939
5940 if (patterloop_cnt==npat-1) {
5941 edge_npat_upper=kTRUE;
5942 }
5943 if (patterloop_cnt==0) {
5944 edge_npat_lower=kTRUE;
5945 }
5946
5947 if (!edge_npat_lower) {
5948 Z_minus1=local_gAli->GetPattern(patterloop_cnt-1)->Z();
5949 if (Z_minus1<Z_normal) Factor=1;
5950 }
5951 if (!edge_npat_upper) {
5952 Z_plus1 =local_gAli->GetPattern(patterloop_cnt+1)->Z();
5953 if (Z_plus1>Z_normal) Factor=1;
5954 }
5955 // New PID we want to have:
5956 Int_t patterloop_test=patterloop_cnt+Factor*n_patterns*BeforeOrAfter;
5957
5958 // Does this plate exist? If not, return 0 directly:
5959 if (patterloop_test>=npat || patterloop_test<0) {
5960 //cout << "So NEW n_patterns would be " << patterloop_test << " BUT IT DOES NOT MATHC in our local_gAli sceheme, which means its not existing. RETURNING 0 " << endl;
5961 return 0;
5962 }
5963
5964 // Since we have checked now for bounds we can FindCompliments:
5965 Int_t n_return=0;
5966 TObjArray array;
5967 array.Clear();
5968 EdbPattern* TestPattern= (EdbPattern*)local_gAli->GetPattern(patterloop_test);
5969 TestPattern -> FillCell(20,20,0.01,0.01);
5970 n_return = TestPattern->FindCompliments(*seg,array,3,3);
5971 //cout << " Found " << n_return << " compliments in 2,2 sigma area:" << endl;
5972
5973 if (n_return==0) return n_return;
5974
5975 //seg->PrintNice();
5976 for (int i=0; i<n_return; i++) {
5977 EdbSegP* s_of_array=(EdbSegP*)array.At(i);
5978 if (i==0) {
5979 mean_dT=0;
5980 mean_dR=0;
5981 }
5982 //s_of_array->PrintNice();
5983 mean_dT+=GetdeltaThetaSingleAngles(seg,s_of_array);
5984 mean_dR+=GetdeltaRNoPropagation(seg,s_of_array);
5985 }
5986 if (n_return>0) mean_dT=mean_dT/(Double_t)n_return;
5987 if (n_return>0) mean_dR=mean_dR/(Double_t)n_return;
5988
5989 // cout << " mean_dT = " << mean_dT << endl;
5990 // cout << " mean_dR = " << mean_dR << endl;
5991
5992 // „Hab ich mich aus einfachsten Verhältnissen emporgequält, um dann zu bitten?“
5993 return n_return;
5994}
Int_t npat
Definition: Xi2HatStartScript.C:33
Double_t GetdeltaRNoPropagation(EdbSegP *s, EdbSegP *stest)
Definition: ShowRec.cpp:7229
Definition: EdbPattern.h:273
int FindCompliments(EdbSegP &s, TObjArray &arr, float nsig, float nsigt)
Definition: EdbPattern.cxx:1354

◆ GetMinsBeforeAndAfter()

Int_t GetMinsBeforeAndAfter ( Float_t &  min_dT,
Float_t &  min_dR,
EdbPVRec local_gAli,
Int_t  patterloop_cnt,
EdbSegP seg,
Int_t  n_patterns,
Int_t  BeforeOrAfter 
)
5838{
5839 // cout << "GetMinsBeforeAndAfter( XX, " << patterloop_cnt << " , Seg, " << n_patterns << ", " << BeforeOrAfter << endl;
5840 min_dT=-1;
5841 min_dR=-1;
5842
5843 float Z_minus1=0;
5844 float Z_normal=local_gAli->GetPattern(patterloop_cnt)->Z();
5845 float Z_plus1=0;
5846
5847 int npat=local_gAli->Npatterns();
5848 Bool_t edge_npat_upper=kFALSE;
5849 Bool_t edge_npat_lower=kFALSE;
5850 Int_t Factor=-1;
5851
5852 if (patterloop_cnt==npat-1) {
5853 edge_npat_upper=kTRUE;
5854 }
5855 if (patterloop_cnt==0) {
5856 edge_npat_lower=kTRUE;
5857 }
5858
5859 if (!edge_npat_lower) {
5860 Z_minus1=local_gAli->GetPattern(patterloop_cnt-1)->Z();
5861 if (Z_minus1<Z_normal) Factor=1;
5862 }
5863 if (!edge_npat_upper) {
5864 Z_plus1 =local_gAli->GetPattern(patterloop_cnt+1)->Z();
5865 if (Z_plus1>Z_normal) Factor=1;
5866 }
5867 // New PID we want to have:
5868 Int_t patterloop_test=patterloop_cnt+Factor*n_patterns*BeforeOrAfter;
5869
5870 // Does this plate exist? If not, return 0 directly:
5871 if (patterloop_test>=npat || patterloop_test<0) {
5872 //cout << "So NEW n_patterns would be " << patterloop_test << " BUT IT DOES NOT MATHC in our local_gAli sceheme, which means its not existing. RETURNING 0 " << endl;
5873 return 0;
5874 }
5875
5876 // Since we have checked now for bounds we can FindCompliments:
5877 Int_t n_return=0;
5878 TObjArray array;
5879 array.Clear();
5880 EdbPattern* TestPattern= (EdbPattern*)local_gAli->GetPattern(patterloop_test);
5881 TestPattern -> FillCell(20,20,0.01,0.01);
5882 n_return = TestPattern->FindCompliments(*seg,array,3,3);
5883 //cout << " Found " << n_return << " compliments in 2,2 sigma area:" << endl;
5884
5885 if (n_return==0) return n_return;
5886
5887 if (n_return==1) {
5888 EdbSegP* s_of_array=(EdbSegP*)array.At(0);
5889 min_dT=GetdeltaThetaSingleAngles(seg,s_of_array);
5890 min_dR=GetdeltaRNoPropagation(seg,s_of_array);
5891 }
5892
5893
5894 Float_t tmp_min_dT=-1;
5895 Float_t tmp_min_dR=-1;
5896 Float_t tmp2_min_dT=-1;
5897 Float_t tmp2_min_dR=-1;
5898 Float_t angle;
5899 Float_t dist;
5900
5901 if (n_return>1) {
5902 for (int i=0; i<n_return; i++) {
5903 EdbSegP* s_of_array=(EdbSegP*)array.At(i);
5904 if (i==0) {
5905 min_dT=999999;
5906 min_dR=9999999;
5907 }
5908 angle=(Float_t)GetdeltaThetaSingleAngles(seg,s_of_array);
5909 tmp_min_dT=min_dT;
5910 tmp2_min_dT=TMath::Min(angle, tmp_min_dT);
5911 min_dT=tmp2_min_dT;
5912
5913 dist=(Float_t)GetdeltaRNoPropagation(seg,s_of_array);
5914 tmp_min_dR=min_dR;
5915 tmp2_min_dR=TMath::Min(dist, tmp_min_dR);
5916 min_dR=tmp2_min_dR;
5917 }
5918 }
5919 return n_return;
5920}

◆ GetNSegBeforeAndAfter()

Int_t GetNSegBeforeAndAfter ( EdbPVRec local_gAli,
Int_t  patterloop_cnt,
EdbSegP seg,
Int_t  n_patterns,
Int_t  BeforeOrAfter 
)
6005{
6006 // cout << "GetNSegBeforeAndAfter( XX, " << patterloop_cnt << " , Seg, " << n_patterns << ", " << BeforeOrAfter << endl;
6007
6008 float Z_minus1=0;
6009 float Z_normal=local_gAli->GetPattern(patterloop_cnt)->Z();
6010 float Z_plus1=0;
6011
6012 int npat=local_gAli->Npatterns();
6013 Bool_t edge_npat_upper=kFALSE;
6014 Bool_t edge_npat_lower=kFALSE;
6015 Int_t Factor=-1;
6016
6017 if (patterloop_cnt==npat-1) {
6018 edge_npat_upper=kTRUE;
6019 }
6020 if (patterloop_cnt==0) {
6021 edge_npat_lower=kTRUE;
6022 }
6023
6024 if (!edge_npat_lower) {
6025 Z_minus1=local_gAli->GetPattern(patterloop_cnt-1)->Z();
6026 // cout << "WHAT IS GREATER? Z_normal Z_minus1 " << Z_normal << " " << Z_minus1 << endl;
6027 //Factor=(Int_t)TMath::Sign(Z_normal,Z_minus1);
6028 if (Z_minus1<Z_normal) Factor=1;
6029 }
6030 if (!edge_npat_upper) {
6031 Z_plus1 =local_gAli->GetPattern(patterloop_cnt+1)->Z();
6032 // cout << "WHAT IS GREATER? Z_normal Z_plus1 " << Z_normal << " " << Z_plus1 << endl;
6033 if (Z_plus1>Z_normal) Factor=1;
6034 }
6035
6036 // cout << Z_minus1 << endl;
6037 // cout << Z_normal << endl;
6038 // cout << Z_plus1 << endl;
6039 // cout << "Is edge_npat_lower = " << edge_npat_lower << endl;
6040 // cout << "Is edge_npat_upper = " << edge_npat_upper << endl;
6041 // cout << "Factor = " << Factor << endl;
6042
6043 // New PID we want to have:
6044 Int_t patterloop_test=patterloop_cnt+Factor*n_patterns*BeforeOrAfter;
6045 // cout << "So NEW n_patterns would be " << patterloop_test << endl;
6046
6047 // Does this plate exist? If not, return 0 directly:
6048 if (patterloop_test>=npat || patterloop_test<0) {
6049 //cout << "So NEW n_patterns would be " << patterloop_test << " BUT IT DOES NOT MATHC in our local_gAli sceheme, which means its not existing. RETURNING 0 " << endl;
6050 return 0;
6051 }
6052
6053 // Since we have checked now for bounds we can FindCompliments:
6054 TObjArray array;
6055 array.Clear();
6056 EdbPattern* TestPattern= (EdbPattern*)local_gAli->GetPattern(patterloop_test);
6057 TestPattern -> FillCell(20,20,0.01,0.01);
6058 int n_return = TestPattern->FindCompliments(*seg,array,3,3);
6059 //cout << " Found " << n_return << " compliments in 2,2 sigma area:" << endl;
6060
6061 return n_return;
6062}

◆ GetSpatialDist()

Double_t GetSpatialDist ( EdbSegP s1,
EdbSegP s2 
)
5819{
5820 Log(4, "ShowRec.cpp", "--- Bool_t GetSpatialDist() ---");
5821 // Mainly Z values should dominate... since the are at the order of 10k microns and x,y of 1k microns
5822 Double_t x1,x2,y1,y2,z1,z2;
5823 x1=s1->X();
5824 x2=s2->X();
5825 y1=s1->Y();
5826 y2=s2->Y();
5827 z1=s1->Z();
5828 z2=s2->Z();
5829 Double_t dist= TMath::Sqrt( (x1-x2)*(x1-x2) + (y1-y2)*(y1-y2) + (z1-z2)*(z1-z2) );
5830 //cout << "dist = " << dist << endl;
5831 return dist;
5832}

◆ IsShowerSortedZ()

Bool_t IsShowerSortedZ ( TObjArray *  showerarray)
7049 {
7050 // Condition: z[0]<= z[1]<=....<=z[nseg]
7051 if (showerarray->GetEntries()<1) return kTRUE;
7052 EdbSegP* s0;
7053 EdbSegP* s1;
7054 for (int i=0; i<showerarray->GetEntries()-1; i++) {
7055 s0= (EdbSegP*)showerarray->At(i);
7056 s1= (EdbSegP*)showerarray->At(i+1);
7057 if (s0->Z()>s1->Z()) return kFALSE;
7058 }
7059 return kTRUE;
7060}

◆ main()

int main ( int  argc,
char *  argv[] 
)
20{
21 if (argc < 2) {
22 cout << "-----------------------------------------------"<< endl;
23 cout << "--- ShowRec ---" << endl;
24 cout << "--- A programm for running multiple shower reconstruction algorithms ---" << endl;
25 cout << "--- with different parameter settings for finding the optimum ---" << endl;
26 cout << "--- reconstruction set. ---" << endl;
27 cout << "-----------------------------------------------" << endl;
28 cout << "--- Usage: ShowRec -OPTION lnk.def ---" << endl << endl;
29 cout << "--- \t\t : -FP FirstPlate \t (1..57)\n";
30 cout << "--- \t\t\t : -default 1\n";
31 cout << "--- \t\t : -LP LastPlate \t (1..57) \n";
32 cout << "--- \t\t\t : -default 57 or number of plates in volume\n";
33 cout << "--- \t\t : -MP MiddlePlate \t (FP..LP)\n";
34 cout << "--- \t\t\t : -default 57 or number of plates in volume\n";
35 cout << "--- \t\t : -NP Maximal NumberofPlates reconstructed \t (1..57)\n";
36 cout << "--- \t\t\t : -default 57 or number of plates in volume\n";
37
38 cout << "--- \t\t : -LT use LinkedTracks.root for InBT \n";
39 cout << "--- \t\t\t : 0: dont use LinkedTracks.root for InBT\n";
40 cout << "--- \t\t\t : 1: use first basetrack of track\n";
41 cout << "--- \t\t\t : 2: use last basetrack of track\n";
42 cout << "--- \t\t\t : 3: use all basetrack of track\n";
43 cout << "--- \t\t\t : 4: use basetrack in [fp,mp] of track\n";
44 cout << "--- \t\t\t : -default 0\n";
45
46 cout << "--- \t\t : -MC use only SIM/BG events for InBT \n";
47 cout << "--- \t\t\t : 0: SIM+BG (i.e. all BT) \n";
48 cout << "--- \t\t\t : 1: SIM \n";
49 cout << "--- \t\t\t : 2: BG \n";
50 cout << "--- \t\t\t : -default 0\n";
51
52 cout << "--- \t\t : -VTX For InBT: Cut to IP for MC vertex (needs BRICK.TreePGunInfo.txt and -MC=1) \t (0,1:Ipcut:100,2:Ipcut250,3:500)\n";
53 cout << "--- \t\t\t : -default ????????\n";
54
55 cout << "--- \t\t : -HPLZ use specific P() or Z() conditions for MCEvt InBTs \n";
56 cout << "--- \t\t\t : 0: All \n";
57 cout << "--- \t\t\t : 1: Take Highest P() value for each MCEvt \n";
58 cout << "--- \t\t\t : 2: Take Lowest (i.e. lowest) z occurence for each MCEvt \n";
59 cout << "--- \t\t\t : -default 0\n";
60
61 cout << "--- \t\t : -FLMC use only PdgId Flag \t (PdgId)\n";
62 cout << "--- \t\t\t : -default 0\n";
63
64 cout << "--- \t\t : -ALI use gALI either\n";
65 cout << "--- \t\t\t : 0: from directory structured: cp.root files \n";
66 cout << "--- \t\t\t : 1: from a tracked root file : linkedtracks.root file\n";
67 cout << "--- \t\t\t : 2: from a volume root file : ScanVolume_Ali.root\n";
68 cout << "--- \t\t\t : 3: from a written volume file : ScanVolumeLinkedTracks_Ali.root \n";
69 cout << "--- \t\t\t : -default ????????\n";
70
71 cout << "--- \t\t : -MIXMC Extract Subpattern with all MCEvents mixed! --!WARNING!-- \n";
72 cout << "--- \t\t : -EXTHETA Extract Subpattern with Delta Theta Cut on Initiator BT angle. \n";
73 cout << "--- \t\t : -PADI ParentDirectory (only for naming the output file)\n";
74 cout << "--- \t\t : -BTPA BasetrackParametrisation (only for naming the output file)\n";
75 cout << "--- \t\t : -BGTP BackgroundType (only for naming the output file)\n";
76
77 cout << "--- \t\t : -ALTP AlgorithmType \n";
78 cout << "--- \t\t\t : 0: ReconstructShowers_CT ().. \n";
79 cout << "--- \t\t\t : 1: ReconstructShowers_CL (NOT USED ANYMORE, EXPERIMENTAL)\n";
80 cout << "--- \t\t\t : 2: ReconstructShowers_CA \n";
81 cout << "--- \t\t\t : 3: ReconstructShowers_NN \n";
82 cout << "--- \t\t\t : 4: ReconstructShowers_OI BEST WORKING ALGORITHM CURRENTLY\n";
83 cout << "--- \t\t\t : 5: ReconstructShowers_SA (take all MC Events only)\n";
84 cout << "--- \t\t\t : 6: ReconstructShowers_TC \n";
85 cout << "--- \t\t\t : 7: ReconstructShowers_RC \n";
86 cout << "--- \t\t\t : 8: ReconstructShowers_BW (EXPERIMENTAL, BEST PARAMETERS STILL TO BE SEARCHED)\n";
87 cout << "--- \t\t\t : 9: ReconstructShowers_AG (EXPERIMENTAL, BEST PARAMETERS STILL TO BE SEARCHED)\n";
88 cout << "--- \t\t\t : 10: ReconstructShowers_GS (same Implementation as in libShowRec----- BEST PARAMETERS STILL TO BE SEARCHED)\n";
89 cout << "--- \t\t\t : 11: ReconstructShowers_N3 REWRITING OF THE IMPLEMENTATION OF NN ALG - with some modifications.\n";
90 cout << "--- \t\t\t\t : -ALN3TRAIN1 Do Training of the Neural Net (default: 0, run)\n";
91 cout << "--- \t\t\t\t : -ALN3DUMP1 Write also TrainingsTrees in the Neural Net Root Info File (default: 0)\n";
92 cout << "--- \t\t\t\t : -ALN3EQUALIZE1 Try to have same number of SG/BG tracks for training (default: 1, yes)\n";
93 cout << "--- \t\t\t : -default 4\n";
94
95
96 cout << "--- \t\t : -PASTART ParametersetStart \n";
97 cout << "--- \t\t : -PAEND ParameterSetEnd \n";
98
99 cout << "--- \t\t : -CUTTP Algorithm CutType \n";
100 cout << "--- \t\t\t : 0: standard \n";
101 cout << "--- \t\t\t : 1: high purity \n";
102 cout << "--- \t\t\t : 2: high efficiency \n";
103 cout << "--- \t\t\t : 3: FJ_highPurity \n";
104 cout << "--- \t\t\t : 4: FJ_Standard \n";
105 cout << "--- \t\t\t : -default ????????\n";
106
107 cout << "--- \t\t : -CLEAN InputData BG Cleaning: 0: No, 1:20BT/mm2 2: 40BT/mm2 3:10BT/mm2 4:60BT/mm2 \n";
108 cout << "--- \t\t\t : -default ????????\n";
109 cout << "--- \t\t\t : ATTENTION ... NOT FULLY FUNCTIONING YET ... TO BE CHECK WITH\n";
110 cout << "--- \t\t\t : THE BG-CELANING IMPLEMENTATION IN LIBSHOWREC\n";
111
112 cout << "--- \t\t : InputData BG Cleaning: 10: Remove DoubleBT and Passing, No dens cut, 11: &&10BT/mm2 12: &&20BT/mm2 13: &&30BT/mm2 ... \n";
113 cout << "--- \t\t\t : -default ????????\n";
114 cout << "--- \t\t\t : ATTENTION ... NOT FULLY FUNCTIONING YET ... TO BE CHECK WITH\n";
115 cout << "--- \t\t\t : THE BG-CELANING IMPLEMENTATION IN LIBSHOWREC\n";
116
117 cout << "--- \t\t : -FILETP Filetype: Additional (distinguish-) variable to be written into treebranch. (only for naming the output tree)\n";
118 cout << "--- \t\t\t : -default ????????\n";
119 cout << "--- \t\t : -GBMC Global MC: addition variable to tell the program which MCEvt is doing (if only one is done).\n";
120 cout << "--- \t\t\t : -default ????????\n";
121 cout << "--- \t\t : -DEBUG gEDBDEBUGLEVEL \t (1..5)\n";
122 cout << "--- \t\t\t : -default 2\n";
123 cout << "--- \t\t : -OUT OUTPUTLEVEL \t (1,2,3)\n";
124 cout << "--- \t\t\t : -default 1\n";
125 cout << "--- \t\t : -STOP STOPLEVEL \t (0,1,2,3,4,5)\n";
126 cout << "--- \t\t\t : 0: Run until end of program \n";
127 cout << "--- \t\t\t : 1: Run until Read_ParasetDefinitionTree().\n";
128 cout << "--- \t\t\t : 2: Run until Do Background cleaning of input.\n";
129 cout << "--- \t\t\t : 3: Run until Fill the Initiator BT array.\n";
130 cout << "--- \t\t\t : 4: Run until Reconstruct showers is done.\n";
131 cout << "--- \t\t\t : 5: Run until Fill output structures.\n";
132 cout << "--- \t\t\t : -default 0\n";
133
134 cout << "--- \t\t : -LIST-PRESET \n";
135 cout << "--- \t\t\t : List built-in preset options. Most usage cases will be covered here. \n";
136
137 cout << "--- \t\t : -PRESET Number \t (0,1,2,3)\n";
138 cout << "--- \t\t\t : Details of switches: see option -LIST-PRESET \n";
139 cout << "--- \t\t\t : 0: Use all BTs of volume for InBT. Loooooong running time! (data driven reco)\n";
140 cout << "--- \t\t\t : 1: Use highest P() MCEvt BTs of whole volume for InBT.! (mc driven reco) \n";
141 cout << "--- \t\t\t : 2: Use all BTs linked_tracks.root file for InBT. (data driven reco) \n";
142 cout << "--- \t\t\t : 3: Use all BTs with IP to list of vertices for InBT. Possibly shortest running time. \n";
143 cout << "--- \t\t\t : -default 0\n";
144
145
146
147
148 cout << "--- Example usages: " << endl;
149
150 cout << "--- Reconstruct all possible showers for all possible Initiator Basetracks in the whole volume -- looooong runnning time!: ShowRec lnk_all.def" << endl<< endl;
151
152 cout << "--- Reconstruct all possible showers for the highest P()- MC Initiator Basetrack, given a ready ali.root file: ShowRec -HPLZ1 -MC1 -ALI2 " << endl<< endl;
153
154
155 cout << "--- Reconstruct all possible showers for the highest P()- MC Initiator Basetrack, given a linked tracks file for starting basetracks: ShowRec -LT1 -MC1 lnk_all.def " << endl<< endl;
156
157 cout << "--- Usage: ShowRec -FP1 -LP31 -MP1 -NP30 -HPLZ1 -MC1 -ALTP4 -PASTART0 -PAEND0 lnk.def ---" << endl<< endl;
158 cout << "--- Usage: ShowRec -FP1 -LP31 -MP30 -NP30 -HPLZ1 -MC1 -ALTP4 lnk_all.def ---" << endl<< endl;
159 cout << "--- Usage: ShowRec -HPLZ1 -MC1 lnk_all.def ---" << endl<< endl;
160 cout << "--- Usage: ShowRec -LT1 -MC1 lnk_all.def ---" << endl<< endl;
161 cout << "-----------------------------------------------"<<endl;
162 return 0;
163 }
164
165 //----------------------------------------------------------------------------------
167 //----------------------------------------------------------------------------------
168
169
170 //----------------------------------------------------------------------------------
171 //-C- Take over values from the command line:
172 //-C- wARNING !!!
173 // TWO OPTIONS ARE NOT ALLOWED TO HAVE THE SAME CHARACTER CODE, otherwise complications
174 // will appear: so -MC and -MCMIX WILL NOT WORK!! use -MC and -MIXMC
175 //-C- wARNING !!!
176 //-C- ATTENTION FIXME
177 //-C- If the volume has not 57 plates than WE HAVE TO READAPT THE DEFAULT VALUES !!!
178 //-C- wARNING !!!
179 //----------------------------------------------------------------------------------
180
181 Bool_t IsSet_cmd_PRESET=kFALSE;
182
183 char *name = argv[argc];
184 for (int i=1; i<argc; ++i ) {
185 char *key = argv[i];
186
187 // ------------------------------
188 // Option Types "HELP" and "-LIST-PRESET"
189 // automatically stop program after displaying
190 // information
191
192 if (!strncmp(key,"-HELP",5)) {
193 if (strlen(key)>5) {
194 sscanf(key+5,"%d",&cmd_HELP);
195 }
196 PrintHelp();
197 return 0;
198 }
199 if (!strncmp(key,"-LIST-PRESET",12)) {
200 if (strlen(key)>12) {
201 sscanf(key+12,"%d",&cmd_PRESET);
202 }
204 return 0;
205 }
206 // ------------------------------
207 // These three value options have to be read in any case,
208 // independently from any other option key.
209 else if (!strncmp(key,"-DEBUG",6)) {
210 if (strlen(key)>6) {
211 sscanf(key+6,"%d",&cmd_gEDBDEBUGLEVEL);
212 }
213 }
214 else if (!strncmp(key,"-OUT",4)) {
215 if (strlen(key)>4) {
216 sscanf(key+4,"%d",&cmd_OUTPUTLEVEL);
217 }
218 }
219 else if (!strncmp(key,"-STOP",5)) {
220 if (strlen(key)>5) {
221 sscanf(key+5,"%d",&cmd_STOPLEVEL);
222 }
223 }
224 // ------------------------------
225
226 if (!strncmp(key,"-PRESET",7)) {
227 if (strlen(key)>7) {
228 sscanf(key+7,"%d",&cmd_PRESET);
229 }
230 // If PRESET value was given then take only the given values for this
231 // preset scenario. Dont read any other given option values anymore.
232 // Skip directly out of this loop!
233 cout <<" If PRESET value was given then take only the given values for this preset scenario. Dont read any other given option values anymore. Skip directly out of this loop! "<< endl;
234 //
236 IsSet_cmd_PRESET=kTRUE;
237 }
238
239 if (IsSet_cmd_PRESET == kTRUE ) continue;
240
241
242 if (!strncmp(key,"-FP",3)) {
243 if (strlen(key)>3) {
244 sscanf(key+3,"%d",&cmd_FP);
245 }
246 }
247 else if (!strncmp(key,"-LP",3)) {
248 if (strlen(key)>3) {
249 sscanf(key+3,"%d",&cmd_LP);
250 }
251 }
252 else if (!strncmp(key,"-NP",3)) {
253 if (strlen(key)>3) {
254 sscanf(key+3,"%d",&cmd_NP);
255 }
256 }
257 else if (!strncmp(key,"-MP",3)) {
258 if (strlen(key)>3) {
259 sscanf(key+3,"%d",&cmd_MP);
260 }
261 }
262 else if (!strncmp(key,"-PADI",5)) {
263 if (strlen(key)>5) {
264 sscanf(key+5,"%d",&cmd_PADI);
265 }
266 }
267 else if (!strncmp(key,"-BTPA",5)) {
268 if (strlen(key)>5) {
269 sscanf(key+5,"%d",&cmd_BTPA);
270 }
271 }
272 else if (!strncmp(key,"-BGTP",5)) {
273 if (strlen(key)>5) {
274 sscanf(key+5,"%d",&cmd_BGTP);
275 }
276 }
277 else if (!strncmp(key,"-ALTP",5)) {
278 if (strlen(key)>5) {
279 sscanf(key+5,"%d",&cmd_ALTP);
280 }
281 }
282 else if (!strncmp(key,"-ALN3TRAIN",10)) {
283 if (strlen(key)>10) {
284 sscanf(key+10,"%d",&cmd_ALN3TRAIN);
285 }
286 }
287 else if (!strncmp(key,"-ALN3DUMP",9)) {
288 if (strlen(key)>9) {
289 sscanf(key+9,"%d",&cmd_ALN3DUMP);
290 }
291 }
292 else if (!strncmp(key,"-PASTART",8)) {
293 if (strlen(key)>8) {
294 sscanf(key+8,"%d",&cmd_PASTART);
295 }
296 }
297 else if (!strncmp(key,"-PAEND",6)) {
298 if (strlen(key)>6) {
299 sscanf(key+6,"%d",&cmd_PAEND);
300 }
301 }
302 else if (!strncmp(key,"-CUTTP",6)) {
303 if (strlen(key)>6) {
304 sscanf(key+6,"%d",&cmd_CUTTP);
305 }
306 }
307 else if (!strncmp(key,"-CLEAN",6)) {
308 if (strlen(key)>6) {
309 sscanf(key+6,"%d",&cmd_CLEAN);
310 }
311 }
312 else if (!strncmp(key,"-LT",3)) {
313 if (strlen(key)>3) {
314 sscanf(key+3,"%d",&cmd_LT);
315 }
316 }
317 else if (!strncmp(key,"-MC",3)) {
318 if (strlen(key)>3) {
319 sscanf(key+3,"%d",&cmd_MC);
320 }
321 }
322 else if (!strncmp(key,"-FLMC",5)) {
323 if (strlen(key)>5) {
324 sscanf(key+5,"%d",&cmd_MCFL);
325 }
326 }
327 else if (!strncmp(key,"-HPLZ",5)) {
328 if (strlen(key)>5) {
329 sscanf(key+5,"%d",&cmd_HPLZ);
330 }
331 }
332 else if (!strncmp(key,"-ALI",4)) {
333 if (strlen(key)>4) {
334 sscanf(key+4,"%d",&cmd_ALI);
335 }
336 }
337 else if (!strncmp(key,"-MIXMC",6)) {
338 if (strlen(key)>6) {
339 sscanf(key+6,"%d",&cmd_MCMIX);
340 }
341 }
342 else if (!strncmp(key,"-EXTHETA",8)) {
343 if (strlen(key)>8) {
344 sscanf(key+8,"%d",&cmd_EXTHETA);
345 }
346 }
347 else if (!strncmp(key,"-VTX",4)) {
348 if (strlen(key)>4) {
349 sscanf(key+4,"%d",&cmd_vtx);
350 }
351 }
352
353 else if (!strncmp(key,"-FILETP",7)) {
354 if (strlen(key)>7) {
355 sscanf(key+7,"%d",&cmd_FILETP);
356 }
357 }
358 else if (!strncmp(key,"-GBMC",5)) {
359 if (strlen(key)>5) {
360 sscanf(key+5,"%d",&cmd_GBMC);
361 }
362 }
363 }
365
366
367 //----------------------------------------------------------------------------------
368 // ReadDefaultValues_CommandLine(); // sorry, doesnt work, because argv and argc need
369 // to be called in the main function loop....
370 // Just used to print the values...
371 // PrintValues_CommandLine();
372 //----------------------------------------------------------------------------------
373
374
375 //----------------------------------------------------------------------------------
377 //----------------------------------------------------------------------------------
378
379
380 //----------------------------------------------------------------------------------
381 // Read the data Objects
382 // This step needs to come at the very beginning, since the data object
383 // itsselfs determines some reconstruction parameters, like FP, MP and LP.
386 //--------------------------
387 // I checked, this is not necessary, since PID is set new when Reading EdbVRec object.
389 //--------------------------
390 // Since the GLOBAL_gAli is now known, one has to check if First-,Middle- and Lastplate
391 // are correctly set. If not, set them to the default values of that GLOBAL_gAli.
393 //----------------------------------------------------------------------------------
394
395
396
397 //----------------------------------------------------------------------------------
399 //----------------------------------------------------------------------------------
400
401
402
403 //----------------------------------------------------------------------------------
404 // Open ParameterSet definition file if it is there.
405 // Otherwise set back default Parameterset values
408 cout << "Reached STOPLEVEL 1" << endl;
409 if (cmd_STOPLEVEL==1) return 1;
410 //----------------------------------------------------------------------------------
411
412
413 //----------------------------------------------------------------------------------
414 // Create Root Files, Trees and Histograms for further processing
416 //----------------------------------------------------------------------------------
417
418
419
420
421
422 //----------------------------------------------------------------------------------
423 // Do Background Data Cleaning with the Clean algorithms..
424 // ATTENTION: This is yet to be modified, depending on the cleaning algorithm!
425 cout << "ATTENTION: Do Background Data Cleaning IS STILL TO BE MODIFIED " << endl;
426 cout << "ATTENTION: DO NOT USE FOR NOW UNLESS ALGO IS FINISHED. " << endl;
428 cout << "Reached STOPLEVEL 2" << endl;
429 if (cmd_STOPLEVEL==2) return 1;
430 //----------------------------------------------------------------------------------
431
432
433 //----------------------------------------------------------------------------------
434 // Fill the Initiator BT array:
435 // FillGlobalInBTArray();
436 cout << "// FillGlobalInBTArray();" << endl;
437 cout << "instead" << endl;
438 cout << "FillGlobalInBTArrayNEW();" << endl;
439 // NEW VARIANT 2018 06 22:
440 // Use the refactored fill function, which might be
441 // better written code (more clearly)
443 // Add additional MC-Event info for vertex filling:
444 BuildParametrizationsMCInfo_PGun("BRICK.TreePGunInfo.txt");
446 cout << "Fill the Initiator BT array:GLOBAL_InBTArray->GetEntries()= " << GLOBAL_InBTArray->GetEntries() << endl;
447 cout << "Reached STOPLEVEL 3" << endl;
448 if (cmd_STOPLEVEL==3) return 1;
449 //----------------------------------------------------------------------------------
450
451
452
453
454
455 //----------------------------------------------------------------------------------
456 // Loop over (possible) Parametersets and Reconstruct Showers!
457 //----------------------------------------------------------------------------------
459 for (Int_t i=cmd_PASTART; i<=cmd_PAEND; i++) {
461 if (gEDBDEBUGLEVEL>2) cout << "Doing PARASET "<< i <<endl;
462
464 if (gEDBDEBUGLEVEL>2) cout << "GetEvent_ParasetDefinitionTree("<<i<<") done."<<endl;
465
467 if (gEDBDEBUGLEVEL>2) cout << "ReconstructShowers("<<i<<") done."<<endl;
468 }
469 cout << "Reached STOPLEVEL 4" << endl;
470 if (cmd_STOPLEVEL==4) return 1;
471 //----------------------------------------------------------------------------------
472
473
474
475 //----------------------------------------------------------------------------------
476 // Done with all reconstruction, fill files now:
477 cout << "Done with all reconstruction, fill files now:" << endl;
479 cout << "Reached STOPLEVEL 5" << endl;
480 if (cmd_STOPLEVEL==5) return 1;
481 //----------------------------------------------------------------------------------
482
483
484
485
486 //----------------------------------------------------------------------------------
487 cout << "Closing files, destructing elements and cleaning up orphaned stuff:" << endl;
488 Finalize();
489 //----------------------------------------------------------------------------------
490
491 cout << "Reached STOPLEVEL 0" << endl;
492 cout << "ShowRec finished." << endl;
493 return 0;
494}
void FillOutPutStructures()
Definition: ShowRec.cpp:7682
void CheckInputParameters()
Definition: ShowRec.cpp:8376
void GetEvent_ParasetDefinitionTree(Int_t nr)
Definition: ShowRec.cpp:1440
void SetDefaultValues_CommandLine()
Definition: ShowRec.cpp:380
Int_t Open_ParasetDefinitionFile()
Definition: ShowRec.cpp:619
void Read_ParasetDefinitionTree()
Definition: ShowRec.cpp:636
EdbPVRec * ReadEdbPVRecObjectFromCurrentDirectory()
Definition: ShowRec.cpp:539
void ReconstructShowers(Int_t nr)
Definition: ShowRec.cpp:1693
void BuildParametrizationsMCInfo_PGun(TString MCInfoFilename)
Definition: ShowRec.cpp:8904
void Fill2GlobalInBTArray()
Definition: ShowRec.cpp:8986
void RewriteSegmentPIDs_BGPID_To_SGPID(EdbPVRec *gAli)
Definition: ShowRec.cpp:6149
void CreateOutPutStructures()
Definition: ShowRec.cpp:448
Int_t cmd_gEDBDEBUGLEVEL
Definition: ShowRec.h:32
Int_t cmd_CUTTP
Definition: ShowRec.h:14
Int_t cmd_MCFL
Definition: ShowRec.h:21
Int_t cmd_FILETP
Definition: ShowRec.h:27
Int_t cmd_MCMIX
Definition: ShowRec.h:24
Int_t cmd_ALI
Definition: ShowRec.h:23
Int_t cmd_STOPLEVEL
Definition: ShowRec.h:34
Int_t cmd_EXTHETA
Definition: ShowRec.h:29
void Finalize()
Definition: ShowRec.cpp:498
void SetPresetParameters(Int_t cmd_PRESET)
Definition: ShowRec.cpp:7337
void DoBGTargetCleaning()
Definition: ShowRec.cpp:7288
Int_t cmd_ALN3DUMP
Definition: ShowRec.h:35
void PrintValues_CommandLine()
Definition: ShowRecHelper.cpp:21
Int_t cmd_ALN3TRAIN
Definition: ShowRec.h:34
void PrintPresetList()
Definition: ShowRecHelper.cpp:11
Int_t cmd_HELP
Definition: ShowRec.h:8
void PrintHelp()
Definition: ShowRecHelper.cpp:3
void FillGlobalInBTArrayNEW()
Definition: ShowRec_InBTFilling.cpp:3
Int_t cmd_PRESET
Definition: ShowRec.h:10
void CheckInputParametersNEW()
Definition: ShowRecHelper.cpp:138
const char * name
Definition: merge_Energy_SytematicSources_Electron.C:24

◆ MakeTracksTree()

void MakeTracksTree ( TTree *  treebranch)
6737{
6738 if (cmd_OUTPUTLEVEL<2) return;
6739
6740 Log(2, "ShowRec.cpp", "--- void MakeTracksTree() ---");
6741 if (gEDBDEBUGLEVEL>3) cout <<"--- --- MakeTracksTree Part 2:"<<endl;
6742
6743 // cout << treebranch->GetName() << " treebranch->GetName(); " << endl;
6744
6745 EdbSegP *seg;
6746 EdbTrackP *track2;
6747 EdbPVRec *ali;
6748 ali = new EdbPVRec();
6749 EdbPattern *pat=0;
6750 char fname_e[128];
6751 float x,y,tx,ty,z;
6752 int w2;
6753
6754 for (int i=0; i<treebranch->GetEntries(); ++i) {
6755 treebranch->GetEntry(i);
6756 track2 = new EdbTrackP();
6757
6758 for (int j=0; j<shower_sizeb; ++j) {
6759
6760 x=shower_xb[j];
6761 y=shower_yb[j];
6762 tx=shower_txb[j];
6763 ty=shower_tyb[j];
6764 z=shower_zb[j];
6765 w2=shower_ntrace2simub[j];
6766
6767 seg = new EdbSegP();
6768 seg->Set(j, x, y, tx, ty, w2, 0);
6769 seg->SetZ(z);
6770 seg->SetDZ(300.);
6771 // DISPLAY PROBLEM IF RIGHT PID IS USED !!!!!!!!!!!!!!
6772 pat = ali->GetPattern( seg->PID() );
6773 if (!pat) {
6774 printf("WARNING: no pattern with pid %d: creating new one!\n",seg->PID());
6775 pat = new EdbPattern( 0., 0., seg->Z() );
6776 //pat->SetID(seg->PID());
6777 ali->AddPatternAt(pat,seg->PID());
6778 ali->AddPatternAt(pat,j);
6779 }
6780 pat->AddSegment(*seg);
6781 track2->AddSegment(seg);
6782 }
6783 track2->SetSegmentsTrack(i);
6784 track2->SetID(i);
6785 track2->SetNpl(shower_nfilmb[shower_sizeb-1]);
6786 track2->SetProb(1.);
6787 track2->SetFlag(10);
6788 track2->FitTrack();
6789 ali->AddTrack(track2);
6790
6791 // cout << "i = delete track2"<< i << endl;
6792 // delete track2;track2=0;
6793 }
6794 if (gEDBDEBUGLEVEL>3) ali->Print();
6795
6796 // if (gEDBDEBUGLEVEL>3)
6797 // cout <<"--- --- MakeTracksTree Part 2:"<<endl;
6798
6799 if (!ali) return;
6800 TObjArray *trarr = ali->eTracks;
6801 if (!trarr) return;
6802 float xv;
6803 xv=ali->X();
6804 float yv;
6805 yv=ali->Y();
6806
6807 // if (gEDBDEBUGLEVEL>2)
6808 // cout <<"--- Write tracks to file: " << FILE_ShowTracks->GetName() <<endl;
6809
6810 TString tracksname="tracks"+TString(treebranch->GetName());
6811
6812 FILE_ShowTracks->cd();
6813 // TFile::Open(FILE_ShowTracks->GetName(),"UPDATE");
6814 TTree *tracks= new TTree(tracksname,tracksname);
6815 tracks->SetDirectory(FILE_ShowTracks);
6816 if (gEDBDEBUGLEVEL>2) cout <<"--- tracks->SetDirectory(FILE_ShowTracks)"<<endl;
6817
6818
6819 EdbTrackP *track = new EdbTrackP(8);
6820 EdbSegP *tr = (EdbSegP*)track;
6821 TClonesArray *segments = new TClonesArray("EdbSegP");
6822 TClonesArray *segmentsf = new TClonesArray("EdbSegP");
6823
6824 int nseg,trid,npl,n0;
6825 float w=0.;
6826
6827 tracks->Branch("trid",&trid,"trid/I");
6828 tracks->Branch("nseg",&nseg,"nseg/I");
6829 tracks->Branch("npl",&npl,"npl/I");
6830 tracks->Branch("n0",&n0,"n0/I");
6831 tracks->Branch("xv",&xv,"xv/F");
6832 tracks->Branch("yv",&yv,"yv/F");
6833 tracks->Branch("w",&w,"w/F");
6834 tracks->Branch("t.","EdbSegP",&tr,32000,99);
6835 tracks->Branch("s", &segments);
6836 //fitted segments is kept for linked_track.root compability
6837 tracks->Branch("sf",&segmentsf);
6838
6839 int ntr = trarr->GetEntriesFast();
6840
6841 if (gEDBDEBUGLEVEL>2) cout <<"--- ntr = trarr->GetEntriesFast(); " << ntr << " " << trarr->GetEntries() << endl;
6842
6843 for (int itr=0; itr<ntr; itr++) {
6844 track = (EdbTrackP*)(trarr->At(itr));
6845 trid = track->ID();
6846 nseg = track->N();
6847 npl = track->Npl();
6848 n0 = track->N0();
6849 tr = (EdbSegP*)track;
6850 segments->Clear("C");
6851 nseg = track->N();
6852 w = track->Wgrains();
6853 EdbSegP *s=0,*sf=0;
6854 for (int is=0; is<nseg; is++) {
6855 s = track->GetSegment(is);
6856 if (s) new((*segments)[is]) EdbSegP( *s );
6857 sf = track->GetSegment(is);
6858 if (sf) new((*segmentsf)[is]) EdbSegP( *sf );
6859 }
6860 track->SetVid( 0, tracks->GetEntries() ); // put track counter in t.eVid[1]
6861 tracks->Fill();
6862 track->Clear();
6863 }
6864 tracks->Write();
6865
6866
6867
6868 return;
6869}
TTree * tr
Definition: Shower_E_FromShowerRoot.C:5
TObjArray * eTracks
Definition: EdbPVRec.h:161
void AddTrack(EdbTrackP *track)
Definition: EdbPVRec.h:246
Float_t Y() const
Definition: EdbPattern.h:364
void AddPatternAt(EdbPattern *pat, int id)
Definition: EdbPattern.cxx:1713
Float_t X() const
Definition: EdbPattern.h:363
void SetProb(float prob)
Definition: EdbSegP.h:134
void SetID(int id)
Definition: EdbSegP.h:128
void SetZ(float z)
Definition: EdbSegP.h:125
void SetDZ(float dz)
Definition: EdbSegP.h:126
void SetFlag(int flag)
Definition: EdbSegP.h:130
void Set(int id, float x, float y, float tx, float ty, float w, int flag)
Definition: EdbSegP.h:87
EdbSegP * AddSegment(int i, EdbSegP &s)
Definition: EdbPattern.cxx:72
Definition: EdbPattern.h:113
void AddSegment(EdbSegP *s)
Definition: EdbPattern.h:214
void SetNpl(int npl)
Definition: EdbPattern.h:168
int SetSegmentsTrack(int id)
Definition: EdbPattern.h:246
void FitTrack()
Definition: EdbPattern.cxx:696
Definition: bitview.h:14
TTree * tracks
Definition: check_tr.C:19
EdbPVRec * ali
Definition: test_oracle.C:9
void w(int rid=2, int nviews=2)
Definition: test.C:27

◆ Open_ParasetDefinitionFile()

Int_t Open_ParasetDefinitionFile ( )
742{
743 Log(2, "ShowRec.cpp", "--- Int_t Open_ParasetDefinitionFile() ---");
744
745 FILE_ParaSetDefinitions = new TFile("PARAMETERSET_DEFINITIONFILE.root","READ");
747 TREE_ParaSetDefinitions = (TTree*)FILE_ParaSetDefinitions->Get("ParaSet_Variables");
748
750
751 // Possible BugFix:
752 if (cmd_PASTART==-1 && cmd_PAEND==-1) {
753 cout << "Possible BugFix: if (cmd_PASTART==-1 and cmd_PAEND==-1)" << endl;
754 cout << "then we assume no FILE_ParaSetDefinitions is needed, and therefore, " << endl;
755 cout << "even if it exists, we set it to NULL: TREE_ParaSetDefinitions = 0;" << endl;
756
758 }
759
761 cout << "WARNING: In --- Open_ParasetDefinitionFile --- Empty TREE_ParaSetDefinitions. (this may have several reasons.)" << endl;
762 cout << "Either corrupted FILE_ParaSetDefinitions or default cmd_PASTART/cmd_PAEND given." << endl;
763 cout << " Switching to default parametersets (algorithm specific)." << endl;
764 cout << " Set cmd_PASTART=-1 cmd_PAEND =-1 " << endl;
765 cmd_PASTART=-1;
766 cmd_PAEND=-1;
767 }
768 return 1;
769}
TFile * FILE_ParaSetDefinitions
Definition: ShowRec.h:64

◆ Read_ParasetDefinitionTree()

void Read_ParasetDefinitionTree ( )
775{
776 Log(2, "ShowRec.cpp", "--- Int_t Read_ParasetDefinitionTree() ---");
777
778 // ALTP 0,2,4 and others ...
779 Double_t dr_max,dt_max,coneangle,tubedist;
780 Int_t nholes_max;
781 Double_t ann_output;
782 Int_t ann_inputneurons;
783 Double_t CUT_P;
784 Double_t CUT_ALISUBSIZE;
785 Double_t distMin_max;
786 Int_t tracksegs_max;
787 Double_t distMin_dt_max;
789
790 // ALTP 11 N3_ALG
791 Double_t ANN_OUTPUT;
792 Int_t ANN_PLATEN;
793 Int_t ANN_PLATEDIRECTION;
794 Int_t ANN_HIDDENLAYER;
795 Int_t ANN_INPUTNEURONS;
796
797 // ALTP 10 GS from libShowRec
798 Double_t cut_gs_cut_dip=150;
799 Double_t cut_gs_cut_dmin=40;
800 Double_t cut_gs_cut_dr=60;
801 Double_t cut_gs_cut_dz=19000;
802 Double_t cut_gs_cut_dtheta=0.06;
803 Double_t cut_gs_cut_piddiff=1;
805
806 // Create on Tree if its not there and fill it with one entry:
807 if (TREE_ParaSetDefinitions==0 && (cmd_ALTP==0 || cmd_ALTP==2 || cmd_ALTP==4)) {
808 if (TREE_ParaSetDefinitions==0) cout << "WARNING: In --- Read_ParasetDefinitionTree --- Empty TREE_ParaSetDefinitions. Using only one, standard parameterset (...) ."<<endl;
809 TREE_ParaSetDefinitions = new TTree("ParaSet_Variables","ParaSet_Variables");
810 TREE_ParaSetDefinitions -> Branch("CUT_ZYLINDER_R_MAX",&tubedist,"CUT_ZYLINDER_R_MAX/D");
811 TREE_ParaSetDefinitions -> Branch("CUT_ZYLINDER_ANGLE_MAX",&coneangle,"CUT_ZYLINDER_ANGLE_MAX/D");
812 TREE_ParaSetDefinitions -> Branch("CUT_SHOWERFOLLOWERBT_DR_MAX",&dr_max,"CUT_SHOWERFOLLOWERBT_DR_MAX/D");
813 TREE_ParaSetDefinitions -> Branch("CUT_SHOWERFOLLOWERBT_DTAN_MAX",&dt_max,"CUT_SHOWERFOLLOWERBT_DTAN_MAX/D");
814 TREE_ParaSetDefinitions -> Branch("CUT_NHOLES_MAX",&nholes_max,"CUT_NHOLES_MAX/I");
815 dr_max=100.0;
816 dt_max=0.1;
817 coneangle=0.1;
818 tubedist=800.0;
819 nholes_max=3;
820
821 if (cmd_ALTP==0||cmd_ALTP==2) {
822 if (cmd_CUTTP==2) {
823 cout << "----- cmd_CUTTP==2 -----"<<endl;
824 dr_max=100.0;
825 dt_max=0.1;
826 coneangle=0.1;
827 tubedist=800.0;
828 }
829 else if (cmd_CUTTP==1) {
830 cout << "----- cmd_CUTTP==1 -----"<<endl;
831 dr_max=100.0;
832 dt_max=0.1;
833 coneangle=0.1;
834 tubedist=800.0;
835 }
836 else {
837 cout << "----- cmd_CUTTP==else -----"<<endl;
838 dr_max=100.0;
839 dt_max=0.1;
840 coneangle=0.1;
841 tubedist=800.0; // CA ALG, cmd_ALTP==2 , CT ALG, cmd_ALTP==0
842 }
843 }
844 if (cmd_ALTP==4) {
845 if (cmd_CUTTP==4) {
846 cout << "----- cmd_CUTTP==4 : FJ_Standard -----"<<endl;
847 dr_max=150.0;
848 dt_max=0.15;
849 coneangle=0.02;
850 tubedist=800.0; // cuttype. FJ_Standard // OI ALG, cmd_ALTP==4
851 }
852 if (cmd_CUTTP==3) {
853 cout << "----- cmd_CUTTP==3 : FJ_HighPur -----"<<endl;
854 dr_max=100.0;
855 dt_max=0.05;
856 coneangle=0.025;
857 tubedist=400.0; // cuttype. FJ_HighPur // OI ALG, cmd_ALTP==4
858 }
859 else if (cmd_CUTTP==2) {
860 cout << "----- cmd_CUTTP==2 -----"<<endl;
861 dr_max=200.0;
862 dt_max=0.15;
863 coneangle=0.03;
864 tubedist=800.0; // cuttype. high eff // OI ALG, cmd_ALTP==4
865 }
866 else if (cmd_CUTTP==1) {
867 cout << "----- cmd_CUTTP==1 -----"<<endl;
868 dr_max=120.0;
869 dt_max=0.11;
870 coneangle=0.02;
871 tubedist=600.0; // cuttype. high pur // OI ALG, cmd_ALTP==4
872 }
873 else {
874 cout << "----- cmd_CUTTP==else -----"<<endl;
875 dr_max=150.0;
876 dt_max=0.15;
877 coneangle=0.02;
878 tubedist=800.0; // cuttype. FJ_Standard // OI ALG, cmd_ALTP==4
879 }
880 }
881
882 //cout << "----------- SAME VALUES AS IN EdbShowerRec FOR tESTING... REMOVE AFTER YOURE DONE HERE!!"<<endl;
883 //if (cmd_ALTP==4) dr_max=150.0;dt_max=0.15;coneangle=0.02;tubedist=800.0; // OI ALG, cmd_ALTP==4
884
885 // ParaSetNr CUT_ZYLINDER_R_MAX CUT_ZYLINDER_ANGLE_MAX CUT_SHOWERFOLLOWERBT_DR_MAX CUT_SHOWERFOLLOWERBT_DTAN_MAX
886 // 7001 800 0.1 100 0.1 (high NBT, middle purity)
887 // 4401 500 0.5 100 0.1 (middle NBT, high purity) (comparable to off. Recoalg.);
888
890 if (gEDBDEBUGLEVEL>2) cout << "--- TREE_ParaSetDefinitions -> GetEntries() " << TREE_ParaSetDefinitions -> GetEntries()<<endl;
892
893 // Reset here then also command line arguments:
894 // cmd_PASTART=0; cmd_PAEND=0;
895 // Update CUT_PARAMETER[0,1,2,3,]
896 }
897
898 if (TREE_ParaSetDefinitions==0 && cmd_ALTP==3) {
899 TREE_ParaSetDefinitions = new TTree("ParaSet_Variables","ParaSet_Variables");
900 TREE_ParaSetDefinitions -> Branch("CUT_ANN_INPUTNEURONS",&ann_inputneurons,"CUT_ANN_INPUTNEURONS/I");
901 TREE_ParaSetDefinitions -> Branch("CUT_ANN_OUTPUT",&ann_output,"CUT_ANN_OUTPUT/D");
902 ann_output=0.85;
903 ann_inputneurons=5;
907 }
908
909 if (TREE_ParaSetDefinitions==0 && cmd_ALTP==11) {
910 TREE_ParaSetDefinitions = new TTree("ParaSet_Variables","ParaSet_Variables");
911 TREE_ParaSetDefinitions->Branch("ANN_PLATE_DELTANMAX",&N3_ANN_PLATE_DELTANMAX,"ANN_PLATE_DELTANMAX/I");
912 TREE_ParaSetDefinitions->Branch("ANN_NTRAINEPOCHS",&N3_ANN_NTRAINEPOCHS,"ANN_NTRAINEPOCHS/I");
913 TREE_ParaSetDefinitions->Branch("ANN_NHIDDENLAYER",&N3_ANN_NHIDDENLAYER,"ANN_NHIDDENLAYER/I");
914 TREE_ParaSetDefinitions->Branch("ANN_EQUALIZESGBG",&N3_ANN_EQUALIZESGBG,"ANN_ANN_EQUALIZESGBG/I");
915 TREE_ParaSetDefinitions->Branch("ANN_OUTPUTTHRESHOLD",&N3_ANN_OUTPUTTHRESHOLD,"ANN_OUTPUTTHRESHOLD/D");
916 TREE_ParaSetDefinitions->Branch("ANN_INPUTNEURONS",&N3_ANN_INPUTNEURONS,"ANN_INPUTNEURONS/I");
917
918 // Default, maximal settings. Same plate, Two plates up- downstream connections looking,
919 // that for 5 inputvariables there
920 // plus 4 fixed input varibles for BT(i) to InBT connections: 4+5*5 = 29
930 }
931
932 if (TREE_ParaSetDefinitions==0 && cmd_ALTP==5) {
933 TREE_ParaSetDefinitions = new TTree("ParaSet_Variables","ParaSet_Variables");
934 TREE_ParaSetDefinitions -> Branch("CUT_P",&CUT_P,"CUT_P/D");
935 TREE_ParaSetDefinitions -> Branch("CUT_ALISUBSIZE",&CUT_ALISUBSIZE,"CUT_ALISUBSIZE/D");
936 CUT_P=0;
937 CUT_ALISUBSIZE=1000;
941 }
942
943 if (TREE_ParaSetDefinitions==0 && cmd_ALTP==6) {
944 TREE_ParaSetDefinitions = new TTree("ParaSet_Variables","ParaSet_Variables");
945 TREE_ParaSetDefinitions -> Branch("CUT_ZYLINDER_R_MAX",&tubedist,"CUT_ZYLINDER_R_MAX/D");
946 TREE_ParaSetDefinitions -> Branch("CUT_ZYLINDER_ANGLE_MAX",&coneangle,"CUT_ZYLINDER_ANGLE_MAX/D");
947 TREE_ParaSetDefinitions -> Branch("CUT_SHOWERFOLLOWERBT_DR_MAX",&dr_max,"CUT_SHOWERFOLLOWERBT_DR_MAX/D");
948 TREE_ParaSetDefinitions -> Branch("CUT_SHOWERFOLLOWERBT_DTAN_MAX",&dt_max,"CUT_SHOWERFOLLOWERBT_DTAN_MAX/D");
949
950 TREE_ParaSetDefinitions -> Branch("CUT_TRACKATTACH_DISTMIN",&distMin_max,"CUT_TRACKATTACH_DISTMIN/D");
951 TREE_ParaSetDefinitions -> Branch("CUT_TRACKATTACH_DTAN_MAX",&distMin_dt_max,"CUT_TRACKATTACH_DTAN_MAX/D");
952 TREE_ParaSetDefinitions -> Branch("CUT_TRACKATTACH_NTRACKSEG",&tracksegs_max,"CUT_TRACKATTACH_NTRACKSEG/I");
953
954 dr_max=150.0;
955 dt_max=0.13;
956 coneangle=0.025;
957 tubedist=700.0;
958 distMin_max=500;
959 tracksegs_max=1;
960 distMin_dt_max=200;
964 }
965
966
967 if (TREE_ParaSetDefinitions==0 && (cmd_ALTP==7 || cmd_ALTP==9)) {
968 TREE_ParaSetDefinitions = new TTree("ParaSet_Variables","ParaSet_Variables");
969 TREE_ParaSetDefinitions -> Branch("CUT_ZYLINDER_R_MAX",&tubedist,"CUT_ZYLINDER_R_MAX/D");
970 TREE_ParaSetDefinitions -> Branch("CUT_ZYLINDER_ANGLE_MAX",&coneangle,"CUT_ZYLINDER_ANGLE_MAX/D");
971 TREE_ParaSetDefinitions -> Branch("CUT_SHOWERFOLLOWERBT_DR_MAX",&dr_max,"CUT_SHOWERFOLLOWERBT_DR_MAX/D");
972 TREE_ParaSetDefinitions -> Branch("CUT_SHOWERFOLLOWERBT_DTAN_MAX",&dt_max,"CUT_SHOWERFOLLOWERBT_DTAN_MAX/D");
973 dr_max=150.0;
974 dt_max=0.13;
975 coneangle=0.025;
976 tubedist=700.0;
980 }
981
982
983 if (TREE_ParaSetDefinitions==0 && cmd_ALTP==8) {
984 TREE_ParaSetDefinitions = new TTree("ParaSet_Variables","ParaSet_Variables");
985 TREE_ParaSetDefinitions -> Branch("CUT_BACK_DMIN",&cut_back_dmin,"CUT_BACK_DMIN/D");
986 TREE_ParaSetDefinitions -> Branch("CUT_BACK_DTHETA",&cut_back_dtheta,"CUT_BACK_DTHETA/D");
987 TREE_ParaSetDefinitions -> Branch("CUT_BACK_DR",&cut_back_dr,"CUT_BACK_DR/D");
988 TREE_ParaSetDefinitions -> Branch("CUT_BACK_DZ",&cut_back_dz,"CUT_BACK_DZ/D");
989 TREE_ParaSetDefinitions -> Branch("CUT_FOR_DMIN",&cut_for_dmin,"CUT_FOR_DMIN/D");
990 TREE_ParaSetDefinitions -> Branch("CUT_FOR_DTHETA",&cut_for_dtheta,"CUT_FOR_DTHETA/D");
991 TREE_ParaSetDefinitions -> Branch("CUT_FOR_DR",&cut_for_dr,"CUT_FOR_DR/D");
992 TREE_ParaSetDefinitions -> Branch("CUT_FOR_DZ",&cut_for_dz,"CUT_FOR_DZ/D");
1000 }
1001
1002 if (TREE_ParaSetDefinitions==0 && cmd_ALTP==10) {
1003 TREE_ParaSetDefinitions = new TTree("ParaSet_Variables","ParaSet_Variables");
1004 TREE_ParaSetDefinitions -> Branch("CUT_GS_CUT_DIP",&cut_gs_cut_dip,"CUT_GS_CUT_DIP/D");
1005 TREE_ParaSetDefinitions -> Branch("CUT_GS_CUT_DMIN",&cut_gs_cut_dmin,"CUT_GS_CUT_DMIN/D");
1006 TREE_ParaSetDefinitions -> Branch("CUT_GS_CUT_DR",&cut_gs_cut_dr,"CUT_GS_CUT_DR/D");
1007 TREE_ParaSetDefinitions -> Branch("CUT_GS_CUT_DZ",&cut_gs_cut_dz,"CUT_GS_CUT_DZ/D");
1008 TREE_ParaSetDefinitions -> Branch("CUT_GS_CUT_DTHETA",&cut_gs_cut_dtheta,"CUT_GS_CUT_DTHETA/D");
1009 TREE_ParaSetDefinitions -> Branch("CUT_GS_CUT_PIDDIFF",&cut_gs_cut_piddiff,"CUT_GS_CUT_PIDDIFF/D");
1010 TREE_ParaSetDefinitions -> Branch("CUT_GS_CUT_OPPOSITEFLAG",&cut_gs_cut_oppositeflag,"CUT_GS_CUT_OPPOSITEFLAG/I");
1011 // PARAMETERSET_DEFINITIONFILE_LONG_GS_ALG.txt: 19642 393.212 35.5454 85.268 25062.6 0.117141 3 0
1012 cut_gs_cut_dip=393;
1013 cut_gs_cut_dmin=35.5;
1014 cut_gs_cut_dr=85.;
1015 cut_gs_cut_dz=25000;
1016 cut_gs_cut_dtheta=0.11;
1021 TREE_ParaSetDefinitions->Print();
1022 }
1023
1024
1025 // Now, TREE_ParaSetDefinitions exists and is filled with one entry at least
1026 // Then set branch addresses for the variables
1027
1028 // Attention: Here is still a __BUG__ possible.
1029 // If the file containing from Open_ParasetDefinitionFile contains a parameter-
1030 // set for the wrong algorithm, the program thinks it has a TREE_ParaSetDefinitions
1031 // (which it actually has), but the variables dont match, and then the program
1032 // crashes!
1033 cout << "Attention: Here is still a __BUG__ possible. If the file containing from Open_ParasetDefinitionFile contains a parameter-" << endl;
1034 cout << "set for the wrong algorithm, the program thinks it has a TREE_ParaSetDefinitions (which it actually has), " << endl;
1035 cout << "but the variables dont match, and then the program crashes!" << endl;
1036
1037 if (cmd_ALTP==0) {
1038 TREE_ParaSetDefinitions->SetBranchAddress("CUT_ZYLINDER_R_MAX",&tubedist);
1039 TREE_ParaSetDefinitions->SetBranchAddress("CUT_ZYLINDER_ANGLE_MAX",&coneangle);
1040 TREE_ParaSetDefinitions->SetBranchAddress("CUT_SHOWERFOLLOWERBT_DR_MAX",&dr_max);
1041 TREE_ParaSetDefinitions->SetBranchAddress("CUT_SHOWERFOLLOWERBT_DTAN_MAX",&dt_max);
1042 }
1043 else if (cmd_ALTP==1) {
1044 cout << "TODO"<<endl;
1045 }
1046 else if (cmd_ALTP==2) {
1047 TREE_ParaSetDefinitions->SetBranchAddress("CUT_ZYLINDER_R_MAX",&tubedist);
1048 TREE_ParaSetDefinitions->SetBranchAddress("CUT_ZYLINDER_ANGLE_MAX",&coneangle);
1049 TREE_ParaSetDefinitions->SetBranchAddress("CUT_SHOWERFOLLOWERBT_DR_MAX",&dr_max);
1050 TREE_ParaSetDefinitions->SetBranchAddress("CUT_SHOWERFOLLOWERBT_DTAN_MAX",&dt_max);
1051 }
1052 else if (cmd_ALTP==4) {
1053 TREE_ParaSetDefinitions->SetBranchAddress("CUT_ZYLINDER_R_MAX",&tubedist);
1054 TREE_ParaSetDefinitions->SetBranchAddress("CUT_ZYLINDER_ANGLE_MAX",&coneangle);
1055 TREE_ParaSetDefinitions->SetBranchAddress("CUT_SHOWERFOLLOWERBT_DR_MAX",&dr_max);
1056 TREE_ParaSetDefinitions->SetBranchAddress("CUT_SHOWERFOLLOWERBT_DTAN_MAX",&dt_max);
1057 TREE_ParaSetDefinitions->SetBranchAddress("CUT_NHOLES_MAX",&nholes_max);
1058 }
1059 else if (cmd_ALTP==5) {
1060 TREE_ParaSetDefinitions->SetBranchAddress("CUT_P",&CUT_P);
1061 TREE_ParaSetDefinitions->SetBranchAddress("CUT_ALISUBSIZE",&CUT_ALISUBSIZE);
1062 }
1063 else if (cmd_ALTP==3) {
1064 TREE_ParaSetDefinitions->SetBranchAddress("CUT_ANN_OUTPUT",&ann_output);
1065 TREE_ParaSetDefinitions -> SetBranchAddress("CUT_ANN_INPUTNEURONS",&ann_inputneurons);
1066 }
1067
1068 else if (cmd_ALTP==6) {
1069 TREE_ParaSetDefinitions->SetBranchAddress("CUT_ZYLINDER_R_MAX",&tubedist);
1070 TREE_ParaSetDefinitions->SetBranchAddress("CUT_ZYLINDER_ANGLE_MAX",&coneangle);
1071 TREE_ParaSetDefinitions->SetBranchAddress("CUT_SHOWERFOLLOWERBT_DR_MAX",&dr_max);
1072 TREE_ParaSetDefinitions->SetBranchAddress("CUT_SHOWERFOLLOWERBT_DTAN_MAX",&dt_max);
1073 TREE_ParaSetDefinitions->SetBranchAddress("CUT_TRACKATTACH_DISTMIN",&distMin_max);
1074 TREE_ParaSetDefinitions->SetBranchAddress("CUT_TRACKATTACH_DTAN_MAX",&distMin_dt_max);
1075 TREE_ParaSetDefinitions->SetBranchAddress("CUT_TRACKATTACH_NTRACKSEG",&tracksegs_max);
1076 }
1077 else if (cmd_ALTP==7) {
1078 TREE_ParaSetDefinitions->SetBranchAddress("CUT_ZYLINDER_R_MAX",&tubedist);
1079 TREE_ParaSetDefinitions->SetBranchAddress("CUT_ZYLINDER_ANGLE_MAX",&coneangle);
1080 TREE_ParaSetDefinitions->SetBranchAddress("CUT_SHOWERFOLLOWERBT_DR_MAX",&dr_max);
1081 TREE_ParaSetDefinitions->SetBranchAddress("CUT_SHOWERFOLLOWERBT_DTAN_MAX",&dt_max);
1082 }
1083 else if (cmd_ALTP==8) {
1084 TREE_ParaSetDefinitions->SetBranchAddress("CUT_BACK_DMIN",&cut_back_dmin);
1085 TREE_ParaSetDefinitions->SetBranchAddress("CUT_BACK_DTHETA",&cut_back_dtheta);
1086 TREE_ParaSetDefinitions->SetBranchAddress("CUT_BACK_DR",&cut_back_dr);
1087 TREE_ParaSetDefinitions->SetBranchAddress("CUT_BACK_DZ",&cut_back_dz);
1088 TREE_ParaSetDefinitions->SetBranchAddress("CUT_FOR_DMIN",&cut_for_dmin);
1089 TREE_ParaSetDefinitions->SetBranchAddress("CUT_FOR_DTHETA",&cut_for_dtheta);
1090 TREE_ParaSetDefinitions->SetBranchAddress("CUT_FOR_DR",&cut_for_dr);
1091 TREE_ParaSetDefinitions->SetBranchAddress("CUT_FOR_DZ",&cut_for_dz);
1092 }
1093 else if (cmd_ALTP==10) {
1101 }
1102 else if (cmd_ALTP==11) {
1109 }
1110
1111 // Check: if PASTART is given (a number), but PAEND is default,
1112 // then set PAEND to PASTART
1114
1115 if (gEDBDEBUGLEVEL>2) cout << "--- Updated commandline values: cmd_PASTART=" << cmd_PASTART << " and cmd_PAEND=" << cmd_PAEND << endl;
1116
1117 Log(2, "ShowRec.cpp", "--- Int_t Read_ParasetDefinitionTree() done.");
1118 return;
1119}
ParaSet Fill()
ParaSet Branch("CUT_BACK_DMIN",&cut_back_dmin,"CUT_BACK_DMIN/D")
cout<< tr-> GetEntries()<< endl

◆ ReadEdbPVRecObjectFromCurrentDirectory()

EdbPVRec * ReadEdbPVRecObjectFromCurrentDirectory ( )
664{
665 Log(2, "ShowRec.cpp", "--- EdbPVRec* ReadEdbPVRecObjectFromCurrentDirectory() ---");
666
667 // Create EdbPVRec on the heap:
668 EdbPVRec *gAli= new EdbPVRec();
669
670// cmd_ALI==0: read gAli from lnk.def Basetracks
671// cmd_ALI==1: read gAli from linked.tracks.root
672// cmd_ALI==2: read gAli from ScanVolume_Ali.root
673// cmd_ALI==3: read gAli from ScanVolumeLinkedTracks_Ali.root
674
675 if (cmd_ALI==3) {
676 Log(2, "ShowRec.cpp", "--- EdbPVRec* ReadEdbPVRecObjectFromCurrentDirectory() cmd_ALI==3: read gAli from ScanVolumeLinkedTracks_Ali.root");
677 TFile* f= new TFile("ScanVolumeLinkedTracks_Ali.root");
678 gAli= (EdbPVRec*) f->Get("EdbPVRec");
679 return gAli;
680 }
681 if (cmd_ALI==2) {
682 Log(2, "ShowRec.cpp", "--- EdbPVRec* ReadEdbPVRecObjectFromCurrentDirectory() cmd_ALI==2: read gAli from ScanVolume_Ali.root");
683 TFile* f= new TFile("ScanVolume_Ali.root");
684 f->ls();
685 gAli= (EdbPVRec*) f->Get("EdbPVRec");
686 return gAli;
687 }
688
689 //-----------------------------------
690 // current dir has to contain:
691 // default.par, lnk_all.lst, lnk_all.def
692 // data, par directory
693 // the definition of filenames and structurs
694 // is given in the lnk.def file (cmd_lnkdef_name)
695 // Warning:
696 // CHECK IF THIS FILE EXISTS. IF NOT, STOP HERE
697 // BECAUSE ONE DOES NOT KNOW WHAT TO DO !!!
698 //-----------------------------------
699 Log(2, "ShowRec.cpp", "--- EdbPVRec* ReadEdbPVRecObjectFromCurrentDirectory() Read EdbDataProc object");
700 Log(2, "ShowRec.cpp", "--- EdbPVRec* ReadEdbPVRecObjectFromCurrentDirectory() from file: %s",cmd_lnkdef_name);
701
702 string filename = cmd_lnkdef_name;
703 ifstream fin( filename.c_str() );
704 if ( !fin ) {
705 cout << "WARNING: Opening " << filename << " failed!!! SEVERE ERROR POSSIBLE." << endl;
706 }
707
708 // DECLARE MAIN OBJECTS
709 // Data set initialization
710 // string handling from cmd_lnkdef_name file here.
713 //dset->Dump();
714
715 // Volume initialization
716 // The differentiation LT or not is made when filling the array
717 // new: (4.2.2010) can distinguish between gAli from cp.root or from linked tracks
718
719 if (cmd_ALI==1) {
720 Log(2, "ShowRec.cpp", "--- EdbPVRec* ReadEdbPVRecObjectFromCurrentDirectory() cmd_ALI==1: read gAli from linked.tracks.root");
721 dset->InitVolume(100, ""); // Read in (all) BT from linked_tracks.root
722 }
723 if (cmd_ALI==0) {
724 Log(2, "ShowRec.cpp", "--- EdbPVRec* ReadEdbPVRecObjectFromCurrentDirectory() cmd_ALI==0: read gAli from lnk.def Basetracks");
725 cout << "TODO HERE ... CHECK IF cp.root files exist !!!" << endl;
726 cout << "OTHERWISE CRASH IN THE EdbDataProc::InitVolume FUNCTION" << endl;
727 dset->InitVolume(0, ""); // Read in (all) BT from cp.root.
728 }
729
730 // Finally: get Pattern Volume Reconstruction object
731 gAli = dset->PVR();
732 //-------------------------------------
733 if (gEDBDEBUGLEVEL>2) gAli->Print();
734 //-------------------------------------
735 return gAli;
736}
EdbDataProc * dset
Definition: RecDispEX.C:9
FILE * f
Definition: RecDispMC.C:150
const char filename[256]
Definition: RecDispNU.C:83
char * cmd_lnkdef_name
Definition: ShowRec.h:31
emulsion data processing
Definition: EdbDataSet.h:181
int InitVolume(int datatype=0, const char *rcut="1")
Definition: EdbDataSet.cxx:2066
EdbPVRec * PVR() const
Definition: EdbDataSet.h:198
EdbPVRec * gAli
Definition: check_vertex.C:14

◆ Reco_CL_AssignZValueToGroup()

Int_t Reco_CL_AssignZValueToGroup ( Double_t  z,
Double_t  z0,
Int_t  NGroupedPLATES,
Int_t  PLATESPerGroup 
)
1527{
1528 // z: Position of BT to be checked,
1529 // z0: ZStart if for example FIRSTPLATE z=3900 (PLATE 4) instead of 0
1530 Int_t actplate=(Int_t)(z-z0)/1300+1;
1531 Int_t actgroup=(actplate-1)/PLATESPerGroup;
1532 // cout << "z z0 actplate "<< z << " " << z0 << " " <<actplate << endl;
1533 // cout << "actplate actgroup "<< actplate << " " << actgroup << endl;
1534 //This Assignment seems ok.
1535 return actgroup;
1536}
brick z0
Definition: RecDispMC.C:106

◆ Reco_CL_BuildGlobalHistogramsOnHeap()

void Reco_CL_BuildGlobalHistogramsOnHeap ( )
1539{
1540 TString HistoNameTitle="XXX";
1541 for (Int_t h=0; h<50; h++) {
1542 // cout << "Creating Hist2DimOnlyBG_Groupe_ " << h << endl;
1543 HistoNameTitle=TString(Form("Hist2DimOnlyBG_Groupe_%d",h));
1544 Hist2DimOnlyBGOneGroupedPlate[h]=new TH2F(HistoNameTitle,HistoNameTitle,10,0,1,10,0,1);
1545 // cout << "Creating Hist2DimOnlySimOneEvent_Groupe_ " << h << endl;
1546 HistoNameTitle=TString(Form("Hist2DimOnlySimOneEvent_Groupe_%d",h));
1547 Hist2DimOnlySimOneEventOneGroupedPlate[h]=new TH2F(HistoNameTitle,HistoNameTitle,10,0,1,10,0,1);
1548 // cout << "Creating Hist2DimBGAndSimOneEvent_Groupe_ " << h << endl;
1549 HistoNameTitle=TString(Form("Hist2DimBGAndSimOneEvent_Groupe_%d",h));
1550 Hist2DimBGAndSimOneEventOneGroupedPlate[h]=new TH2F(HistoNameTitle,HistoNameTitle,10,0,1,10,0,1);
1551 }
1552 return;
1553}
TH2F * Hist2DimOnlyBGOneGroupedPlate[50]
Definition: ShowRec.h:350
TH2F * Hist2DimOnlySimOneEventOneGroupedPlate[50]
Definition: ShowRec.h:351
TH2F * Hist2DimBGAndSimOneEventOneGroupedPlate[50]
Definition: ShowRec.h:352

◆ ReconstructShowers()

void ReconstructShowers ( Int_t  nr)

MakeTracksTree(TREE_ShowShower);

1358{
1359 Log(2, "ShowRec.cpp", "--- void ReconstructShowers() for parameterset %d---",nr);
1360
1361 //-----------------------------------
1362 // Create the ShowerOutputtree:
1364 //-----------------------------------
1365
1366 //-----------------------------------
1367 // Call main reconstruction function:
1368 //-----------------------------------
1369 if (cmd_ALTP==0) {
1370 cout << "ReconstructShowers:: cmd_ALTP==0 ReconstructShowers_CT() IS NOW THE SAME AS CA ALG! "<< endl;
1371 cout << "ReconstructShowers:: cmd_ALTP==0 ReconstructShowers_CTA() Reconstruction of ParameterSet: "<< nr <<endl;
1373 }
1374 else if (cmd_ALTP==1) {
1375 cout << "TODO... CL ...."<<endl;
1376 cout << "ReconstructShowers:: cmd_ALTP==1 ReconstructShowers_CL() Reconstruction of ParameterSet: "<< nr <<endl;
1378 }
1379 else if (cmd_ALTP==2) {
1380 cout << "ReconstructShowers:: cmd_ALTP==2 ReconstructShowers_CA() Reconstruction of ParameterSet: "<< nr <<endl;
1382 }
1383 else if (cmd_ALTP==3) {
1384 cout << "ReconstructShowers:: cmd_ALTP==3 ReconstructShowers_NN() Reconstruction of ParameterSet: "<< nr <<endl;
1386 }
1387 else if (cmd_ALTP==4) {
1388 cout << "ReconstructShowers:: cmd_ALTP==4 ReconstructShowers_OI() Reconstruction of ParameterSet: "<< nr <<endl;
1390 }
1391 else if (cmd_ALTP==5) {
1392 cout << "ReconstructShowers:: cmd_ALTP==5 ReconstructShowers_SA() Reconstruction of ParameterSet: "<< nr <<endl;
1394 }
1395 else if (cmd_ALTP==6) {
1396 cout << "ReconstructShowers:: cmd_ALTP==6 ReconstructShowers_TC() Reconstruction of ParameterSet: "<< nr <<endl;
1398 }
1399 else if (cmd_ALTP==7) {
1400 cout << "ReconstructShowers:: cmd_ALTP==7 ReconstructShowers_RC() Reconstruction of ParameterSet: "<< nr <<endl;
1402 }
1403 else if (cmd_ALTP==8) {
1404 cout << "ReconstructShowers:: cmd_ALTP==8 ReconstructShowers_BW() Reconstruction of ParameterSet: "<< nr <<endl;
1406 }
1407 else if (cmd_ALTP==9) {
1408 cout << "ReconstructShowers:: cmd_ALTP==9 ReconstructShowers_AG() Reconstruction of ParameterSet: "<< nr <<endl;
1410 }
1411 else if (cmd_ALTP==10) {
1412 cout << "ReconstructShowers:: cmd_ALTP==10 ReconstructShowers_GS() Reconstruction of ParameterSet: "<< nr <<endl;
1414 }
1415 else if (cmd_ALTP==11) {
1416 cout << "ReconstructShowers:: cmd_ALTP==11 ReconstructShowers_N3() Reconstruction of ParameterSet: "<< nr <<endl;
1418 }
1419 else if (cmd_ALTP==999) {
1420 cout << "ReconstructShowers:: cmd_ALTP==9999 OpenMP TEST!!!!! PROBABLY TO BE DEPRECATED ..."<<endl;
1422 }
1423 //-----------------------------------
1424
1425
1426 //-----------------------------------
1427 if (TREE_ShowShower->GetEntries()<1) {
1428 cout << "//-----------------------------------------------------------------------------//"<<endl;
1429 cout << "TREE_ShowShower->GetEntries()<1. NO SHOWER HAS BEEN RECONSTRUCTED."<<endl;
1430 cout << "CHECK INPUT BTs, INPUT PARAMETERS, SOURCE FILES, etc.."<<endl;
1431 cout << "//-----------------------------------------------------------------------------//"<<endl;
1432 }
1433 cout << "TREE_ShowShower->GetEntries() = " << TREE_ShowShower->GetEntries()<< endl;
1434 //-----------------------------------
1435
1436
1437 //-----------------------------------
1438 // MakeShowerTree:
1439 // Writing showers in treebranch style
1440 // as done by FJ algorithm.
1441 //-----------------------------------
1442 FILE_ShowShower->cd();
1443 TREE_ShowShower->Write("",TObject::kOverwrite);
1444 //-----------------------------------
1445
1446
1447 //-----------------------------------
1448 // MakeTracksTree:
1449 // Writing showers in tracks style
1450 // copied almost verbatim from GL.
1451 //-----------------------------------
1453 cout << "Make Tracks Tree commented out!!!"<< endl;
1454 //-----------------------------------
1455
1456
1457 //-----------------------------------
1458 // Delete the ShowerOutputtree:
1459 delete TREE_ShowShower;
1461 //-----------------------------------
1462 return;
1463}
void ReconstructShowers_NN()
Definition: ShowRec.cpp:3244
void ReconstructShowers_OI()
void ReconstructShowers_CL() /// Still Missing in the Implementation !!!
Definition: ShowRec.cpp:2838
TTree * CreateTreeBranchShowerTree(Int_t ParaSetNr)
Definition: ShowRec.cpp:7864
void ReconstructShowers_SA()
Definition: ShowRec.cpp:3050
void ReconstructShowers_AG()
Definition: ShowRec.cpp:5145
void ReconstructShowers_GS()
Definition: ShowRec.cpp:5371
void ReconstructShowers_CL()
Definition: ShowRec.cpp:1892
void ReconstructShowers_RC()
Definition: ShowRec.cpp:4491
void ReconstructShowers_CA()
Definition: ShowRec.cpp:2649
void ReconstructShowers_BW()
Definition: ShowRec.cpp:4763
void ReconstructShowers_TC()
Definition: ShowRec.cpp:4034
void ReconstructShowers_OPENMP()
Definition: ShowRec.cpp:2398
void ReconstructShowers_CT()
Definition: ShowRec.cpp:2462
TTree * TREE_ShowShower
Definition: ShowRec.h:68
void ReconstructShowers_N3()
DEBUG OPENMP TEST!!!!!!!// DEPRECATED !!!!
Definition: ShowRec_Alg_N3.cpp:2

◆ ReconstructShowers_AG()

void ReconstructShowers_AG ( )
4032{
4033 Log(2, "ShowRec.cpp", "--- void ReconstructShowers_AG() ---");
4034
4035 //-----------------------------------------------------------------
4036 // Main function for reconstruction of "Advanced Gamma" Algorithm
4037 //-----------------------------------------------------------------
4038
4039 //-----------------------------------
4040 // For each InitiatorBT this is
4041 // divided in several small parts:
4042 //
4043 // 1) Make local_gAli with cut parameters, Make GetPID of InBT and corresponding of plates
4044 // 3) Loop over (whole) local_gAli, check BT for Cuts
4045 // 4) Calculate pur/eff/NBT numbers
4046 // 5) Fill Trees
4047 //-----------------------------------
4048
4049 // Define Helper Variables:
4050 EdbPVRec* local_gAli;
4051 EdbSegP* InBT;
4052 EdbSegP* seg;
4053 Float_t local_gAli_pat_interim_halfsize=0;
4054
4057
4058 //-----------------------------------------------------------------
4059 // Since GLOBAL_InBTArray is filled in ascending ordering by zpositon
4060 // We use the descending loop to begin with BT with lowest z first.
4061 for (Int_t i=GLOBAL_InBTArrayEntries-1; i>=0; --i) {
4062
4063 //-----------------------------------
4064 // CounterOutPut
4065 if (gEDBDEBUGLEVEL==2) if ((i%1)==0) cout << GLOBAL_InBTArrayEntries <<" InBT in total, still to do:"<<Form("%4d",i)<< "\r\r\r\r"<<flush;
4066 //-----------------------------------
4067
4068 //-----------------------------------
4069 // Get InitiatorBT from GLOBAL_InBTArray
4070 InBT=(EdbSegP*)GLOBAL_InBTArray->At(i);
4071 //--------
4072 GLOBAL_InBT_E=InBT->P();
4073 GLOBAL_InBT_TanTheta=TMath::Sqrt(InBT->TX()*InBT->TX()+InBT->TY()*InBT->TY());
4074 GLOBAL_InBT_Flag=InBT->Flag();
4075 GLOBAL_InBT_MC=InBT->MCEvt();
4076 //--------
4077 Int_t local_NBT=0;
4078 Int_t local_NBTMC=0;
4079 Int_t local_NBTallMC=0;
4080 Int_t local_NBTeMC=0;
4081 float_t local_pure=-1;
4082 float_t local_purall=-1;
4083 Int_t npat_int=0;
4084 Int_t npat_total=0;
4085 Int_t npatN=0;
4086 Int_t npat_Neff=0;
4087 Int_t NBT_Neff=0;
4088 Int_t NBTMC_Neff=0;
4089 Int_t NBTMCe_Neff=0;
4090 //--------
4091
4092 if (gEDBDEBUGLEVEL>2) {
4093 cout << endl << endl << "--- Starting Shower for Number " << i << " now: "<<endl;
4094 InBT->PrintNice();
4095 }
4096 //-----------------------------------
4097
4098 //-----------------------------------
4099 // 1) Make local_gAli with cut parameters:
4100 //-----------------------------------
4101 local_gAli = TransformEdbPVRec(GLOBAL_gAli, InBT);
4102 // Add InBT to GLOBAL_ShowerSegArray
4103 GLOBAL_ShowerSegArray -> Add(InBT);
4104 //-----------------------------------
4105
4106
4107 //-----------------------------------
4108 // 2) Loop over (whole) local_gAli, check InitiatorBT
4109 // 2) compatible with a segment forming a e+e- pair:
4110 //-----------------------------------
4111 Int_t NPairs=0,PIDDIFF=0,minPIDDIFF=0;
4112
4113 Int_t local_gAli_npat=local_gAli->Npatterns();
4114 Int_t btloop_cnt_N=0;
4115 for (Int_t patterloop_cnt=local_gAli_npat-1; patterloop_cnt>=0; --patterloop_cnt) {
4116 if (gEDBDEBUGLEVEL>3) cout << "--- --- Doing patterloop_cnt= " << patterloop_cnt << endl;
4117 btloop_cnt_N=local_gAli->GetPattern(patterloop_cnt)->GetN();
4118 if (local_gAli->GetPattern(patterloop_cnt)->Z()<InBT->Z()) continue;
4119 if (TMath::Abs(local_gAli->GetPattern(patterloop_cnt)->Z()-InBT->Z())>3000) continue;
4120 if (local_gAli->GetPattern(patterloop_cnt)->Z()<InBT->Z()) continue;
4121 for (Int_t btloop_cnt=0; btloop_cnt<btloop_cnt_N; ++btloop_cnt) {
4122 seg = (EdbSegP*)local_gAli->GetPattern(patterloop_cnt)->GetSegment(btloop_cnt);
4123 if (gEDBDEBUGLEVEL>3) seg->PrintNice();
4124 if (IsSameSegment(seg,InBT)) continue;
4125 PIDDIFF=TMath::Abs(seg->PID()-InBT->PID());
4126 if (GetMinimumDist(InBT,seg)>50) continue;
4127 if (GetdR(InBT,seg)>200) continue;
4128 if (GetdeltaThetaSingleAngles(InBT,seg)>0.5) continue;
4129 if (PIDDIFF>minPIDDIFF) continue;
4130 // cout << " GetMinimumDist(InBT,seg); " << GetMinimumDist(InBT,seg) << "PIDDIFF "<< PIDDIFF<< endl;
4131
4133 minPIDDIFF=PIDDIFF;
4134 }
4135 }
4137 // return;
4138
4139 //-----------------------------------
4140 // 2) Loop over (whole) local_gAli, check BT for Cuts
4141 //-----------------------------------
4142 if (gEDBDEBUGLEVEL>2) cout << "--- local_gAli_npat= " << local_gAli_npat << endl;
4143
4144 // Loop over all plates of local_gAli, since this is already
4145 // extracted with the right numbers of plates...
4146 for (Int_t patterloop_cnt=local_gAli_npat-1; patterloop_cnt>=0; --patterloop_cnt) {
4147 if (gEDBDEBUGLEVEL>3) cout << "--- --- Doing patterloop_cnt= " << patterloop_cnt << endl;
4148 btloop_cnt_N=local_gAli->GetPattern(patterloop_cnt)->GetN();
4149
4150 // if pattern is before the Initiator BT->Z() position we just go on:
4151 if (local_gAli->GetPattern(patterloop_cnt)->Z()<InBT->Z()) continue;
4152
4153 for (Int_t btloop_cnt=0; btloop_cnt<btloop_cnt_N; ++btloop_cnt) {
4154 seg = (EdbSegP*)local_gAli->GetPattern(patterloop_cnt)->GetSegment(btloop_cnt);
4155 if (gEDBDEBUGLEVEL>3) seg->PrintNice();
4156
4157 // Now apply cut conditions: Advanced Gamma Alg --------------------
4159 if (!FindPrecedingBTsSingleThetaAngle(seg, InBT, local_gAli, GLOBAL_ShowerSegArray)) continue;
4160 // end of cut conditions: Advanced Gamma Alg --------------------
4161
4162 // If we arrive here, Basetrack seg has passed criteria
4163 // and is then added to the shower array:
4164 // Check if its not the InBT which is already added:
4165 // if (IsSameSegment(seg,InBT)) { ; } // do nothing;
4166 // else {GLOBAL_ShowerSegArray -> Add(seg);}
4168 }
4169
4170
4171 // Calc BT density around shower:
4172 EdbPattern* pat_interim=local_gAli->GetPattern(patterloop_cnt);
4173 CalcTrackDensity(pat_interim,local_gAli_pat_interim_halfsize,npat_int,npat_total,npatN);
4174
4175 // Calc TrackNumbers for plate for efficency numbers:
4176 CalcEfficencyNumbers(pat_interim, InBT->MCEvt(), NBT_Neff, NBTMC_Neff,NBTMCe_Neff);
4177 }
4178 // end of loop over all plates of local_gAli
4179
4181
4182
4183
4184
4185 Int_t s_NBT=0;
4186 Int_t s_NBTMC=0;
4187 Int_t s_NBTallMC=0;
4188 Int_t s_NBTeMC=0;
4189 Double_t s_eff=0;
4190 Double_t s_purall=0;
4191 Double_t s_pure=0;
4192 CalcEffPurOfShower(GLOBAL_ShowerSegArray, s_NBT, s_NBTMC, s_NBTallMC, s_NBTeMC, s_purall, s_pure);
4193
4194 //-----------------------------------
4195 // 4) Calculate pur/eff/NBT numbers,
4196 // not needed when only reconstruction
4197 // done:
4198 //-----------------------------------
4199 if (cmd_OUTPUTLEVEL>=2 || cmd_OUTPUTLEVEL==0 ) {
4200 Int_t NBT=0;
4201 Int_t NBTMC=0;
4202 Int_t NBTallMC=0;
4203 Int_t NBTeMC=0;
4204 Double_t eff, purall, pure;
4205 CalcEffPurOfShower2(GLOBAL_ShowerSegArray, NBT, NBTMC, NBTallMC, NBTeMC, purall, pure, NBT_Neff, NBTMC_Neff,NBTMCe_Neff);
4206
4207 // Fill only for MC Event:
4208 if (GLOBAL_InBT_MC>0) {
4213 }
4215 }
4216
4217
4218 //-----------------------------------
4219 // 5) Fill Tree:
4220 //-----------------------------------
4221 TREE_ShowRecEff->Fill();
4222 if (gEDBDEBUGLEVEL>3) TREE_ShowRecEff->Show(TREE_ShowRecEff->GetEntries()-1);
4223
4224
4225 //-----------------------------------
4226 // 6a) Transfer ShowerArray to treebranchTreeEntry:
4227 //-----------------------------------
4228 if (cmd_OUTPUTLEVEL>0) {
4230 }
4231
4232
4233 //------------------------------------
4234 // Reset and delete important things:
4235 // also to avoid memory problems ...
4236 //-----------------------------------
4237 GLOBAL_ShowerSegArray->Clear();
4238 if (gEDBDEBUGLEVEL>3) cout << "--- ---GLOBAL_ShowerSegArray->GetEntries(): "<< GLOBAL_ShowerSegArray->GetEntries() << endl;
4239 delete local_gAli;
4240 local_gAli=0;
4242 //------------------------------------
4243 }
4244 // end of loop over GLOBAL_InBTArrayEntries
4245 //-----------------------------------------------------------------
4246
4247 if (gEDBDEBUGLEVEL==2) cout << endl<<flush;
4248 if (gEDBDEBUGLEVEL>3) cout << "---TREE_ShowRecEff->GetEntries() ... " << TREE_ShowRecEff->GetEntries() << endl;
4249 if (gEDBDEBUGLEVEL>3) cout << "---GLOBAL_INBTSHOWERNR ... " << GLOBAL_INBTSHOWERNR<< endl;
4250
4251
4252 return;
4253}
void CalcEffPurOfShower(TObjArray *arr, Int_t &NBT, Int_t &NBTMC, Int_t &NBTallMC, Int_t &NBTeMC, Double_t &purall, Double_t &pure)
Definition: ShowRec.cpp:7597
Bool_t IsSameSegment(EdbSegP *seg1, EdbSegP *seg2)
Definition: ShowRec.cpp:8857
Bool_t AddBTToArrayWithCeck(EdbSegP *tryAttachedSegment, TObjArray *GLOBAL_ShowerSegArray)
Definition: ShowRec.cpp:5939
void CalcTrackDensity(EdbPattern *pat_interim, Float_t pat_interim_halfsize, Int_t &npat_int, Int_t &npat_total, Int_t &npatN)
Definition: ShowRec.cpp:8749
void TransferShowerObjectArrayIntoEntryOfTreebranchShowerTree(TTree *treebranchtree, TObjArray *segarray)
Definition: ShowRec.cpp:7940
Bool_t FindPrecedingBTsSingleThetaAngle(EdbSegP *s, EdbSegP *InBT, EdbPVRec *gAli, TObjArray *showersegarray)
Definition: ShowRec.cpp:6825
void CalcEffPurOfShower2(TObjArray *arr, Int_t &NBT, Int_t &NBTMC, Int_t &NBTallMC, Int_t &NBTeMC, Double_t &purall, Double_t &pure, Int_t NBT_Neff, Int_t NBTMC_Neff, Int_t NBTMCe_Neff)
Definition: ShowRec.cpp:7631
void PrintShowerObjectArray(TObjArray *segarray)
Definition: ShowRec.cpp:6967
EdbPVRec * TransformEdbPVRec(EdbPVRec *gAli, EdbSegP *InitiatorBT)
DEBUG OPENMP TEST!!!!!!!
Definition: ShowRec.cpp:6299
Bool_t GetConeOrTubeDistanceToBTOfShowerArray(EdbSegP *sa, EdbSegP *InBT, TObjArray *showersegarray, Double_t CylinderRadius, Double_t ConeAngle)
Definition: ShowRec.cpp:7072
Double_t GetMinimumDist(EdbSegP *seg1, EdbSegP *seg2)
Definition: ShowRec.cpp:8581
void CalcEfficencyNumbers(EdbPattern *pat_interim, Int_t MCCheck, Int_t &NBT_Neff, Int_t &NBTMC_Neff, Int_t &NBTMCe_Neff)
Definition: ShowRec.cpp:8771
Double_t GetdR(EdbSegP *s1, EdbSegP *s2)
Definition: ShowRec.h:167
Int_t GLOBAL_InBTArrayEntries
Definition: ShowRec.h:75
Float_t P() const
Definition: EdbSegP.h:152

◆ ReconstructShowers_BW()

void ReconstructShowers_BW ( )

return; -----------------------------------------------------------------------—

3650{
3651 Log(2, "ShowRec.cpp", "--- void ReconstructShowers_BW() ---");
3652
3653 //-----------------------------------------------------------------
3654 // Main function for reconstruction of "BackWard" Algorithm
3655 //-----------------------------------------------------------------
3656
3657 //-----------------------------------
3658 // For each InitiatorBT this is
3659 // divided in several small parts:
3660 //
3661 // 1) Make local_gAli with cut parameters, Make GetPID of InBT and corresponding of plates
3662 // 3) Loop over (whole) local_gAli, check BT for Cuts
3663 // 4) Calculate pur/eff/NBT numbers
3664 // 5) Fill Trees
3665 //-----------------------------------
3666
3667 //-----------------------------------
3668 // Algorithm Iteration Steps:
3669 //
3670 // 0) Start Adjust Shower Axis, Virtual Vertex
3671 // 0) Calc dR/dT/dIP(trk,trk) to same plate.
3672 // ---Loop up to firstplate;
3673 // // ---Loop for deltaN (plate)=1,2,3:
3674 // // // 1) Calc dR/dT/dIP(trk,trk) to backward plate.
3675 // // // 1) Check for already in shower array; add BT to shower
3676 // // // 1) Adjust Shower Axis, Adjust Virtual Vertex
3677 // // ---Loop for deltaN (plate)=1,2,3:
3678 // ---Loop up to firstplate;
3679 // 2) Adjust Shower Axis, Virtual Vertex.
3680 //
3681 //-----------------------------------
3682
3683
3684 // Define Helper Variables:
3685 EdbPVRec* local_gAli;
3686 EdbSegP* InBT;
3687 EdbSegP* seg;
3688 EdbSegP* segShower;
3689 EdbSegP* ShowerAxis;
3690 EdbVertex* VirtualVertex;
3691 Float_t local_gAli_pat_interim_halfsize=0;
3692 Double_t dR,dT,dminDist;
3693
3696
3697 //-----------------------------------------------------------------
3698 // Since GLOBAL_InBTArray is filled in ascending ordering by zpositon
3699 // We use the descending loop to begin with BT with lowest z first.
3700 for (Int_t i=GLOBAL_InBTArrayEntries-1; i>=0; --i) {
3701
3702 //-----------------------------------
3703 // CounterOutPut
3704 if (gEDBDEBUGLEVEL==2) if ((i%1)==0) cout << GLOBAL_InBTArrayEntries <<" InBT in total, still to do:"<<Form("%4d",i)<< "\r\r\r\r"<<flush;
3705 //-----------------------------------
3706
3707 //-----------------------------------
3708 // Get InitiatorBT from GLOBAL_InBTArray
3709 InBT=(EdbSegP*)GLOBAL_InBTArray->At(i);
3710 //--------
3711 GLOBAL_InBT_E=InBT->P();
3712 GLOBAL_InBT_TanTheta=TMath::Sqrt(InBT->TX()*InBT->TX()+InBT->TY()*InBT->TY());
3713 GLOBAL_InBT_Flag=InBT->Flag();
3714 GLOBAL_InBT_MC=InBT->MCEvt();
3715 //--------
3716 Int_t local_NBT=0;
3717 Int_t local_NBTMC=0;
3718 Int_t local_NBTallMC=0;
3719 Int_t local_NBTeMC=0;
3720 float_t local_pure=-1;
3721 float_t local_purall=-1;
3722 Int_t npat_int=0;
3723 Int_t npat_total=0;
3724 Int_t npatN=0;
3725 Int_t show_NP=0;
3726 Int_t npat_Neff=0;
3727 Int_t NBT_Neff=0;
3728 Int_t NBTMC_Neff=0;
3729 Int_t NBTMCe_Neff=0;
3730 //--------
3731
3732 if (gEDBDEBUGLEVEL!=2) {
3733 cout << endl << endl << "--- Starting Shower for Number " << i << " (MCEvt=" << InBT->MCEvt() << ") now: "<<endl;
3734 InBT->PrintNice();
3735 cout << "InBT->P() " << InBT->P() << endl;
3736 }
3737 //-----------------------------------
3738
3739 //-----------------------------------
3740 // 1) Make local_gAli with cut parameters:
3741 //-----------------------------------
3742 local_gAli = TransformEdbPVRec_BackWard(GLOBAL_gAli, InBT);
3743 // Add InBT to GLOBAL_ShowerSegArray
3744 GLOBAL_ShowerSegArray -> Add(InBT);
3745 if (gEDBDEBUGLEVEL>2) cout << "--- TransformEdbPVRec done."<<endl;
3746 //-----------------------------------
3747
3748
3749 //-----------------------------------
3750 // 2) Start at plate for Initator BT:
3751 //-----------------------------------
3752 Int_t local_gAli_npat=local_gAli->Npatterns();
3753 Int_t btloop_cnt_N=0;
3754 // if (gEDBDEBUGLEVEL>2)
3755 cout << "--- Starting BACKWARD Reco... ---" << endl;
3756 if (gEDBDEBUGLEVEL>2) cout << "--- local_gAli_npat= " << local_gAli_npat << endl;
3757
3758 Int_t patterloop_cnt_InBT=-1;
3759 Float_t patterloop_cnt_InBT_Z=0;
3760 for (Int_t patterloop_cnt=0; patterloop_cnt<local_gAli_npat; patterloop_cnt++) {
3761 if (gEDBDEBUGLEVEL>3) cout << "--- --- Doing patterloop_cnt= " << patterloop_cnt << endl;
3762 // if pattern is after the Initiator BT->Z() position we stop:
3763 if (local_gAli->GetPattern(patterloop_cnt)->Z()<InBT->Z()) continue;
3764 patterloop_cnt_InBT=patterloop_cnt;
3765 patterloop_cnt_InBT_Z=local_gAli->GetPattern(patterloop_cnt)->Z();
3766 }
3767 if (gEDBDEBUGLEVEL>2) cout << "--- patterloop_cnt_InBT= " << patterloop_cnt_InBT << endl;
3768 if (gEDBDEBUGLEVEL>2) cout << "--- patterloop_cnt_InBT_Z= " << patterloop_cnt_InBT_Z << endl;
3769
3770 // Check wich Steptype is needed for BackwardStepping:
3771 // Convention: -1 if Patter(0)_Z<Pattern(npat)_Z
3772 // Convention: +1 if Patter(0)_Z>Pattern(npat)_Z
3773 Int_t StepNr=0;
3774 if (gEDBDEBUGLEVEL>2) cout << "local_gAli->GetPattern(0)->Z() " << local_gAli->GetPattern(0)->Z() << endl;
3775 if (gEDBDEBUGLEVEL>2) cout << "local_gAli->GetPattern(local_gAli_npat-1)->Z() " << local_gAli->GetPattern(local_gAli_npat-1)->Z() << endl;
3776 if (local_gAli->GetPattern(0)->Z() > local_gAli->GetPattern(local_gAli_npat-1)->Z()) {
3777 StepNr=1;
3778 }
3779 else {
3780 StepNr=-1;
3781 }
3782 if (gEDBDEBUGLEVEL>2) cout << "--- StepNr for going backwards (decreasing Z) to next plate= " << StepNr << endl;
3783
3784 // return;
3785 Bool_t FP_reached=kFALSE;
3786 Int_t patterloop_cnt=patterloop_cnt_InBT;
3787 if (StepNr==1) patterloop_cnt=patterloop_cnt_InBT;
3788 if (StepNr==-1) cout << "DONT KNOW HERE WHICH patterloop_cnt=local_gAli_npat-1; to calculate!!! " << endl;
3789
3790 // Loop over all plates of local_gAli, since this is already
3791 // extracted with the right numbers of plates...
3792 while (!FP_reached) {
3793 if (gEDBDEBUGLEVEL>2) cout << " FP NOT YET REACHED .... << doing patterloop_cnt = " << patterloop_cnt << endl;
3794 btloop_cnt_N=local_gAli->GetPattern(patterloop_cnt)->GetN();
3795 if (gEDBDEBUGLEVEL>2) cout << " FP NOT YET REACHED .... << with btloop_cnt_N = " << btloop_cnt_N << endl;
3796
3797 // Loop over all BTs in the actual plate. Calculate dR/dT/dIP to
3798 // all BTs which are already in the shower (at beginning it is
3799 // only the InBT.
3800 for (Int_t btloop_cnt=0; btloop_cnt<btloop_cnt_N; ++btloop_cnt) {
3801 seg = (EdbSegP*)local_gAli->GetPattern(patterloop_cnt)->GetSegment(btloop_cnt);
3802 if (gEDBDEBUGLEVEL>3) seg->PrintNice();
3803
3804 Bool_t add_seg=kFALSE;
3805 if (gEDBDEBUGLEVEL>3) cout << "btloop_cnt (ot of ) " << btloop_cnt << " ( " << btloop_cnt_N << " ) " << endl;
3806
3807 // Now apply cut conditions: BACKWARD Alg --------------------
3808 // Check for dTheta to tracks already in shower:
3809 Int_t actualEntries=GLOBAL_ShowerSegArray->GetEntries();
3810 if (gEDBDEBUGLEVEL>3) cout << "actualEntries of GLOBAL_ShowerSegArray: " << actualEntries << endl;
3811 for (int i=0; i<actualEntries; ++i) {
3812 segShower=(EdbSegP*)GLOBAL_ShowerSegArray->At(i);
3813 Float_t dZ=TMath::Abs(segShower->Z()-seg->Z());
3814 dT=GetdeltaThetaSingleAngles(seg,segShower); // DO NOT TAKE GetdeltaTheta since this is calculation based on absolute theta differences (not on TX,TY relative ones) !!
3815 dR=GetdR(seg,segShower);
3816 dminDist=GetMinimumDist(seg,segShower);
3817 if (gEDBDEBUGLEVEL>3) cout << "btloop_cnt i dT dR dminDist dZ: " << btloop_cnt << " " << i << " " << dT << " " << dR << " " << dminDist << " " << dZ << endl;
3818 if (TMath::Abs(dZ)>CUT_PARAMETER[3]) continue;
3819 if (TMath::Abs(dT)>CUT_PARAMETER[1]) continue;
3820 if (TMath::Abs(dR)>CUT_PARAMETER[2]) continue;
3821 if (TMath::Abs(dminDist)>CUT_PARAMETER[0]) continue;
3822 if (gEDBDEBUGLEVEL>3) cout << "try to add this BT (if not already in there...) "<< endl;
3823 add_seg=kTRUE;
3824 break;
3825 } // of for (int i=0; i<actualEntries; ++i)
3826 if (add_seg) {
3828 EdbSegP* BT_1=(EdbSegP*)GLOBAL_ShowerSegArray->At(0);
3829 EdbSegP* BT_2=(EdbSegP*)GLOBAL_ShowerSegArray->At(GLOBAL_ShowerSegArray->GetEntries()-1);
3830 show_NP=TMath::Max(show_NP,TMath::Abs(BT_1->PID()-BT_2->PID())+1);
3831 //cout << "show_NP = " << show_NP << endl;
3832 }
3833 } // of for (Int_t btloop_cnt=0; btloop_cnt<btloop_cnt_N; ++btloop_cnt)
3834
3835 // Now goto next plate:
3836 patterloop_cnt=patterloop_cnt+StepNr;
3837 if (patterloop_cnt<0) FP_reached=kTRUE;
3838 if (patterloop_cnt>=local_gAli_npat) FP_reached=kTRUE;
3839 // Or we stop also if the number of plates is more than cmd_NP
3840 if (show_NP>=cmd_NP) FP_reached=kTRUE;
3841 } // while (!FP_reached)
3842
3843
3845 if (cmd_OUTPUTLEVEL>=2 || cmd_OUTPUTLEVEL==0 ) {
3846 Int_t NBT=0;
3847 Int_t NBTMC=0;
3848 Int_t NBTallMC=0;
3849 Int_t NBTeMC=0;
3850 Double_t purall, pure;
3851 CalcEffPurOfShower(GLOBAL_ShowerSegArray, NBT, NBTMC, NBTallMC, NBTeMC, purall, pure);
3857 }
3858
3859 if (gEDBDEBUGLEVEL>2) cout << " Check if its sorted: GLOBAL_ShowerSegArray->At(0)->Z() should be the lowest one...continue;" << endl;
3860 if (gEDBDEBUGLEVEL>2) cout << " IsShowerSortedZ(GLOBAL_ShowerSegArray) " << IsShowerSortedZ(GLOBAL_ShowerSegArray) << endl;
3862
3863 // After Sort Shower we can build axis right now...
3865 ShowerAxis->PrintNice();
3866 Float_t mindTTT=999999;
3867 Int_t mindTTT_h=0;
3868 for (int h=0; h<GLOBAL_ShowerSegArray->GetEntries(); ++h) {
3869 segShower=(EdbSegP*)GLOBAL_ShowerSegArray->At(h);
3870 // segShower->PrintNice();
3871 if (segShower->Z()!=ShowerAxis->Z()) continue;
3872 Float_t dTTT = GetdeltaTheta(ShowerAxis,segShower); //cout << "dTTT = " << dTTT << endl;
3873 if (dTTT<mindTTT) {
3874 mindTTT=dTTT;
3875 mindTTT_h=h;
3876 }
3877 }
3878
3879 // Now here comes the forward (==downstream==inbeamdirection) reconstruction
3880 if (gEDBDEBUGLEVEL>2) cout << "--- Starting FORWARD Reco... ---" << endl;
3881
3882 // Just take the BT which is closest to shower axis:
3883 ShowerAxis=(EdbSegP*)GLOBAL_ShowerSegArray->At(mindTTT_h);
3884 GLOBAL_ShowerSegArray->Clear();
3885 // The First we have to add by hand because in the reco routine there has to be at least one BT to check.
3886 GLOBAL_ShowerSegArray->Add(ShowerAxis);
3887 if (gEDBDEBUGLEVEL>3) ShowerAxis->PrintNice();
3888
3889 for (Int_t patterloop_cnt=0; patterloop_cnt<local_gAli_npat; patterloop_cnt++) {
3890 if (gEDBDEBUGLEVEL>3) cout << "--- --- Doing patterloop_cnt= " << patterloop_cnt << endl;
3891 // if pattern is after the ShowerAxis BT->Z() position we stop:
3892 if (local_gAli->GetPattern(patterloop_cnt)->Z()<ShowerAxis->Z()) continue;
3893 patterloop_cnt_InBT=patterloop_cnt;
3894 patterloop_cnt_InBT_Z=local_gAli->GetPattern(patterloop_cnt)->Z();
3895 }
3896 if (gEDBDEBUGLEVEL>2) cout << "--- patterloop_cnt_InBT= " << patterloop_cnt_InBT << endl;
3897 if (gEDBDEBUGLEVEL>2) cout << "--- patterloop_cnt_InBT_Z= " << patterloop_cnt_InBT_Z << endl;
3898
3899 // InvertSpeNr now for forward Step:
3900 Int_t StepNrForward=StepNr*-1;
3901 StepNr=StepNrForward;
3902 show_NP=0;
3903
3904 Bool_t LP_reached=kFALSE;
3905 patterloop_cnt=patterloop_cnt_InBT;
3906
3907 while (!LP_reached) {
3908 if (gEDBDEBUGLEVEL>2) cout << " LP NOT YET REACHED .... << doing patterloop_cnt = " << patterloop_cnt << endl;
3909 btloop_cnt_N=local_gAli->GetPattern(patterloop_cnt)->GetN();
3910 if (gEDBDEBUGLEVEL>2) cout << " LP NOT YET REACHED .... << with btloop_cnt_N = " << btloop_cnt_N << endl;
3911
3912 // Loop over all BTs in the actual plate. Calculate dR/dT/dIP to
3913 // all BTs which are already in the shower (at beginning it is
3914 // only the InBT.
3915 for (Int_t btloop_cnt=0; btloop_cnt<btloop_cnt_N; ++btloop_cnt) {
3916 seg = (EdbSegP*)local_gAli->GetPattern(patterloop_cnt)->GetSegment(btloop_cnt);
3917 if (gEDBDEBUGLEVEL>3) seg->PrintNice();
3918 Bool_t add_seg=kFALSE;
3919 if (gEDBDEBUGLEVEL>3) cout << "btloop_cnt (ot of ) " << btloop_cnt << " ( " << btloop_cnt_N << " ) " << endl;
3920
3921 // Now apply cut conditions: BACKWARD Alg --------------------
3922 // Check for dTheta to tracks already in shower:
3923 Int_t actualEntries=GLOBAL_ShowerSegArray->GetEntries();
3924 if (gEDBDEBUGLEVEL>3) cout << "actualEntries of GLOBAL_ShowerSegArray: " << actualEntries << endl;
3925 for (int i=0; i<actualEntries; ++i) {
3926 segShower=(EdbSegP*)GLOBAL_ShowerSegArray->At(i);
3927 Float_t dZ=TMath::Abs(segShower->Z()-seg->Z());
3928 dT=GetdeltaThetaSingleAngles(seg,segShower); // DO NOT TAKE GetdeltaTheta since this is calculation based on absolute theta differences (not on TX,TY relative ones) !!
3929 dR=GetdR(seg,segShower);
3930 dminDist=GetMinimumDist(seg,segShower);
3931 if (gEDBDEBUGLEVEL>3) cout << "btloop_cnt i dT dR dminDist dZ: " << btloop_cnt << " " << i << " " << dT << " " << dR << " " << dminDist << " " << dZ << endl;
3932 if (TMath::Abs(dZ)>CUT_PARAMETER[7]) continue;
3933 if (TMath::Abs(dT)>CUT_PARAMETER[5]) continue;
3934 if (TMath::Abs(dR)>CUT_PARAMETER[6]) continue;
3935 if (TMath::Abs(dminDist)>CUT_PARAMETER[4]) continue;
3936 if (gEDBDEBUGLEVEL>3) cout << "try to add this BT (if not already in there...) "<< endl;
3937 add_seg=kTRUE;
3938 break;
3939 } // of for (int i=0; i<actualEntries; ++i)
3940 if (add_seg) {
3942 EdbSegP* BT_1=(EdbSegP*)GLOBAL_ShowerSegArray->At(0);
3943 EdbSegP* BT_2=(EdbSegP*)GLOBAL_ShowerSegArray->At(GLOBAL_ShowerSegArray->GetEntries()-1);
3944 show_NP=TMath::Max(show_NP,TMath::Abs(BT_1->PID()-BT_2->PID())+1);
3945 //cout << "show_NP = " << show_NP << endl;
3946 }
3947 } // of for (Int_t btloop_cnt=0; btloop_cnt<btloop_cnt_N; ++btloop_cnt)
3948
3949
3950 // Calc BT density around shower:
3951 EdbPattern* pat_interim=local_gAli->GetPattern(patterloop_cnt);
3952 CalcTrackDensity(pat_interim,local_gAli_pat_interim_halfsize,npat_int,npat_total,npatN);
3953
3954 // Calc TrackNumbers for plate for efficency numbers:
3955 CalcEfficencyNumbers(pat_interim, InBT->MCEvt(), NBT_Neff, NBTMC_Neff,NBTMCe_Neff);
3956
3957 // Now goto next plate:
3958 patterloop_cnt=patterloop_cnt+StepNr;
3959 if (patterloop_cnt<0) LP_reached=kTRUE;
3960 if (patterloop_cnt>=local_gAli_npat) LP_reached=kTRUE;
3961 // Or we stop also if the number of plates is more than cmd_NP
3962 if (show_NP>=cmd_NP) LP_reached=kTRUE;
3963
3964 } // of while (!LP_reached)
3966
3967 //-----------------------------------
3968 // 4) Calculate pur/eff/NBT numbers,
3969 // not needed when only reconstruction
3970 // done:
3971 //-----------------------------------
3972 if (cmd_OUTPUTLEVEL>=2 || cmd_OUTPUTLEVEL==0 ) {
3973 Int_t NBT=0;
3974 Int_t NBTMC=0;
3975 Int_t NBTallMC=0;
3976 Int_t NBTeMC=0;
3977 Double_t eff, purall, pure;
3978 CalcEffPurOfShower2(GLOBAL_ShowerSegArray, NBT, NBTMC, NBTallMC, NBTeMC, purall, pure, NBT_Neff, NBTMC_Neff,NBTMCe_Neff);
3979
3980 // Fill only for MC Event:
3981 if (GLOBAL_InBT_MC>0) {
3986 }
3988 }
3989
3990
3991
3992 //-----------------------------------
3993 // 5) Fill Tree:
3994 //-----------------------------------
3995 TREE_ShowRecEff->Fill();
3996 if (gEDBDEBUGLEVEL>3) TREE_ShowRecEff->Show(TREE_ShowRecEff->GetEntries()-1);
3997
3998
3999 //-----------------------------------
4000 // 6a) Transfer ShowerArray to treebranchTreeEntry:
4001 //-----------------------------------
4002 if (cmd_OUTPUTLEVEL>0) {
4004 }
4005
4006 //------------------------------------
4007 // Reset and delete important things:
4008 // also to avoid memory problems ...
4009 //-----------------------------------
4010 GLOBAL_ShowerSegArray->Clear();
4011 if (gEDBDEBUGLEVEL>3) cout << "--- ---GLOBAL_ShowerSegArray->GetEntries(): "<< GLOBAL_ShowerSegArray->GetEntries() << endl;
4012 delete local_gAli;
4013 local_gAli=0;
4015 //------------------------------------
4016 }
4017 // end of loop over GLOBAL_InBTArrayEntries
4018 //-----------------------------------------------------------------
4019
4020 if (gEDBDEBUGLEVEL==2) cout << endl<<flush;
4021 if (gEDBDEBUGLEVEL>3) cout << "---TREE_ShowRecEff->GetEntries() ... " << TREE_ShowRecEff->GetEntries() << endl;
4022 if (gEDBDEBUGLEVEL>3) cout << "---GLOBAL_INBTSHOWERNR ... " << GLOBAL_INBTSHOWERNR<< endl;
4023
4024
4025 return;
4026}
Bool_t IsShowerSortedZ(TObjArray *showerarray)
Definition: ShowRec.cpp:8801
void SortShowerZ(TObjArray *showerarray)
Definition: ShowRec.cpp:8816
EdbPVRec * TransformEdbPVRec_BackWard(EdbPVRec *gAli, EdbSegP *InitiatorBT)
Definition: ShowRec.cpp:6413
EdbSegP * BuildShowerAxis(TObjArray *ShowerSegArray)
Definition: ShowRec.cpp:8629

◆ ReconstructShowers_CA()

void ReconstructShowers_CA ( )
2324{
2325 Log(2, "ShowRec.cpp", "--- void ReconstructShowers_CA() ---");
2326
2327 //-----------------------------------------------------------------
2328 // Main function for reconstruction of ConeAdvanced Algorithm
2329 //-----------------------------------------------------------------
2330
2331 //-----------------------------------
2332 // For each InitiatorBT this is
2333 // divided in several small parts:
2334 //
2335 // 1) Make local_gAli with cut parameters, Make GetPID of InBT and corresponding of plates
2336 // 3) Loop over (whole) local_gAli, check BT for Cuts
2337 // 4) Calculate pur/eff/NBT numbers
2338 // 5) Fill Trees
2339 //-----------------------------------
2340
2341 // Define Helper Variables:
2342 EdbPVRec* local_gAli;
2343 EdbSegP* InBT;
2344 EdbSegP* seg;
2345 Float_t local_gAli_pat_interim_halfsize=0;
2346
2349 cout << "GLOBAL_InBTArrayEntries = " << GLOBAL_InBTArrayEntries << endl;
2350
2351
2352 //-----------------------------------------------------------------
2353 // Since GLOBAL_InBTArray is filled in ascending ordering by zpositon
2354 // We use the descending loop to begin with BT with lowest z first.
2355 for (Int_t i=GLOBAL_InBTArrayEntries-1; i>=0; --i) {
2356
2357 //-----------------------------------
2358 // CounterOutPut
2359 if (gEDBDEBUGLEVEL==2) if ((i%1)==0) cout << GLOBAL_InBTArrayEntries <<" InBT in total, still to do:"<<Form("%4d",i)<< "\r\r\r\r"<<flush;
2360 if (gEDBDEBUGLEVEL==1) {
2361 int modulo=GLOBAL_InBTArrayEntries/20;
2362 if ((i%modulo)==0) cout << i <<" : 5% more done"<<endl;
2363 }
2364 //-----------------------------------
2365
2366 //-----------------------------------
2367 // Get InitiatorBT from GLOBAL_InBTArray
2368 InBT=(EdbSegP*)GLOBAL_InBTArray->At(i);
2369 //--------
2370 GLOBAL_InBT_E=InBT->P();
2371 GLOBAL_InBT_TanTheta=TMath::Sqrt(InBT->TX()*InBT->TX()+InBT->TY()*InBT->TY());
2372 GLOBAL_InBT_Flag=InBT->Flag();
2373 GLOBAL_InBT_MC=InBT->MCEvt();
2374 //--------
2375 Int_t local_NBT=0;
2376 Int_t local_NBTMC=0;
2377 Int_t local_NBTallMC=0;
2378 Int_t local_NBTeMC=0;
2379 float_t local_pure=-1;
2380 float_t local_purall=-1;
2381 Int_t npat_int=0;
2382 Int_t npat_total=0;
2383 Int_t npatN=0;
2384 Int_t npat_Neff=0;
2385 Int_t NBT_Neff=0;
2386 Int_t NBTMC_Neff=0;
2387 Int_t NBTMCe_Neff=0;
2388 //--------
2389
2390 if (gEDBDEBUGLEVEL>2) {
2391 cout << endl << endl << "--- Starting Shower for Number " << i << " now: "<<endl;
2392 InBT->PrintNice();
2393 }
2394 //-----------------------------------
2395
2396 //-----------------------------------
2397 // 1) Make local_gAli with cut parameters:
2398 //-----------------------------------
2399 local_gAli = TransformEdbPVRec(GLOBAL_gAli, InBT);
2400 // Add InBT to GLOBAL_ShowerSegArray
2401 GLOBAL_ShowerSegArray -> Add(InBT);
2402 //-----------------------------------
2403
2404
2405 //-----------------------------------
2406 // 2) Loop over (whole) local_gAli, check BT for Cuts
2407 //-----------------------------------
2408 Int_t local_gAli_npat=local_gAli->Npatterns();
2409 if (gEDBDEBUGLEVEL>2) cout << "--- local_gAli_npat= " << local_gAli_npat << endl;
2410
2411 // Loop over all plates of local_gAli, since this is already
2412 // extracted with the right numbers of plates...
2413 for (Int_t patterloop_cnt=local_gAli_npat-1; patterloop_cnt>=0; --patterloop_cnt) {
2414 if (gEDBDEBUGLEVEL>3) cout << "--- --- Doing patterloop_cnt= " << patterloop_cnt << endl;
2415
2416 for (Int_t btloop_cnt=0; btloop_cnt<local_gAli->GetPattern(patterloop_cnt)->GetN(); ++btloop_cnt) {
2417 seg = (EdbSegP*)local_gAli->GetPattern(patterloop_cnt)->GetSegment(btloop_cnt);
2418 if (gEDBDEBUGLEVEL>3) seg->PrintNice();
2419
2420 // Now apply cut conditions: CA ConeAdvanced Alg --------------------
2421 if (!GetConeOrTubeDistanceToInBT(seg, InBT, CUT_PARAMETER[0], CUT_PARAMETER[1])) continue;
2422 if (!FindPrecedingBTs(seg, InBT, local_gAli, GLOBAL_ShowerSegArray)) continue;
2423 // end of cut conditions: CA ConeAdvanced Alg --------------------
2424
2425 // If we arrive here, Basetrack seg has passed criteria
2426 // and is then added to the shower array:
2427 // Check if its not the InBT which is already added:
2428 if (seg->X()==InBT->X()&&seg->Y()==InBT->Y()) {
2429 ; // do nothing;
2430 }
2431 else {
2432 GLOBAL_ShowerSegArray -> Add(seg);
2433 }
2434 }
2435 // Calc BT density around shower:
2436 EdbPattern* pat_interim=local_gAli->GetPattern(patterloop_cnt);
2437 CalcTrackDensity(pat_interim,local_gAli_pat_interim_halfsize,npat_int,npat_total,npatN);
2438
2439 // Calc TrackNumbers for plate for efficency numbers:
2440 CalcEfficencyNumbers(pat_interim, InBT->MCEvt(), NBT_Neff, NBTMC_Neff,NBTMCe_Neff);
2441 }
2442 // end of loop over all plates of local_gAli
2444
2445
2446 //-----------------------------------
2447 // 4) Calculate pur/eff/NBT numbers,
2448 // not needed when only reconstruction
2449 // done:
2450 //-----------------------------------
2451 if (cmd_OUTPUTLEVEL>=2 || cmd_OUTPUTLEVEL==0 ) {
2452 Int_t NBT=0;
2453 Int_t NBTMC=0;
2454 Int_t NBTallMC=0;
2455 Int_t NBTeMC=0;
2456 Double_t eff, purall, pure;
2457 CalcEffPurOfShower2(GLOBAL_ShowerSegArray, NBT, NBTMC, NBTallMC, NBTeMC, purall, pure, NBT_Neff, NBTMC_Neff,NBTMCe_Neff);
2458
2459 // Fill only for MC Event:
2460 if (GLOBAL_InBT_MC>0) {
2465 }
2467 }
2468
2469
2470 //-----------------------------------
2471 // 5) Fill Tree:
2472 //-----------------------------------
2473 TREE_ShowRecEff->Fill();
2474 if (gEDBDEBUGLEVEL>3) TREE_ShowRecEff->Show(TREE_ShowRecEff->GetEntries()-1);
2475
2476
2477 //-----------------------------------
2478 // 6a) Transfer ShowerArray to treebranchTreeEntry:
2479 //-----------------------------------
2480 if (cmd_OUTPUTLEVEL>0) {
2482 }
2483
2484
2485 //------------------------------------
2486 // Reset and delete important things:
2487 // also to avoid memory problems ...
2488 //-----------------------------------
2489 GLOBAL_ShowerSegArray->Clear();
2490 if (gEDBDEBUGLEVEL>3) cout << "--- ---GLOBAL_ShowerSegArray->GetEntries(): "<< GLOBAL_ShowerSegArray->GetEntries() << endl;
2491 delete local_gAli;
2492 local_gAli=0;
2494 //------------------------------------
2495 }
2496 // end of loop over GLOBAL_InBTArrayEntries
2497 //-----------------------------------------------------------------
2498
2499 if (gEDBDEBUGLEVEL==2) cout << endl<<flush;
2500 if (gEDBDEBUGLEVEL>3) cout << "---TREE_ShowRecEff->GetEntries() ... " << TREE_ShowRecEff->GetEntries() << endl;
2501 if (gEDBDEBUGLEVEL>3) cout << "---GLOBAL_INBTSHOWERNR ... " << GLOBAL_INBTSHOWERNR<< endl;
2502
2503
2504 return;
2505}
Bool_t FindPrecedingBTs(EdbSegP *s, EdbSegP *InBT, EdbPVRec *gAli, TObjArray *showersegarray)
Definition: ShowRec.cpp:6764

◆ ReconstructShowers_CL()

void ReconstructShowers_CL ( )

=== DEBUG===

===END DEBUG===

===DEBUG===

====== DEBUG===

===END DEBUG===

if (sa->X()<LeftX || sa->X()>RightX || sa->Y()<LeftY || sa->Y()>RightY) continue; /// DEBUG

–val_tan; // Project the last on beack to its owns


==== Now loop over the Grouped plates and search for spectrum peaks in each groupedPlate...

Set the bin arrays for the Spectrum...


Fit each grouped Plate with Spectrum...


.------------—

Fill interimSpectrum For Drawing... without the THRESHOLD_SMOOTHED_DEST Cut to find Maximum

Fill interimSpectrum For Drawing...only when Entry is > THRESHOLD_SMOOTHED_DEST * Maximum THRESHOLD_SMOOTHED_DEST is in % Units of Maxium...

end of loop over the Grouped plates

1559{
1560 Log(2, "ShowRec.cpp", "--- void ReconstructShowers_CL() ---");
1561
1562 //-----------------------------------------------------------------
1563 // Main function for reconstruction of CLuster Algorithm
1564 //-----------------------------------------------------------------
1565 //
1566 // For each InitiatorBT this is
1567 // divided in several small parts:
1568 // 1) Make local_gAli with cut parameters, Make GetPID of InBT and corresponding of plates
1569 // 3) Loop over (whole) local_gAli, check BT for Cuts
1570 // 4) Calculate pur/eff/NBT numbers
1571 // 5) Fill Trees
1572 //-----------------------------------
1573
1574 //-----------------------------------
1575 // 0) Predefinitions
1576 //-----------------------------------
1577
1578 // Set ClusterBoxSize of X,Y in microns: (f.e. 50x50)
1579 Float_t BOXSIZE=50;
1580 Float_t ClusterBoxSizeX=BOXSIZE;
1581 Float_t ClusterBoxSizeY=ClusterBoxSizeX;
1582 Float_t ClusterBoxSize[]= {ClusterBoxSizeX,ClusterBoxSizeY};
1583
1584 // Set GLOBAL Boundaries of the BrickSize, depends on your MC Simulation and on your scanned BG size
1585 // Later we will set the frame size, which can be f.e. 1mmX1mm, 3mmX3mm ...
1586 // This does not need to be changed...
1587 Float_t LeftX=-11000;
1588 Float_t RightX=21000;
1589 Float_t LeftY=-11000;
1590 Float_t RightY=16000;
1591
1592 cout << " ......."<<endl;
1593 // Set SquareSize of The gAliSub -> Coorseponds to the totral scan Area:
1594 Float_t VIEWSIZE=1000;
1595 Float_t gAliSub_Length_X=VIEWSIZE;
1596 Float_t gAliSub_Length_Y=VIEWSIZE; //1mm
1597
1598 // Calculate how many NbinsX,Y are needed:
1599 Int_t NbinsX=Int_t((RightX-LeftX)/ClusterBoxSizeX);
1600 Int_t NbinsY=Int_t((RightY-LeftY)/ClusterBoxSizeY);
1601
1602
1603 cout << " ......."<<endl;
1604
1605 Int_t NPLATES=GLOBAL_gAli->Npatterns();
1606 Int_t NbinsZ=NPLATES;
1607
1608 // Calculate how many NbinsX,Y are needed:
1609 Int_t NbinsX_gAliSub=Int_t((gAliSub_Length_X)/ClusterBoxSizeX);
1610 Int_t NbinsY_gAliSub=Int_t((gAliSub_Length_Y)/ClusterBoxSizeY);
1611
1612 // Arrays for the Spectrum source and dests...
1613 // Float_t ** source = new float *[NbinsX];
1614 Double_t ** source = new double *[NbinsX];
1615 for (Int_t cnti=0; cnti<NbinsX; cnti++) {
1616 // source[cnti]=new float[NbinsY];
1617 source[cnti]=new double[NbinsY];
1618 }
1619 // Float_t ** dest = new float *[NbinsX];
1620 Double_t ** dest = new double *[NbinsX];
1621 for (Int_t cnti=0; cnti<NbinsX; cnti++) {
1622 // dest[cnti]=new float[NbinsY];
1623 dest[cnti]=new double[NbinsY];
1624 }
1625
1626 // Arrays for the Spectrum source and dests...
1627 // Unused ??? Not to be found in any other part of the code ...
1628 // Comment out!
1629 /*
1630 Float_t ** source_gAliSub = new float *[NbinsX_gAliSub];
1631 for (Int_t cnti=0; cnti<NbinsX_gAliSub; cnti++) {
1632 source_gAliSub[cnti]=new float[NbinsY_gAliSub];
1633 }
1634 Float_t ** dest_gAliSub = new float *[NbinsX_gAliSub];
1635 for (Int_t cnti=0; cnti<NbinsX_gAliSub; cnti++) {
1636 dest_gAliSub[cnti]=new float[NbinsY_gAliSub];
1637 }
1638 */
1639
1640 // Fill Extrapolated BT with direction into next plate?
1641 Bool_t FillTANData=kTRUE;
1642 cout << " ......."<<endl;
1643
1644 // Plates to be grouped Together:
1645 Int_t PLATESPERGROUP=1;
1646 Int_t FIRSTPLATE=0;
1647 Int_t LASTPLATE=0;
1648 Int_t MAXPLATE=GLOBAL_gAli->Npatterns()-1;
1649 Int_t NGroupedPLATES=ceil( (Double_t)NPLATES/(Double_t)PLATESPERGROUP);
1650
1651 // Spectrum Position Peaks
1652 Float_t* fPositionX;
1653 Float_t* fPositionY;
1654 Int_t fNPeaks;
1655
1656 // Start Position...
1657 Float_t StartPosX,StartPosY,StartPosTX,StartPosTY;
1658
1659 // Calculate the z-positions for the grouped plates:
1660 Float_t ZPosGroupedPlates[50];
1662 cout << "gAli->GetPattern(firstplate)->GetSegment(0)->Z; "<<GLOBAL_gAli->GetPattern(0)->Z()<<endl;
1663 cout << "gAli->GetPattern(lastplate)->GetSegment(0)->Z; "<<GLOBAL_gAli->GetPattern(GLOBAL_gAli->Npatterns()-1)->Z()<<endl;
1665
1666 for (Int_t i=0; i<NGroupedPLATES; i++) {
1667 ZPosGroupedPlates[i]=GLOBAL_gAli->GetPattern(0)->Z()+PLATESPERGROUP*1300*i;
1669 cout << "i PLATESPERGROUP NGroupedPLATES ZPosGroupedPlates[i] " << i << " " << PLATESPERGROUP << " " << NGroupedPLATES << " " << ZPosGroupedPlates[i] << " " << endl;
1670 }
1671
1673 if (gEDBDEBUGLEVEL==2) {
1674 cout << "NbinsX = " << NbinsX << endl;
1675 cout << "NbinsY = " << NbinsY << endl;
1676 cout << "NbinsZ = " << NbinsZ << endl;
1677 cout << "NbinsX_gAliSub = " << NbinsX_gAliSub << endl;
1678 cout << "NbinsY_gAliSub = " << NbinsY_gAliSub << endl;
1679 cout << "FIRSTPLATE= "<<FIRSTPLATE<<endl;
1680 cout << "LASTPLATE= "<<LASTPLATE<<endl;
1681 cout << "MAXPLATE= "<<MAXPLATE<<endl;
1682 cout << "NPLATES= "<<NPLATES<<endl;
1683 cout << "NGroupedPLATES= "<<NGroupedPLATES<<endl;
1684 cout << "PLATESPERGROUP= "<<PLATESPERGROUP<<endl;
1685 }
1687
1688 //=========================================
1689 // Create the 2Dim Histograms:
1691 // Create the 2Dim Histograms:
1692 Hist2DimOnlyBGAllPlates= new TH2F();
1695 // Create the 3Dim Histograms:
1696 Hist3DimOnlyBG = new TH3F();
1697 Hist3DimRecoEvent_gAli = new TH3F();
1698 //=========================================
1699 // Allocate TSectrum2 pointer on the heap, and try to speed up program....
1700 spectrum2dim= new TSpectrum2();
1701 spectrum2dim->Print();
1702 //=========================================
1703
1704
1705 // Define Helper Variables:
1706 EdbPVRec* local_gAli;
1707 EdbSegP* InBT;
1708 EdbSegP* seg;
1709 Float_t local_gAli_pat_interim_halfsize=0;
1710
1713 cout << "GLOBAL_InBTArrayEntries = " << GLOBAL_InBTArrayEntries << endl;
1714
1715 TClonesArray *as;
1716 EdbSegP *sa;
1717 EdbPattern *as_pattern;
1718 EdbPattern *as_pattern_sub;
1719
1720
1721 //-----------------------------------------------------------------
1722 // Since GLOBAL_InBTArray is filled in ascending ordering by zpositon
1723 // We use the descending loop to begin with BT with lowest z first.
1724 // for (Int_t i=GLOBAL_InBTArrayEntries-1; i>=0; --i) {
1725 for (Int_t i=GLOBAL_InBTArrayEntries-1; i>=GLOBAL_InBTArrayEntries-1; --i) {
1726
1727 //-----------------------------------
1728 // CounterOutPut
1729 if (gEDBDEBUGLEVEL==2) if ((i%1)==0) cout << GLOBAL_InBTArrayEntries <<" InBT in total, still to do:"<<Form("%4d",i)<< "\r\r\r\r"<<flush;
1730 if (gEDBDEBUGLEVEL==1) {
1731 int modulo=GLOBAL_InBTArrayEntries/20;
1732 if ((i%modulo)==0) cout << i <<" : 5% more done"<<endl;
1733 }
1734 //-----------------------------------
1735
1736 //-----------------------------------
1737 // Get InitiatorBT from GLOBAL_InBTArray
1738 InBT=(EdbSegP*)GLOBAL_InBTArray->At(i);
1739 //--------
1740 GLOBAL_InBT_E=InBT->P();
1741 GLOBAL_InBT_TanTheta=TMath::Sqrt(InBT->TX()*InBT->TX()+InBT->TY()*InBT->TY());
1742 GLOBAL_InBT_Flag=InBT->Flag();
1743 GLOBAL_InBT_MC=InBT->MCEvt();
1744 //--------
1745 Int_t local_NBT=0;
1746 Int_t local_NBTMC=0;
1747 Int_t local_NBTallMC=0;
1748 Int_t local_NBTeMC=0;
1749 float_t local_pure=-1;
1750 float_t local_purall=-1;
1751 Int_t npat_int=0;
1752 Int_t npat_total=0;
1753 Int_t npatN=0;
1754 Int_t npat_Neff=0;
1755 Int_t NBT_Neff=0;
1756 Int_t NBTMC_Neff=0;
1757 Int_t NBTMCe_Neff=0;
1758 //--------
1759
1760 if (gEDBDEBUGLEVEL>2) {
1761 cout << endl << endl << "--- Starting Shower for Number " << i << " now: "<<endl;
1762 InBT->PrintNice();
1763 }
1764 //-----------------------------------
1765
1766 //-----------------------------------
1767 // 1) Make local_gAli with cut parameters:
1768 //-----------------------------------
1769 local_gAli = TransformEdbPVRec(GLOBAL_gAli, InBT);
1770 // Add InBT to GLOBAL_ShowerSegArray
1771 GLOBAL_ShowerSegArray -> Add(InBT);
1772 //-----------------------------------
1773
1774 //-----------------------------------
1775 // 1a) Set Some Variables
1776 //-----------------------------------
1777 StartPosX=InBT->X();
1778 StartPosY=InBT->Y();
1779 StartPosTX=InBT->TX();
1780 StartPosTY=InBT->TY();
1781 //-----------------------------------
1782
1783 //-----------------------------------
1784 // 1b) Now SetBins for the 2D, 3D Histograms for THIS (specific) Event
1785 //-----------------------------------
1786
1787 cout << "Reset now some other histos"<<endl;
1788 for (Int_t h=0; h<50; h++) {
1792 }
1793
1794 cout << "Reset now some other SetNameTitle "<<endl;
1795 Hist2DimOnlyBGAllPlates->SetNameTitle("Hist2DimOnlyBGAllPlates","Hist2DimOnlyBGAllPlates");
1796 Hist2DimOnlySimOneEventAllPlates->SetNameTitle("Hist2DimOnlySimOneEventAllPlates","Hist2DimOnlySimOneEventAllPlates");
1797 Hist2DimBGAndSimOneEventAllPlates->SetNameTitle("Hist2DimBGAndSimOneEventAllPlates","Hist2DimBGAndSimOneEventAllPlates");
1798 Hist2DimOnlyBGAllPlates->SetBins( NbinsX_gAliSub, StartPosX-gAliSub_Length_X/2.0, StartPosX +gAliSub_Length_X/2.0, NbinsY_gAliSub, StartPosY-gAliSub_Length_Y/2.0, StartPosY +gAliSub_Length_Y/2.0);
1799 Hist2DimOnlySimOneEventAllPlates->SetBins( NbinsX_gAliSub, StartPosX-gAliSub_Length_X/2.0, StartPosX +gAliSub_Length_X/2.0, NbinsY_gAliSub, StartPosY-gAliSub_Length_Y/2.0, StartPosY +gAliSub_Length_Y/2.0);
1800 Hist2DimBGAndSimOneEventAllPlates->SetBins( NbinsX_gAliSub, StartPosX-gAliSub_Length_X/2.0, StartPosX +gAliSub_Length_X/2.0, NbinsY_gAliSub, StartPosY-gAliSub_Length_Y/2.0, StartPosY +gAliSub_Length_Y/2.0);
1801
1802 cout << "Reset now some other SetNameTitle "<<endl;
1803 Hist3DimOnlyBG->SetNameTitle("Hist3DimOnlyBG","Hist3DimOnlyBG");
1804 Hist3DimOnlyBG->SetBins( NbinsX_gAliSub, StartPosX -gAliSub_Length_X/2.0, StartPosX +gAliSub_Length_X/2.0, NbinsY_gAliSub, StartPosY -gAliSub_Length_Y/2.0, StartPosY +gAliSub_Length_Y/2.0, NGroupedPLATES, (FIRSTPLATE-1)*1300, NbinsZ*1300);
1805 Hist3DimRecoEvent_gAli->SetNameTitle("Hist3DimRecoEvent_gAli","Hist3DimRecoEvent_gAli");
1806 Hist3DimRecoEvent_gAli->SetBins( NbinsX, LeftX, RightX, NbinsY, LeftY, RightY, NGroupedPLATES, (FIRSTPLATE-1)*1300, (LASTPLATE)*1300);
1807
1808 cout << "Reset now some other SetNameTitle "<<endl;
1809 Hist2DimOnlyBGAllPlates->Reset();
1812 Hist3DimOnlyBG->Reset();
1813 Hist3DimRecoEvent_gAli->Reset();
1814
1815 //-----------------------------------
1816 // 1c) Define the Histograms Bounds and Bins,
1817 // 1c) Since Bounds are depending on h ...
1818 //-----------------------------------
1819 Float_t InBT_X=InBT->X();
1820 Float_t InBT_TX=InBT->TX();
1821 Float_t InBT_X_Extrapolated;
1822 Float_t InBT_Y=InBT->Y();
1823 Float_t InBT_TY=InBT->TY();
1824 Float_t InBT_Y_Extrapolated;
1825 Float_t InBT_Z=InBT->Z();
1826 for (Int_t h=0; h<NGroupedPLATES; h++) {
1827 //cout << "--------------------"<<endl;
1828 Float_t zdiff=ZPosGroupedPlates[h]-InBT_Z;
1829 InBT_X_Extrapolated=InBT_X+InBT_TX*zdiff;
1830 InBT_Y_Extrapolated=InBT_Y+InBT_TY*zdiff;
1831 cout << "h InBT_X InBT_TX InBT_Z ZPosGroupedPlates[h] zdiff InBT_X_Extrapolated " << h << " " << InBT_X << " " << InBT_TX << " " << InBT_Z << " " << ZPosGroupedPlates[h] << " " << zdiff << " " <<InBT_X_Extrapolated << endl;
1832 cout << "h InBT_Y InBT_TY InBT_Z ZPosGroupedPlates[h] zdiff InBT_Y_Extrapolated " << h << " " << InBT_Y << " " << InBT_TY << " " << InBT_Z << " " << ZPosGroupedPlates[h] << " " << zdiff << " " <<InBT_Y_Extrapolated << endl;
1833 Hist2DimOnlyBGOneGroupedPlate[h]->SetBins(NbinsX_gAliSub, InBT_X_Extrapolated-gAliSub_Length_X/2.0,InBT_X_Extrapolated+gAliSub_Length_X/2.0, NbinsY_gAliSub,InBT_Y_Extrapolated-gAliSub_Length_Y/2.0,InBT_Y_Extrapolated+gAliSub_Length_Y/2.0);
1834 Hist2DimOnlySimOneEventOneGroupedPlate[h]->SetBins(NbinsX_gAliSub, InBT_X_Extrapolated-gAliSub_Length_X/2.0,InBT_X_Extrapolated+gAliSub_Length_X/2.0, NbinsY_gAliSub,InBT_Y_Extrapolated-gAliSub_Length_Y/2.0,InBT_Y_Extrapolated+gAliSub_Length_Y/2.0);
1835 Hist2DimBGAndSimOneEventOneGroupedPlate[h]->SetBins(NbinsX_gAliSub, InBT_X_Extrapolated-gAliSub_Length_X/2.0,InBT_X_Extrapolated+gAliSub_Length_X/2.0, NbinsY_gAliSub,InBT_Y_Extrapolated-gAliSub_Length_Y/2.0,InBT_Y_Extrapolated+gAliSub_Length_Y/2.0);
1836 }
1837 //=========================================
1838
1839
1840
1841 //-----------------------------------
1842 // 1c) Loop over (whole) local_gAli, Fill the Histograms (from firstplate up to lastplate)
1843 //-----------------------------------
1844 Int_t val, val_tan;
1845 Int_t local_gAli_npat=local_gAli->Npatterns();
1846 if (gEDBDEBUGLEVEL>2) cout << "--- local_gAli_npat= " << local_gAli_npat << endl;
1847
1848 // Loop over all plates of local_gAli, since this is already
1849 // extracted with the right numbers of plates...
1850 for (Int_t patterloop_cnt=local_gAli_npat-1; patterloop_cnt>=0; --patterloop_cnt) {
1851 if (gEDBDEBUGLEVEL>3) cout << "--- --- Doing patterloop_cnt= " << patterloop_cnt << endl;
1852
1853 as = (TClonesArray*)local_gAli->GetPattern(patterloop_cnt)->GetSegments();
1854 as_pattern= (EdbPattern*)local_gAli->GetPattern(patterloop_cnt);
1855
1856 cout << "===DEBUG patterloop_cnt= " << patterloop_cnt << " Z pos (k) " << local_gAli->GetPattern(patterloop_cnt)->Z() << endl; // get Z pos of the plate k
1857 cout << "===DEBUG (patterloop_cnt) EdbSegments in the Pattern (total): " << as->GetEntries() << endl;
1858
1859 for (Int_t h=0; h<as->GetEntries(); h++) {
1860 sa = (EdbSegP*)( as->At(h) );
1862 val=Reco_CL_AssignZValueToGroup(sa->Z(), ZPosGroupedPlates[0], NGroupedPLATES, PLATESPERGROUP);
1863 cout << "entry, val "<<h << " " << val<<endl;
1864 Hist2DimBGAndSimOneEventOneGroupedPlate[val]->Fill(sa->X(),sa->Y());
1865 if (sa->MCEvt()<0) Hist2DimOnlyBGOneGroupedPlate[val]->Fill(sa->X(),sa->Y());
1866 if (FillTANData) {
1867 val_tan=Reco_CL_AssignZValueToGroup(sa->Z()+1300, ZPosGroupedPlates[0], NGroupedPLATES, PLATESPERGROUP);
1868 cout << "(TAN) entry, val_tan "<<h << " " << val_tan<<endl;
1869 if (val_tan>=NGroupedPLATES) {
1871 ++val_tan; // Project the last on beack to its owns
1872 cout << "(TAN) val_tan changed to "<<h << " " << val_tan<<endl;
1873 }
1874 Hist2DimBGAndSimOneEventOneGroupedPlate[val_tan]->Fill(sa->X()+sa->TX()*1300,sa->Y()+sa->TY()*1300);
1875 if (sa->MCEvt()<0) Hist2DimOnlyBGOneGroupedPlate[val_tan]->Fill(sa->X()+sa->TX()*1300,sa->Y()+sa->TY()*1300);
1876 }
1877 if (sa->MCEvt()<0) continue;
1878 if (sa->MCEvt()!=GLOBAL_InBT_MC) continue;
1879 cout << "=== ==DEBUG Filling i with MCEvt "<< i <<"("<< GLOBAL_InBT_MC <<") X,Y,Z: "<<sa->X()<<" "<<sa->Y()<<" "<<sa->Z()<<" "<<sa->MCEvt()<< " to val= " <<val <<endl;
1880 Hist2DimOnlySimOneEventOneGroupedPlate[val]->Fill(sa->X(),sa->Y());
1881 if (FillTANData) {
1882 Hist2DimOnlySimOneEventOneGroupedPlate[val_tan]->Fill(sa->X()+sa->TX()*1300,sa->Y()+sa->TY()*1300);
1883 }
1884 }
1885
1886 } //of Loop over all plates of local_gAli,
1887
1888
1889 cout<<endl<<endl;
1890 cout <<"Loop over the Grouped plates and search for spectrum peaks in each groupedPlate."<<endl;
1893 for (Int_t h=0; h<NGroupedPLATES; h++) {
1894
1896 for (Int_t cnti = 0; cnti < NbinsX_gAliSub; cnti++) {
1897 for (Int_t cntj = 0; cntj < NbinsY_gAliSub; cntj++) {
1898 source[cnti][cntj] = 0; // Reset source before filling it new...
1899 dest[cnti][cntj] = 0; // Reset dest before filling it new...
1900 source[cnti][cntj] = Hist2DimBGAndSimOneEventOneGroupedPlate[h]->GetBinContent(cnti + 1,cntj + 1);
1901 }
1902 }
1905 Int_t nfound=0;
1906 cout << " Do now peak search..."<<endl;
1907 nfound = spectrum2dim->SearchHighRes(source, dest, NbinsX_gAliSub, NbinsY_gAliSub, 2, 20, kTRUE, 10, kFALSE, 5);// TO BE OPTIMIZED...
1908 cout << " Peak search finished. Go on."<<endl;
1911 spectrum_interim->Reset();
1913 Int_t interimsbin=0;
1914 TAxis *xax;
1915 TAxis *yax;
1916 TAxis *zax;
1917 Double_t xax_bin_value;
1918 Double_t yax_bin_value;
1919 Double_t zax_bin_value;
1920 Double_t value;
1921
1923 for (Int_t ii = 0; ii < NbinsX_gAliSub; ii++) {
1924 for (Int_t jj = 0; jj < NbinsY_gAliSub; jj++) {
1925 value=dest[ii][jj];
1926 spectrum_interim->SetBinContent(ii + 1,jj + 1, value);
1927 }
1928 }
1929 Float_t THRESHOLD_SMOOTHED_DEST=0.5;
1930 cout << "THRESHOLD_SMOOTHED_DEST spectrum_interim->GetMaximum() : " << THRESHOLD_SMOOTHED_DEST << " " << spectrum_interim->GetMaximum()<< endl;
1931 cout << "----------_"<<endl;
1932
1933 Double_t spec_int_maximum=spectrum_interim->GetMaximum();
1934
1937 for (Int_t ii = 0; ii < NbinsX_gAliSub; ii++) {
1938 for (Int_t jj = 0; jj < NbinsY_gAliSub; jj++) {
1939 // cout << " h ii jj THRESHOLD_SMOOTHED_DEST dest[ii][jj] "<< h << " " << ii << " " << jj << " " << THRESHOLD_SMOOTHED_DEST << " " << dest[ii][jj] << endl;
1940 if (dest[ii][jj]<THRESHOLD_SMOOTHED_DEST*spec_int_maximum) continue;
1941 value=dest[ii][jj];
1942 spectrum_interim->SetBinContent(ii + 1,jj + 1, value);
1943 xax_bin_value=spectrum_interim->GetXaxis()->GetBinCenter(ii + 1);
1944 yax_bin_value=spectrum_interim->GetYaxis()->GetBinCenter(jj + 1);
1945 zax_bin_value=ZPosGroupedPlates[h];
1946 // cout <<" xax_bin ii jj (xyz) value "<< xax_bin_value << " " << ii << " " << jj<< " " <<xax_bin_value << " " << yax_bin_value<< " " << zax_bin_value<<" " << value << endl;
1947 Hist3DimRecoEvent_gAli->Fill(xax_bin_value,yax_bin_value,zax_bin_value, value);
1948 }
1949 }
1950 cout << "THRESHOLD_SMOOTHED_DEST spectrum_interim->GetMaximum() : " << THRESHOLD_SMOOTHED_DEST << " " << spectrum_interim->GetMaximum()<< endl;
1951 cout << "----------_"<<endl;
1952
1953 //AllGroupsSimPlusBGittedSpectrum->cd(h+1);
1954 //spectrum_interim->DrawCopy("colz");
1955 }
1958
1959
1960
1961
1962
1963 return;
1964
1965 //-----------------------------------
1966 // 2) Loop over (whole) local_gAli, check BT for Cuts
1967 //-----------------------------------
1968 // Int_t local_gAli_npat=local_gAli->Npatterns();
1969 if (gEDBDEBUGLEVEL>2) cout << "--- local_gAli_npat= " << local_gAli_npat << endl;
1970
1971 // Loop over all plates of local_gAli, since this is already
1972 // extracted with the right numbers of plates...
1973 for (Int_t patterloop_cnt=local_gAli_npat-1; patterloop_cnt>=0; --patterloop_cnt) {
1974 if (gEDBDEBUGLEVEL>3) cout << "--- --- Doing patterloop_cnt= " << patterloop_cnt << endl;
1975
1976 for (Int_t btloop_cnt=0; btloop_cnt<local_gAli->GetPattern(patterloop_cnt)->GetN(); ++btloop_cnt) {
1977 seg = (EdbSegP*)local_gAli->GetPattern(patterloop_cnt)->GetSegment(btloop_cnt);
1978 if (gEDBDEBUGLEVEL>3) seg->PrintNice();
1979
1980 // Now apply cut conditions: CT ConeTube Alg --------------------
1981 if (!GetConeOrTubeDistanceToInBT(seg, InBT, CUT_PARAMETER[0], CUT_PARAMETER[1])) continue;
1982 if (!FindPrecedingBTs(seg, InBT, local_gAli, GLOBAL_ShowerSegArray)) continue;
1983 // end of cut conditions: CT ConeTube Alg --------------------
1984
1985 // If we arrive here, Basetrack seg has passed criteria
1986 // and is then added to the shower array:
1987 // Check if its not the InBT which is already added:
1988 if (seg->X()==InBT->X()&&seg->Y()==InBT->Y()) {
1989 ; // do nothing;
1990 }
1991 else {
1992 GLOBAL_ShowerSegArray -> Add(seg);
1993 }
1994 }
1995 // Calc BT density around shower:
1996 EdbPattern* pat_interim=local_gAli->GetPattern(patterloop_cnt);
1997 CalcTrackDensity(pat_interim,local_gAli_pat_interim_halfsize,npat_int,npat_total,npatN);
1998
1999 // Calc TrackNumbers for plate for efficency numbers:
2000 CalcEfficencyNumbers(pat_interim, InBT->MCEvt(), NBT_Neff, NBTMC_Neff,NBTMCe_Neff);
2001 }
2002 // end of loop over all plates of local_gAli
2004
2005 //-----------------------------------
2006 // 4) Calculate pur/eff/NBT numbers,
2007 // not needed when only reconstruction
2008 // done:
2009 //-----------------------------------
2010 if (cmd_OUTPUTLEVEL>=2 || cmd_OUTPUTLEVEL==0 ) {
2011 Int_t NBT=0;
2012 Int_t NBTMC=0;
2013 Int_t NBTallMC=0;
2014 Int_t NBTeMC=0;
2015 Double_t eff, purall, pure;
2016 CalcEffPurOfShower2(GLOBAL_ShowerSegArray, NBT, NBTMC, NBTallMC, NBTeMC, purall, pure, NBT_Neff, NBTMC_Neff,NBTMCe_Neff);
2017
2018 // Fill only for MC Event:
2019 if (GLOBAL_InBT_MC>0) {
2024 }
2026 }
2027
2028
2029 //-----------------------------------
2030 // 5) Fill Tree:
2031 //-----------------------------------
2032 TREE_ShowRecEff->Fill();
2033 if (gEDBDEBUGLEVEL>3) TREE_ShowRecEff->Show(TREE_ShowRecEff->GetEntries()-1);
2034
2035
2036 //-----------------------------------
2037 // 6a) Transfer ShowerArray to treebranchTreeEntry:
2038 //-----------------------------------
2039 if (cmd_OUTPUTLEVEL>0) {
2041 }
2042
2043
2044 //------------------------------------
2045 // Reset and delete important things:
2046 // also to avoid memory problems ...
2047 //-----------------------------------
2048 GLOBAL_ShowerSegArray->Clear();
2049 if (gEDBDEBUGLEVEL>3) cout << "--- ---GLOBAL_ShowerSegArray->GetEntries(): "<< GLOBAL_ShowerSegArray->GetEntries() << endl;
2050 delete local_gAli;
2051 local_gAli=0;
2053 //------------------------------------
2054 }
2055 // end of loop over GLOBAL_InBTArrayEntries
2056 //-----------------------------------------------------------------
2057
2058 if (gEDBDEBUGLEVEL==2) cout << endl<<flush;
2059 if (gEDBDEBUGLEVEL>3) cout << "---TREE_ShowRecEff->GetEntries() ... " << TREE_ShowRecEff->GetEntries() << endl;
2060 if (gEDBDEBUGLEVEL>3) cout << "---GLOBAL_INBTSHOWERNR ... " << GLOBAL_INBTSHOWERNR<< endl;
2061
2062
2063 return;
2064}
void Reco_CL_BuildGlobalHistogramsOnHeap()
Definition: ShowRec.cpp:1872
Int_t Reco_CL_AssignZValueToGroup(Double_t z, Double_t z0, Int_t NGroupedPLATES, Int_t PLATESPerGroup)
Definition: ShowRec.cpp:1860
TH2F * spectrum_interim
Definition: ShowRec.h:358
TH3F * Hist3DimRecoEvent_gAli
Definition: ShowRec.h:354
TH3F * Hist3DimOnlyBG
Definition: ShowRec.h:353
TH2F * Hist2DimBGAndSimOneEventAllPlates
Definition: ShowRec.h:349
TH2F * Hist2DimOnlyBGAllPlates
Definition: ShowRec.h:347
TH2F * Hist2DimOnlySimOneEventAllPlates
Definition: ShowRec.h:348
TSpectrum2 * spectrum2dim
Definition: ShowRec.h:357
TClonesArray * GetSegments() const
Definition: EdbPattern.h:69
int MAXPLATE
Definition: shower_btr.C:19

◆ ReconstructShowers_CT()

void ReconstructShowers_CT ( )
2137{
2138 Log(2, "ShowRec.cpp", "--- void ReconstructShowers_CT() ---");
2139
2140 //-----------------------------------------------------------------
2141 // Main function for reconstruction of ConeTube Algorithm
2142 //-----------------------------------------------------------------
2143 //
2144 // For each InitiatorBT this is
2145 // divided in several small parts:
2146 // 1) Make local_gAli with cut parameters, Make GetPID of InBT and corresponding of plates
2147 // 3) Loop over (whole) local_gAli, check BT for Cuts
2148 // 4) Calculate pur/eff/NBT numbers
2149 // 5) Fill Trees
2150 //-----------------------------------
2151
2152 // Define Helper Variables:
2153 EdbPVRec* local_gAli;
2154 EdbSegP* InBT;
2155 EdbSegP* seg;
2156 Float_t local_gAli_pat_interim_halfsize=0;
2157
2160 cout << "GLOBAL_InBTArrayEntries = " << GLOBAL_InBTArrayEntries << endl;
2161
2162 //-----------------------------------------------------------------
2163 // Since GLOBAL_InBTArray is filled in ascending ordering by zpositon
2164 // We use the descending loop to begin with BT with lowest z first.
2165 for (Int_t i=GLOBAL_InBTArrayEntries-1; i>=0; --i) {
2166
2167 //-----------------------------------
2168 // CounterOutPut
2169 if (gEDBDEBUGLEVEL==2) if ((i%1)==0) cout << GLOBAL_InBTArrayEntries <<" InBT in total, still to do:"<<Form("%4d",i)<< "\r\r\r\r"<<flush;
2170 if (gEDBDEBUGLEVEL==1) {
2171 int modulo=GLOBAL_InBTArrayEntries/20;
2172 if ((i%modulo)==0) cout << i <<" : 5% more done"<<endl;
2173 }
2174 //-----------------------------------
2175
2176 //-----------------------------------
2177 // Get InitiatorBT from GLOBAL_InBTArray
2178 InBT=(EdbSegP*)GLOBAL_InBTArray->At(i);
2179 //--------
2180 GLOBAL_InBT_E=InBT->P();
2181 GLOBAL_InBT_TanTheta=TMath::Sqrt(InBT->TX()*InBT->TX()+InBT->TY()*InBT->TY());
2182 GLOBAL_InBT_Flag=InBT->Flag();
2183 GLOBAL_InBT_MC=InBT->MCEvt();
2184 //--------
2185 Int_t local_NBT=0;
2186 Int_t local_NBTMC=0;
2187 Int_t local_NBTallMC=0;
2188 Int_t local_NBTeMC=0;
2189 float_t local_pure=-1;
2190 float_t local_purall=-1;
2191 Int_t npat_int=0;
2192 Int_t npat_total=0;
2193 Int_t npatN=0;
2194 Int_t npat_Neff=0;
2195 Int_t NBT_Neff=0;
2196 Int_t NBTMC_Neff=0;
2197 Int_t NBTMCe_Neff=0;
2198 //--------
2199
2200 if (gEDBDEBUGLEVEL>2) {
2201 cout << endl << endl << "--- Starting Shower for Number " << i << " now: "<<endl;
2202 InBT->PrintNice();
2203 }
2204 //-----------------------------------
2205
2206 //-----------------------------------
2207 // 1) Make local_gAli with cut parameters:
2208 //-----------------------------------
2209 local_gAli = TransformEdbPVRec(GLOBAL_gAli, InBT);
2210 // Add InBT to GLOBAL_ShowerSegArray
2211 GLOBAL_ShowerSegArray -> Add(InBT);
2212 //-----------------------------------
2213
2214
2215 //-----------------------------------
2216 // 2) Loop over (whole) local_gAli, check BT for Cuts
2217 //-----------------------------------
2218 Int_t local_gAli_npat=local_gAli->Npatterns();
2219 if (gEDBDEBUGLEVEL>2) cout << "--- local_gAli_npat= " << local_gAli_npat << endl;
2220
2221 // Loop over all plates of local_gAli, since this is already
2222 // extracted with the right numbers of plates...
2223 for (Int_t patterloop_cnt=local_gAli_npat-1; patterloop_cnt>=0; --patterloop_cnt) {
2224 if (gEDBDEBUGLEVEL>3) cout << "--- --- Doing patterloop_cnt= " << patterloop_cnt << endl;
2225
2226 for (Int_t btloop_cnt=0; btloop_cnt<local_gAli->GetPattern(patterloop_cnt)->GetN(); ++btloop_cnt) {
2227 seg = (EdbSegP*)local_gAli->GetPattern(patterloop_cnt)->GetSegment(btloop_cnt);
2228 if (gEDBDEBUGLEVEL>3) seg->PrintNice();
2229
2230 // Now apply cut conditions: CT ConeTube Alg --------------------
2231 if (!GetConeOrTubeDistanceToInBT(seg, InBT, CUT_PARAMETER[0], CUT_PARAMETER[1])) continue;
2232 if (!FindPrecedingBTs(seg, InBT, local_gAli, GLOBAL_ShowerSegArray)) continue;
2233 // end of cut conditions: CT ConeTube Alg --------------------
2234
2235 // If we arrive here, Basetrack seg has passed criteria
2236 // and is then added to the shower array:
2237 // Check if its not the InBT which is already added:
2238 if (seg->X()==InBT->X()&&seg->Y()==InBT->Y()) {
2239 ; // do nothing;
2240 }
2241 else {
2242 GLOBAL_ShowerSegArray -> Add(seg);
2243 }
2244 }
2245 // Calc BT density around shower:
2246 EdbPattern* pat_interim=local_gAli->GetPattern(patterloop_cnt);
2247 CalcTrackDensity(pat_interim,local_gAli_pat_interim_halfsize,npat_int,npat_total,npatN);
2248
2249 // Calc TrackNumbers for plate for efficency numbers:
2250 CalcEfficencyNumbers(pat_interim, InBT->MCEvt(), NBT_Neff, NBTMC_Neff,NBTMCe_Neff);
2251 }
2252 // end of loop over all plates of local_gAli
2254
2255 //-----------------------------------
2256 // 4) Calculate pur/eff/NBT numbers,
2257 // not needed when only reconstruction
2258 // done:
2259 //-----------------------------------
2260 if (cmd_OUTPUTLEVEL>=2 || cmd_OUTPUTLEVEL==0 ) {
2261 Int_t NBT=0;
2262 Int_t NBTMC=0;
2263 Int_t NBTallMC=0;
2264 Int_t NBTeMC=0;
2265 Double_t eff, purall, pure;
2266 CalcEffPurOfShower2(GLOBAL_ShowerSegArray, NBT, NBTMC, NBTallMC, NBTeMC, purall, pure, NBT_Neff, NBTMC_Neff,NBTMCe_Neff);
2267
2268 // Fill only for MC Event:
2269 if (GLOBAL_InBT_MC>0) {
2274 }
2276 }
2277
2278
2279 //-----------------------------------
2280 // 5) Fill Tree:
2281 //-----------------------------------
2282 TREE_ShowRecEff->Fill();
2283 if (gEDBDEBUGLEVEL>3) TREE_ShowRecEff->Show(TREE_ShowRecEff->GetEntries()-1);
2284
2285
2286 //-----------------------------------
2287 // 6a) Transfer ShowerArray to treebranchTreeEntry:
2288 //-----------------------------------
2289 if (cmd_OUTPUTLEVEL>0) {
2291 }
2292
2293
2294 //------------------------------------
2295 // Reset and delete important things:
2296 // also to avoid memory problems ...
2297 //-----------------------------------
2298 GLOBAL_ShowerSegArray->Clear();
2299 if (gEDBDEBUGLEVEL>3) cout << "--- ---GLOBAL_ShowerSegArray->GetEntries(): "<< GLOBAL_ShowerSegArray->GetEntries() << endl;
2300 delete local_gAli;
2301 local_gAli=0;
2303 //------------------------------------
2304 }
2305 // end of loop over GLOBAL_InBTArrayEntries
2306 //-----------------------------------------------------------------
2307
2308 if (gEDBDEBUGLEVEL==2) cout << endl<<flush;
2309 if (gEDBDEBUGLEVEL>3) cout << "---TREE_ShowRecEff->GetEntries() ... " << TREE_ShowRecEff->GetEntries() << endl;
2310 if (gEDBDEBUGLEVEL>3) cout << "---GLOBAL_INBTSHOWERNR ... " << GLOBAL_INBTSHOWERNR<< endl;
2311
2312
2313 return;
2314}

◆ ReconstructShowers_GS()

void ReconstructShowers_GS ( )

============================================================================================

======================== CODE FROM EdbShowAlg_GS FROM libShowRec =========================

Change with respect to libShowRec: here we assume that Segment will always be the Initiator BaseTrack and Segment2 is the other segment to check.

Segment = (EdbSegP*)pat_one->GetSegment(pat_one_bt_cnt); Segment = InBT; Change with respect to libShowRec: here we assume that Segment will always be the Initiator BaseTrack.

At first: Check for already duplicated pairings: if (CheckPairDuplications(Segment->PID(),Segment->ID(),Segment2->PID(),Segment2->ID(), SegmentPIDArray,SegmentIDArray,Segment2PIDArray,Segment2IDArray, RecoShowerArrayN)) continue;

if (IsPossibleFakeDoublet(Segment,Segment2) ) continue;

============================================================================================

============================================================================================


ONLY FOR THE ANN TRAINING FOR GS ALGO: DO THIS ONLY IF YOU HAVE PAIRS !!!


4258{
4259 Log(2, "ShowRec.cpp", "--- void ReconstructShowers_GS() ---");
4260 //-----------------------------------------------------------------
4261 // Main function for reconstruction of "Gamma Search" Algorithm
4262 //-----------------------------------------------------------------
4263
4264 //-----------------------------------
4265 // For each InitiatorBT this is
4266 // divided in several small parts:
4267 //
4268 // 1) Make local_gAli with cut parameters, Make GetPID of InBT and corresponding of plates
4269 // 3) Loop over (whole) local_gAli, search and check BT pairs for suts
4270 // 4) Calculate pur/eff/NBT numbers
4271 // 5) Fill Trees
4272 //-----------------------------------
4273
4274 // Define Helper Variables:
4275 EdbPVRec* local_gAli;
4276 EdbSegP* InBT;
4277 EdbSegP* seg;
4278 Float_t local_gAli_pat_interim_halfsize=0;
4279
4282
4283 Bool_t IsFirstLoopCount=kTRUE;
4284 Int_t LastGlobalMCEventNr=1;
4285
4286 EdbVertex* vtx=new EdbVertex();
4287
4288 //-----------------------------------------------------------------
4289 // Since GLOBAL_InBTArray is filled in ascending ordering by zpositon
4290 // We use the descending loop to begin with BT with lowest z first.
4291 for (Int_t i=GLOBAL_InBTArrayEntries-1; i>=0; --i) {
4292
4293 //-----------------------------------
4294 // CounterOutPut
4295 if (gEDBDEBUGLEVEL==2) if ((i%1)==0) cout << GLOBAL_InBTArrayEntries <<" InBT in total, still to do:"<<Form("%4d",i)<< "\r\r\r\r"<<flush;
4296 //-----------------------------------
4297
4298 //-----------------------------------
4299 // Get InitiatorBT from GLOBAL_InBTArray
4300 InBT=(EdbSegP*)GLOBAL_InBTArray->At(i);
4301 //--------
4302 GLOBAL_InBT_E=InBT->P();
4303 GLOBAL_InBT_TanTheta=TMath::Sqrt(InBT->TX()*InBT->TX()+InBT->TY()*InBT->TY());
4304 GLOBAL_InBT_Flag=InBT->Flag();
4305 GLOBAL_InBT_MC=InBT->MCEvt();
4306 //--------
4307 Int_t local_NBT=0;
4308 Int_t local_NBTMC=0;
4309 Int_t local_NBTallMC=0;
4310 Int_t local_NBTeMC=0;
4311 float_t local_pure=-1;
4312 float_t local_purall=-1;
4313 Int_t npat_int=0;
4314 Int_t npat_total=0;
4315 Int_t npatN=0;
4316 Int_t npat_Neff=0;
4317 Int_t NBT_Neff=0;
4318 Int_t NBTMC_Neff=0;
4319 Int_t NBTMCe_Neff=0;
4320 //--------
4321
4322 if (gEDBDEBUGLEVEL>2) {
4323 cout << endl << endl << "--- Starting Shower for Number " << i << " now: "<<endl;
4324 InBT->PrintNice();
4325 }
4326 //-----------------------------------
4327
4328
4329
4330 //-----------------------------------
4331 // 0) Set vtx according to MC event,
4332 // or to a half plate backward propagated segment.
4333 // Do this only if the value -GBMC is NOT set,
4334 // (in the case -GBMC is set, we should know the vertex anyway).
4335 //-----------------------------------
4336 //
4337 if (GLOBAL_InBT_MC>LastGlobalMCEventNr) LastGlobalMCEventNr=GLOBAL_InBT_MC;
4338 //
4339 //
4340 if (GLOBAL_InBT_MC<0&& cmd_GBMC<0) {
4341 // This is an "equalization" effect. If we dont put this in, we will have BG base
4342 // tracks always extrapolated to themselves, but SIM basetracks extrapolated to
4343 // the vertex. This leads to a wrong deltaZ distribution which spoils the
4344 // ANN Training.
4345 if( IsFirstLoopCount==kTRUE) cout << "Option: GLOBAL_InBT_MC<0&& cmd_GBMC<0"<<endl;
4346 vtx->SetXYZ(GLOBAL_VtxArrayX[LastGlobalMCEventNr],GLOBAL_VtxArrayY[LastGlobalMCEventNr],GLOBAL_VtxArrayZ[LastGlobalMCEventNr]);
4347 }
4348 //
4349 else if (GLOBAL_InBT_MC<0 && cmd_GBMC==0) {
4350 if( IsFirstLoopCount==kTRUE) cout << "Option: GLOBAL_InBT_MC<0 && cmd_GBMC==0"<<endl;
4351 vtx->SetXYZ(InBT->X()-650*InBT->TX(),InBT->Y()-650*InBT->TY(),InBT->Z()-650);
4352 }
4353 else if (GLOBAL_InBT_MC<0 && cmd_GBMC>0) {
4354 if( IsFirstLoopCount==kTRUE) cout << "Option: GLOBAL_InBT_MC<0 && cmd_GBMC>0"<<endl;
4356 }
4357 else if (GLOBAL_InBT_MC>0 && GLOBAL_IsBrickTreePGunInfo==kFALSE) {
4358 if( IsFirstLoopCount==kTRUE) cout << "Option: GLOBAL_InBT_MC>0 && GLOBAL_IsBrickTreePGunInfo==kFALSE"<<endl;
4359 vtx->SetXYZ(InBT->X()-650*InBT->TX(),InBT->Y()-650*InBT->TY(),InBT->Z()-650);
4360 }
4361 else {
4362 if( IsFirstLoopCount==kTRUE) cout << "Option: else"<<endl;
4364 }
4365 vtx->SetMC(GLOBAL_InBT_MC);
4366
4367 if (gEDBDEBUGLEVEL>2) {
4368 cout << "The vtx info for this MC event: X:Y:Z:MC: " << vtx->X() << " " << vtx->Y() << " " << vtx->Z() << " " << GLOBAL_InBT_MC << endl;
4369 cout << "The vtx info for this MC event: IP(INBT,vtx): " << CalcIP(InBT,vtx)<< endl;
4370 }
4371 //-----------------------------------
4372
4373
4374
4375 //-----------------------------------
4376 // 1) Make local_gAli with cut parameters:
4377 //-----------------------------------
4378 local_gAli = TransformEdbPVRec(GLOBAL_gAli, InBT);
4379
4380 // IN THIS ALGORITHM WE DO NOT YET AUTOMATICALLY ADD THE FIRST BT
4381 // SINCE WE NEED AN ADDIITONAL VERTEX CUT OF THIS FIRST BT TO CHECK!
4382 // // Add InBT to GLOBAL_ShowerSegArray
4383 // GLOBAL_ShowerSegArray -> Add(InBT);
4384 //-----------------------------------
4385
4386
4387 //-----------------------------------
4388 // 2) Loop over (whole) local_gAli, check InitiatorBT
4389 // 2) compatible with a segment forming a e+e- pair:
4390 // 2) (Loop over all plates of local_gAli, since this is already
4391 // 2) extracted with the right numbers of plates...)
4392 //-----------------------------------
4393 Int_t local_gAli_npat=local_gAli->Npatterns();
4394 Int_t btloop_cnt_N=0;
4395
4399
4400
4401
4402 Int_t npat=local_gAli->Npatterns();
4403 Int_t pat_one_bt_cnt_max,pat_two_bt_cnt_max=0;
4404 EdbPattern* pat_one=0;
4405 EdbPattern* pat_two=0;
4406 EdbSegP* Segment=0;
4407 EdbSegP* Segment2=0;
4408 Float_t distZ,IP_Pair_To_InBT,IP_Pair_To_InBT_SegSum;
4409 Float_t IP_Pair_To_InBT_Seg2;
4410
4411
4412 Segment = InBT;
4413 IP_Pair_To_InBT=CalcIP(Segment, vtx);
4416
4417
4418
4419
4420
4421
4422
4423 // Loop over pattern for the first BT of the pairs:
4424 // Start first with the pattern with the lowest Z position.
4425 pat_one=local_gAli->GetPatternZLowestHighest(1);
4426 Float_t pat_one_Z=pat_one->Z();
4427 pat_one_bt_cnt_max=pat_one->GetN();
4428
4429 for (Int_t pat_one_cnt=0; pat_one_cnt<npat; ++pat_one_cnt) {
4430
4431 if (pat_one_cnt>0) {
4432 pat_one=(EdbPattern*)local_gAli->NextPattern(pat_one_Z,1);
4433 pat_one_Z=pat_one->Z();
4434 pat_one_bt_cnt_max=pat_one->GetN();
4435 }
4436
4437 // Check if pattern Z() equals the InBZ->Z(), since we wanna have the
4438 // pattern one the pattern to contain the InBT:
4439 distZ=pat_one->Z()-InBT->Z();
4440 if (TMath::Abs(distZ)>10) continue;
4441 //cout << "distZ (pat_one->Z()-InBT->Z())= " << distZ << endl;
4442
4443 // Check if InBT fulfills criteria for IP to vertex:
4444 if (IP_Pair_To_InBT>CUT_PARAMETER[0]) continue;
4445 // Check if InBT fulfills criteria for z-diff to vertex:
4446 if ((InBT->Z()-vtx->Z())>CUT_PARAMETER[3]) continue;
4447
4448 // Now here we can add InBT since it passed also the vertex cut.
4449 // Therefore, the Reconstructed Shower has always InBT as first BT stored.
4450 if (GLOBAL_ShowerSegArray->GetEntries()==0) {
4451 GLOBAL_ShowerSegArray->Add(InBT);
4452 if (gEDBDEBUGLEVEL>2) {
4453 cout << "I have added the first InBT " << InBT << " to GLOBAL_ShowerSegArray." << endl;
4454 InBT->PrintNice();
4455 }
4456 }
4457
4458 // Check if pattern dist Z to Vtx is ok:
4459 distZ=pat_one->Z()-vtx->Z();
4460 // Z distance has to be greater zero, cause the InBT
4461 // and other pair BTs shall come downstream the vertex:
4462 if (distZ<0) continue;
4463 //cout << "distZ (pat_one->Z()-vtx->Z();) = " << distZ << endl;
4464
4465 if (gEDBDEBUGLEVEL>2) cout << "Searching patterns: pat_one_cnt=" << pat_one_cnt << " pat_one->Z() = " << pat_one->Z() << " pat_one_bt_cnt_max= "<< pat_one_bt_cnt_max <<endl;
4466
4467
4468 // Loop over pattern for the second BT of the pairs:
4469 //
4470 //cout << "// Loop over pattern for the second BT of the pairs: "<< endl;
4471
4472 pat_two=local_gAli->GetPatternZLowestHighest(1);
4473 Float_t pat_two_Z=pat_two->Z();
4474 pat_two_bt_cnt_max=pat_two->GetN();
4475
4476 for (Int_t pat_two_cnt=0; pat_two_cnt<npat; ++pat_two_cnt) {
4477
4478 if (pat_two_cnt>0) {
4479 pat_two=(EdbPattern*)local_gAli->NextPattern(pat_two_Z,1);
4480 pat_two_Z=pat_two->Z();
4481 pat_two_bt_cnt_max=pat_two->GetN();
4482 }
4483
4484 // PID diff of two plates may be maximum [0..PidDIFFN]
4485 if (TMath::Abs(pat_one_cnt-pat_two_cnt)>CUT_PARAMETER[5]) continue;
4486
4487 // pattern two should come downstream pattern one:
4488 if (pat_two->Z()<pat_one->Z()) continue;
4489
4490
4491 if (gEDBDEBUGLEVEL>2) cout << " Searching patterns: pat_two_cnt=" << pat_two_cnt << " pat_two->Z() = " << pat_two->Z() << " pat_two_bt_cnt_max= "<< pat_two_bt_cnt_max <<endl;
4492
4493
4494 for (Int_t pat_one_bt_cnt=0; pat_one_bt_cnt<pat_one_bt_cnt_max; ++pat_one_bt_cnt) {
4499
4500 for (Int_t pat_two_bt_cnt=0; pat_two_bt_cnt<pat_two_bt_cnt_max; ++pat_two_bt_cnt) {
4501 Segment2 = (EdbSegP*)pat_two->GetSegment(pat_two_bt_cnt);
4502
4503 // Ceck if segments are not (by chance) the same:
4504 if (Segment2==Segment) continue;
4505 if (Segment2->ID()==Segment->ID()&&Segment2->PID()==Segment->PID()) continue;
4506 if (IsSameSegment(Segment2,Segment)) continue;
4507
4508
4509
4512
4513 // Now apply cut conditions: GS GAMMA SEARCH Alg --------------------
4514
4515 // Check if IP of both to vtx (BT) is ok:
4516 IP_Pair_To_InBT_Seg2 =CalcIP(Segment2, vtx);
4517 if (IP_Pair_To_InBT_Seg2>CUT_PARAMETER[0]) continue;
4518
4519 // if InBT is flagged as MC InBT, take care that only BG or same MC basetracks are taken:
4520 if (InBT->MCEvt()>0) if (Segment->MCEvt()>0&&Segment2->MCEvt()>0) if (Segment->MCEvt()!=Segment2->MCEvt()) continue;
4521 if (InBT->MCEvt()>0) if (Segment->MCEvt()>0&&Segment2->MCEvt()>0) if (Segment->MCEvt()!=InBT->MCEvt()) continue;
4522 if (InBT->MCEvt()>0) if (Segment->MCEvt()>0&&Segment2->MCEvt()>0) if (Segment2->MCEvt()!=InBT->MCEvt()) continue;
4523
4524 // In case of two MC events, check for e+ e- pairs
4525 // Do this ONLY IF parameter eParaValue[6] is set to choose different Flag() pairs:
4526 if (InBT->MCEvt()>0 && CUT_PARAMETER[6]==1) {
4527 if (Segment->MCEvt()>0&&Segment2->MCEvt()>0) {
4528 if ((Segment2->Flag()+Segment->Flag())!=0) continue;
4529 }
4530 }
4531
4532 // a) Check dR between tracks:
4533 if (GetdeltaRWithPropagation(Segment,Segment2)>CUT_PARAMETER[2]) continue;
4534 // b) Check dT between tracks:
4535 if (GetdeltaThetaSingleAngles(Segment,Segment2)>CUT_PARAMETER[4]) continue;
4536 // c) Check dMinDist between tracks:
4537 if (GetMinimumDist(Segment,Segment2)>CUT_PARAMETER[1]) continue;
4538
4539 // f) Check if this is not a possible fake doublet which is
4540 // sometimes caused by view overlap in the scanning:
4541 // in the EdbPVRQuality class this will be done at start for the whole
4542 // PVR object so this will be later on obsolete.
4544 //
4545 // end of cut conditions: GS GAMMA SEARCH Alg --------------------
4546 //
4547
4548
4549 if (gEDBDEBUGLEVEL>3) {
4550 cout << "EdbShowAlg_GS::FindPairs Pair (PID:" << Segment->PID() << ",ID:" << Segment->ID()<< ";"<< Segment2->PID() << "," << Segment2->ID() << ") has passed all cuts w.r.t to InBT:" << endl;
4551 cout << "EdbShowAlg_GS::FindPairs GetdeltaRWithPropagation(Segment,Segment2) = " << GetdeltaRWithPropagation(Segment,Segment2) << endl;
4552 cout << "EdbShowAlg_GS::FindPairs GetdeltaThetaSingleAngles(Segment,Segment2) = " << GetdeltaThetaSingleAngles(Segment,Segment2) << endl;
4553 cout << "EdbShowAlg_GS::FindPairs GetMinimumDist(Segment,Segment2) = " << GetMinimumDist(Segment,Segment2) << endl;
4554 cout << "EdbShowAlg_GS::FindPairs CalcIP(BetterSegment,InBT) = " << IP_Pair_To_InBT << endl;
4555 }
4556
4557 if (gEDBDEBUGLEVEL>3) cout <<"------------"<< endl;
4558
4559 // And Add Segment2 to to shower array:
4560// cout << "// Add Segment2 to to shower array (AddBTToArrayWithCeck):" << endl;
4561 Bool_t isContained = AddBTToArrayWithCeck(Segment2, GLOBAL_ShowerSegArray);
4562 //PrintShowerObjectArray(GLOBAL_ShowerSegArray);
4563// cout << " isContained == " << isContained << endl;
4564 if (isContained==kTRUE) continue;
4565
4566 } //for (Int_t pat_two_bt_cnt=0; ...
4567
4568 } //for (Int_t pat_one_bt_cnt=0; ...
4569
4570 } // for (Int_t pat_two_cnt=0; ...
4571
4572
4573 // Now here do the usual rest for BG density calculation:
4574 //...
4575 // Calc BT density around shower:
4576 EdbPattern* pat_interim=local_gAli->GetPattern(pat_one_cnt);
4577 CalcTrackDensity(pat_interim,local_gAli_pat_interim_halfsize,npat_int,npat_total,npatN);
4578
4579 // Calc TrackNumbers for plate for efficency numbers:
4580 CalcEfficencyNumbers(pat_interim, InBT->MCEvt(), NBT_Neff, NBTMC_Neff,NBTMCe_Neff);
4581
4582 } //for (Int_t pat_one_cnt=0; ...
4583
4584
4588
4589 if (gEDBDEBUGLEVEL>2) cout << " GLOBAL_ShowerSegArray->GetEntries() " << GLOBAL_ShowerSegArray->GetEntries() << endl;
4590
4594
4595 if (GLOBAL_ShowerSegArray->GetEntries()>1) {
4596
4597 Segment=(EdbSegP*)GLOBAL_ShowerSegArray->At(0);
4598 Segment2=(EdbSegP*)GLOBAL_ShowerSegArray->At(1);
4599
4600
4601
4602 if (gEDBDEBUGLEVEL>2) {
4603 cout << "ONLY FOR THE ANN TRAINING FOR GS ALGO: " << endl;
4604 cout << "DO THIS ONLY IF YOU HAVE PAIRS !!!: " << endl;
4605 cout << "YES WE HAVE A PAIR Print all segs in the array: " << endl;
4606 for (int l=0; l<GLOBAL_ShowerSegArray->GetEntries(); ++l) {
4608 s->PrintNice();
4609 }
4610// Segment->PrintNice();
4611// Segment2->PrintNice();
4612 cout << "Print again the InBT for crosscheck: InBT= " << endl;
4613 InBT->PrintNice();
4614 cout << "Address of Segment = " << Segment << endl;
4615 cout << "Address of Segment2 = " << Segment2 << endl;
4616 }
4617
4618
4619
4620 // Implicitly, we assume that InBT= Seg->At(0), which I checked is
4621 // correct. Also in the code it is done this way that InBT is added
4622 // as first BT.
4623 //Segment->PrintNice();
4624 //Segment2->PrintNice();
4625 //InBT->PrintNice();
4626
4627 IP_Pair_To_InBT_Seg2=CalcIP(Segment2,vtx);
4628 IP_Pair_To_InBT=CalcIP(Segment,vtx);
4629
4630 // Check if both basetracks have a vertex which is upstream
4631 // of both tracks (only then the two BT are really pointing).
4632 TObjArray *segments = new TObjArray(2);
4633 segments->Clear();
4634 segments->Add(Segment);
4635 segments->Add(Segment2);
4636 EdbVertex* vetex = new EdbVertex();
4637 vetex = CalcVertex(segments);
4638 cout << "Calculated helper _vetex_ out of the first two segments. " << endl;
4639 cout <<"vetex ->X,Y,Z: " << vetex ->X() << " " << vetex ->Y() << " " << vetex ->Z()<< endl;
4640 if (vetex ->Z()> TMath::Min(Segment->Z(),Segment2->Z()) ) cout << "The interims vertex to which the two segments points lies downstream, or in between the to segmnets, i.e. the do NOT point to an originating vertex. continue now...." << endl;
4641 cout << "Check: TMath::Min(Segment->Z(),Segment2->Z()) " << TMath::Min(Segment->Z(),Segment2->Z()) << endl;
4642 cout <<"Segment->Z(): " << Segment->Z() << " Segment2->Z() " << Segment2->Z() << endl;
4643 cout << "Address of Segment = " << Segment << endl;
4644 cout << "Address of Segment2 = " << Segment2 << endl;
4645 if (vetex ->Z()> TMath::Min(Segment->Z(),Segment2->Z()) ) {
4646 cout << " Hmm, do nothing..." << endl;
4647 }
4648 else {
4649
4650 Float_t IP_Seg1ToVtxSeg1Seg2=0;
4651 Float_t IP_Seg2ToVtxSeg1Seg2=0;
4652 IP_Seg1ToVtxSeg1Seg2 = CalcIP(Segment,vetex);
4653 IP_Seg2ToVtxSeg1Seg2 = CalcIP(Segment2,vetex);
4654
4655 Int_t eRecoMode=2;
4656 cout << "WARNING eRecoMode konstant set to =2 TODO .... change on prompt!!" << endl;
4657 Float_t eValueGSNN_var00;
4658 Float_t IP_InBT_To_Vtx=IP_Pair_To_InBT;
4659 if (eRecoMode==0) eValueGSNN_var00=IP_InBT_To_Vtx;
4660 if (eRecoMode==1) eValueGSNN_var00=IP_InBT_To_Vtx;
4661 if (eRecoMode==2) {
4662 eValueGSNN_var00=TMath::Min(IP_Seg1ToVtxSeg1Seg2,IP_Seg2ToVtxSeg1Seg2);
4663 }
4664
4665 h_GSNN_var00->Fill(eValueGSNN_var00);
4666 h_GSNN_var01->Fill(GetMinimumDist(Segment,Segment2));
4667 h_GSNN_var02->Fill(GetdeltaRWithPropagation(Segment,Segment2));
4668 h_GSNN_var03->Fill(InBT->Z()-vtx->Z());
4669 h_GSNN_var04->Fill(GetdeltaThetaSingleAngles(Segment,Segment2));
4670 h_GSNN_var05->Fill(TMath::Abs(Segment->PID()-Segment2->PID()));
4671 h_GSNN_var06->Fill(Segment2->Flag()+Segment->Flag());
4672
4673 // Purity 1: Input = 1.0;
4674 // Purity 0.5: Input = 0.5;
4675 // Purity else: Input = 0.0;
4676 if (Segment2->Flag()+Segment->Flag()==0&&TMath::Abs(Segment2->Flag())==11&&Segment->MCEvt()>0) {
4678 }
4679 else if (Segment2->Flag()+Segment->Flag()!=0&&TMath::Abs(Segment2->Flag())==11&&Segment->MCEvt()>0) {
4681 }
4682 else {
4684 }
4685 value_GSNN_var00=eValueGSNN_var00;
4686 value_GSNN_var01=GetMinimumDist(Segment,Segment2);
4688 value_GSNN_var03=InBT->Z()-vtx->Z();
4690 value_GSNN_var05=TMath::Abs(Segment->PID()-Segment2->PID());
4691 value_GSNN_var06=Segment2->Flag()+Segment->Flag();
4692
4693 t_GSNN->Fill();
4694
4695 cout << "I have filled the GSNN Tree now. End of this bracket." << endl;
4696 }
4697 }
4699
4701
4702 Int_t s_NBT=0;
4703 Int_t s_NBTMC=0;
4704 Int_t s_NBTallMC=0;
4705 Int_t s_NBTeMC=0;
4706 Double_t s_eff=0;
4707 Double_t s_purall=0;
4708 Double_t s_pure=0;
4709 CalcEffPurOfShower(GLOBAL_ShowerSegArray, s_NBT, s_NBTMC, s_NBTallMC, s_NBTeMC, s_purall, s_pure);
4710
4711 //-----------------------------------
4712 // 4) Calculate pur/eff/NBT numbers,
4713 // not needed when only reconstruction
4714 // done:
4715 //-----------------------------------
4716 if (cmd_OUTPUTLEVEL>=2 || cmd_OUTPUTLEVEL==0 ) {
4717 Int_t NBT=0;
4718 Int_t NBTMC=0;
4719 Int_t NBTallMC=0;
4720 Int_t NBTeMC=0;
4721 Double_t eff, purall, pure;
4722 CalcEffPurOfShower2(GLOBAL_ShowerSegArray, NBT, NBTMC, NBTallMC, NBTeMC, purall, pure, NBT_Neff, NBTMC_Neff,NBTMCe_Neff);
4723
4724
4725 // Fill only for MC Event:
4726 if (GLOBAL_InBT_MC>0) {
4731 }
4733 }
4734// cout << "// 4) Calculate pur/eff/NBT numbers...done." << endl;
4735
4736
4737// XXXDEBUG
4738
4739 //-----------------------------------
4740 // 5) Fill Tree:
4741 //-----------------------------------
4742 if (gEDBDEBUGLEVEL>2) cout << "// 5) Fill Tree:" << endl;
4743 TREE_ShowRecEff->Fill();
4744 if (gEDBDEBUGLEVEL>3) TREE_ShowRecEff->Show(TREE_ShowRecEff->GetEntries()-1);
4745
4746
4747 //-----------------------------------
4748 // 6a) Transfer ShowerArray to treebranchTreeEntry:
4749 //-----------------------------------
4750 if (cmd_OUTPUTLEVEL>0) {
4751 //cout << "// 6a) Transfer ShowerArray to treebranchTreeEntry:" << endl;
4753 }
4754
4755
4756 //------------------------------------
4757 // Reset and delete important things:
4758 // also to avoid memory problems ...
4759 //-----------------------------------
4760 GLOBAL_ShowerSegArray->Clear();
4761 if (gEDBDEBUGLEVEL>2) cout << "--- --- after clear: GLOBAL_ShowerSegArray->GetEntries(): "<< GLOBAL_ShowerSegArray->GetEntries() << endl;
4762 delete local_gAli;
4763 local_gAli=0;
4765 //------------------------------------
4766
4767
4768
4769 IsFirstLoopCount=kFALSE;
4770 }
4771 // end of loop over GLOBAL_InBTArrayEntries
4772 //-----------------------------------------------------------------
4773
4774 if (gEDBDEBUGLEVEL==2) cout << endl<<flush;
4775 if (gEDBDEBUGLEVEL>3) cout << "---TREE_ShowRecEff->GetEntries() ... " << TREE_ShowRecEff->GetEntries() << endl;
4776 if (gEDBDEBUGLEVEL>3) cout << "---GLOBAL_INBTSHOWERNR ... " << GLOBAL_INBTSHOWERNR<< endl;
4777
4778
4779
4780 Log(2, "ShowRec.cpp", "--- void ReconstructShowers_GS() done.");
4781 return;
4782}
EdbVertex * CalcVertex(TObjArray *segments)
Definition: ShowRec.cpp:9043
EdbPattern * GetPatternZLowestHighest(Bool_t lowestZ=kTRUE) const
Definition: EdbPattern.cxx:1816
EdbPattern * NextPattern(float z, int dir) const
Definition: EdbPattern.cxx:1920
Float_t X() const
Definition: EdbVertex.h:130
Float_t Z() const
Definition: EdbVertex.h:132
Float_t Y() const
Definition: EdbVertex.h:131

◆ ReconstructShowers_OI()

void ReconstructShowers_OI ( )

void ReconstructShowers_CL() /// Still Missing in the Implementation !!!

2513{
2514 Log(2, "ShowRec.cpp", "--- void ReconstructShowers_OI() ---");
2515
2516 //-----------------------------------------------------------------
2517 // Main function for reconstruction of OFFICIAL IMPLEMENTATION Algorithm
2518 //-----------------------------------------------------------------
2519
2520 //-----------------------------------
2521 // For each InitiatorBT this is
2522 // divided in several small parts:
2523 //
2524 // 1) Make local_gAli with cut parameters, Make GetPID of InBT and corresponding of plates
2525 // 3) Loop over (whole) local_gAli, check BT for Cuts
2526 // 4) Calculate pur/eff/NBT numbers
2527 // 5) Fill Trees
2528 //-----------------------------------
2529
2530 // Define Helper Variables:
2531 EdbPVRec* local_gAli;
2532 EdbSegP* InBT;
2533 EdbSegP* seg;
2534 Float_t local_gAli_pat_interim_halfsize=0;
2535
2538
2539 //-----------------------------------------------------------------
2540 // Since GLOBAL_InBTArray is filled in ascending ordering by zpositon
2541 // We use the descending loop to begin with BT with lowest z first.
2542 for (Int_t i=GLOBAL_InBTArrayEntries-1; i>=0; --i) {
2543
2544 //-----------------------------------
2545 // CounterOutPut
2546 if (gEDBDEBUGLEVEL==2) if ((i%1)==0) cout << GLOBAL_InBTArrayEntries <<" InBT in total, still to do:"<<Form("%4d",i)<< "\r\r\r\r"<<flush;
2547 if (gEDBDEBUGLEVEL==1) {
2548 int modulo=TMath::Max(GLOBAL_InBTArrayEntries/20,1);
2549 if ((i%modulo)==0) cout << i <<" : 5% more done"<<endl;
2550 }
2551 //-----------------------------------
2552
2553 //-----------------------------------
2554 // Get InitiatorBT from GLOBAL_InBTArray
2555 InBT=(EdbSegP*)GLOBAL_InBTArray->At(i);
2556 //--------
2557 GLOBAL_InBT_E=InBT->P();
2558 GLOBAL_InBT_TanTheta=TMath::Sqrt(InBT->TX()*InBT->TX()+InBT->TY()*InBT->TY());
2559 GLOBAL_InBT_Flag=InBT->Flag();
2560 GLOBAL_InBT_MC=InBT->MCEvt();
2561 //--------
2562 Int_t local_NBT=0;
2563 Int_t local_NBTMC=0;
2564 Int_t local_NBTallMC=0;
2565 Int_t local_NBTeMC=0;
2566 float_t local_pure=-1;
2567 float_t local_purall=-1;
2568 Int_t npat_int=0;
2569 Int_t npat_total=0;
2570 Int_t npatN=0;
2571 Int_t npat_Neff=0;
2572 Int_t NBT_Neff=0;
2573 Int_t NBTMC_Neff=0;
2574 Int_t NBTMCe_Neff=0;
2575 //--------
2576
2577 if (gEDBDEBUGLEVEL>2) {
2578 cout << endl << endl << "--- Starting Shower for Number " << i << " now: "<<endl;
2579 InBT->PrintNice();
2580 }
2581 //-----------------------------------
2582
2583 //-----------------------------------
2584 // 1) Make local_gAli with cut parameters:
2585 //-----------------------------------
2586 local_gAli = TransformEdbPVRec(GLOBAL_gAli, InBT);
2587
2588 /*
2589 //-----------------------------------
2590 // 1) BG Clean of local_gAli
2591 // that maybe not necessary always , only for the large
2592 // MC pasted Backgrounds...
2593 //-----------------------------------
2594 Float_t BGTargetDensity=0;
2595 // cout << "--- \t\t : -CLEAN InputData BG Cleaning: 0: No, 1:20BT/mm2 2: 40BT/mm2 3:10BT/mm2 4:60BT/mm2 \n";
2596 if (cmd_CLEAN==1) BGTargetDensity=20;
2597 if (cmd_CLEAN==2) BGTargetDensity=40;
2598 if (cmd_CLEAN==3) BGTargetDensity=10;
2599 if (cmd_CLEAN==4) BGTargetDensity=60;
2600 if (cmd_CLEAN==0) BGTargetDensity=1000;
2601
2602 EdbPVRQuality* localPVRQualCheck = new EdbPVRQuality(local_gAli,BGTargetDensity);
2603 EdbPVRec* new_local_gAli;
2604 new_local_gAli = localPVRQualCheck->GetEdbPVRec(1);
2605 localPVRQualCheck->Print();
2606 local_gAli=new_local_gAli;
2607 */
2608
2609// InBT->PrintNice();
2610// gSystem->Exit(1);
2611
2612 //-----------------------------------
2613 // Add InBT to GLOBAL_ShowerSegArray
2614 GLOBAL_ShowerSegArray -> Add(InBT);
2615 //-----------------------------------
2616
2617
2618 //-----------------------------------
2619 // 2) Loop over (whole) local_gAli, check BT for Cuts
2620 //-----------------------------------
2621 Int_t local_gAli_npat=local_gAli->Npatterns();
2622 if (gEDBDEBUGLEVEL>2) cout << "--- local_gAli_npat= " << local_gAli_npat << endl;
2623
2624 // Loop over all plates of local_gAli, since this is already
2625 // extracted with the right numbers of plates...
2626 for (Int_t patterloop_cnt=local_gAli_npat-1; patterloop_cnt>=0; --patterloop_cnt) {
2627 if (gEDBDEBUGLEVEL>3) cout << "--- --- Doing patterloop_cnt= " << patterloop_cnt << endl;
2628
2629 for (Int_t btloop_cnt=0; btloop_cnt<local_gAli->GetPattern(patterloop_cnt)->GetN(); ++btloop_cnt) {
2630 seg = (EdbSegP*)local_gAli->GetPattern(patterloop_cnt)->GetSegment(btloop_cnt);
2631 if (gEDBDEBUGLEVEL>3) seg->PrintNice();
2632
2633 // Now apply cut conditions: OFFICIAL IMPLEMENTATION Alg --------------------
2634 if (!GetConeOrTubeDistanceToInBT(seg, InBT, CUT_PARAMETER[0], CUT_PARAMETER[1])) continue;
2635 if (!FindPrecedingBTsSingleThetaAngle(seg, InBT, local_gAli, GLOBAL_ShowerSegArray)) continue;
2636 // end of cut conditions: OFFICIAL IMPLEMENTATION Alg --------------------
2637
2638 // If we arrive here, Basetrack seg has passed criteria
2639 // and is then added to the shower array:
2640 // Check if its not the InBT which is already added:
2641 if (seg->X()==InBT->X()&&seg->Y()==InBT->Y()) {
2642 ; // do nothing;
2643 }
2644 else {
2645 GLOBAL_ShowerSegArray -> Add(seg);
2646 }
2647 }
2648 // Calc BT density around shower:
2649 EdbPattern* pat_interim=local_gAli->GetPattern(patterloop_cnt);
2650 CalcTrackDensity(pat_interim,local_gAli_pat_interim_halfsize,npat_int,npat_total,npatN);
2651
2652 // Calc TrackNumbers for plate for efficency numbers:
2653 CalcEfficencyNumbers(pat_interim, InBT->MCEvt(), NBT_Neff, NBTMC_Neff,NBTMCe_Neff);
2654 }
2655 // end of loop over all plates of local_gAli
2657
2658
2659 //-----------------------------------
2660 // 4) Calculate pur/eff/NBT numbers,
2661 // not needed when only reconstruction
2662 // done:
2663 //-----------------------------------
2664 if (cmd_OUTPUTLEVEL>=2 || cmd_OUTPUTLEVEL==0 ) {
2665 Int_t NBT=0;
2666 Int_t NBTMC=0;
2667 Int_t NBTallMC=0;
2668 Int_t NBTeMC=0;
2669 Double_t eff, purall, pure;
2670 CalcEffPurOfShower2(GLOBAL_ShowerSegArray, NBT, NBTMC, NBTallMC, NBTeMC, purall, pure, NBT_Neff, NBTMC_Neff,NBTMCe_Neff);
2671
2672 // Fill only for MC Event:
2673 if (GLOBAL_InBT_MC>0) {
2678 }
2680 }
2681
2682
2683
2684 //-----------------------------------
2685 // 5) Fill Tree:
2686 //-----------------------------------
2687 TREE_ShowRecEff->Fill();
2688 if (gEDBDEBUGLEVEL>3) TREE_ShowRecEff->Show(TREE_ShowRecEff->GetEntries()-1);
2689
2690
2691 //-----------------------------------
2692 // 6a) Transfer ShowerArray to treebranchTreeEntry:
2693 //-----------------------------------
2694 if (cmd_OUTPUTLEVEL>0) {
2696 }
2697
2698
2699 //------------------------------------
2700 // Reset and delete important things:
2701 // also to avoid memory problems ...
2702 //-----------------------------------
2703 GLOBAL_ShowerSegArray->Clear();
2704 if (gEDBDEBUGLEVEL>3) cout << "--- ---GLOBAL_ShowerSegArray->GetEntries(): "<< GLOBAL_ShowerSegArray->GetEntries() << endl;
2705 delete local_gAli;
2706 local_gAli=0;
2708 //------------------------------------
2709 }
2710 // end of loop over GLOBAL_InBTArrayEntries
2711 //-----------------------------------------------------------------
2712
2713 if (gEDBDEBUGLEVEL==2) cout << endl<<flush;
2714 if (gEDBDEBUGLEVEL>3) cout << "---TREE_ShowRecEff->GetEntries() ... " << TREE_ShowRecEff->GetEntries() << endl;
2715 if (gEDBDEBUGLEVEL>3) cout << "---GLOBAL_INBTSHOWERNR ... " << GLOBAL_INBTSHOWERNR<< endl;
2716
2717
2718 return;
2719}

◆ ReconstructShowers_OI2()

void ReconstructShowers_OI2 ( )

DEPRECATED !!!!

2909{
2911 Log(2, "ShowRec.cpp", "--- void ReconstructShowers_OI2() --- DEPRECATED !!!! RETURN !!!");
2912 return;
2913}

◆ ReconstructShowers_OPENMP()

void ReconstructShowers_OPENMP ( )
2072 {
2073 cout << endl << "=======================================================" << endl << endl;
2076 cout << "GLOBAL_InBTArrayEntries = " << GLOBAL_InBTArrayEntries << endl;
2077 int tid=0;
2078 int i=0;
2079 int nthreads=0;
2080 int chunk=2;
2081
2082 #pragma omp parallel shared(nthreads) private(i,tid)
2083 {
2084 // cout << "tid = omp_get_thread_num() " << omp_get_thread_num() << endl;
2085 if (tid == 0)
2086 {
2087 // nthreads = omp_get_num_threads();
2088 printf("Number of threads = %d\n", nthreads);
2089 }
2090
2091 printf("Thread %d starting...\n",tid);
2092
2094
2095 cout << endl;
2096
2097 #pragma omp for
2098 for (Int_t ii=GLOBAL_InBTArrayEntries-1; ii>=0; --ii) {
2099 EdbSegP* seg = (EdbSegP*) GLOBAL_InBTArray -> At(ii);
2100 printf("Thread %d: %i execute now ReconstructShowers_OPENMP_TEST \n",tid,ii);
2101 seg->PrintNice();
2102 TObjArray LOCAL_ShowerSegArray;
2103 ReconstructShowers_OPENMP_TEST(seg, LOCAL_ShowerSegArray);
2104 printf("Thread %d: %i %d entires in LOCAL_ShowerSegArray: \n",tid,ii,LOCAL_ShowerSegArray.GetEntries() );
2105 }
2106
2107 } /* end of parallel section */
2108
2109
2110 // endo of OPENMP_session
2111 return;
2112}
void ReconstructShowers_OPENMP_TEST(EdbSegP *InBT, TObjArray array)
DEBUG OPENMP TEST!!!!!!!
Definition: ShowRec.cpp:2439

◆ ReconstructShowers_OPENMP_TEST()

void ReconstructShowers_OPENMP_TEST ( EdbSegP InBT,
TObjArray  array 
)

DEBUG OPENMP TEST!!!!!!!

DEBUG OPENMP TEST!!!!!!! // DEPRECATED !!!!

2113 {
2114
2115 // Dummy Function: Create 4 Segments just by propagating to 2=2,3,4,5*InBT->Z();
2116 array.Add(InBT);
2117 for (Int_t j=0; j<3; ++j) {
2118 cout << " j = " << j << endl;
2119 EdbSegP* s=new EdbSegP(j,InBT->X(),InBT->Y(),InBT->TX(),InBT->TY());
2120 s->SetZ(InBT->Z());
2121 s->PropagateTo((j+1)*1300+InBT->Z());
2122 s->SetMC(InBT->MCEvt(),InBT->MCEvt());
2123 s->PrintNice();
2124 array.Add(s);
2125 }
2126 //PrintShowerObjectArray(array);
2127
2128 cout << " Since GLOBAL_ShowerSegArray is global we SHOULD expect here parallel conflicts !!!! " << endl;
2129 return;
2130}

◆ ReconstructShowers_RC()

void ReconstructShowers_RC ( )

last to variables are dummyvariabes.

if this is in, it doesnt work for iteratet ShowerAxisCenterGravityBT

3378{
3379 Log(2, "ShowRec.cpp", "--- void ReconstructShowers_RC() ---");
3380
3381 //-----------------------------------------------------------------
3382 // Main function for reconstruction of "Recursive Cone" Algorithm
3383 //-----------------------------------------------------------------
3384
3385 //-----------------------------------
3386 // For each InitiatorBT this is
3387 // divided in several small parts:
3388 //
3389 // 1) Make local_gAli with cut parameters, Make GetPID of InBT and corresponding of plates
3390 // 3) Loop over (whole) local_gAli, check BT for Cuts
3391 // 4) Calculate pur/eff/NBT numbers
3392 // 5) Fill Trees
3393 //-----------------------------------
3394
3395 // Define Helper Variables:
3396 EdbPVRec* local_gAli;
3397 EdbSegP* InBT;
3398 EdbSegP* seg;
3399 Float_t local_gAli_pat_interim_halfsize=0;
3400
3403
3404 //-----------------------------------------------------------------
3405 // Since GLOBAL_InBTArray is filled in ascending ordering by zpositon
3406 // We use the descending loop to begin with BT with lowest z first.
3407 for (Int_t i=GLOBAL_InBTArrayEntries-1; i>=0; --i) {
3408
3409 //-----------------------------------
3410 // CounterOutPut
3411 if (gEDBDEBUGLEVEL==2) if ((i%1)==0) cout << GLOBAL_InBTArrayEntries <<" InBT in total, still to do:"<<Form("%4d",i)<< "\r\r\r\r"<<flush;
3412 //-----------------------------------
3413
3414 //-----------------------------------
3415 // Get InitiatorBT from GLOBAL_InBTArray
3416 InBT=(EdbSegP*)GLOBAL_InBTArray->At(i);
3417 //--------
3418 GLOBAL_InBT_E=InBT->P();
3419 GLOBAL_InBT_TanTheta=TMath::Sqrt(InBT->TX()*InBT->TX()+InBT->TY()*InBT->TY());
3420 GLOBAL_InBT_Flag=InBT->Flag();
3421 GLOBAL_InBT_MC=InBT->MCEvt();
3422 //--------
3423 Int_t local_NBT=0;
3424 Int_t local_NBTMC=0;
3425 Int_t local_NBTallMC=0;
3426 Int_t local_NBTeMC=0;
3427 float_t local_pure=-1;
3428 float_t local_purall=-1;
3429 Int_t npat_int=0;
3430 Int_t npat_total=0;
3431 Int_t npatN=0;
3432 Int_t npat_Neff=0;
3433 Int_t NBT_Neff=0;
3434 Int_t NBTMC_Neff=0;
3435 Int_t NBTMCe_Neff=0;
3436 //--------
3437
3438 if (gEDBDEBUGLEVEL>2) {
3439 cout << endl << endl << "--- Starting Shower for Number " << i << " now: "<<endl;
3440 InBT->PrintNice();
3441 }
3442 //-----------------------------------
3443
3444 //-----------------------------------
3445 // 1) Make local_gAli with cut parameters:
3446 //-----------------------------------
3447 local_gAli = TransformEdbPVRec(GLOBAL_gAli, InBT);
3448 // Add InBT to GLOBAL_ShowerSegArray
3449 GLOBAL_ShowerSegArray -> Add(InBT);
3450 //-----------------------------------
3451
3452 //-----------------------------------
3453 // 2) Loop over (whole) local_gAli, check BT for Cuts
3454 //-----------------------------------
3455 Int_t local_gAli_npat=local_gAli->Npatterns();
3456 Int_t btloop_cnt_N=0;
3457 if (gEDBDEBUGLEVEL>2) cout << "--- local_gAli_npat= " << local_gAli_npat << endl;
3458
3459 // Loop over all plates of local_gAli, since this is already
3460 // extracted with the right numbers of plates...
3461 for (Int_t patterloop_cnt=local_gAli_npat-1; patterloop_cnt>=0; --patterloop_cnt) {
3462 if (gEDBDEBUGLEVEL>3) cout << "--- --- Doing patterloop_cnt= " << patterloop_cnt << endl;
3463 btloop_cnt_N=local_gAli->GetPattern(patterloop_cnt)->GetN();
3464
3465 // if pattern is before the Initiator BT->Z() position we just go on:
3466 if (local_gAli->GetPattern(patterloop_cnt)->Z()<InBT->Z()) continue;
3467
3468 for (Int_t btloop_cnt=0; btloop_cnt<btloop_cnt_N; ++btloop_cnt) {
3469 seg = (EdbSegP*)local_gAli->GetPattern(patterloop_cnt)->GetSegment(btloop_cnt);
3470 if (gEDBDEBUGLEVEL>3) seg->PrintNice();
3471
3472 // Now apply cut conditions: RECURSIVE CONE Alg --------------------
3474 if (!FindPrecedingBTsSingleThetaAngle(seg, InBT, local_gAli, GLOBAL_ShowerSegArray)) continue;
3475 // end of cut conditions: RECURSIVE CONE Alg --------------------
3476
3477 // If we arrive here, Basetrack seg has passed criteria
3478 // and is then added to the shower array:
3479 // Check if its not the InBT which is already added:
3481 }
3482
3483 // Calc BT density around shower:
3484 EdbPattern* pat_interim=local_gAli->GetPattern(patterloop_cnt);
3485 CalcTrackDensity(pat_interim,local_gAli_pat_interim_halfsize,npat_int,npat_total,npatN);
3486
3487 // Calc TrackNumbers for plate for efficency numbers:
3488 CalcEfficencyNumbers(pat_interim, InBT->MCEvt(), NBT_Neff, NBTMC_Neff,NBTMCe_Neff);
3489 }
3490 // end of loop over all plates of local_gAli
3491
3493
3494 Int_t f_NBT=0;
3495 Int_t f_NBTMC=0;
3496 Int_t f_NBTallMC=0;
3497 Int_t f_NBTeMC=0;
3498 Double_t f_eff=0;
3499 Double_t f_purall=0;
3500 Double_t f_pure=0;
3501 CalcEffPurOfShower(GLOBAL_ShowerSegArray, f_NBT, f_NBTMC, f_NBTallMC, f_NBTeMC, f_purall, f_pure);
3503
3504 //-----------------------------------
3505 // 3) Try RE-ITERATION over (whole) local_gAli!!
3506 // 3) Using the iterated shower Gravity Center!
3507 // 3)
3508 // 3) WILL NOT WORK FOR ELECTRONS ... CAUSE FISRT POSITION IS SHIFTED AFTER ITERATION !!!
3509 // 3) DEPRECIAPTED
3510 // 3) DEPRECIAPTED .... DO NOT USE IT NOW!!!!!!!!!!!!!!
3511 // 3) DEPRECIAPTED (even if it works we dont need to reevaluate the
3512 // 3) efficency numbers anymore, since calculated above)
3513 //-----------------------------------
3514
3515 Bool_t DoIteration=kFALSE;
3516 // Bool_t DoIteration=kTRUE// 3) DEPRECIAPTED .... DO NOT USE IT NOW!!!!!!!!!!!!!!
3517
3518 if (DoIteration) {
3519
3520 cout << "-------------------------------------------"<<endl;
3521 EdbSegP* ShowerAxisCenterGravityBT = BuildShowerAxis(GLOBAL_ShowerSegArray);
3522 GLOBAL_ShowerSegArray->Clear();
3523 //-----------------------------------
3524 // 3) Loop again over (whole) local_gAli, check BT for Cuts
3525 //-----------------------------------
3526 local_gAli_npat=local_gAli->Npatterns();
3527 btloop_cnt_N=0;
3528 if (gEDBDEBUGLEVEL>2) cout << "--- local_gAli_npat= " << local_gAli_npat << endl;
3529
3530 // Loop over all plates of local_gAli, since this is already
3531 // extracted with the right numbers of plates...
3532 for (Int_t patterloop_cnt=local_gAli_npat-1; patterloop_cnt>=0; --patterloop_cnt) {
3533 if (gEDBDEBUGLEVEL>3) cout << "--- --- Doing patterloop_cnt= " << patterloop_cnt << endl;
3534 btloop_cnt_N=local_gAli->GetPattern(patterloop_cnt)->GetN();
3535
3536 for (Int_t btloop_cnt=0; btloop_cnt<btloop_cnt_N; ++btloop_cnt) {
3537 seg = (EdbSegP*)local_gAli->GetPattern(patterloop_cnt)->GetSegment(btloop_cnt);
3538 if (gEDBDEBUGLEVEL>3) seg->PrintNice();
3539
3540 // Now apply cut conditions: RECURSIVE CONE Alg --------------------
3541 // if (!GetConeOrTubeDistanceToBTOfShowerArray(seg, ShowerAxisCenterGravityBT, GLOBAL_ShowerSegArray, CUT_PARAMETER[0], CUT_PARAMETER[1])) continue;
3543 if (!FindPrecedingBTsSingleThetaAngle(seg, ShowerAxisCenterGravityBT, local_gAli, GLOBAL_ShowerSegArray)) continue;
3544 // end of cut conditions: RECURSIVE CONE Alg --------------------
3545
3546 // If we arrive here, Basetrack seg has passed criteria
3547 // and is then added to the shower array:
3548 // Check if its not the InBT which is already added:
3549 // if (seg->X()==ShowerAxisCenterGravityBT->X()&&seg->Y()==ShowerAxisCenterGravityBT->Y()) { ; } // do nothing;
3550 // else {GLOBAL_ShowerSegArray -> Add(seg);}
3552 }
3553 }
3554 // end of loop over all plates of local_gAli
3556 cout << "-------------------------------------------"<<endl;
3557
3558
3559 } // of if (DoIteration)
3560
3561 Int_t s_NBT=0;
3562 Int_t s_NBTMC=0;
3563 Int_t s_NBTallMC=0;
3564 Int_t s_NBTeMC=0;
3565 Double_t s_eff=0;
3566 Double_t s_purall=0;
3567 Double_t s_pure=0;
3568 CalcEffPurOfShower(GLOBAL_ShowerSegArray, s_NBT, s_NBTMC, s_NBTallMC, s_NBTeMC, s_purall, s_pure);
3569
3570 //-----------------------------------
3571 // 4) Calculate pur/eff/NBT numbers,
3572 // not needed when only reconstruction
3573 // done:
3574 //-----------------------------------
3575 if (cmd_OUTPUTLEVEL>=2 || cmd_OUTPUTLEVEL==0 ) {
3576 Int_t NBT=0;
3577 Int_t NBTMC=0;
3578 Int_t NBTallMC=0;
3579 Int_t NBTeMC=0;
3580 Double_t eff, purall, pure;
3581 CalcEffPurOfShower2(GLOBAL_ShowerSegArray, NBT, NBTMC, NBTallMC, NBTeMC, purall, pure, NBT_Neff, NBTMC_Neff,NBTMCe_Neff);
3582
3583 // Fill only for MC Event:
3584 if (GLOBAL_InBT_MC>0) {
3589 }
3591 }
3592
3593
3594 //-----------------------------------
3595 // 5) Fill Tree:
3596 //-----------------------------------
3597 TREE_ShowRecEff->Fill();
3598 if (gEDBDEBUGLEVEL>3) TREE_ShowRecEff->Show(TREE_ShowRecEff->GetEntries()-1);
3599
3600
3601 //-----------------------------------
3602 // 6a) Transfer ShowerArray to treebranchTreeEntry:
3603 //-----------------------------------
3604 if (cmd_OUTPUTLEVEL>0) {
3606 }
3607
3608
3609 //-----------------------------------
3610 // 7) cout some numbers from shower reco:
3611 //-----------------------------------
3612 if (gEDBDEBUGLEVEL>2) {
3613 cout << "------------------------------- _NUMBERS ----------------------"<<endl;
3614 cout << "ITERATION 0 : --- NBT = " << f_NBT << endl;
3615 cout << "ITERATION 0 : --- NBTMC = " << f_NBTMC << endl;
3616 cout << "ITERATION 0 : --- purall = " << f_purall << endl;
3617 cout << "------------"<<endl;
3618 cout << "ITERATION 1 : --- NBT = " << s_NBT << endl;
3619 cout << "ITERATION 1 : --- NBTMC = " << s_NBTMC << endl;
3620 cout << "ITERATION 1 : --- purall = " << s_purall << endl;
3621 cout << "NUMBERS " << f_NBT << " " << f_NBTMC << " " << f_purall << " " << s_NBT << " " << s_NBTMC << " " << s_purall << " " << endl;
3622 }
3623
3624 //------------------------------------
3625 // Reset and delete important things:
3626 // also to avoid memory problems ...
3627 //-----------------------------------
3628 GLOBAL_ShowerSegArray->Clear();
3629 if (gEDBDEBUGLEVEL>3) cout << "--- ---GLOBAL_ShowerSegArray->GetEntries(): "<< GLOBAL_ShowerSegArray->GetEntries() << endl;
3630 delete local_gAli;
3631 local_gAli=0;
3633 //------------------------------------
3634 }
3635 // end of loop over GLOBAL_InBTArrayEntries
3636 //-----------------------------------------------------------------
3637
3638 if (gEDBDEBUGLEVEL==2) cout << endl<<flush;
3639 if (gEDBDEBUGLEVEL>3) cout << "---TREE_ShowRecEff->GetEntries() ... " << TREE_ShowRecEff->GetEntries() << endl;
3640 if (gEDBDEBUGLEVEL>3) cout << "---GLOBAL_INBTSHOWERNR ... " << GLOBAL_INBTSHOWERNR<< endl;
3641
3642
3643 return;
3644}

◆ ReconstructShowers_SA()

void ReconstructShowers_SA ( )
2725{
2726 Log(2, "ShowRec.cpp", "--- void ReconstructShowers_SA() ---");
2727
2728 //-----------------------------------------------------------------
2729 // Main function for reconstruction of SA Algorithm : only MCEvents with different cuts on MC parameters
2730 //-----------------------------------------------------------------
2731
2732 //-----------------------------------
2733 // For each InitiatorBT this is
2734 // divided in several small parts:
2735 //
2736 // 1) Make local_gAli with cut parameters, Make GetPID of InBT and corresponding of plates
2737 // 3) Loop over (whole) local_gAli, check BT for Cuts
2738 // 4) Calculate pur/eff/NBT numbers
2739 // 5) Fill Trees
2740 //-----------------------------------
2741
2742 // Define Helper Variables:
2743 EdbPVRec* local_gAli;
2744 EdbSegP* InBT;
2745 EdbSegP* seg;
2746 Float_t local_gAli_pat_interim_halfsize=0;
2747
2750
2751 //-----------------------------------------------------------------
2752 // Since GLOBAL_InBTArray is filled in ascending ordering by zpositon
2753 // We use the descending loop to begin with BT with lowest z first.
2754 for (Int_t i=GLOBAL_InBTArrayEntries-1; i>=0; --i) {
2755
2756 //-----------------------------------
2757 // CounterOutPut
2758 if (gEDBDEBUGLEVEL==2) if ((i%1)==0) cout << GLOBAL_InBTArrayEntries <<" InBT in total, still to do:"<<Form("%4d",i)<< "\r\r\r\r"<<flush;
2759 //-----------------------------------
2760
2761 //-----------------------------------
2762 // Get InitiatorBT from GLOBAL_InBTArray
2763 InBT=(EdbSegP*)GLOBAL_InBTArray->At(i);
2764 //--------
2765 GLOBAL_InBT_E=InBT->P();
2766 GLOBAL_InBT_TanTheta=TMath::Sqrt(InBT->TX()*InBT->TX()+InBT->TY()*InBT->TY());
2767 GLOBAL_InBT_Flag=InBT->Flag();
2768 GLOBAL_InBT_MC=InBT->MCEvt();
2769 //--------
2770 Int_t local_NBT=0;
2771 Int_t local_NBTMC=0;
2772 Int_t local_NBTallMC=0;
2773 Int_t local_NBTeMC=0;
2774 float_t local_pure=-1;
2775 float_t local_purall=-1;
2776 Int_t npat_int=0;
2777 Int_t npat_total=0;
2778 Int_t npatN=0;
2779 Int_t npat_Neff=0;
2780 Int_t NBT_Neff=0;
2781 Int_t NBTMC_Neff=0;
2782 Int_t NBTMCe_Neff=0;
2783 //--------
2784
2785 if (gEDBDEBUGLEVEL>2) {
2786 cout << endl << endl << "--- Starting Shower for Number " << i << " now: "<<endl;
2787 InBT->PrintNice();
2788 }
2789 //-----------------------------------
2790
2791 //-----------------------------------
2792 // 1) Make local_gAli with cut parameters:
2793 //-----------------------------------
2794 //local_gAli = TransformEdbPVRec(GLOBAL_gAli, InBT);
2795 local_gAli = TransformEdbPVRec_SA(GLOBAL_gAli, InBT); // Especially for SA-Algorithm to set the size of the local_gAli also.
2796
2797 // Add InBT to GLOBAL_ShowerSegArray
2798 GLOBAL_ShowerSegArray -> Add(InBT);
2799 //-----------------------------------
2800
2801
2802 //-----------------------------------
2803 // 2) Loop over (whole) local_gAli, check BT for Cuts
2804 //-----------------------------------
2805 Int_t local_gAli_npat=local_gAli->Npatterns();
2806 if (gEDBDEBUGLEVEL>2) cout << "--- local_gAli_npat= " << local_gAli_npat << endl;
2807
2808 // Loop over all plates of local_gAli, since this is already
2809 // extracted with the right numbers of plates...
2810 for (Int_t patterloop_cnt=local_gAli_npat-1; patterloop_cnt>=0; --patterloop_cnt) {
2811 if (gEDBDEBUGLEVEL>3) cout << "--- --- Doing patterloop_cnt= " << patterloop_cnt << endl;
2812
2813 for (Int_t btloop_cnt=0; btloop_cnt<local_gAli->GetPattern(patterloop_cnt)->GetN(); ++btloop_cnt) {
2814 seg = (EdbSegP*)local_gAli->GetPattern(patterloop_cnt)->GetSegment(btloop_cnt);
2815 if (gEDBDEBUGLEVEL>3) seg->PrintNice();
2816
2817 // Now apply cut conditions: ReconstructShowers_SA Alg --------------------
2818 if (seg->MCEvt()<0) continue;
2819 if (seg->P() < CUT_PARAMETER[0]) continue;
2820 // end of cut conditions: ReconstructShowers_SA Alg --------------------
2821
2822 // If we arrive here, Basetrack seg has passed criteria
2823 // and is then added to the shower array:
2824 // Check if its not the InBT which is already added:
2825 if (seg->X()==InBT->X()&&seg->Y()==InBT->Y()) {
2826 ; // do nothing;
2827 }
2828 else {
2829 GLOBAL_ShowerSegArray -> Add(seg);
2830 }
2831 }
2832
2833 // Calc BT density around shower:
2834 EdbPattern* pat_interim=local_gAli->GetPattern(patterloop_cnt);
2835 CalcTrackDensity(pat_interim,local_gAli_pat_interim_halfsize,npat_int,npat_total,npatN);
2836
2837 // Calc TrackNumbers for plate for efficency numbers:
2838 CalcEfficencyNumbers(pat_interim, InBT->MCEvt(), NBT_Neff, NBTMC_Neff,NBTMCe_Neff);
2839 }
2840 // end of loop over all plates of local_gAli
2842
2843
2844 //-----------------------------------
2845 // 4) Calculate pur/eff/NBT numbers,
2846 // not needed when only reconstruction
2847 // done:
2848 //-----------------------------------
2849 if (cmd_OUTPUTLEVEL>=2 || cmd_OUTPUTLEVEL==0 ) {
2850 Int_t NBT=0;
2851 Int_t NBTMC=0;
2852 Int_t NBTallMC=0;
2853 Int_t NBTeMC=0;
2854 Double_t eff, purall, pure;
2855 CalcEffPurOfShower2(GLOBAL_ShowerSegArray, NBT, NBTMC, NBTallMC, NBTeMC, purall, pure, NBT_Neff, NBTMC_Neff,NBTMCe_Neff);
2856
2857 // Fill only for MC Event:
2858 if (GLOBAL_InBT_MC>0) {
2863 }
2865 }
2866
2867
2868 //-----------------------------------
2869 // 5) Fill Tree:
2870 //-----------------------------------
2871 TREE_ShowRecEff->Fill();
2872 if (gEDBDEBUGLEVEL>3) TREE_ShowRecEff->Show(TREE_ShowRecEff->GetEntries()-1);
2873
2874
2875 //-----------------------------------
2876 // 6a) Transfer ShowerArray to treebranchTreeEntry:
2877 //-----------------------------------
2878 if (cmd_OUTPUTLEVEL>0) {
2880 }
2881
2882
2883 //------------------------------------
2884 // Reset and delete important things:
2885 // also to avoid memory problems ...
2886 //-----------------------------------
2887 GLOBAL_ShowerSegArray->Clear();
2888 if (gEDBDEBUGLEVEL>3) cout << "--- ---GLOBAL_ShowerSegArray->GetEntries(): "<< GLOBAL_ShowerSegArray->GetEntries() << endl;
2889 delete local_gAli;
2890 local_gAli=0;
2892 //------------------------------------
2893 }
2894 // end of loop over GLOBAL_InBTArrayEntries
2895 //-----------------------------------------------------------------
2896
2897 if (gEDBDEBUGLEVEL==2) cout << endl<<flush;
2898 if (gEDBDEBUGLEVEL>3) cout << "---TREE_ShowRecEff->GetEntries() ... " << TREE_ShowRecEff->GetEntries() << endl;
2899 if (gEDBDEBUGLEVEL>3) cout << "---GLOBAL_INBTSHOWERNR ... " << GLOBAL_INBTSHOWERNR<< endl;
2900
2901
2902 return;
2903}
EdbPVRec * TransformEdbPVRec_SA(EdbPVRec *gAli, EdbSegP *InitiatorBT)
Definition: ShowRec.cpp:6506

◆ ReconstructShowers_TC()

void ReconstructShowers_TC ( )
2921{
2922 Log(2, "ShowRec.cpp", "--- void ReconstructShowers_TC() ---");
2923
2924 //-----------------------------------------------------------------
2925 // Main function for reconstruction of TC "Track(s) (in) Cone" Algorithm
2926 // Connects tracks to ConteTube Reconstructed Object like in the CA or OI Alg.
2927 //-----------------------------------------------------------------
2928
2929 //-----------------------------------
2930 // For each InitiatorBT this is
2931 // divided in several small parts:
2932 //
2933 // 1) Make local_gAli with cut parameters, Make GetPID of InBT and corresponding of plates
2934 // 2a) Loop over (whole) local_gAli, check BT for Cuts (ConeTube)
2935 // 2b) Loop over (whole) tracks from a linked_tracks file, try to attach these tracks to BT of these within the cone
2936 // 2c) Loop over (whole) attached basetracks, start ConeTube Reconstruction for these BT itsself.
2937 // 4) Calculate pur/eff/NBT numbers
2938 // 5) Fill Trees
2939 //-----------------------------------
2940
2941 // Define Helper Variables:
2942 EdbPVRec* local_gAli;
2943 EdbSegP* InBT;
2944 EdbSegP* seg;
2945 Float_t local_gAli_pat_interim_halfsize=0;
2946
2949
2950 Float_t gAliZMax=TMath::Max(GLOBAL_gAli->GetPattern(GLOBAL_gAli->Npatterns()-1)->Z(),GLOBAL_gAli->GetPattern(0)->Z());
2951
2952 if (gEDBDEBUGLEVEL>2) {
2953 cout << "--- --- --- Printing GLOBAL_InBTArray MaximumZ Position " << gAliZMax << " --- --- ---"<<endl;
2955 }
2956
2957 // Define TObjArray which contains Bastracks Clones from the tracking.
2958 EdbSegP * segment=0;
2959 EdbSegP * s2=0;
2960 EdbTrackP *t = 0;
2961 TFile * fil = new TFile("linked_tracks.root");
2962 TTree* tr= (TTree*)fil->Get("tracks");
2963 TClonesArray *segClonesArray= new TClonesArray("EdbSegP",60);
2964 int nentr = int(tr->GetEntries());
2965 int nseg,n0,npl;
2966 cout << "Of linked_tracks we have " << nentr << " entries Total"<<endl;
2967 tr->SetBranchAddress("t.", &t );
2968 tr->SetBranchAddress("s", &segClonesArray );
2969 tr->SetBranchAddress("nseg", &nseg );
2970 tr->SetBranchAddress("n0", &n0 );
2971 tr->SetBranchAddress("npl", &npl );
2972 if (gEDBDEBUGLEVEL>2) tr->Show(0);
2973
2974 cout << "Try Creating Arrays"<< endl;
2975 TObjArray* LOCAL_TrackBTArray= new TObjArray(nentr);
2976 TObjArray* LOCAL_NewAddedBTArray= new TObjArray(nentr);
2977 cout << "Creating Arrays done."<< endl;
2978
2979 for (int i=0; i<nentr; i++ ) {
2980 //if (i%10!=0) continue;
2981 tr->GetEntry(i);
2982
2983 if (gEDBDEBUGLEVEL>3) cout << i << " t.eX Y Z " << t->X() << " "<< t->Y() << " "<< t->Z() << endl;
2984
2985 // // Take only Basetracks from tracks which pass 3 or more plates:
2986 // if (npl<3) continue;
2987
2988
2989 // Take only tracks which are inside the gAli Volume:
2990 // Cause Linking is done with all 57 plates, but reconstruction can be done of coure on less:
2991 s2=(EdbSegP*) segClonesArray->At(nseg-1);
2992 if (s2->Z()>gAliZMax) {
2993 cout << " TrackEND is outside of gALi Volume! Dont take track." << endl;
2994 continue;
2995 }
2996
2997 // CUTPARAMETER[6]=CUT_TRACKATTACH_NTRACKSEG
2998 // CUT_TRACKATTACH_NTRACKSEG ranges from [0..nseg-2]
2999 // nseg ranges from [2..nseg-1]
3000
3001 int takeN=TMath::Min(nseg-1,int(CUT_PARAMETER[6])+1);
3002 //cout << " takeN = " << takeN << endl;
3003
3004 for (int hh=0; hh<takeN; hh++) {
3005 // Take first BT of the tracks:
3006 s2=(EdbSegP*) segClonesArray->At(hh);
3007 if (gEDBDEBUGLEVEL>3) s2->PrintNice();
3008
3009 // Note: here we take all tracks, regardingless if they are in our desired range. (FP,MP,LP)
3010 // This we check further down:
3011 // Clone segment, otherwise it will be overwritten by the next.
3012 segment=(EdbSegP*)s2->Clone();
3013 // Add it to LOCAL_TrackBTArray
3014 LOCAL_TrackBTArray->Add(segment);
3015 }
3016 //cout << "for (int hh=0; hh<takeN; hh++) done."<<endl;
3017
3018 }
3019 delete tr;
3020 delete fil;
3021
3022 if (gEDBDEBUGLEVEL>1) cout << "--- Filled " << LOCAL_TrackBTArray->GetEntries() << " Segments into LOCAL_TrackBTArray."<<endl;
3023
3024
3025 //-----------------------------------------------------------------
3026 // Since GLOBAL_InBTArray is filled in ascending ordering by zpositon
3027 // We use the descending loop to begin with BT with lowest z first.
3028 // This part of the Algorithm is the same as OI Alg part:
3029 for (Int_t i=GLOBAL_InBTArrayEntries-1; i>=0; --i) {
3030
3031 //-----------------------------------
3032 // CounterOutPut
3033 if (gEDBDEBUGLEVEL==2) if ((i%1)==0) cout << GLOBAL_InBTArrayEntries <<" InBT in total, still to do:"<<Form("%4d",i)<< "\r\r\r\r"<<flush;
3034 //-----------------------------------
3035
3036 //-----------------------------------
3037 // Get InitiatorBT from GLOBAL_InBTArray
3038 InBT=(EdbSegP*)GLOBAL_InBTArray->At(i);
3039 //--------
3040 GLOBAL_InBT_E=InBT->P();
3041 GLOBAL_InBT_TanTheta=TMath::Sqrt(InBT->TX()*InBT->TX()+InBT->TY()*InBT->TY());
3042 GLOBAL_InBT_Flag=InBT->Flag();
3043 GLOBAL_InBT_MC=InBT->MCEvt();
3044 //--------
3045 Int_t local_NBT=0;
3046 Int_t local_NBTMC=0;
3047 Int_t local_NBTallMC=0;
3048 Int_t local_NBTeMC=0;
3049 float_t local_pure=-1;
3050 float_t local_purall=-1;
3051 Int_t npat_int=0;
3052 Int_t npat_total=0;
3053 Int_t npatN=0;
3054 Int_t npat_Neff=0;
3055 Int_t NBT_Neff=0;
3056 Int_t NBTMC_Neff=0;
3057 Int_t NBTMCe_Neff=0;
3058 //--------
3059
3060 if (gEDBDEBUGLEVEL>2) {
3061 cout << endl << endl << "--- Starting Shower for Number " << i << " now: "<<endl;
3062 InBT->PrintNice();
3063 cout << " InBT->MCEvt() "<< InBT->MCEvt() << " InBT->P() " << InBT->P() << endl;
3064 }
3065 //-----------------------------------
3066
3067 //-----------------------------------
3068 // 1) Make local_gAli with cut parameters:
3069 //-----------------------------------
3070 local_gAli = TransformEdbPVRec(GLOBAL_gAli, InBT);
3071 //local_gAli = TransformEdbPVRec_SA(GLOBAL_gAli, InBT); // Especially for SA-Algorithm to set the size of the local_gAli also.
3072
3073 // Add InBT to GLOBAL_ShowerSegArray
3074 GLOBAL_ShowerSegArray -> Add(InBT);
3075 //-----------------------------------
3076
3077
3078 //-----------------------------------
3079 // 2a) Loop over (whole) local_gAli, check BT for Cuts
3080 //-----------------------------------
3081 Int_t local_gAli_npat=local_gAli->Npatterns();
3082 if (gEDBDEBUGLEVEL>2) cout << "--- local_gAli_npat= " << local_gAli_npat << endl;
3083
3084 // Loop over all plates of local_gAli, since this is already
3085 // extracted with the right numbers of plates...
3086 for (Int_t patterloop_cnt=local_gAli_npat-1; patterloop_cnt>=0; --patterloop_cnt) {
3087 if (gEDBDEBUGLEVEL>3) cout << "--- --- Doing patterloop_cnt= " << patterloop_cnt << endl;
3088
3089 for (Int_t btloop_cnt=0; btloop_cnt<local_gAli->GetPattern(patterloop_cnt)->GetN(); ++btloop_cnt) {
3090 seg = (EdbSegP*)local_gAli->GetPattern(patterloop_cnt)->GetSegment(btloop_cnt);
3091 if (gEDBDEBUGLEVEL>3) seg->PrintNice();
3092
3093 // Now apply cut conditions: TrackCone Alg --------------------
3094 // (for first iteration, thi is equivalent to OI Alg Implementation:
3095 // if (GetdeltaRWithPropagation(seg,InBT)>100) continue;
3096 // if (TMath::Abs(seg->Z()-InBT->Z())>5000) continue;
3097 if (!GetConeOrTubeDistanceToInBT(seg, InBT, CUT_PARAMETER[0], CUT_PARAMETER[1])) continue;
3098 if (!FindPrecedingBTsSingleThetaAngle(seg, InBT, local_gAli, GLOBAL_ShowerSegArray)) continue;
3099 // end of cut conditions: TrackCone IMPLEMENTATION Alg --------------------
3100
3101 // If we arrive here, Basetrack seg has passed criteria
3102 // and is then added to the shower array:
3103 // Check if its not the InBT which is already added:
3105 }
3106
3107 } // end of loop over all plates of local_gAli
3108// if (gEDBDEBUGLEVEL>2) PrintShowerObjectArray(GLOBAL_ShowerSegArray);
3109
3110
3111 Float_t NBT_before=0;
3112 Float_t NBT_after=0;
3113 Float_t NBTMC_before=0;
3114 Float_t NBTMC_after=0;
3115 Float_t pur_before=0;
3116 Float_t pur_after=0;
3117
3118 // Quickly calculate NEW NBT and pur------------------------
3119 EdbSegP* interim=0;
3120 for (int count=0; count<GLOBAL_ShowerSegArray->GetEntries(); count++) {
3121 NBT_before++;
3122 interim=(EdbSegP*)GLOBAL_ShowerSegArray->At(count);
3123 if (interim->MCEvt()>0) NBTMC_before++;
3124 }
3125 pur_before=(Float_t)NBTMC_before/(Float_t)NBT_before;
3126 // Quickly calculate NEW NBT and pur------------------------
3127
3128
3129
3130 //-----------------------------------
3131 // 2b) Loop over (whole) tracks from a linked_tracks file, try to attach these tracks to BT of these within the cone
3132 // wARNING,wARNING: the linked tracks root file BaseTrack PIDs and the PIDs of the BTs in the eAli DO NOT
3133 // NECESSARILY have to be identical, so please, make comparisons rather on Z instead on PID.
3134 //-----------------------------------
3135
3136
3137 //cout << "=============================================================================="<<endl;
3138 //cout << "=" << endl;
3139 //cout << "= NOW try to attach tracks to the reconstructed showers:" << endl;
3140
3141 // Clear LOCAL_NewAddedBTArray to have only same MCEvts in it:
3142 LOCAL_NewAddedBTArray->Clear();
3143
3144 int nentr_LOCAL_TrackBTArray=LOCAL_TrackBTArray->GetEntries();
3145 int nentr_GLOBAL_ShowerSegArray=GLOBAL_ShowerSegArray->GetEntries();
3146
3147 int nentr2=nentr_LOCAL_TrackBTArray;
3148
3149 EdbSegP* tryAttachedSegment=0;
3150 EdbSegP* alreadyTakenSegment=0;
3151
3152 for (Int_t icount=0; icount<nentr2; icount++ ) {
3153 //for(int icount=nentr2/2; icount<(nentr2/2)+2; icount++ ) {
3154
3155 tryAttachedSegment=(EdbSegP*)LOCAL_TrackBTArray->At(icount);
3156
3157 // But take only segemnst with same MC Number as InBT of course!!
3158 if (tryAttachedSegment->MCEvt()>0 && tryAttachedSegment->MCEvt()!=InBT->MCEvt()) continue;
3159
3160 //cout << "Try to attac now segment (if array) " << icount << " with: " << endl;
3161 //tryAttachedSegment->PrintNice();
3162 //cout << "to any of the already attached segments: " << endl;
3163
3164 for (Int_t j=0; j<GLOBAL_ShowerSegArray->GetEntries(); j++ ) {
3165 alreadyTakenSegment=(EdbSegP*)GLOBAL_ShowerSegArray->At(j);
3166
3167 Float_t dRTEST= GetdeltaRWithPropagation(tryAttachedSegment,alreadyTakenSegment);
3168 Float_t dMinDist=GetMinimumDist(tryAttachedSegment,alreadyTakenSegment);
3169 Float_t dMinDist_DT=GetdeltaThetaSingleAngles(tryAttachedSegment,alreadyTakenSegment);
3170
3171 /*
3172 if (gEDBDEBUGLEVEL>2) {
3173 cout << " Test GLOBAL_ShowerSegArray segment (if array) " << j << " with: " << endl;
3174 alreadyTakenSegment->PrintNice();
3175 cout << " to connect: deltaRWith Propagation (tryAttachedSegment,alreadyTakenSegment) : ";
3176 cout << dRTEST;;
3177 cout << " GetMinimumDist(tryAttachedSegment,alreadyTakenSegment) : " << dMinDist << " " << dMinDist_DT << endl;
3178 }
3179 */
3180
3181 // The testing trackBT has to satisfy both criteria:
3182 // minimum Distance and deltaThetaSingleAngels
3183 // CUT_PARAMETER[4]=CUT_TRACKATTACH_DISTMIN
3184 // CUT_PARAMETER[5]=CUT_TRACKATTACH_DTAN_MAX
3185 if (dMinDist< CUT_PARAMETER[4] && dMinDist_DT< CUT_PARAMETER[5]) {
3186 LOCAL_NewAddedBTArray->Add(tryAttachedSegment);
3187 //if (gEDBDEBUGLEVEL>2) cout << "Found a close connection. Add tryAttachedSegment to LOCAL_NewAddedBTArray"<<endl;
3188 break;
3189 }
3190
3191 } // of (int j=0;)
3192 } // of (int icount=0; );
3193
3194 //cout << "LOCAL_NewAddedBTArray->GetEntries() = " << LOCAL_NewAddedBTArray->GetEntries() << endl;
3195 //cout << "=" << endl;
3196 //cout << "=============================================================================="<<endl;
3197
3198
3199 //-----------------------------------
3200 // 2c) Loop over (whole) local_gAli, again, but now with ONLY the new LOCAL_NewAddedBTArray as starting BTs
3201 // 2c) and only if the local_gAli Z position id greater equal than LOCAL_NewAddedBTArray z position:
3202 // 2c) Do this for every new added BaseTrack:
3203 // 2c) Rember that not the BaseTracks of the linked_tracks.root file are NOT given into ShowerOject array,
3204 // 2c) Only the intrinsic ones which come out from the gAli directly.
3205 // 2c) This is to avoid duplication of tracks, since the may not be totally equal in X,Y,Z
3206 // 2c) For example if tracking was done with small different par sets...
3207 //-----------------------------------
3208 //cout << " // 2c) Loop over (whole) local_gAli, again, but now with ONLY the new LOCAL_NewAddedBTArray as starting BTs"<<endl;
3209 //cout << " // 2c) LOCAL_NewAddedBTArray->GetEntries() " << LOCAL_NewAddedBTArray->GetEntries() << endl;
3210 //PrintShowerObjectArray(LOCAL_NewAddedBTArray);
3211
3212 for (Int_t icount=0; icount<LOCAL_NewAddedBTArray->GetEntries(); icount++) {
3213
3214 tryAttachedSegment=(EdbSegP*)LOCAL_NewAddedBTArray->At(icount);
3215 if (tryAttachedSegment->MCEvt()>0 && tryAttachedSegment->MCEvt()!=InBT->MCEvt()) continue;
3216
3217 //cout << "// 2c) Loop over (whole) local_gAli, again, but now with ONLY the new LOCAL_NewAddedBTArray as starting BTs"<< endl;
3218 //cout << "// 2c) and only if the local_gAli Z position id greater equal than LOCAL_NewAddedBTArray z position:"<< endl;
3219 //cout << " Doing this for tryAttachedSegment " << tryAttachedSegment->X() << " " << tryAttachedSegment->Y() << " " << tryAttachedSegment->Z() << " " << tryAttachedSegment->TX() << " " << tryAttachedSegment->TY() << " " << tryAttachedSegment->MCEvt() << " " << endl;
3220
3221 local_gAli_npat=local_gAli->Npatterns();
3222 // cout << "--- local_gAli_npat= " << local_gAli_npat << endl;
3223
3224 // Loop over all plates of local_gAli, since this is already
3225 // extracted with the right numbers of plates...
3226 for (Int_t patterloop_cnt=local_gAli_npat-1; patterloop_cnt>=0; --patterloop_cnt) {
3227
3228 float_t local_gAliZ=local_gAli->GetPattern(patterloop_cnt)->Z();
3229
3230 // cout << "--- --- Doing patterloop_cnt= " << patterloop_cnt << endl;
3231 // cout << "--- --- local_gAli->GetPattern(patterloop_cnt)->Z()= " << local_gAliZ << endl;
3232 // cout << "--- --- Is tryAttachedSegment->Z() gtreater equal local_gAliZ()= " << tryAttachedSegment->Z() << " " << local_gAliZ << endl;
3233
3234 // We do not want to search for local_gAli which has lower Z than the attacet BT itself
3235 //if (tryAttachedSegment->Z() < local_gAliZ) continue;
3236 //if (tryAttachedSegment->Z() > local_gAliZ) continue;
3237
3238 int matches_found=0;
3239 //cout << "--- --- YES its greater, searching BTs of localgAli now for matches ?? ? GREATER OR SMALLER ???"<<endl;
3240
3241
3242 for (Int_t btloop_cnt=0; btloop_cnt<local_gAli->GetPattern(patterloop_cnt)->GetN(); ++btloop_cnt) {
3243 seg = (EdbSegP*)local_gAli->GetPattern(patterloop_cnt)->GetSegment(btloop_cnt);
3244 if (gEDBDEBUGLEVEL>3) seg->PrintNice();
3245
3246 // Now what was formerly InBT is now the new tryAttachedSegment:
3247 // cout << " comparing now Segment " << seg << " (Z= " << seg->Z() << ") with the tryAttachedSegment (Z= " << tryAttachedSegment->Z() << ") GetdeltaRWithPropagation: "<< GetdeltaRWithPropagation(seg,tryAttachedSegment) << endl;
3248
3249 // Now apply cut conditions: TrackCone Alg --------------------
3250 if (!GetConeOrTubeDistanceToInBT(seg, tryAttachedSegment, CUT_PARAMETER[0], CUT_PARAMETER[1])) continue;
3251 // cout << "Passed GetConeOrTubeDistanceToInBT"<< endl;
3252 if (!FindPrecedingBTsSingleThetaAngleTCDEBUG(seg, tryAttachedSegment, local_gAli, GLOBAL_ShowerSegArray)) continue;
3253 // cout << "Passed FindPrecedingBTsSingleThetaAngleTCDEBUG"<< endl;
3254 // end of cut conditions: TrackCone IMPLEMENTATION Alg --------------------
3255
3256 // If we arrive here, Basetrack seg has passed criteria
3257 // and is then added to the shower array:
3258 // Check if its not the InBT which is already added:
3259 Bool_t isBTadded=kFALSE;
3261
3262 if (gEDBDEBUGLEVEL>2) {
3263 if (isBTadded) cout << "...Yes this was a new one, and is added to shower array! ..."<< endl;
3264 if (isBTadded) seg->PrintNice();
3265 }
3266 if (isBTadded) matches_found++;
3267
3268 } // of (Int_t btloop_cnt=0; );
3269
3270 //if (matches_found>0) cout << "--- --- In this plate we have found _ADDITIONAL_ (more than zero) BTs: "<< matches_found << endl;
3271
3272 // Calculate Efficency numbers only for the last element of the loop,
3273 // otherwise we add to much numbers...
3274 if (icount==LOCAL_NewAddedBTArray->GetEntries()-1) {
3275 // Calc BT density around shower:
3276 EdbPattern* pat_interim=local_gAli->GetPattern(patterloop_cnt);
3277 CalcTrackDensity(pat_interim,local_gAli_pat_interim_halfsize,npat_int,npat_total,npatN);
3278 // Calc TrackNumbers for plate for efficency numbers:
3279 CalcEfficencyNumbers(pat_interim, InBT->MCEvt(), NBT_Neff, NBTMC_Neff,NBTMCe_Neff);
3280 }
3281
3282 } // for (Int_t patterloop_cnt=local_gAli_npat-1; patterloop_cnt>=0; --patterloop_cnt) // end of loop over all plates of local_gAli
3283
3284 } // for(int icount=0; icount<OCAL_NewAddedBTArray->GetEntries(); icount++ )
3285 LOCAL_NewAddedBTArray->Clear();
3286
3287// if (gEDBDEBUGLEVEL>2) PrintShowerObjectArray(GLOBAL_ShowerSegArray);
3288
3289
3290 // Quickly calculate NEW NBT and pur------------------------
3291 NBT_after=0;
3292 NBTMC_after=0;
3293 for (int count=0; count<GLOBAL_ShowerSegArray->GetEntries(); count++) {
3294 NBT_after++;
3295 interim=(EdbSegP*)GLOBAL_ShowerSegArray->At(count);
3296 if (interim->MCEvt()>0) NBTMC_after++;
3297 }
3298 pur_after=(Float_t)NBTMC_after/(Float_t)NBT_after;
3299 // Quickly calculate NEW NBT and pur------------------------
3300
3301 if (gEDBDEBUGLEVEL>2) {
3302 cout << " Difference between before and after: " << endl;
3303 cout << " NBT = " << NBT_after << " Before: "<< NBT_before << endl;
3304 cout << " NBTMC = " << NBTMC_after << " Before: "<< NBTMC_before << endl;
3305 cout << " pur = " << pur_after << " Before: "<< pur_before << endl;
3306 }
3307
3308 //-----------------------------------
3309 // 4) Calculate pur/eff/NBT numbers,
3310 // not needed when only reconstruction
3311 // done:
3312 //-----------------------------------
3313 if (cmd_OUTPUTLEVEL>=2 || cmd_OUTPUTLEVEL==0 ) {
3314 Int_t NBT=0;
3315 Int_t NBTMC=0;
3316 Int_t NBTallMC=0;
3317 Int_t NBTeMC=0;
3318 Double_t eff, purall, pure;
3319 CalcEffPurOfShower2(GLOBAL_ShowerSegArray, NBT, NBTMC, NBTallMC, NBTeMC, purall, pure, NBT_Neff, NBTMC_Neff,NBTMCe_Neff);
3320
3321 // Fill only for MC Event:
3322 if (GLOBAL_InBT_MC>0) {
3327 }
3329 }
3330
3331
3332 //-----------------------------------
3333 // 5) Fill Tree:
3334 //-----------------------------------
3335 TREE_ShowRecEff->Fill();
3336 if (gEDBDEBUGLEVEL>3) TREE_ShowRecEff->Show(TREE_ShowRecEff->GetEntries()-1);
3337
3338
3339 //-----------------------------------
3340 // 6a) Transfer ShowerArray to treebranchTreeEntry:
3341 //-----------------------------------
3342 if (cmd_OUTPUTLEVEL>0) {
3344 }
3345
3346
3347 //------------------------------------
3348 // Reset and delete important things:
3349 // also to avoid memory problems ...
3350 //-----------------------------------
3351
3352 GLOBAL_ShowerSegArray->Clear();
3353 if (gEDBDEBUGLEVEL>3) cout << "--- ---GLOBAL_ShowerSegArray->GetEntries(): "<< GLOBAL_ShowerSegArray->GetEntries() << endl;
3354 delete local_gAli;
3355 local_gAli=0;
3357 //------------------------------------
3358 }
3359 // end of loop over GLOBAL_InBTArrayEntries
3360 //-----------------------------------------------------------------
3361
3362
3363 delete LOCAL_TrackBTArray;
3364 delete LOCAL_NewAddedBTArray;
3365
3366 if (gEDBDEBUGLEVEL==2) cout << endl<<flush;
3367 if (gEDBDEBUGLEVEL>3) cout << "---TREE_ShowRecEff->GetEntries() ... " << TREE_ShowRecEff->GetEntries() << endl;
3368 if (gEDBDEBUGLEVEL>3) cout << "---GLOBAL_INBTSHOWERNR ... " << GLOBAL_INBTSHOWERNR<< endl;
3369
3370
3371 return;
3372}
Bool_t FindPrecedingBTsSingleThetaAngleTCDEBUG(EdbSegP *s, EdbSegP *InBT, EdbPVRec *gAli, TObjArray *showersegarray)
Definition: ShowRec.cpp:6903
TTree * t
Definition: check_shower.C:4

◆ SetDefaultValues_CommandLine()

void SetDefaultValues_CommandLine ( )
510 {
511
512 Log(2, "ShowRec.cpp", "--- void SetDefaultValues_CommandLine() ---");
513
514 //--- Set default Values:
515 cmd_FP=1; // This default setting (FP,MP,LP,NP) takes all BTs in the volume
516 cmd_LP=57; // for possible initiator basetracks and starts reconstruction
517 cmd_MP=57; // from them all.
518 cmd_NP=57; // Attention: this may take a very long time.
519 cmd_PADI=0;
520 cmd_BTPA=0;
521 cmd_BGTP=0;
522 cmd_ALTP=4;
523 cmd_PASTART=-1;
524 cmd_PAEND=-1;
525 cmd_LT=0;
526 cmd_MC=1;
527 cmd_MCFL=0;
528 cmd_HPLZ=1;
529 cmd_vtx=0;
532 cmd_ALI=0;
533 cmd_MCMIX=0;
534 cmd_FILETP=0;
535 cmd_GBMC=0;
536 cmd_lnkdef_name = "lnk.def";
537 cmd_EXTHETA=0;
538 return;
539}

◆ SetPresetParameters()

void SetPresetParameters ( Int_t  cmd_PRESET)
7337 {
7338
7339 Log(2, "ShowRec.cpp", "--- SetPresetParameters() ---");
7340
7341 cout << "ATTentION : Currently we set cmd_ALI=2 for all presets for testing purposes!!! " << endl;
7342 cmd_ALI=2;
7343
7344 if (cmd_PRESET==0) {
7345 cmd_MC=0;
7346 cmd_HPLZ=0;
7347 cmd_CLEAN=0;
7348 }
7349 else if (cmd_PRESET==1) {
7350 cmd_MC=1;
7351 cmd_HPLZ=1;
7352 cmd_CLEAN=0;
7353 }
7354 else if (cmd_PRESET==2) {
7355 cmd_MC=0;
7356 cmd_HPLZ=0;
7357 cmd_LT=1;
7358 }
7359 else if (cmd_PRESET==3) {
7360 cmd_MC=0;
7361 cmd_HPLZ=0;
7362 cmd_vtx=1;
7363 }
7364 else {
7365 cout << "No Preset List for this parameter found. Using values for PRESET 0." << endl;
7366 cmd_MC=0;
7367 cmd_HPLZ=0;
7368 cmd_CLEAN=0;
7369 }
7370 Log(2, "ShowRec.cpp", "--- SetPresetParameters()...done. ---");
7371 return;
7372}

◆ SortShowerZ()

void SortShowerZ ( TObjArray *  showerarray)
7064 {
7065
7066 // A simple reverting sort: assuming that segments in shower are already sorted, but in
7067 // descending direction, so we just invert them!
7068 // CANNOT BE USED WHEN segments wer put in an arbitrary way!!!
7069
7070 if (IsShowerSortedZ(showerarray)) {
7071 if (gEDBDEBUGLEVEL>2) cout << "Shower already sorted in ascending Z-direction. Do nothing." << endl;
7072 return;
7073 }
7074 Int_t nent_showerarray=showerarray->GetEntries();
7075 Int_t nent=showerarray->GetEntries();
7076 TObjArray* interimShower = new TObjArray(nent_showerarray);
7077 if (gEDBDEBUGLEVEL>2) cout << "interif (gEDBDEBUGLEVEL>2)imShower->GetEntries() " << interimShower->GetEntries() << endl;
7078 if (gEDBDEBUGLEVEL>2) cout << "showerarray->GetEntries() " << showerarray->GetEntries() << endl;
7079 EdbSegP* s0;
7080 EdbSegP* s1;
7081 for (Int_t k=0; k<nent; ++k) {
7082 EdbSegP* s0=(EdbSegP*)showerarray->At(nent-k-1);
7083 interimShower->AddAt(s0,k);
7084 }
7085 showerarray->Clear();
7086 for (Int_t k=0; k<nent; ++k) {
7087 EdbSegP* s0=(EdbSegP*)interimShower->At(k);
7088 showerarray->AddAt(s0,k);
7089 }
7090 if (gEDBDEBUGLEVEL>2) PrintShowerObjectArray(showerarray);
7091
7092 if (IsShowerSortedZ(showerarray)) {
7093 if (gEDBDEBUGLEVEL>2) cout << "Shower now sorted in ascending Z-direction. Done." << endl;
7094 return;
7095 }
7096 if (!IsShowerSortedZ(showerarray)) {
7097 cout << "WARNING WARNING Shower is still NOT sorted in ascending Z-direction. YOU HAVE TO CHECK MANUALLY." << endl;
7098 return;
7099 }
7100 return;
7101}
void Clear()
Definition: EdbSegP.h:86

◆ TransferShowerObjectArrayIntoEntryOfTreebranchShowerTree()

void TransferShowerObjectArrayIntoEntryOfTreebranchShowerTree ( TTree *  treebranchtree,
TObjArray *  segarray 
)

--— IMPORTANT:: these areopen cut values for best combifinding of pair BT deltaR/Theta values --— IMPORTANT:: then you do NOT necessarily get back your values which you put in durign --— IMPORTANT:: your shower reconstruction cone ( deltaR/Theta cutvalues could be NO cutvalues --— IMPORTANT:: for some reconstruction algorithms for example, but we wanna have these values anyway. In Any Case: Frederics Cut looks only for best min_shower_deltar so we do also.

6441{
6442 Log(3, "ShowRec.cpp", "--- void* TransferShowerObjectArrayIntoEntryOfTreebranchShowerTree() ---");
6443
6444 // SaveCheck if shower has at least one basetrack:
6445 if (segarray->GetEntries()<1) return;
6446
6447 EdbSegP* seg;
6448 EdbSegP* Inseg;
6449 Int_t helper_nfilmb;
6450 Int_t diff_pid;
6451 Float_t min_shower_deltathetab=99999;
6452 Float_t min_shower_deltar=99999;
6453 Float_t test_shower_deltathetab=99999;
6454 Float_t test_shower_deltar=99999;
6455 Float_t test_shower_deltax,test_shower_deltay;
6456 Int_t max_diff_pid=0;
6457
6458
6459 Float_t shower_sizebNHELP=0;
6460 Float_t shower_sizebMCNHELP=0;
6461
6462 Float_t extrapol_x,extrapol_y, extrapo_diffz;
6463
6464 // Initialize arrays...
6468 shower_sizeb=0;
6474 for (int ii=0; ii<5000; ii++) {
6475 shower_xb[ii]=0;
6476 shower_yb[ii]=0;
6477 shower_zb[ii]=0;
6478 shower_txb[ii]=0;
6479 shower_tyb[ii]=0;
6480 shower_nfilmb[ii]=0;
6481 shower_tagprimary[ii]=0;
6482 shower_ntrace1simub[ii]=0;
6483 shower_ntrace2simub[ii]=0;
6484 shower_ntrace3simub[ii]=0;
6485 shower_ntrace4simub[ii]=0;
6486 shower_deltaxb[ii]=0;
6487 shower_deltayb[ii]=0;
6488 shower_chi2btkb[ii]=0;
6489 shower_idb[ii]=0;
6490 shower_plateb[ii]=0;
6491 }
6492 for (int i=1; i<58; ++i) {
6494 }
6495
6496 // Part To calculate the TransfereedVariables....
6497 shower_sizeb=segarray->GetEntries();
6498 Inseg=(EdbSegP*)segarray->At(0);
6500 shower_number_eventb=Inseg->MCEvt();
6502
6503
6504 if (gEDBDEBUGLEVEL>3) cout << "--- --- ---------------------"<<endl;
6505 //-------------------------------------
6506 for (int ii=0; ii<shower_sizeb; ii++) {
6507
6508 if (ii>=5000) {
6509 cout << "WARNING: shower_sizeb ( " << shower_sizeb<< ") greater than SHOWERARRAY. Set sizeb to 4999 and Stop filling!."<<endl;
6510 shower_sizeb=4999;
6511 continue;
6512 }
6513 seg=(EdbSegP*)segarray->At(ii);
6514
6515 //-------------------------------------
6516 shower_xb[ii]=seg->X();
6517 shower_yb[ii]=seg->Y();
6518 shower_txb[ii]=seg->TX();
6519 shower_tyb[ii]=seg->TY();
6520 shower_zb[ii]=seg->Z();
6521 shower_chi2btkb[ii]=seg->Chi2();
6522 shower_deltathetab[ii]=0.5;
6523 shower_deltarb[ii]=200;
6524 shower_tagprimary[ii]=0;
6525 if (ii==0) shower_tagprimary[ii]=1;
6526 shower_isizeb=1; // always 1, not needed anymore
6527 if (seg->MCEvt()>0) {
6528 shower_ntrace1simub[ii]=seg->MCEvt();
6529 shower_ntrace2simub[ii]=seg->W();
6530 shower_ntrace3simub[ii]=seg->P();
6531 shower_ntrace4simub[ii]=seg->Flag();
6532 }
6533 else {
6534 // keep the seg->BT settings for BG:
6535 // that come out of "normal" scanned data from fedra:
6536 // shower_ntrace1simub=-999
6537 // shower_ntrace2simub=seg->W();
6538 // shower_ntrace3simub=-999
6539 // shower_ntrace4simub=0
6540 shower_ntrace1simub[ii]=-999;
6541 shower_ntrace2simub[ii]=seg->W();
6542 shower_ntrace3simub[ii]=-999;
6543 shower_ntrace4simub[ii]=0;
6544 }
6545 shower_idb[ii]=seg->ID();
6546 shower_plateb[ii]=seg->PID();
6547
6548
6549 //-------------------------------------
6550 // PUT HERE: deltarb,deltarb, nflimb, sizeb15......
6551 diff_pid=TMath::Abs( Inseg->PID()-seg->PID() )+1;
6552 // (does this work for up/downsream listing??)
6553 // (yes, since InBT->PID is also changed.)
6554 // but works only if the gAli Object has no missing plates
6555 // otherwise f.e. PID(1) and PID(2) are not necessaryly abay by dZ=1300
6556 // (could be Z(1)=1300 and Z(2)=3900...)
6557
6558 // Calc pur:
6559 // New: (16.02.2010) define purity w.r.t. MC of Initiabtor Basetrack
6560 // So if other MC-events (like in testbeam simulation case) had been taken, they
6561 // count as well as "background!"
6562 shower_sizebNHELP++;
6563 if (seg->MCEvt()==shower_number_eventb&&shower_number_eventb>0) shower_sizebMCNHELP++;
6564 // for example: InBT:MCEvt==4 and Basetrack has MCEvt==18 then
6565 // shower_sizebNHELP++, but not shower_sizebMCNHELP !!
6566 // But also: if shower_number_eventb==-999 i.e. we start from a BG basetrack
6567 // and all other shower collected BTs have MCEvt==-999 then we get also
6568 // a purity of 1.
6569 // That means shower consisting only of BG events are in that sense also "very pure".
6570 // How to deal with this?
6571 // if (shower_number_eventb=-999) then we do NOT increment
6572 // shower_sizebMCNHELP , this is by changing the statement from
6573 // if (seg->MCEvt()==shower_number_eventb) shower_sizebMCNHELP++;
6574 // to
6575 // if (seg->MCEvt()==shower_number_eventb&&shower_number_eventb>0) shower_sizebMCNHELP++;
6576
6577 // InBT:
6578 if (ii==0) {
6579 shower_deltathetab[0]=0.5;
6580 shower_deltarb[0]=200;
6581 shower_nfilmb[0]=1;
6582 }
6583 // All other BTs:
6584 if (ii>0) {
6585 // its correct like this, since this is the way it is done in
6586 // the official FJ-Algorithm:
6587 shower_nfilmb[ii]=diff_pid;
6588 if (gEDBDEBUGLEVEL>3) cout << "--- ---Inseg->PID() seg->PID() ii diif_pid shower_nfilmb[ii] " << Inseg->PID()<< " " << seg->PID() << " " << ii<< " " << diff_pid<<" "<< shower_nfilmb[ii]<<" " << endl;
6589
6590 shower_numberofilms=TMath::Max(shower_numberofilms,diff_pid);
6591
6592 if (diff_pid >= 15 ) shower_sizeb15++;
6593 if (diff_pid >= 20 ) shower_sizeb20++;
6594 if (diff_pid >= 30 ) shower_sizeb30++;
6595
6596 // PUT HERE: calculation routine for shower_deltasigmathetab
6597 // see referenc in thesis of Luillo Esposito, page 109.
6598 shower_deltasigmathetab[diff_pid]=shower_deltasigmathetab[diff_pid]+(Power(shower_txb[ii]-shower_txb[0],2)+Power(shower_tyb[ii]-shower_tyb[0],2));
6599
6600 // PUT HERE: calculation routine for shower_deltathetab, shower_deltarb
6601 // ExSetTreebranchNametrapolate the BT [ii] to the position [jj] and then calc the
6602 // position and slope differences;
6603 // For the backward extrapolation of the shower_deltathetab and shower_deltarb
6604 // calulation for BaseTrack(ii), Basetrack(jj)->Z() hast to be smaller.
6605 min_shower_deltathetab=99999; // Reset
6606 min_shower_deltar=99999; // Reset
6607
6608 for (int jj=0; jj<shower_sizeb; jj++) {
6609 if (ii==jj) continue;
6610
6611 // since we do not know if BTs are ordered by their Z positions:
6612 // and cannot cut directly on the number in the shower entry:
6613 // Entry jj has to have lower Z than ii:
6614 if (shower_zb[ii]<=shower_zb[jj]) continue;
6615
6616 extrapo_diffz=shower_zb[ii]-shower_zb[jj];
6617 if (TMath::Abs(extrapo_diffz)>4*1300+1.0) continue;
6618// if (TMath::Abs(extrapo_diffz)>6*1300+1.0) continue;
6619// if (TMath::Abs(extrapo_diffz)>9*1300+1.0) continue;
6620 // if 4/6/9 gives only similar results...
6621 if (TMath::Abs(extrapo_diffz)<1.0) continue; // remove same positions.
6622
6623 extrapol_x=shower_xb[ii]-shower_txb[ii]*extrapo_diffz; // minus, because its ii after jj.
6624 extrapol_y=shower_yb[ii]-shower_tyb[ii]*extrapo_diffz; // minus, because its ii after jj.
6625
6626 // Delta radius we need to extrapolate.
6627// test_shower_deltax=extrapol_x;//shower_txb[ii]*(shower_zb[ii]-shower_zb[jj])+shower_xb[ii];
6628// test_shower_deltay=extrapol_y;//shower_tyb[ii]*(shower_zb[ii]-shower_zb[jj])+shower_yb[ii];
6629 test_shower_deltax=extrapol_x-shower_xb[jj];
6630 test_shower_deltay=extrapol_y-shower_yb[jj];
6631 test_shower_deltar=TMath::Sqrt(test_shower_deltax*test_shower_deltax+test_shower_deltay*test_shower_deltay);
6632
6633 // Delta theta we do not need to extrapolate. (old version...)
6634 //test_shower_deltathetab=TMath::Sqrt(shower_txb[ii]*shower_txb[ii]+shower_tyb[ii]*shower_tyb[ii]);
6635 //test_shower_deltathetab=test_shower_deltathetab-TMath::Sqrt(shower_txb[jj]*shower_txb[jj]+shower_tyb[jj]*shower_tyb[jj]);
6636 //test_shower_deltathetab=TMath::Abs(test_shower_deltathetab);
6637 //----
6638 // As before in ShowRec this way of calculation is not equivalent as calculating
6639 // DeltaTheta domponentwise:
6640 // Code from libShower:
6641 // delta = sqrt((SX0-a->GetTXb(l2))*(SX0-a->GetTXb(l2))+((SY0-a->GetTYb(l2))*(SY0-a->GetTYb(l2))));
6642 test_shower_deltathetab=TMath::Sqrt(TMath::Power(shower_txb[ii]-shower_txb[jj],2)+TMath::Power(shower_tyb[ii]-shower_tyb[jj],2));
6643
6644 // Check if both dr,dt match parameter criteria and then just take these values.....
6645 // Maybe a change is necessary because it is not exactly the same as in the off. algorithm.
6646// if (test_shower_deltar<400 && test_shower_deltathetab<0.8 ) {
6647// if (test_shower_deltar<150 && test_shower_deltathetab<0.15) {
6648 if (test_shower_deltar<1000 && test_shower_deltathetab<2.0 ) {
6655 if (test_shower_deltar<min_shower_deltar) {
6656 min_shower_deltathetab=test_shower_deltathetab;
6657 min_shower_deltar=test_shower_deltar;
6658 shower_deltathetab[ii]=min_shower_deltathetab;
6659 shower_deltarb[ii]=min_shower_deltar;
6660 //cout << ii << " " << jj << " " << test_shower_deltathetab << " " << test_shower_deltar << " " <<min_shower_deltathetab << " " << min_shower_deltar << endl;
6661
6662 } // if (test_shower_deltar<min_shower_deltar)
6663 } // if (test_shower_deltar<150 && test_shower_deltathetab<0.15 )
6664 } // for (int jj=0;jj<shower_sizeb;jj++)
6665
6666
6667 //cout << "For ii= " << ii << "we found the best matcjgin dRtehta values: " << min_shower_deltathetab << " " << min_shower_deltar << endl;
6668 } // if (ii>0)
6669 //-------------------------------------
6670
6671
6672 shower_purb=shower_sizebMCNHELP/shower_sizebNHELP;
6673 } // for (int ii=0;ii<shower_sizeb;ii++) {
6674 if (gEDBDEBUGLEVEL>2) {
6675 cout << "ShowRec.cpp : --- void* TransferShowerObjectArrayIntoEntryOfTreebranchShowerTree() ---"<<endl;
6676 cout << "Loop over for (int ii=0;ii<shower_sizeb;ii++) done." << endl;
6677 }
6678
6679 //-------------------------------------
6680 for (int i=1; i<58; ++i) {
6682 }
6683 shower_numberofilms=shower_nfilmb[shower_sizeb-1]; // there we assume (this is correct always?) when
6684 // the last shower BT is in the last film...(otherwise we would again have to loop on sizeb array);
6685 //cout << "TransferShowerObjectArrayIntoEntryOfTreebranchShowerTree shower_numberofilms= "<< shower_numberofilms <<endl;
6686
6687 int eN0=0;
6688 for (int i=0; i<shower_nfilmb[shower_sizeb-1]; i++) if (shower_nfilmb[i]==0) ++eN0;
6690
6691 int eN00int=0;
6692 int eN00=0;
6693 for (int i=1; i<shower_nfilmb[shower_sizeb-1]; i++) {
6694 //cout << i << "------------" << shower_nfilmb[i]-shower_nfilmb[i-1] << " -- " << eN00 << endl;
6695 if (shower_nfilmb[i]-shower_nfilmb[i-1]>1) {
6696 eN00=shower_nfilmb[i]-shower_nfilmb[i-1]-1;
6697 if (eN00>eN00int) eN00int=eN00;
6698 }
6699 if (shower_nfilmb[i]-shower_nfilmb[i-1]==1) eN00=0;
6700 }
6701 eN00=eN00int;
6703
6704 //cout << "TransferShowerObjectArrayIntoEntryOfTreebranchShowerTree shower_numberofholesconseq= "<< shower_numberofholesconseq <<endl;
6705
6706 // Also calculate now Shower axis and fill axis values into the treebranch:
6707// EdbSegP* axis= new EdbSegP();
6708 EdbSegP* axis = BuildShowerAxis(segarray);
6709// axis->PrintNice();
6710 //cout << "TransferShowerObjectArrayIntoEntryOfTreebranchShowerTree BuildShowerAxis done."<<endl;
6711 shower_axis_xb=axis->X();
6712 shower_axis_yb=axis->Y();
6713 shower_axis_zb=axis->Z();
6714 shower_axis_txb=axis->TX();
6715 shower_axis_tyb=axis->TY();
6716// delete axis;
6717
6718 // Fill Tree:
6719 treebranchtree->Fill();
6720
6721 if (gEDBDEBUGLEVEL>2) cout << "Now we have treebranchtree Entries: " << treebranchtree->GetEntries() << endl;
6722 if (gEDBDEBUGLEVEL>3) treebranchtree->Show(treebranchtree->GetEntries()-1);
6723
6724 return;
6725}
Float_t Chi2() const
Definition: EdbSegP.h:157
Float_t W() const
Definition: EdbSegP.h:151

◆ TransformEdbPVRec()

EdbPVRec * TransformEdbPVRec ( EdbPVRec gAli,
EdbSegP InitiatorBT 
)

DEBUG OPENMP TEST!!!!!!!

THIS IS VERY IMPORTANT, because gAliSub has to be ordered in a way that 2nd plate follows after first, since we loop in the Reconstruct_??() Alogrithms over the Basetracks already added in the shower!


DEBUG TEST !!! MAYBE IT GOES FASTER LIKE THIS; AND ALSO THE BG CALCULATION IS BETTER PERFORMED .....


4865{
4866 Log(3, "ShowRec.cpp", "--- void TransformEdbPVRec() ---");
4867
4868 // local_halfpatternsize=11250;// debugTEST how long it takes more if we take a big area to reconstruct.
4869 Float_t halfpatternsize=local_halfpatternsize;
4870
4871
4872 // Informational Debug Output
4873 // DOWNSTREAM ORDER ASSUMED !!!
4876 Int_t npat = GLOBAL_gAli->Npatterns(); //number of plates
4877 Int_t firstplate= npat-cmd_FP;
4878 Int_t middleplate= npat-cmd_MP;
4879 Int_t actualplate= npat-cmd_FP;
4880 Int_t lastplate= TMath::Max(npat-cmd_LP-1,0);
4881 Int_t InBTplate= InitiatorBT->PID();
4882 Int_t InBTplateandNplate= InitiatorBT->PID()-cmd_NP+1;
4883 Int_t endlplatetopropagate=TMath::Max(InBTplateandNplate,lastplate);
4884 Float_t InBTZ= InitiatorBT->Z();
4885
4886 if (gEDBDEBUGLEVEL>2) {
4887 cout << "--- TransformEdbPVRec --- DOWNSTREAM ORDER = " <<endl;
4888 cout << "--- TransformEdbPVRec --- npat = " << npat << endl;
4889 cout << "--- TransformEdbPVRec --- firstplate = " << firstplate << endl;
4890 cout << "--- TransformEdbPVRec --- middleplate = " << middleplate << endl;
4891 cout << "--- TransformEdbPVRec --- lastplate = " << lastplate << endl;
4892 cout << "--- TransformEdbPVRec --- InBTplate = " << InBTplate << endl;
4893 cout << "--- TransformEdbPVRec --- InBTplateandNplate = " << InBTplateandNplate << endl;
4894 cout << "--- TransformEdbPVRec --- endlplatetopropagate = " << endlplatetopropagate << endl;
4895 cout << "--- TransformEdbPVRec --- InBTZ = " << InBTZ << endl;
4896 cout << "--- TransformEdbPVRec --- InBTplate = " << InBTplate << endl;
4897 }
4898
4899 // has to be deleted in some part of the script outside this function...
4900 // Dont forget , otherwise memory heap overflow!
4901 EdbPVRec* gAli_Sub = new EdbPVRec();
4902
4903 // Create SubPattern objects
4904 EdbSegP* ExtrapolateInitiatorBT;
4905 ExtrapolateInitiatorBT = (EdbSegP*)InitiatorBT->Clone();
4906
4907 // Create Variables For ExtractSubpattern boundaries
4908 Float_t mini[5];
4909 Float_t maxi[5];
4910 mini[0]=ExtrapolateInitiatorBT->X()-halfpatternsize;
4911 mini[1]=ExtrapolateInitiatorBT->Y()-halfpatternsize;
4912 maxi[0]=ExtrapolateInitiatorBT->X()+halfpatternsize;
4913 maxi[1]=ExtrapolateInitiatorBT->Y()+halfpatternsize;
4914 mini[2]=-0.5;
4915 mini[3]=-0.5;
4916 mini[4]=0.0;
4917 maxi[2]=0.5;
4918 maxi[3]=0.5;
4919 maxi[4]=100.0;
4920
4921
4925 if (cmd_EXTHETA==1) {
4926 mini[2]=ExtrapolateInitiatorBT->TX()-0.15;
4927 mini[3]=ExtrapolateInitiatorBT->TY()-0.15;
4928 maxi[2]=ExtrapolateInitiatorBT->TX()+0.15;
4929 maxi[3]=ExtrapolateInitiatorBT->TY()+0.15;
4930 }
4932
4933 EdbPattern* singlePattern;
4934 Int_t MCMixFlag=-1;
4935 if (cmd_MCMIX==1) {
4936 MCMixFlag=-1;
4937 }
4938 else {
4939 MCMixFlag=InitiatorBT->MCEvt();
4940 }
4941
4942 // Add the subpatterns in a loop for the plates:
4943 // in reverse ordering.due to donwstream behaviour (!):
4944 // (Only downstream is supported now...)
4945 for (Int_t ii=endlplatetopropagate; ii<=InBTplate; ++ii) {
4946
4947 Float_t zpos=gAli->GetPattern(ii)->Z();
4948 if (gEDBDEBUGLEVEL>3) cout << "--- --- Loop: ii, zpos "<< ii << " " << zpos << "; Print InitiatorBT,ExtrapolateInitiatorBT"<<endl;
4949
4950 ExtrapolateInitiatorBT->PropagateTo(zpos);
4951 if (gEDBDEBUGLEVEL>3) {
4952 InitiatorBT->PrintNice();
4953 ExtrapolateInitiatorBT->PrintNice();
4954 }
4955
4956 mini[0]=ExtrapolateInitiatorBT->X()-halfpatternsize;
4957 mini[1]=ExtrapolateInitiatorBT->Y()-halfpatternsize;
4958 maxi[0]=ExtrapolateInitiatorBT->X()+halfpatternsize;
4959 maxi[1]=ExtrapolateInitiatorBT->Y()+halfpatternsize;
4960
4961 singlePattern=(EdbPattern*)gAli->GetPattern(ii)->ExtractSubPattern(mini,maxi,MCMixFlag);
4962// cout << "singlePattern with MCMixFlag= " << MCMixFlag << " nentries= " << singlePattern->N() << endl;
4963
4964
4965 singlePattern-> SetID(gAli->GetPattern(ii)->ID());
4966 singlePattern-> SetPID(gAli->GetPattern(ii)->PID());
4967 gAli_Sub->AddPattern(singlePattern);
4968 }
4969 if (gEDBDEBUGLEVEL>2) cout <<"--- gAli_Sub->Print():"<<endl;
4970 if (gEDBDEBUGLEVEL>2) gAli_Sub->Print();
4971 if (gEDBDEBUGLEVEL>2) cout <<"--- ----------------------------------"<<endl;
4972
4973 return gAli_Sub;
4974}
int PID() const
Definition: EdbPattern.h:320
int ID() const
Definition: EdbPattern.h:319
EdbPattern * ExtractSubPattern(float min[5], float max[5], int MCevt=-1)
Definition: EdbPattern.cxx:1470
void AddPattern(EdbPattern *pat)
Definition: EdbPattern.cxx:1707
void PropagateTo(float z)
Definition: EdbSegP.cxx:293

◆ TransformEdbPVRec_BackWard()

EdbPVRec * TransformEdbPVRec_BackWard ( EdbPVRec gAli,
EdbSegP InitiatorBT 
)

THIS IS VERY IMPORTANT, because gAliSub has to be ordered in a way that 2nd plate follows after first, since we loop in the Reconstruct_??() Alogrithms over the Basetracks already added in the shower!

4979{
4980 Log(3, "ShowRec.cpp", "--- void TransformEdbPVRec_BackWard() ---");
4981
4982 local_halfpatternsize=11250;// debugTEST how long it takes more if we take a big area to reconstruct.
4983 local_halfpatternsize=5000;// debugTEST how long it takes more if we take a big area to reconstruct.
4984 local_halfpatternsize=2000;// debugTEST how long it takes more if we take a big area to reconstruct.
4985 Float_t halfpatternsize=local_halfpatternsize;
4986
4987 // Informational Debug Output
4988 // DOWNSTREAM ORDER ASSUMED !!!
4991 Int_t npat = GLOBAL_gAli->Npatterns(); //number of plates
4992 Int_t firstplate= npat-cmd_FP;
4993 Int_t middleplate= npat-cmd_MP;
4994 Int_t actualplate= npat-cmd_FP;
4995 Int_t lastplate= TMath::Max(npat-cmd_LP-1,0);
4996 Int_t InBTplate= InitiatorBT->PID();
4997 Int_t InBTplateandNplate= InitiatorBT->PID()-cmd_NP+1;
4998 Int_t endlplatetopropagate=TMath::Max(InBTplateandNplate,lastplate);
4999 Float_t InBTZ= InitiatorBT->Z();
5000
5001 if (gEDBDEBUGLEVEL>3) {
5002 cout << "--- DOWNSTREAM ORDER = " <<endl;
5003 cout << "--- npat = " << npat << endl;
5004 cout << "--- firstplate = " << firstplate << endl;
5005 cout << "--- middleplate = " << middleplate << endl;
5006 cout << "--- lastplate = " << lastplate << endl;
5007 cout << "--- InBTplate = " << InBTplate << endl;
5008 cout << "--- InBTplateandNplate = " << InBTplateandNplate << endl;
5009 cout << "--- endlplatetopropagate = " << endlplatetopropagate << endl;
5010 cout << "--- InBTZ = " << InBTZ << endl;
5011 }
5012
5013 // has to be deleted in some part of the script outside this function...
5014 // Dont forget , otherwise memory heap overflow!
5015 EdbPVRec* gAli_Sub = new EdbPVRec();
5016
5017 // Create SubPattern objects
5018 EdbSegP* ExtrapolateInitiatorBT;
5019 ExtrapolateInitiatorBT = (EdbSegP*)InitiatorBT->Clone();
5020
5021 // Create Variables For ExtractSubpattern boundaries
5022 Float_t mini[5];
5023 Float_t maxi[5];
5024 mini[0]=ExtrapolateInitiatorBT->X()-halfpatternsize;
5025 mini[1]=ExtrapolateInitiatorBT->Y()-halfpatternsize;
5026 maxi[0]=ExtrapolateInitiatorBT->X()+halfpatternsize;
5027 maxi[1]=ExtrapolateInitiatorBT->Y()+halfpatternsize;
5028 mini[2]=-0.5;
5029 mini[3]=-0.5;
5030 mini[4]=0.0;
5031 maxi[2]=0.5;
5032 maxi[3]=0.5;
5033 maxi[4]=100.0;
5034
5035 EdbPattern* singlePattern;
5036
5037 for (Int_t ii=0; ii<npat; ++ii) {
5038
5039 Float_t zpos=gAli->GetPattern(ii)->Z();
5040 if (gEDBDEBUGLEVEL>3) cout << "--- --- Loop: ii, zpos "<< ii << " " << zpos << "; Print InitiatorBT,ExtrapolateInitiatorBT"<<endl;
5041
5042 ExtrapolateInitiatorBT->PropagateTo(zpos);
5043 if (gEDBDEBUGLEVEL>3) {
5044 InitiatorBT->PrintNice();
5045 ExtrapolateInitiatorBT->PrintNice();
5046 }
5047
5048 mini[0]=ExtrapolateInitiatorBT->X()-halfpatternsize;
5049 mini[1]=ExtrapolateInitiatorBT->Y()-halfpatternsize;
5050 maxi[0]=ExtrapolateInitiatorBT->X()+halfpatternsize;
5051 maxi[1]=ExtrapolateInitiatorBT->Y()+halfpatternsize;
5052
5053 singlePattern=(EdbPattern*)gAli->GetPattern(ii)->ExtractSubPattern(mini,maxi,InitiatorBT->MCEvt());
5054 singlePattern-> SetID(gAli->GetPattern(ii)->ID());
5055 singlePattern-> SetPID(gAli->GetPattern(ii)->PID());
5056 gAli_Sub->AddPattern(singlePattern);
5057 }
5058 if (gEDBDEBUGLEVEL>3) cout <<"--- gAli_Sub->Print():"<<endl;
5059 if (gEDBDEBUGLEVEL>3) gAli_Sub->Print();
5060 if (gEDBDEBUGLEVEL>3) cout <<"--- ----------------------------------"<<endl;
5061
5062 if (gEDBDEBUGLEVEL>2) cout <<"--- gAli_Sub with ():"<< gAli_Sub->Npatterns() << "patterns."<<endl;
5063
5064 return gAli_Sub;
5065}

◆ TransformEdbPVRec_SA()

EdbPVRec * TransformEdbPVRec_SA ( EdbPVRec gAli,
EdbSegP InitiatorBT 
)

THIS IS VERY IMPORTANT, because gAliSub has to be ordered in a way that 2nd plate follows after first, since we loop in the Reconstruct_??() Alogrithms over the Basetracks already added in the shower!

5072{
5073 Log(3, "ShowRec.cpp", "--- void TransformEdbPVRec_SA() ---");
5074
5075 // Informational Debug Output
5076 // DOWNSTREAM ORDER ASSUMED !!!
5079 Int_t npat = GLOBAL_gAli->Npatterns(); //number of plates
5080 Int_t firstplate= npat-cmd_FP;
5081 Int_t middleplate= npat-cmd_MP;
5082 Int_t actualplate= npat-cmd_FP;
5083 Int_t lastplate= TMath::Max(npat-cmd_LP-1,0);
5084 Int_t InBTplate= InitiatorBT->PID();
5085 Int_t InBTplateandNplate= InitiatorBT->PID()-cmd_NP+1;
5086 Int_t endlplatetopropagate=TMath::Max(InBTplateandNplate,lastplate);
5087 Float_t InBTZ= InitiatorBT->Z();
5088
5089 if (gEDBDEBUGLEVEL>2) {
5090 cout << "--- DOWNSTREAM ORDER = " <<endl;
5091 cout << "--- npat = " << npat << endl;
5092 cout << "--- firstplate = " << firstplate << endl;
5093 cout << "--- middleplate = " << middleplate << endl;
5094 cout << "--- lastplate = " << lastplate << endl;
5095 cout << "--- InBTplate = " << InBTplate << endl;
5096 cout << "--- InBTplateandNplate = " << InBTplateandNplate << endl;
5097 cout << "--- endlplatetopropagate = " << endlplatetopropagate << endl;
5098 cout << "--- InBTZ = " << InBTZ << endl;
5099 }
5100
5101 // has to be deleted in some part of the script outside this function...
5102 // Dont forget , otherwise memory heap overflow!
5103 EdbPVRec* gAli_Sub = new EdbPVRec();
5104
5105 // Create SubPattern objects
5106 EdbSegP* ExtrapolateInitiatorBT;
5107 ExtrapolateInitiatorBT = (EdbSegP*)InitiatorBT->Clone();
5108
5109 Float_t halfsize=CUT_PARAMETER[1];
5110
5111 // Create Variables For ExtractSubpattern boundaries
5112 Float_t mini[5];
5113 Float_t maxi[5];
5114 mini[0]=ExtrapolateInitiatorBT->X()-halfsize;
5115 mini[1]=ExtrapolateInitiatorBT->Y()-halfsize;
5116 maxi[0]=ExtrapolateInitiatorBT->X()+halfsize;
5117 maxi[1]=ExtrapolateInitiatorBT->Y()+halfsize;
5118 mini[2]=-0.5;
5119 mini[3]=-0.5;
5120 mini[4]=0.0;
5121 maxi[2]=0.5;
5122 maxi[3]=0.5;
5123 maxi[4]=100.0;
5124
5125 EdbPattern* singlePattern;
5126
5127 // Add the subpatterns in a loop for the plates:
5128 // in reverse ordering.due to donwstream behaviour (!):
5129 // (Only downstream is supported now...)
5130 for (Int_t ii=endlplatetopropagate; ii<=InBTplate; ++ii) {
5131
5132 Float_t zpos=gAli->GetPattern(ii)->Z();
5133 if (gEDBDEBUGLEVEL>3) cout << "--- --- Loop: ii, zpos "<< ii << " " << zpos << "; Print InitiatorBT,ExtrapolateInitiatorBT"<<endl;
5134
5135 ExtrapolateInitiatorBT->PropagateTo(zpos);
5136 if (gEDBDEBUGLEVEL>3) {
5137 InitiatorBT->PrintNice();
5138 ExtrapolateInitiatorBT->PrintNice();
5139 }
5140
5141 mini[0]=ExtrapolateInitiatorBT->X()-halfsize;
5142 mini[1]=ExtrapolateInitiatorBT->Y()-halfsize;
5143 maxi[0]=ExtrapolateInitiatorBT->X()+halfsize;
5144 maxi[1]=ExtrapolateInitiatorBT->Y()+halfsize;
5145
5146 singlePattern=(EdbPattern*)gAli->GetPattern(ii)->ExtractSubPattern(mini,maxi,InitiatorBT->MCEvt());
5147 singlePattern-> SetID(gAli->GetPattern(ii)->ID());
5148 singlePattern-> SetPID(gAli->GetPattern(ii)->PID());
5149 gAli_Sub->AddPattern(singlePattern);
5150 }
5151 if (gEDBDEBUGLEVEL>2) cout <<"--- gAli_Sub->Print():"<<endl;
5152 if (gEDBDEBUGLEVEL>2) gAli_Sub->Print();
5153 if (gEDBDEBUGLEVEL>2) cout <<"--- ----------------------------------"<<endl;
5154
5155 return gAli_Sub;
5156}

◆ Write_Alg_GS_Histograms()

void Write_Alg_GS_Histograms ( )
7267 {
7268
7269 Log(2, "ShowRec.cpp", "--- void Write_Alg_GS_Histograms() ---");
7270 f_GSNN->cd();
7271 f_GSNN->ls();
7272 h_GSNN_var00->Write();
7273 h_GSNN_var01->Write();
7274 h_GSNN_var02->Write();
7275 h_GSNN_var03->Write();
7276 h_GSNN_var04->Write();
7277 h_GSNN_var05->Write();
7278 h_GSNN_var06->Write();
7279 t_GSNN->Write();
7280 f_GSNN->Close();
7281 Log(2, "ShowRec.cpp", "--- void Write_Alg_GS_Histograms()...done.");
7282 return;
7283}