FEDRA emulsion software from the OPERA Collaboration
ShowRec.cpp File Reference
#include "ShowRecInclude.h"
#include "ShowRec.h"
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)
 
Double_t CalcIP (EdbSegP *s, double x, double y, double z)
 
Double_t CalcIP (EdbSegP *s, EdbVertex *v)
 
void CalcTrackDensity (EdbPattern *pat_interim, Float_t pat_interim_halfsize, Int_t &npat_int, Int_t &npat_total, Int_t &npatN)
 
EdbVertexCalcVertex (TObjArray *segments)
 
Int_t Check_ParasetDefinitionFile ()
 
void CheckInputParameters ()
 
void Create_NN_Alg_Histograms ()
 
void CreateOutPutStructures ()
 
TTree * CreateTreeBranchShowerTree (Int_t ParaSetNr)
 
void Fill2GlobalInBTArray ()
 
void FillGlobalInBTArray ()
 
void FillOutPutStructures ()
 
void FillShowerAxis ()
 
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)
 
void Get_NN_ALG_MLP (TTree *simu, Int_t parasetnr)
 
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)
 
Double_t GetMinimumDist (EdbSegP *seg1, EdbSegP *seg2)
 
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)
 
void InitCutParameters ()
 
Bool_t IsSameSegment (EdbSegP *seg1, EdbSegP *seg2)
 
Bool_t IsShowerSortedZ (TObjArray *showerarray)
 
void Load_NN_ALG_MLP_weights (TMultiLayerPerceptron *mlp, Int_t parasetnr)
 
int main (int argc, char *argv[])
 
void MakeTracksTree (TTree *treebranch)
 
Int_t Open_ParasetDefinitionFile ()
 
void PrintShowerObjectArray (TObjArray *segarray)
 
void Read_ParasetDefinitionTree ()
 
void ReadDefaultValues_CommandLine ()
 
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_NN ()
 
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 RewriteSegmentPIDs (EdbPVRec *gAli)
 
void RewriteSegmentPIDs_BGPID_To_SGPID (EdbPVRec *gAli)
 
void RewriteSegmentPIDs_SGPID_To_BGPID (EdbPVRec *gAli)
 
void SetDefaultValues_CommandLine ()
 
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)
 

Function Documentation

◆ AddBTToArrayWithCeck()

Bool_t AddBTToArrayWithCeck ( EdbSegP tryAttachedSegment,
TObjArray *  GLOBAL_ShowerSegArray 
)
5940 {
5941  // We add by comparison with X,Y,TX,TY values, since this seems to be more failsafe
5942  // than adding by adresses.
5943  // This function returns kTRUE if BT is already in the shower array
5944  // This function returns kFALSE if BT is not yet in the shower array
5945 
5946  int nent=GLOBAL_ShowerSegArray->GetEntries();
5947  EdbSegP* ComparingSegment;
5948 
5949 
5950  if (gEDBDEBUGLEVEL>3) cout << "AddBTToArrayWithCeck() Check: "<< tryAttachedSegment << " with all "<< nent << " entries of GLOBAL_ShowerSegArray "<< endl;
5951 
5952  Bool_t IsContained=kFALSE;
5953 
5954  for (int i=0; i<nent; ++i) {
5955  ComparingSegment=(EdbSegP*)GLOBAL_ShowerSegArray->At(i);
5956  if (TMath::Abs(tryAttachedSegment->X()-ComparingSegment->X())>0.1) continue;
5957  if (TMath::Abs(tryAttachedSegment->Y()-ComparingSegment->Y())>0.1) continue;
5958 
5959  if (TMath::Abs(tryAttachedSegment->TX()-ComparingSegment->TX())>0.01) continue;
5960  if (TMath::Abs(tryAttachedSegment->TY()-ComparingSegment->TY())>0.01) continue;
5961 
5962  IsContained=kTRUE;
5963  }
5964 
5965 
5966  if (gEDBDEBUGLEVEL>3) cout << "AddBTToArrayWithCeck DO WE ADD THIS BT ?? "<< !IsContained << endl;
5967 
5968  if (!IsContained) {
5969  GLOBAL_ShowerSegArray->Add(tryAttachedSegment);
5970  }
5971 
5972  return !IsContained;
5973 }
TObjArray * GLOBAL_ShowerSegArray
Definition: ShowRec.h:76
Definition: EdbSegP.h:18
Float_t TX() const
Definition: EdbSegP.h:172
Float_t X() const
Definition: EdbSegP.h:170
Float_t Y() const
Definition: EdbSegP.h:171
Float_t TY() const
Definition: EdbSegP.h:173
gEDBDEBUGLEVEL
Definition: energy.C:7

◆ BuildParametrizationsMCInfo_PGun()

void BuildParametrizationsMCInfo_PGun ( TString  MCInfoFilename)
8904  {
8905  //Declare Tree Variables
8906  Int_t MCEvt, PDGId;
8907  Float_t energy, tantheta,dirx,diry,dirz,vtxposx,vtxposy,vtxposz;
8908  Float_t TX,TY,Y,X,Z;
8909 
8910 
8911  // Read Tree with File:
8912  TTree* PGunTree = new TTree();
8913  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");
8914  PGunTree->SetBranchAddress("MCEvt",&MCEvt);
8915  PGunTree->SetBranchAddress("PDGId",&PDGId);
8916  PGunTree->SetBranchAddress("energy",&energy);
8917  PGunTree->SetBranchAddress("tantheta",&tantheta);
8918  PGunTree->SetBranchAddress("dirx",&dirx);
8919  PGunTree->SetBranchAddress("diry",&diry);
8920  PGunTree->SetBranchAddress("dirz",&dirz);
8921  PGunTree->SetBranchAddress("vtxposx",&vtxposx);
8922  PGunTree->SetBranchAddress("vtxposy",&vtxposy);
8923  PGunTree->SetBranchAddress("vtxposz",&vtxposz);
8924  PGunTree->SetBranchAddress("TX",&TX);
8925  PGunTree->SetBranchAddress("TY",&TY);
8926  PGunTree->SetBranchAddress("X",&X);
8927  PGunTree->SetBranchAddress("Z",&Z);
8928  PGunTree->SetBranchAddress("Y",&Y);
8929  if (gEDBDEBUGLEVEL>2) PGunTree->Print();
8930 
8931 
8932 
8933 
8934  if (cmd_GBMC>0) PGunTree->Show(cmd_GBMC);
8935  cout << "PGunTree->GetEntries(); " << PGunTree->GetEntries() << endl;
8936 
8937  // If the PGunTree is not filled, this can be a hint that the
8938  // MCInfoFilename might not be there. This is important for alorithms that
8939  // rely on Vertex Informations, like the _GS() alg.
8940  if (PGunTree->GetEntries()==0) {
8941  cout << "ATTENTION! PGunTree->GetEntries()==0" << endl;
8942  cout << "Bool_t GLOBAL_IsBrickTreePGunInfo=kFALSE;" << endl;
8944  }
8945  else {
8947  }
8948 
8949  if (!GLOBAL_VtxArray) GLOBAL_VtxArray=new TObjArray(69999);
8950  GLOBAL_VtxArrayX[0]=0;
8951  GLOBAL_VtxArrayZ[0]=0;
8952  GLOBAL_VtxArrayY[0]=0;
8953 
8954  //------------------
8955  Int_t PGunTreeEntry_MCEvt_Correspondance[69999]; // PGunTreeEntry_MCEvt_Correspondance[0]=TreeEntry(0)->MC()
8956  for (Int_t i=0; i<PGunTree->GetEntries(); ++i) {
8957  PGunTree->GetEntry(i);
8958  PGunTreeEntry_MCEvt_Correspondance[MCEvt]=i;
8959  EdbVertex* vtx=new EdbVertex();
8960  vtx->SetXYZ(vtxposx*1000,vtxposy*1000,(vtxposz+40.0)*1000);
8961  vtx->SetMC(MCEvt);
8962  // vtx->Print(); // Gives Crash!
8963  GLOBAL_VtxArray->Add(vtx);
8964  GLOBAL_VtxArrayX[MCEvt]=vtxposx*1000;
8965  GLOBAL_VtxArrayY[MCEvt]=vtxposy*1000;
8966  GLOBAL_VtxArrayZ[MCEvt]=(vtxposz+40.0)*1000;
8967 // vtx->Print();
8968 // cout << vtx->X() << endl;
8969 // cout << vtx->Y() << endl;
8970 // cout << vtx->Z() << endl;
8971 // gSystem->Exit(1);
8972  GLOBAL_EvtBT_EArray[MCEvt]=energy;
8973  GLOBAL_EvtBT_TanThetaArray[MCEvt]=tantheta;
8974  GLOBAL_EvtBT_FlagArray[MCEvt]=0;
8975  GLOBAL_EvtBT_MCArray[MCEvt]=MCEvt;
8976  GLOBAL_EvtBT_ZArray[MCEvt]=(vtxposz+40.0)*1000;
8977  }
8978  //------------------
8979 
8980  cout << "BuildParametrizationsMCInfo_PGun.... done." << endl;
8981  return;
8982 }
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:68
void SetMC(int mEvt=0)
Definition: EdbVertex.h:159
void SetXYZ(float x, float y, float z)
Definition: EdbVertex.h:157
struct @8 Z
Double_t X
Definition: tlg2pattern.C:77
Double_t Y
Definition: tlg2pattern.C:77
Double_t TY
Definition: tlg2pattern.C:79
Double_t TX
Definition: tlg2pattern.C:79

◆ BuildShowerAxis()

EdbSegP* BuildShowerAxis ( TObjArray *  ShowerSegArray)

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

Differene NOW FOR DEBUG TESTS !!!!

8630 {
8631  Int_t eNBT= ShowerSegArray->GetEntries();
8632  if (eNBT==0) return NULL;
8633  if (eNBT==1) return (EdbSegP*)ShowerSegArray->At(0);
8634  Double_t eNBT_float=(Double_t)eNBT;
8635 // cout << "eNBT= " << eNBT << " eNBT_float= " << eNBT_float << endl;
8636 
8637  // Code taken from EdbMath::LFIT3 to fit line to a collection of points in spce!
8638  //int EdbMath::LFIT3( float *X, float *Y, float *Z, float *W, int L,
8639  //float &X0, float &Y0, float &Z0, float &TX, float &TY, float &EX, float &EY )
8640  // Linar fit in 3-d case (microtrack-like)
8641  // Input: X,Y,Z - coords, W -weight - arrays of the lengh >=L
8642  // Note that X,Y,Z modified by function
8643  // Output: X0,Y0,Z0 - center of gravity of segment
8644  // TX,TY : tangents in respect to Z axis
8645 
8646  Float_t X0,Y0,Z0;
8647  Float_t TX,TY;
8648  Float_t EX,EY;
8649  // Float_t x[eNBT]; Float_t z[eNBT]; Float_t y[eNBT]; Float_t W[eNBT];
8650  // Compiled with -pedantic -Wall -W -Wstrict-prototypes this gives error message: Fehler: ISO-C++ verbietet Feld »x« variabler Länge
8651  // So we take it as fixed length:
8652  // As before we take the global maximum of 5k BT /shower.
8653  Float_t x[5000];
8654  Float_t z[5000];
8655  Float_t y[5000];
8656  Float_t W[5000];
8657 
8658 
8659  // SUM UP TANGES VALUES OF ALL BTS SO FAR TO GET tx and TY of SHOWERCENTER ???
8660  Float_t sumX=0;
8661  Float_t sumY=0;
8662  Float_t sumTX=0;
8663  Float_t sumTY=0;
8664  Float_t sumW=0;
8665 //
8666  // The weighting of the segments is a crucial point here, since it influences
8667  // the fitting to the shower axis!
8668  int eNBTMAX=TMath::Min(5000,eNBT);
8669  for (int i=0; i<eNBTMAX; i++) {
8670  EdbSegP* TestBT = (EdbSegP*)ShowerSegArray->At(i);
8671  x[i]=TestBT->X();
8672  y[i]=TestBT->Y();
8673  z[i]=TestBT->Z();
8674  // Choose weighting to be one!
8675  W[i]=1;
8676  W[i]=1.0/(TMath::Abs(z[i]-z[0])/1300.0*TMath::Abs(z[i]-z[0])/1300.0+1);
8677  // W[i]=1.0/TMath::Sqrt((TMath::Abs(z[i]-z[0])/1300.0*TMath::Abs(z[i]-z[0])/1300.0+1));
8678  if (TMath::Abs(z[i]-z[0])/1300.0>4) W[i]=0;
8679  // chose this,....could be that this will lead to something different results....
8680  sumX+=W[i]*TestBT->X();
8681  sumY+=W[i]*TestBT->Y();
8682  sumTX+=W[i]*TestBT->TX();
8683  sumTY+=W[i]*TestBT->TY();
8684  sumW+=W[i];
8685  }
8686  //cout << " Set all others to zero...." << endl;
8687  if (eNBT<5000) {
8688  for (int i=eNBT; i<5000; i++) {
8689  W[i]=0;
8690  x[i]=0;
8691  y[i]=0;
8692  z[i]=0;
8693  }
8694  }
8695 
8696 
8697  //cout << "BuildShowerAxis Invoke fit function:" << endl;
8698  // Invoke fit function:
8699  EdbMath::LFIT3( x,y,z,W,eNBTMAX,X0,Y0,Z0,TX,TY,EX,EY);
8700 
8701  //cout <<"AfterLinefit: x=" << x << " y=" << y << " z=" << z << " W=" << W << " eNBTMAX=" << eNBTMAX << " X0=" << X0 << " Y0=" << Y0 << " Z0=" << Z0 << " TX=" << TX << " TY= " << TY << endl;
8702 
8703  sumTX=sumTX/sumW;
8704  sumTY=sumTY/sumW;
8705  sumX=sumTX/sumW;
8706  sumY=sumTY/sumW;
8709 
8710  //==C== In few cases "nan" can happen, then we put val to -1;
8711  if (TMath::IsNaN(X0)) {
8712  //cout << "EdbShowerP::BuildShowerAxis WARNING! FIT DID NOT CONVVERGE, RETURN FIRST SEGMENT! " << endl;
8713  EdbSegP* seg0=(EdbSegP*)ShowerSegArray->At(0);
8714  EdbSegP* eShowerAxisCenterGravityBT = new EdbSegP(0,seg0->X(),seg0->Y(),seg0->TX(),seg0->TY(),0,0);
8715  eShowerAxisCenterGravityBT -> SetZ(((EdbSegP*)ShowerSegArray->At(0))->Z());
8716  //eShowerAxisCenterGravityBT->PrintNice();
8717  return eShowerAxisCenterGravityBT;
8718  }
8719 
8720  //cout << "EdbShowerP::BuildShowerAxis Axis X0,Y0,Z0, TX, TY " << X0 << " " << Y0 << " " << Z0 << " " << TX << " " << TY << " " << endl;
8721  //cout << "sumTX= " << sumTX << " sumTY= " << sumTY << " sumW= " << sumW << endl;
8722 
8723  EdbSegP* eShowerAxisCenterGravityBT = 0;
8724  if (!eShowerAxisCenterGravityBT) eShowerAxisCenterGravityBT = new EdbSegP(-1,X0,Y0,sumTX,sumTY,0,0); // with linefit
8725 // if (!eShowerAxisCenterGravityBT) eShowerAxisCenterGravityBT = new EdbSegP(-1,sumX,sumY,sumTX,sumTY,0,0); // without linefit
8726  eShowerAxisCenterGravityBT -> SetZ(((EdbSegP*)ShowerSegArray->At(0))->Z());
8727 
8728 
8730  // Bool_t UseOnlyFirstBT=kTRUE;
8731  Bool_t UseOnlyFirstBT=kFALSE;
8732  if (UseOnlyFirstBT) {
8733  cout << "Attention: UseOnlyFirstBT"<< endl;
8734  eShowerAxisCenterGravityBT -> SetX(((EdbSegP*)ShowerSegArray->At(0))->X());
8735  eShowerAxisCenterGravityBT -> SetY(((EdbSegP*)ShowerSegArray->At(0))->Y());
8736  eShowerAxisCenterGravityBT -> SetZ(((EdbSegP*)ShowerSegArray->At(0))->Z());
8737  eShowerAxisCenterGravityBT -> SetTX(((EdbSegP*)ShowerSegArray->At(0))->TX());
8738  eShowerAxisCenterGravityBT -> SetTY(((EdbSegP*)ShowerSegArray->At(0))->TY());
8739  }
8740 
8741  //eShowerAxisCenterGravityBT->Print();
8742  return eShowerAxisCenterGravityBT;
8743 }
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:150
float X0
Definition: emthickness.cpp:69
float Y0
Definition: emthickness.cpp:70
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

7145 {
7146  Log(4,"ShowRec.cpp", "--- Bool_t CalcConeOrTubeDistanceToInBT() ---");
7147 
7148  TVector3 x1(InBT->X(),InBT->Y(),InBT->Z());
7149  TVector3 x2(sa->X(),sa->Y(),sa->Z());
7150  TVector3 direction_x1(InBT->TX()*1300,InBT->TY()*1300,1300);
7151  TVector3 direction_x2(sa->TX()*1300,sa->TY()*1300,1300);
7152  TVector3 u1=x2-x1;
7153 
7154  Double_t direction_x1_norm= direction_x1.Mag();
7155  Double_t cosangle= (direction_x1*u1)/(u1.Mag()*direction_x1_norm);
7156  Double_t angle = TMath::ACos(cosangle);
7157  // NO THIS IS NOT THE CONE ANGLE!!
7158 
7159  TVector3 direction_1(InBT->TX()*1300,InBT->TY()*1300,1300);
7160  TVector3 direction_2(sa->TX()*1300,sa->TY()*1300,1300);
7161 
7162  angle=u1.Angle(direction_x1);
7163 
7164 
7165  // For the case where the two basetracks have same z position
7166  // the angle is about 90 degree so it makes no sense to calculate it...
7167  // therefore we set it artificially to zero:
7168  if (TMath::Abs(InBT->Z()-sa->Z())<5.0 ) {
7169  angle=0.0;
7170  //if (gEDBDEBUGLEVEL>3) //cout << "same z position, set angle artificially to zero" << endl;
7171  }
7172 
7173 
7174 
7175  // If this InBT is in z position AFTER the testBT, the cone goes in the other direction and therefore, we have
7176  // to mirror the angle by 180 degree:
7177  if (angle>TMath::Pi()/2.0) {
7178  angle=TMath::Abs(TMath::Pi()-angle);
7179  //cout << "reverse angle: " << angle << endl;
7180  }
7181 
7183  if (angle>ConeAngle) {
7184  return kFALSE;
7185  }
7186 
7188  Double_t TubeDistance = 1.0/direction_x1_norm * ( (x2-x1).Cross(direction_x1) ).Mag();
7189  // cout << "CylinderRadius= " << CylinderRadius << " TubeDistance= " << TubeDistance << endl;
7190  if (TubeDistance>CylinderRadius) {
7191  return kFALSE;
7192  }
7193 
7194 
7195 
7196  //cout << "--- Bool_t CalcConeOrTubeDistanceToInBT() ---"<<endl;
7197  //InBT->PrintNice();
7198  //sa->PrintNice();
7199  //cout << "angle= " << angle << " ConeAngle= " << ConeAngle << endl;
7200  //cout << "CylinderRadius= " << CylinderRadius << " TubeDistance= " << TubeDistance << endl;
7201 
7202  return kTRUE;
7203 }
bool Log(int level, const char *location, const char *fmt,...)
Definition: EdbLog.cxx:75

◆ CalcEfficencyNumbers()

void CalcEfficencyNumbers ( EdbPattern pat_interim,
Int_t  MCCheck,
Int_t &  NBT_Neff,
Int_t &  NBTMC_Neff,
Int_t &  NBTMCe_Neff 
)
8772 {
8773  if (gEDBDEBUGLEVEL>3) cout << "-------------void CalcEfficencyNumbers()"<<endl;
8774  Int_t npat_int=pat_interim->GetN();
8775  if (npat_int<=0) return;
8776 
8777  for (int i=0; i<pat_interim->N(); ++i) {
8778  EdbSegP* seg=(EdbSegP* )pat_interim->GetSegment(i);
8779  if (seg->MCEvt()<0||seg->MCEvt()==MCCheck) ++NBT_Neff;
8780  if (seg->MCEvt()==MCCheck) ++NBTMC_Neff;
8781  if (seg->MCEvt()==MCCheck&&TMath::Abs(seg->Flag())==11) ++NBTMCe_Neff;
8782  }
8783  if (gEDBDEBUGLEVEL>3) {
8784  cout << "npat_int = " << npat_int << endl;
8785  cout << "NBT_Neff = " << NBT_Neff << endl;
8786  cout << "NBTMC_Neff = " << NBTMC_Neff << endl;
8787  cout << "NBTMCe_Neff = " << NBTMCe_Neff << endl;
8788  }
8789  return;
8790 }
Int_t MCEvt() const
Definition: EdbSegP.h:142
Int_t Flag() const
Definition: EdbSegP.h:146
Int_t N() const
Definition: EdbPattern.h:89
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 
)
7598 {
7599  Log(3, "ShowRec.cpp", "--- void CalcEffPurOfShower() ---");
7600  EdbSegP* seg;
7601  for (int i=0; i<arr->GetEntries(); ++i) {
7602  seg=(EdbSegP*)arr->At(i);
7603  ++NBT;
7604  if (seg->MCEvt()>0) {
7605  ++NBTMC; //NBTMC is kept for backward compability
7606  ++NBTallMC;
7607  }
7608  if (seg->MCEvt()>0 && TMath::Abs(seg->Flag())==11) {
7609  ++NBTeMC;
7610  }
7611  }
7612 
7613  purall=-1;
7614  pure=-1;
7615  if (NBT!=0) purall=(Double_t)NBTallMC/(Double_t)NBT;
7616  if (NBT!=0) pure=(Double_t)NBTeMC/(Double_t)NBT;
7617 
7618  if (gEDBDEBUGLEVEL>2) {
7619  cout << "CalcEffPurOfShower---------------- NBT,NBTallMC,NBTeMC,purall,pure= "<< NBT <<" " << NBTallMC <<" " << NBTeMC <<" " << purall <<" " << pure <<" " <<endl;
7620  }
7621 
7622  GLOBAL_NBT=NBT;
7623  GLOBAL_NBTallMC=NBTallMC;
7624  GLOBAL_NBTMC=NBTallMC; // kept for backward compability
7625  GLOBAL_NBTeMC=NBTeMC;
7626  GLOBAL_purall=purall;
7627  GLOBAL_pure=pure;
7628  return;
7629 }
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 
)
7632 {
7633  Log(3, "ShowRec.cpp", "--- void CalcEffPurOfShower2() ---");
7634  EdbSegP* seg;
7635 
7636  for (int i=0; i<arr->GetEntries(); ++i) {
7637  seg=(EdbSegP*)arr->At(i);
7638  ++NBT;
7639  if (seg->MCEvt()>0) {
7640  ++NBTMC; //NBTMC is kept for backward compability
7641  ++NBTallMC;
7642  }
7643  if (seg->MCEvt()>0 && TMath::Abs(seg->Flag())==11) {
7644  ++NBTeMC;
7645  }
7646  }
7647 
7648  purall=-1;
7649  pure=-1;
7650  if (NBT!=0) purall=(Double_t)NBTallMC/(Double_t)NBT;
7651  if (NBT!=0) pure=(Double_t)NBTeMC/(Double_t)NBT;
7652 
7653  // eff_all = NBTMC_SHOWER/NBTMC_VOLUME
7654  // eff_e = NBTMCe_SHOWER/NBTMCe_VOLUME
7655 
7656  Double_t effall=0;
7657  if (NBTMC_Neff!=0) effall = (Double_t)NBTMC/(Double_t)NBTMC_Neff;
7658  Double_t effe=0;
7659  if (NBTMC_Neff!=0) effe = (Double_t)NBTeMC/(Double_t)NBTMCe_Neff;
7660 
7661  if (gEDBDEBUGLEVEL>2) {
7662  cout << "CalcEffPurOfShower2---------------- NBT,NBTallMC,NBTeMC,purall,pure, effall, effe= "<< NBT <<" " << NBTallMC;
7663  cout <<" " << NBTeMC <<" " << purall <<" " << pure <<" " << effall <<" " << effe <<" " << endl;
7664  }
7665 
7666  GLOBAL_NBT=NBT;
7667  GLOBAL_NBTallMC=NBTallMC;
7668  GLOBAL_NBTMC=NBTallMC; // kept for backward compability
7669  GLOBAL_NBTeMC=NBTeMC;
7670  GLOBAL_purall=purall;
7671  GLOBAL_pure=pure;
7672  GLOBAL_effall=effall;
7673  GLOBAL_effe=effe;
7674 
7675  Log(3, "ShowRec.cpp", "--- void CalcEffPurOfShower2() done.");
7676  return;
7677 }
Double_t GLOBAL_effall
Definition: ShowRec.h:38
Double_t GLOBAL_effe
Definition: ShowRec.h:38

◆ CalcIP() [1/2]

Double_t CalcIP ( EdbSegP s,
double  x,
double  y,
double  z 
)
8884  {
8885  // Calculate IP between a given segment and a given x,y,z.
8886  // return the IP value.
8887  double ax = s->TX();
8888  double ay = s->TY();
8889  double bx = s->X()-ax*s->Z();
8890  double by = s->Y()-ay*s->Z();
8891  double a;
8892  double r;
8893  double xx,yy,zz;
8894  a = (ax*(x-bx)+ay*(y-by)+1.*(z-0.))/(ax*ax+ay*ay+1.);
8895  xx = bx +ax*a;
8896  yy = by +ay*a;
8897  zz = 0. +1.*a;
8898  r = sqrt((xx-x)*(xx-x)+(yy-y)*(yy-y)+(zz-z)*(zz-z));
8899  return r;
8900 }
void a()
Definition: check_aligned.C:59
void r(int rid=2)
Definition: test.C:201
EdbSegP * s
Definition: tlg2pattern.C:32

◆ CalcIP() [2/2]

Double_t CalcIP ( EdbSegP s,
EdbVertex v 
)
8872  {
8873  // calculate IP for the selected tracks wrt the given vertex.
8874  // if the vertex is not given, use the selected vertex.
8875  if (NULL==v) {
8876  printf("select a vertex!\n");
8877  return 0;
8878  }
8879  if (gEDBDEBUGLEVEL>3) printf(" /// Calc IP w.r.t. Vertex %d %8.1lf %8.1lf %8.1lf (red vertex) ///\n",v->ID(), v->X(),v->Y(),v->Z() );
8880  double r = CalcIP(s,v->X(),v->Y(),v->Z());
8881  return r;
8882 }
Double_t CalcIP(EdbSegP *s, EdbVertex *v)
Definition: ShowRec.cpp:8872
Int_t ID() const
Definition: EdbVertex.h:126
Float_t X() const
Definition: EdbVertex.h:130
Float_t Z() const
Definition: EdbVertex.h:132
Float_t Y() const
Definition: EdbVertex.h:131

◆ CalcTrackDensity()

void CalcTrackDensity ( EdbPattern pat_interim,
Float_t  pat_interim_halfsize,
Int_t &  npat_int,
Int_t &  npat_total,
Int_t &  npatN 
)
8750 {
8751  if (gEDBDEBUGLEVEL>3) cout << "-------------void CalcTrackDensity(&pat_interim,pat_interim_halfsize,&npat_int,&npat_total)"<<endl;
8752  npat_int=pat_interim->GetN();
8753  if (npat_int<=0) return;
8754  npat_total+=npat_int;
8755  ++npatN;
8756  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!
8757 
8758  if (gEDBDEBUGLEVEL>3) {
8759  cout << "pat_interim->Z() = " << pat_interim->Z() << endl;
8760  cout << "pat_interim->GetN() = " << pat_interim->GetN() << endl;
8761  cout << "npat_int = " << npat_int << endl;
8762  cout << "npat_total = " << npat_total << endl;
8763  cout << "npatN = " << npatN << endl;
8764  cout << "shower_trackdensb = " << shower_trackdensb << endl;
8765  }
8766  return;
8767 }
Float_t local_halfpatternsize
Definition: ShowRec.h:146
Float_t shower_trackdensb
Definition: ShowRec.h:395
Float_t Z() const
Definition: EdbPattern.h:87

◆ CalcVertex()

EdbVertex* CalcVertex ( TObjArray *  segments)
9043  {
9044 
9045  // Exactly same implementation as in EdbEDAUtil.C
9046  // but I do not want to link in hardcoded all eda libraries.
9047  // calc vertex point with given segments. just topological calculation.
9048  // VTA is currently not set.
9049  // in case of Single-stop. make a vertex 650 micron upstream ob base.
9050 
9051 
9052  double xx,yy,zz,Det,Ax,Ay,Az,Bx,By,Bz,Cx,Cy,Cz,Dx,Dy,Dz;
9053  Ax=0.;
9054  Ay=0.;
9055  Az=0.;
9056  Bx=0.;
9057  By=0.;
9058  Bz=0.;
9059  Cx=0.;
9060  Cy=0.;
9061  Cz=0.;
9062  Dx=0.;
9063  Dy=0.;
9064  Dz=0.;
9065 
9066  if (segments->GetEntries()==1) {
9067  // in case of Single-stop. make a vertex 650 micron upstream ob base.
9068  EdbSegP *s = new EdbSegP(*((EdbSegP *) segments->At(0)));
9069  s->PropagateTo(s->Z()-650);
9070  xx=s->X();
9071  yy=s->Y();
9072  zz=s->Z();
9073  delete s;
9074  }
9075  else {
9076  for (int i=0; i<segments->GetEntries(); i++) {
9077  EdbSegP *s = (EdbSegP *) segments->At(i);
9078  double ax = s->TX();
9079  double ay = s->TY();
9080  double az = 1.0;
9081  double x = s->X();
9082  double y = s->Y();
9083  double z = s->Z();
9084  double a = ax*ax+ay*ay+az*az;
9085  double c = -ax*x-ay*y-az*z;
9086  double b = (ax*ax+ay*ay);
9087  // double w = 1.0/a/a; // weight for small angle tracks.
9088  double w = 1.0; // no weight
9089 
9090  Ax+=2.0*w/b*( a*(ay*ay+az*az) );
9091  Bx+=2.0*w/b*( -a*ax*ay );
9092  Cx+=2.0*w/b*( -a*ax*az );
9093  Dx+=2.0*w/b*( -(a*x+c*ax)*(ax*ax-a)-(a*y+c*ay)*ax*ay-(a*z+c*az)*az*ax );
9094 
9095  Ay+=2.0*w/b*( -a*ay*ax );
9096  By+=2.0*w/b*( a*(az*az+ax*ax) );
9097  Cy+=2.0*w/b*( -a*ay*az );
9098  Dy+=2.0*w/b*( -(a*y+c*ay)*(ay*ay-a)-(a*z+c*az)*ay*az-(a*x+c*ax)*ax*ay );
9099 
9100  Az+=2.0*w/b*( -a*az*ax );
9101  Bz+=2.0*w/b*( -a*az*ay );
9102  Cz+=2.0*w/b*( a*b );
9103  Dz+=2.0*w/b*( -(a*z+c*az)*(az*az-a)-(a*x+c*ax)*az*ax-(a*y+c*ay)*ay*az );
9104 
9105  }
9106 
9107  Det=fabs( Ax*(By*Cz-Cy*Bz)-Bx*(Ay*Cz-Cy*Az)+Cx*(Ay*Bz-By*Az) );
9108  xx=( (By*Cz-Cy*Bz)*Dx-(Bx*Cz-Cx*Bz)*Dy+(Bx*Cy-Cx*By)*Dz)/Det;
9109  yy=(-(Ay*Cz-Cy*Az)*Dx+(Ax*Cz-Cx*Az)*Dy-(Ax*Cy-Cx*Ay)*Dz)/Det;
9110  zz=( (Ay*Bz-By*Az)*Dx-(Ax*Bz-Bx*Az)*Dy+(Ax*By-Bx*Ay)*Dz)/Det;
9111  }
9112 
9113  EdbVertex *v = new EdbVertex();
9114  v->SetXYZ(xx,yy,zz);
9115 
9116  return v;
9117 }
Expr< UnaryOp< Fabs< T >, Expr< A, T, D >, T >, T, D > fabs(const Expr< A, T, D > &rhs)
Definition: UnaryOperators.hh:96
void PropagateTo(float z)
Definition: EdbSegP.cxx:292
void w(int rid=2, int nviews=2)
Definition: test.C:27

◆ Check_ParasetDefinitionFile()

Int_t Check_ParasetDefinitionFile ( )
602 {
603  Log(2, "ShowRec.cpp", "--- Int_t Check_ParasetDefinitionFile() ---");
604 
605  string filename = "PARAMETERSET_DEFINITIONFILE.root";
606  ifstream fin( filename.c_str() );
607  if ( !fin ) {
608  cout << "WARNING: In --- Check_ParasetDefinitionFile --- ";
609  cout << "Opening " << filename << " failed. Using only one, standard parameterset." << endl;
610  return 1;
611  }
612 
613  return 0;
614 }
string filename
Definition: emthickness.cpp:34

◆ CheckInputParameters()

void CheckInputParameters ( )
8377 {
8378  if (cmd_BTPA>4 ) {
8379  cout << "CheckInputParameters: cmd_BTPA>4 not supported. Here it has no effect but please check your nput!"<<endl;
8380  }
8381  if (cmd_BGTP>43) {
8382  cout << "CheckInputParameters: cmd_BGTP>43 not supported. Here it has no effect but pleas check your input!"<<endl;
8383  }
8384  if (cmd_ALTP>8) {
8385  cout << "CheckInputParameters: cmd_ALTP>8 not supported. Please check your input!"<<endl;
8386  }
8387 
8388  if (cmd_FP<1) {
8389  cout << "CheckInputParameters: cmd_FP<1. Set cmd_FP=1;"<<endl;
8390  cmd_FP=1;
8391  }
8392  if (cmd_LP>57) {
8393  cout << "CheckInputParameters: cmd_LP>57. Set cmd_LP=57;"<<endl;
8394  cmd_LP=57;
8395  }
8396  if (cmd_MP<cmd_FP) {
8397  cout << "CheckInputParameters: cmd_MP<cmd_FP. Set cmd_MP=cmd_FP;"<<endl;
8398  cmd_MP=cmd_FP;
8399  }
8400  if (cmd_FP>cmd_LP) {
8401  cout << "CheckInputParameters: cmd_FP>cmd_LP. Set cmd_LP=cmd_MP+cmd_NP;"<<endl;
8403  }
8404  if (cmd_MP>cmd_LP) {
8405  cout << "CheckInputParameters: cmd_MP>cmd_LP. Set cmd_LP=cmd_MP+cmd_NP;"<<endl;
8407  }
8408 
8409 
8410  if (cmd_MCFL<0) {
8411  cout << "CheckInputParameters: cmd_MCFL<0. Absolute Number will be taken;"<<endl;
8412  }
8413 
8414  if (cmd_gEDBDEBUGLEVEL>5) {
8415  cout << "CheckInputParameters: cmd_gEDBDEBUGLEVEL>5 not supported. Here it has no effect but pleas check your input!"<<endl;
8416  }
8417 
8418  return;
8419 }
Int_t cmd_BTPA
Definition: ShowRec.h:9
Int_t cmd_ALTP
Definition: ShowRec.h:11
Int_t cmd_BGTP
Definition: ShowRec.h:10
Int_t cmd_gEDBDEBUGLEVEL
Definition: ShowRec.h:32
Int_t cmd_FP
Definition: ShowRec.h:15
Int_t cmd_MCFL
Definition: ShowRec.h:21
Int_t cmd_MP
Definition: ShowRec.h:17
Int_t cmd_NP
Definition: ShowRec.h:18
Int_t cmd_LP
Definition: ShowRec.h:16

◆ Create_NN_Alg_Histograms()

void Create_NN_Alg_Histograms ( )
8426 {
8427  var_NN__BG__SpatialDist_TestBT_To_InBT = new TH1F("var_NN__BG__SpatialDist_TestBT_To_InBT","var_NN__BG__SpatialDist_TestBT_To_InBT",1000,0,60000);
8428  var_NN__SG__SpatialDist_TestBT_To_InBT = new TH1F("var_NN__SG__SpatialDist_TestBT_To_InBT","var_NN__SG__SpatialDist_TestBT_To_InBT",1000,0,60000);
8429  var_NN__ALL__SpatialDist_TestBT_To_InBT = new TH1F("var_NN__ALL__SpatialDist_TestBT_To_InBT","var_NN__ALL__SpatialDist_TestBT_To_InBT",1000,0,60000);
8430 
8431  var_NN__BG__zDiff_TestBT_To_InBT = new TH1F("var_NN__BG__zDiff_TestBT_To_InBT","var_NN__BG__zDiff_TestBT_To_InBT",1000,0,60000);
8432  var_NN__SG__zDiff_TestBT_To_InBT = new TH1F("var_NN__SG__zDiff_TestBT_To_InBT","var_NN__SG__zDiff_TestBT_To_InBT",1000,0,60000);
8433  var_NN__ALL__zDiff_TestBT_To_InBT = new TH1F("var_NN__ALL__zDiff_TestBT_To_InBT","var_NN__ALL__zDiff_TestBT_To_InBT",1000,0,60000);
8434 
8435 
8436  var_NN__SG__dT_InBT_To_TestBT = new TH1F("var_NN__SG__dT_InBT_To_TestBT","var_NN__SG__dT_InBT_To_TestBT",100,0,1);
8437  var_NN__BG__dT_InBT_To_TestBT = new TH1F("var_NN__BG__dT_InBT_To_TestBT","var_NN__BG__dT_InBT_To_TestBT",100,0,1);
8438  var_NN__ALL__dT_InBT_To_TestBT = new TH1F("var_NN__ALL__dT_InBT_To_TestBT","var_NN__ALL__dT_InBT_To_TestBT",100,0,1);
8439 
8440  var_NN__SG__dR_InBT_To_TestBT = new TH1F("var_NN__SG__dR_InBT_To_TestBT","var_NN__SG__dR_InBT_To_TestBT",100,0,2000);
8441  var_NN__BG__dR_InBT_To_TestBT = new TH1F("var_NN__BG__dR_InBT_To_TestBT","var_NN__BG__dR_InBT_To_TestBT",100,0,2000);
8442  var_NN__ALL__dR_InBT_To_TestBT = new TH1F("var_NN__ALL__dR_InBT_To_TestBT","var_NN__ALL__dR_InBT_To_TestBT",100,0,2000);
8443 
8444  var_NN__SG__dR_TestBT_To_InBT = new TH1F("var_NN__SG__dR_TestBT_To_InBT","var_NN__SG__dR_TestBT_To_InBT",100,0,2000);
8445  var_NN__BG__dR_TestBT_To_InBT = new TH1F("var_NN__BG__dR_TestBT_To_InBT","var_NN__BG__dR_TestBT_To_InBT",100,0,2000);
8446  var_NN__ALL__dR_TestBT_To_InBT = new TH1F("var_NN__ALL__dR_TestBT_To_InBT","var_NN__ALL__dR_TestBT_To_InBT",100,0,2000);
8447 
8448 
8449 
8450  var_NN__SG__nseg_TestBT_To2BeforePlate = new TH1F("var_NN__SG__nseg_TestBT_To2BeforePlate","var_NN__SG__nseg_TestBT_To2BeforePlate",10,0,10);
8451  var_NN__BG__nseg_TestBT_To2BeforePlate = new TH1F("var_NN__BG__nseg_TestBT_To2BeforePlate","var_NN__BG__nseg_TestBT_To2BeforePlate",10,0,10);
8452  var_NN__ALL__nseg_TestBT_To2BeforePlate = new TH1F("var_NN__ALL__nseg_TestBT_To2BeforePlate","var_NN__ALL__nseg_TestBT_To2BeforePlate",10,0,10);
8453 
8454  var_NN__BG__nseg_TestBT_ToBeforePlate = new TH1F("var_NN__BG__nseg_TestBT_ToBeforePlate","var_NN__BG__nseg_TestBT_ToBeforePlate",10,0,10);
8455  var_NN__SG__nseg_TestBT_ToBeforePlate = new TH1F("var_NN__SG__nseg_TestBT_ToBeforePlate","var_NN__SG__nseg_TestBT_ToBeforePlate",10,0,10);
8456  var_NN__ALL__nseg_TestBT_ToBeforePlate = new TH1F("var_NN__ALL__nseg_TestBT_ToBeforePlate","var_NN__ALL__nseg_TestBT_ToBeforePlate",10,0,10);
8457 
8458  var_NN__BG__nseg_TestBT_ToSamePlate = new TH1F("var_NN__BG__nseg_TestBT_ToSamePlate","var_NN__BG__nseg_TestBT_ToSamePlate",10,0,10);
8459  var_NN__SG__nseg_TestBT_ToSamePlate = new TH1F("var_NN__SG__nseg_TestBT_ToSamePlate","var_NN__SG__nseg_TestBT_ToSamePlate",10,0,10);
8460  var_NN__ALL__nseg_TestBT_ToSamePlate = new TH1F("var_NN__ALL__nseg_TestBT_ToSamePlate","var_NN__ALL__nseg_TestBT_ToSamePlate",10,0,10);
8461 
8462  var_NN__BG__nseg_TestBT_To2AfterPlate = new TH1F("var_NN__BG__nseg_TestBT_To2AfterPlate","var_NN__BG__nseg_TestBT_To2AfterPlate",10,0,10);
8463  var_NN__SG__nseg_TestBT_To2AfterPlate = new TH1F("var_NN__SG__nseg_TestBT_To2AfterPlate","var_NN__SG__nseg_TestBT_To2AfterPlate",10,0,10);
8464  var_NN__ALL__nseg_TestBT_To2AfterPlate = new TH1F("var_NN__ALL__nseg_TestBT_To2AfterPlate","var_NN__ALL__nseg_TestBT_To2AfterPlate",10,0,10);
8465 
8466  var_NN__BG__nseg_TestBT_ToAfterPlate = new TH1F("var_NN__BG__nseg_TestBT_ToAfterPlate","var_NN__BG__nseg_TestBT_ToAfterPlate",10,0,10);
8467  var_NN__SG__nseg_TestBT_ToAfterPlate = new TH1F("var_NN__SG__nseg_TestBT_ToAfterPlate","var_NN__SG__nseg_TestBT_ToAfterPlate",10,0,10);
8468  var_NN__ALL__nseg_TestBT_ToAfterPlate = new TH1F("var_NN__ALL__nseg_TestBT_ToAfterPlate","var_NN__ALL__nseg_TestBT_ToAfterPlate",10,0,10);
8469 
8470 
8471 
8472  var_NN__BG__mean_dT_TestBT_ToSamePlate = new TH1F("var_NN__BG__mean_dT_TestBT_ToSamePlate","var_NN__BG__mean_dT_TestBT_ToSamePlate",100,0,0.2);
8473  var_NN__SG__mean_dT_TestBT_ToSamePlate = new TH1F("var_NN__SG__mean_dT_TestBT_ToSamePlate","var_NN__SG__mean_dT_TestBT_ToSamePlate",100,0,0.2);
8474  var_NN__ALL__mean_dT_TestBT_ToSamePlate = new TH1F("var_NN__ALL__mean_dT_TestBT_ToSamePlate","var_NN__ALL__mean_dT_TestBT_ToSamePlate",100,0,0.2);
8475 
8476  var_NN__BG__mean_dR_TestBT_ToSamePlate = new TH1F("var_NN__BG__mean_dR_TestBT_ToSamePlate","var_NN__BG__mean_dR_TestBT_ToSamePlate",100,0,800);
8477  var_NN__SG__mean_dR_TestBT_ToSamePlate = new TH1F("var_NN__SG__mean_dR_TestBT_ToSamePlate","var_NN__SG__mean_dR_TestBT_ToSamePlate",100,0,800);
8478  var_NN__ALL__mean_dR_TestBT_ToSamePlate = new TH1F("var_NN__ALL__mean_dR_TestBT_ToSamePlate","var_NN__ALL__mean_dR_TestBT_ToSamePlate",100,0,800);
8479 
8480 
8481  var_NN__SG__mean_dR_TestBT_ToAfterPlate = new TH1F("var_NN__SG__mean_dR_TestBT_ToAfterPlate","var_NN__SG__mean_dR_TestBT_ToAfterPlate",100,0,800);
8482  var_NN__BG__mean_dR_TestBT_ToAfterPlate = new TH1F("var_NN__BG__mean_dR_TestBT_ToAfterPlate","var_NN__BG__mean_dR_TestBT_ToAfterPlate",100,0,800);
8483  var_NN__ALL__mean_dR_TestBT_ToAfterPlate = new TH1F("var_NN__ALL__mean_dR_TestBT_ToAfterPlate","var_NN__ALL__mean_dR_TestBT_ToAfterPlate",100,0,800);
8484 
8485  var_NN__SG__mean_dT_TestBT_ToAfterPlate = new TH1F("var_NN__SG__mean_dT_TestBT_ToAfterPlate","var_NN__SG__mean_dT_TestBT_ToAfterPlate",100,0,0.2);
8486  var_NN__BG__mean_dT_TestBT_ToAfterPlate = new TH1F("var_NN__BG__mean_dT_TestBT_ToAfterPlate","var_NN__BG__mean_dT_TestBT_ToAfterPlate",100,0,0.2);
8487  var_NN__ALL__mean_dT_TestBT_ToAfterPlate = new TH1F("var_NN__ALL__mean_dT_TestBT_ToAfterPlate","var_NN__ALL__mean_dT_TestBT_ToAfterPlate",100,0,0.2);
8488 
8489 
8490  var_NN__SG__mean_dR_TestBT_To2AfterPlate = new TH1F("var_NN__SG__mean_dR_TestBT_To2AfterPlate","var_NN__SG__mean_dR_TestBT_To2AfterPlate",100,0,800);
8491  var_NN__BG__mean_dR_TestBT_To2AfterPlate = new TH1F("var_NN__BG__mean_dR_TestBT_To2AfterPlate","var_NN__BG__mean_dR_TestBT_To2AfterPlate",100,0,800);
8492  var_NN__ALL__mean_dR_TestBT_To2AfterPlate = new TH1F("var_NN__ALL__mean_dR_TestBT_To2AfterPlate","var_NN__ALL__mean_dR_TestBT_To2AfterPlate",100,0,800);
8493 
8494  var_NN__SG__mean_dT_TestBT_To2AfterPlate = new TH1F("var_NN__SG__mean_dT_TestBT_To2AfterPlate","var_NN__SG__mean_dT_TestBT_To2AfterPlate",100,0,0.2);
8495  var_NN__BG__mean_dT_TestBT_To2AfterPlate = new TH1F("var_NN__BG__mean_dT_TestBT_To2AfterPlate","var_NN__BG__mean_dT_TestBT_To2AfterPlate",100,0,0.2);
8496  var_NN__ALL__mean_dT_TestBT_To2AfterPlate = new TH1F("var_NN__ALL__mean_dT_TestBT_To2AfterPlate","var_NN__ALL__mean_dT_TestBT_To2AfterPlate",100,0,0.2);
8497 
8498  var_NN__SG__mean_dR_TestBT_ToBeforePlate = new TH1F("var_NN__SG__mean_dR_TestBT_ToBeforePlate","var_NN__SG__mean_dR_TestBT_ToBeforePlate",100,0,800);
8499  var_NN__BG__mean_dR_TestBT_ToBeforePlate = new TH1F("var_NN__BG__mean_dR_TestBT_ToBeforePlate","var_NN__BG__mean_dR_TestBT_ToBeforePlate",100,0,800);
8500  var_NN__ALL__mean_dR_TestBT_ToBeforePlate = new TH1F("var_NN__ALL__mean_dR_TestBT_ToBeforePlate","var_NN__ALL__mean_dR_TestBT_ToBeforePlate",100,0,800);
8501 
8502  var_NN__SG__mean_dT_TestBT_ToBeforePlate = new TH1F("var_NN__SG__mean_dT_TestBT_ToBeforePlate","var_NN__SG__mean_dT_TestBT_ToBeforePlate",100,0,0.2);
8503  var_NN__BG__mean_dT_TestBT_ToBeforePlate = new TH1F("var_NN__BG__mean_dT_TestBT_ToBeforePlate","var_NN__BG__mean_dT_TestBT_ToBeforePlate",100,0,0.2);
8504  var_NN__ALL__mean_dT_TestBT_ToBeforePlate = new TH1F("var_NN__ALL__mean_dT_TestBT_ToBeforePlate","var_NN__ALL__mean_dT_TestBT_ToBeforePlate",100,0,0.2);
8505 
8506 
8507  var_NN__SG__mean_dR_TestBT_To2BeforePlate = new TH1F("var_NN__SG__mean_dR_TestBT_To2BeforePlate","var_NN__SG__mean_dR_TestBT_To2BeforePlate",100,0,800);
8508  var_NN__BG__mean_dR_TestBT_To2BeforePlate = new TH1F("var_NN__BG__mean_dR_TestBT_To2BeforePlate","var_NN__BG__mean_dR_TestBT_To2BeforePlate",100,0,800);
8509  var_NN__ALL__mean_dR_TestBT_To2BeforePlate = new TH1F("var_NN__ALL__mean_dR_TestBT_To2BeforePlate","var_NN__ALL__mean_dR_TestBT_To2BeforePlate",100,0,800);
8510 
8511  var_NN__SG__mean_dT_TestBT_To2BeforePlate = new TH1F("var_NN__SG__mean_dT_TestBT_To2BeforePlate","var_NN__SG__mean_dT_TestBT_To2BeforePlate",100,0,0.2);
8512  var_NN__BG__mean_dT_TestBT_To2BeforePlate = new TH1F("var_NN__BG__mean_dT_TestBT_To2BeforePlate","var_NN__BG__mean_dT_TestBT_To2BeforePlate",100,0,0.2);
8513  var_NN__ALL__mean_dT_TestBT_To2BeforePlate = new TH1F("var_NN__ALL__mean_dT_TestBT_To2BeforePlate","var_NN__ALL__mean_dT_TestBT_To2BeforePlate",100,0,0.2);
8514 
8515  //---------
8516 
8517  var_NN__BG__min_dT_TestBT_ToSamePlate = new TH1F("var_NN__BG__min_dT_TestBT_ToSamePlate","var_NN__BG__min_dT_TestBT_ToSamePlate",100,0,0.2);
8518  var_NN__SG__min_dT_TestBT_ToSamePlate = new TH1F("var_NN__SG__min_dT_TestBT_ToSamePlate","var_NN__SG__min_dT_TestBT_ToSamePlate",100,0,0.2);
8519  var_NN__ALL__min_dT_TestBT_ToSamePlate = new TH1F("var_NN__ALL__min_dT_TestBT_ToSamePlate","var_NN__ALL__min_dT_TestBT_ToSamePlate",100,0,0.2);
8520 
8521  var_NN__BG__min_dR_TestBT_ToSamePlate = new TH1F("var_NN__BG__min_dR_TestBT_ToSamePlate","var_NN__BG__min_dR_TestBT_ToSamePlate",100,0,800);
8522  var_NN__SG__min_dR_TestBT_ToSamePlate = new TH1F("var_NN__SG__min_dR_TestBT_ToSamePlate","var_NN__SG__min_dR_TestBT_ToSamePlate",100,0,800);
8523  var_NN__ALL__min_dR_TestBT_ToSamePlate = new TH1F("var_NN__ALL__min_dR_TestBT_ToSamePlate","var_NN__ALL__min_dR_TestBT_ToSamePlate",100,0,800);
8524 
8525 
8526  var_NN__SG__min_dR_TestBT_ToAfterPlate = new TH1F("var_NN__SG__min_dR_TestBT_ToAfterPlate","var_NN__SG__min_dR_TestBT_ToAfterPlate",100,0,800);
8527  var_NN__BG__min_dR_TestBT_ToAfterPlate = new TH1F("var_NN__BG__min_dR_TestBT_ToAfterPlate","var_NN__BG__min_dR_TestBT_ToAfterPlate",100,0,800);
8528  var_NN__ALL__min_dR_TestBT_ToAfterPlate = new TH1F("var_NN__ALL__min_dR_TestBT_ToAfterPlate","var_NN__ALL__min_dR_TestBT_ToAfterPlate",100,0,800);
8529 
8530  var_NN__SG__min_dT_TestBT_ToAfterPlate = new TH1F("var_NN__SG__min_dT_TestBT_ToAfterPlate","var_NN__SG__min_dT_TestBT_ToAfterPlate",100,0,0.2);
8531  var_NN__BG__min_dT_TestBT_ToAfterPlate = new TH1F("var_NN__BG__min_dT_TestBT_ToAfterPlate","var_NN__BG__min_dT_TestBT_ToAfterPlate",100,0,0.2);
8532  var_NN__ALL__min_dT_TestBT_ToAfterPlate = new TH1F("var_NN__ALL__min_dT_TestBT_ToAfterPlate","var_NN__ALL__min_dT_TestBT_ToAfterPlate",100,0,0.2);
8533 
8534 
8535  var_NN__SG__min_dR_TestBT_To2AfterPlate = new TH1F("var_NN__SG__min_dR_TestBT_To2AfterPlate","var_NN__SG__min_dR_TestBT_To2AfterPlate",100,0,800);
8536  var_NN__BG__min_dR_TestBT_To2AfterPlate = new TH1F("var_NN__BG__min_dR_TestBT_To2AfterPlate","var_NN__BG__min_dR_TestBT_To2AfterPlate",100,0,800);
8537  var_NN__ALL__min_dR_TestBT_To2AfterPlate = new TH1F("var_NN__ALL__min_dR_TestBT_To2AfterPlate","var_NN__ALL__min_dR_TestBT_To2AfterPlate",100,0,800);
8538 
8539  var_NN__SG__min_dT_TestBT_To2AfterPlate = new TH1F("var_NN__SG__min_dT_TestBT_To2AfterPlate","var_NN__SG__min_dT_TestBT_To2AfterPlate",100,0,0.2);
8540  var_NN__BG__min_dT_TestBT_To2AfterPlate = new TH1F("var_NN__BG__min_dT_TestBT_To2AfterPlate","var_NN__BG__min_dT_TestBT_To2AfterPlate",100,0,0.2);
8541  var_NN__ALL__min_dT_TestBT_To2AfterPlate = new TH1F("var_NN__ALL__min_dT_TestBT_To2AfterPlate","var_NN__ALL__min_dT_TestBT_To2AfterPlate",100,0,0.2);
8542 
8543  var_NN__SG__min_dR_TestBT_ToBeforePlate = new TH1F("var_NN__SG__min_dR_TestBT_ToBeforePlate","var_NN__SG__min_dR_TestBT_ToBeforePlate",100,0,800);
8544  var_NN__BG__min_dR_TestBT_ToBeforePlate = new TH1F("var_NN__BG__min_dR_TestBT_ToBeforePlate","var_NN__BG__min_dR_TestBT_ToBeforePlate",100,0,800);
8545  var_NN__ALL__min_dR_TestBT_ToBeforePlate = new TH1F("var_NN__ALL__min_dR_TestBT_ToBeforePlate","var_NN__ALL__min_dR_TestBT_ToBeforePlate",100,0,800);
8546 
8547  var_NN__SG__min_dT_TestBT_ToBeforePlate = new TH1F("var_NN__SG__min_dT_TestBT_ToBeforePlate","var_NN__SG__min_dT_TestBT_ToBeforePlate",100,0,0.2);
8548  var_NN__BG__min_dT_TestBT_ToBeforePlate = new TH1F("var_NN__BG__min_dT_TestBT_ToBeforePlate","var_NN__BG__min_dT_TestBT_ToBeforePlate",100,0,0.2);
8549  var_NN__ALL__min_dT_TestBT_ToBeforePlate = new TH1F("var_NN__ALL__min_dT_TestBT_ToBeforePlate","var_NN__ALL__min_dT_TestBT_ToBeforePlate",100,0,0.2);
8550 
8551 
8552  var_NN__SG__min_dR_TestBT_To2BeforePlate = new TH1F("var_NN__SG__min_dR_TestBT_To2BeforePlate","var_NN__SG__min_dR_TestBT_To2BeforePlate",100,0,800);
8553  var_NN__BG__min_dR_TestBT_To2BeforePlate = new TH1F("var_NN__BG__min_dR_TestBT_To2BeforePlate","var_NN__BG__min_dR_TestBT_To2BeforePlate",100,0,800);
8554  var_NN__ALL__min_dR_TestBT_To2BeforePlate = new TH1F("var_NN__ALL__min_dR_TestBT_To2BeforePlate","var_NN__ALL__min_dR_TestBT_To2BeforePlate",100,0,800);
8555 
8556  var_NN__SG__min_dT_TestBT_To2BeforePlate = new TH1F("var_NN__SG__min_dT_TestBT_To2BeforePlate","var_NN__SG__min_dT_TestBT_To2BeforePlate",100,0,0.2);
8557  var_NN__BG__min_dT_TestBT_To2BeforePlate = new TH1F("var_NN__BG__min_dT_TestBT_To2BeforePlate","var_NN__BG__min_dT_TestBT_To2BeforePlate",100,0,0.2);
8558  var_NN__ALL__min_dT_TestBT_To2BeforePlate = new TH1F("var_NN__ALL__min_dT_TestBT_To2BeforePlate","var_NN__ALL__min_dT_TestBT_To2BeforePlate",100,0,0.2);
8559 
8560  return;
8561 }
TH1F * var_NN__BG__mean_dT_TestBT_ToSamePlate
Definition: ShowRec.h:275
TH1F * var_NN__SG__min_dR_TestBT_To2AfterPlate
Definition: ShowRec.h:326
TH1F * var_NN__BG__mean_dR_TestBT_To2BeforePlate
Definition: ShowRec.h:259
TH1F * var_NN__BG__nseg_TestBT_ToSamePlate
Definition: ShowRec.h:241
TH1F * var_NN__ALL__min_dT_TestBT_ToAfterPlate
Definition: ShowRec.h:324
TH1F * var_NN__SG__min_dR_TestBT_ToSamePlate
Definition: ShowRec.h:310
TH1F * var_NN__BG__mean_dT_TestBT_To2BeforePlate
Definition: ShowRec.h:267
TH1F * var_NN__BG__mean_dT_TestBT_ToAfterPlate
Definition: ShowRec.h:283
TH1F * var_NN__SG__dT_InBT_To_TestBT
Definition: ShowRec.h:223
TH1F * var_NN__ALL__nseg_TestBT_ToBeforePlate
Definition: ShowRec.h:235
TH1F * var_NN__ALL__dR_TestBT_To_InBT
Definition: ShowRec.h:230
TH1F * var_NN__ALL__mean_dT_TestBT_To2AfterPlate
Definition: ShowRec.h:292
TH1F * var_NN__BG__mean_dR_TestBT_To2AfterPlate
Definition: ShowRec.h:287
TH1F * var_NN__SG__min_dT_TestBT_ToBeforePlate
Definition: ShowRec.h:302
TH1F * var_NN__BG__dR_InBT_To_TestBT
Definition: ShowRec.h:226
TH1F * var_NN__ALL__min_dR_TestBT_To2BeforePlate
Definition: ShowRec.h:300
TH1F * var_NN__ALL__dR_InBT_To_TestBT
Definition: ShowRec.h:227
TH1F * var_NN__SG__mean_dR_TestBT_ToSamePlate
Definition: ShowRec.h:270
TH1F * var_NN__SG__min_dR_TestBT_ToAfterPlate
Definition: ShowRec.h:318
TH1F * var_NN__SG__mean_dR_TestBT_To2AfterPlate
Definition: ShowRec.h:286
TH1F * var_NN__BG__min_dR_TestBT_ToSamePlate
Definition: ShowRec.h:311
TH1F * var_NN__ALL__zDiff_TestBT_To_InBT
Definition: ShowRec.h:218
TH1F * var_NN__ALL__dT_InBT_To_TestBT
Definition: ShowRec.h:224
TH1F * var_NN__ALL__min_dT_TestBT_ToSamePlate
Definition: ShowRec.h:316
TH1F * var_NN__BG__nseg_TestBT_ToBeforePlate
Definition: ShowRec.h:234
TH1F * var_NN__SG__mean_dT_TestBT_To2AfterPlate
Definition: ShowRec.h:290
TH1F * var_NN__SG__mean_dR_TestBT_ToBeforePlate
Definition: ShowRec.h:254
TH1F * var_NN__SG__mean_dT_TestBT_ToBeforePlate
Definition: ShowRec.h:262
TH1F * var_NN__SG__mean_dT_TestBT_To2BeforePlate
Definition: ShowRec.h:266
TH1F * var_NN__ALL__min_dR_TestBT_ToAfterPlate
Definition: ShowRec.h:320
TH1F * var_NN__SG__nseg_TestBT_To2AfterPlate
Definition: ShowRec.h:249
TH1F * var_NN__BG__mean_dR_TestBT_ToSamePlate
Definition: ShowRec.h:271
TH1F * var_NN__SG__min_dT_TestBT_ToSamePlate
Definition: ShowRec.h:314
TH1F * var_NN__SG__mean_dT_TestBT_ToAfterPlate
Definition: ShowRec.h:282
TH1F * var_NN__SG__SpatialDist_TestBT_To_InBT
Definition: ShowRec.h:214
TH1F * var_NN__ALL__min_dR_TestBT_ToBeforePlate
Definition: ShowRec.h:296
TH1F * var_NN__ALL__mean_dT_TestBT_ToSamePlate
Definition: ShowRec.h:276
TH1F * var_NN__SG__zDiff_TestBT_To_InBT
Definition: ShowRec.h:217
TH1F * var_NN__BG__min_dT_TestBT_To2BeforePlate
Definition: ShowRec.h:307
TH1F * var_NN__BG__mean_dR_TestBT_ToBeforePlate
Definition: ShowRec.h:255
TH1F * var_NN__BG__mean_dT_TestBT_ToBeforePlate
Definition: ShowRec.h:263
TH1F * var_NN__BG__dR_TestBT_To_InBT
Definition: ShowRec.h:229
TH1F * var_NN__BG__SpatialDist_TestBT_To_InBT
Definition: ShowRec.h:213
TH1F * var_NN__ALL__mean_dT_TestBT_ToAfterPlate
Definition: ShowRec.h:284
TH1F * var_NN__ALL__mean_dR_TestBT_To2AfterPlate
Definition: ShowRec.h:288
TH1F * var_NN__ALL__nseg_TestBT_To2AfterPlate
Definition: ShowRec.h:251
TH1F * var_NN__BG__nseg_TestBT_To2AfterPlate
Definition: ShowRec.h:250
TH1F * var_NN__BG__dT_InBT_To_TestBT
Definition: ShowRec.h:222
TH1F * var_NN__SG__dR_TestBT_To_InBT
Definition: ShowRec.h:228
TH1F * var_NN__ALL__mean_dR_TestBT_ToSamePlate
Definition: ShowRec.h:272
TH1F * var_NN__BG__min_dR_TestBT_To2AfterPlate
Definition: ShowRec.h:327
TH1F * var_NN__ALL__min_dR_TestBT_ToSamePlate
Definition: ShowRec.h:312
TH1F * var_NN__BG__min_dR_TestBT_ToAfterPlate
Definition: ShowRec.h:319
TH1F * var_NN__ALL__min_dT_TestBT_To2AfterPlate
Definition: ShowRec.h:332
TH1F * var_NN__SG__nseg_TestBT_ToBeforePlate
Definition: ShowRec.h:233
TH1F * var_NN__SG__mean_dR_TestBT_ToAfterPlate
Definition: ShowRec.h:278
TH1F * var_NN__ALL__mean_dT_TestBT_ToBeforePlate
Definition: ShowRec.h:264
TH1F * var_NN__ALL__nseg_TestBT_ToAfterPlate
Definition: ShowRec.h:247
TH1F * var_NN__ALL__SpatialDist_TestBT_To_InBT
Definition: ShowRec.h:215
TH1F * var_NN__BG__min_dT_TestBT_ToSamePlate
Definition: ShowRec.h:315
TH1F * var_NN__BG__zDiff_TestBT_To_InBT
Definition: ShowRec.h:216
TH1F * var_NN__SG__mean_dR_TestBT_To2BeforePlate
Definition: ShowRec.h:258
TH1F * var_NN__ALL__mean_dT_TestBT_To2BeforePlate
Definition: ShowRec.h:268
TH1F * var_NN__SG__min_dT_TestBT_To2BeforePlate
Definition: ShowRec.h:306
TH1F * var_NN__ALL__min_dT_TestBT_To2BeforePlate
Definition: ShowRec.h:308
TH1F * var_NN__BG__min_dT_TestBT_ToAfterPlate
Definition: ShowRec.h:323
TH1F * var_NN__BG__mean_dR_TestBT_ToAfterPlate
Definition: ShowRec.h:279
TH1F * var_NN__BG__min_dR_TestBT_To2BeforePlate
Definition: ShowRec.h:299
TH1F * var_NN__SG__nseg_TestBT_ToAfterPlate
Definition: ShowRec.h:245
TH1F * var_NN__BG__mean_dT_TestBT_To2AfterPlate
Definition: ShowRec.h:291
TH1F * var_NN__BG__min_dR_TestBT_ToBeforePlate
Definition: ShowRec.h:295
TH1F * var_NN__SG__dR_InBT_To_TestBT
Definition: ShowRec.h:225
TH1F * var_NN__SG__nseg_TestBT_ToSamePlate
Definition: ShowRec.h:242
TH1F * var_NN__SG__mean_dT_TestBT_ToSamePlate
Definition: ShowRec.h:274
TH1F * var_NN__SG__min_dR_TestBT_To2BeforePlate
Definition: ShowRec.h:298
TH1F * var_NN__ALL__mean_dR_TestBT_ToAfterPlate
Definition: ShowRec.h:280
TH1F * var_NN__ALL__mean_dR_TestBT_To2BeforePlate
Definition: ShowRec.h:260
TH1F * var_NN__SG__nseg_TestBT_To2BeforePlate
Definition: ShowRec.h:237
TH1F * var_NN__BG__min_dT_TestBT_ToBeforePlate
Definition: ShowRec.h:303
TH1F * var_NN__BG__nseg_TestBT_ToAfterPlate
Definition: ShowRec.h:246
TH1F * var_NN__ALL__nseg_TestBT_To2BeforePlate
Definition: ShowRec.h:239
TH1F * var_NN__ALL__mean_dR_TestBT_ToBeforePlate
Definition: ShowRec.h:256
TH1F * var_NN__ALL__nseg_TestBT_ToSamePlate
Definition: ShowRec.h:243
TH1F * var_NN__BG__nseg_TestBT_To2BeforePlate
Definition: ShowRec.h:238
TH1F * var_NN__SG__min_dR_TestBT_ToBeforePlate
Definition: ShowRec.h:294
TH1F * var_NN__ALL__min_dT_TestBT_ToBeforePlate
Definition: ShowRec.h:304
TH1F * var_NN__ALL__min_dR_TestBT_To2AfterPlate
Definition: ShowRec.h:328
TH1F * var_NN__SG__min_dT_TestBT_ToAfterPlate
Definition: ShowRec.h:322
TH1F * var_NN__BG__min_dT_TestBT_To2AfterPlate
Definition: ShowRec.h:331
TH1F * var_NN__SG__min_dT_TestBT_To2AfterPlate
Definition: ShowRec.h:330

◆ CreateOutPutStructures()

void CreateOutPutStructures ( )
448  {
449 
450  Log(2, "ShowRec.cpp", "--- void CreateOutPutStructures() ---");
451 
452  // Create unique Outputfile where efficencies and purities are written in:
453  //-----------------------------------
454  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))+"_FZHP_"+TString(Form("%d",cmd_FZHP))+"__ParaSet_"+TString(Form("%d",cmd_PASTART))+"_To_"+TString(Form("%d",cmd_PAEND))+".txt";
455  //------------------
456  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))+"_FZHP_"+TString(Form("%d",cmd_FZHP))+"__ParaSet_"+TString(Form("%d",cmd_PASTART))+"_To_"+TString(Form("%d",cmd_PAEND))+".txt";
457  FILE_ShowShower = new TFile(STRING_ShowShowerName+".root","RECREATE");
458  //------------------
459  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))+"_FZHP_"+TString(Form("%d",cmd_FZHP))+"__ParaSet_"+TString(Form("%d",cmd_PASTART))+"_To_"+TString(Form("%d",cmd_PAEND))+".txt";
460  FILE_ShowTracks = new TFile(STRING_ShowTracksName+".root","RECREATE");
461  //------------------
462  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))+"_FZHP_"+TString(Form("%d",cmd_FZHP))+"__ParaSet_"+TString(Form("%d",cmd_PASTART))+"_To_"+TString(Form("%d",cmd_PAEND))+".txt";
463  FILE_ShowRecHistos = new TFile(HistoOutputFile+".root","RECREATE");
464  //------------------
465 
466  cout << "--- void CreateOutPutStructures() --- Root Files Recreated."<<endl;
467 
468  NBTeMC_pure = new TProfile("NBTeMCvspure","NBTeMCvspure",100,0,1.05,0,300);
469  NBTallMC_purall = new TProfile("NBTallMCvspurall","NBTallMCvspurall",100,0,1.05,0,300);
470  NBTeMC_NBTMC = new TProfile("NBTeMCvsNBTMC","NBTeMCvsNBTMC",100,0,200,0,300);
471  NBTeMC_NBT = new TProfile("NBTeMCvsNBT","NBTeMCvsNBT",100,0,200,0,300);
472  NBT_InBTE = new TProfile("NBTvsInBTE","NBTvsInBTE",100,0,30,0,300);
473  NBTeMC_InBTE = new TProfile("NBTeMCvsInBTE","NBTeMCvsInBTE",100,0,30,0,300);
474  pure_InBTE = new TProfile("pure_InBTE","pure_InBTE",100,0,30,0,1.05);
475  purall_InBTE = new TProfile("purall_InBTE","purall_InBTE",100,0,30,0,1.05);
476 
477  Hist_NBTeMC_pure = new TH2F("Hist_NBTeMC_pure","Hist_NBTeMC_pure",105,0,1.05,200,0,400);
478  Hist_NBTallMC_purall = new TH2F("Hist_NBTallMC_purall","Hist_NBTallMC_purall",105,0,1.05,200,0,400);
479  Hist_NBTeMC_NBTMC = new TH2F("Hist_NBTeMC_NBTMC","Hist_NBTeMC_NBTMC",200,0,400,200,0,200);
480  Hist_NBTeMC_NBT = new TH2F("Hist_NBTeMC_NBT","Hist_NBTeMC_NBT",200,0,400,200,0,200);
481  Hist_NBT_InBTE = new TH2F("Hist_NBT_InBTE","Hist_NBT_InBTE",120,0,30,200,0,200);
482  Hist_NBTeMC_InBTE = new TH2F("Hist_NBTeMC_InBTE","Hist_NBTeMC_InBTE",120,0,30,200,0,200);
483  Hist_pure_InBTE = new TH2F("Hist_pure_InBTE","Hist_pure_InBTE",120,0,30,100,0,1.05);
484  Hist_purall_InBTE = new TH2F("Hist_purall_InBTE","Hist_purall_InBTE",120,0,30,100,0,1.05);
485 
486 
487  cout << "--- void CreateOutPutStructures() --- Histos Recreated."<<endl;
488  //------------------
489  FILE_ShowRecEff = new TFile(STREAM_ShowRecEffName+".root","RECREATE");
490  TREE_ShowRecEff = new TTree("TreeSTREAM_ShowRecEff","TreeWithvaluesEqualToSTREAM_ShowRecEffTextFile");
491  TREE_ShowRecEff->SetDirectory(FILE_ShowRecEff);
492  cout << "--- void CreateOutPutStructures() --- Tree Recreated."<<endl;
493  //-----------------------------------
494  TREE_ShowRecEff->Branch("PADI", &cmd_PADI, "PADI/I");
495  TREE_ShowRecEff->Branch("BTPA", &cmd_BTPA, "BTPA/I");
496  TREE_ShowRecEff->Branch("BGTP", &cmd_BGTP, "BGTP/I");
497  TREE_ShowRecEff->Branch("ALTP", &cmd_ALTP, "ALTP/I");
498 
499  TREE_ShowRecEff->Branch("FP", &cmd_FP, "FP/I");
500  TREE_ShowRecEff->Branch("MP", &cmd_MP, "MP/I");
501  TREE_ShowRecEff->Branch("LP", &cmd_LP, "LP/I");
502  TREE_ShowRecEff->Branch("NP", &cmd_NP, "NP/I");
503 
504  TREE_ShowRecEff->Branch("LT", &cmd_LT, "LT/I");
505  TREE_ShowRecEff->Branch("MC", &cmd_MC, "MC/I");
506 
507  TREE_ShowRecEff->Branch("PARASETNR", &GLOBAL_PARASETNR, "PARASETNR/I");
508  TREE_ShowRecEff->Branch("ShowerNr", &GLOBAL_INBTSHOWERNR, "ShowerNr/I");
509 
510  TREE_ShowRecEff->Branch("EvtBT_E", &GLOBAL_EvtBT_E, "EvtBT_E/D");
511  TREE_ShowRecEff->Branch("EvtBT_TanTheta", &GLOBAL_EvtBT_TanTheta, "EvtBT_TanTheta/D");
512  TREE_ShowRecEff->Branch("EvtBT_Flag", &GLOBAL_EvtBT_Flag, "EvtBT_Flag/I");
513  TREE_ShowRecEff->Branch("EvtBT_MC", &GLOBAL_EvtBT_MC, "EvtBT_MC/I");
514 
515  TREE_ShowRecEff->Branch("InBT_E", &GLOBAL_InBT_E, "InBT_E/D");
516  TREE_ShowRecEff->Branch("InBT_TanTheta", &GLOBAL_InBT_TanTheta, "InBT_TanTheta/D");
517  TREE_ShowRecEff->Branch("InBT_Flag", &GLOBAL_InBT_Flag, "InBT_Flag/I");
518  TREE_ShowRecEff->Branch("InBT_MC", &GLOBAL_InBT_MC, "InBT_MC/I");
519 
520  TREE_ShowRecEff->Branch("NBT", &GLOBAL_NBT, "NBT/I");
521  TREE_ShowRecEff->Branch("NBTMC", &GLOBAL_NBTMC, "NBTMC/I"); // kept for backward compability
522  TREE_ShowRecEff->Branch("NBTallMC", &GLOBAL_NBTallMC, "NBTallMC/I");
523  TREE_ShowRecEff->Branch("NBTeMC", &GLOBAL_NBTeMC, "NBTeMC/I");
524  TREE_ShowRecEff->Branch("purall", &GLOBAL_purall, "purall/D");
525  TREE_ShowRecEff->Branch("pure", &GLOBAL_pure, "pure/D");
526  TREE_ShowRecEff->Branch("effall", &GLOBAL_effall, "effall/D");
527  TREE_ShowRecEff->Branch("effe", &GLOBAL_effe, "effe/D");
528 
529  TREE_ShowRecEff->Branch("trckdens", &GLOBAL_trckdens, "trckdens/D");
530  //-----------------------------------
531  Log(2, "ShowRec.cpp", "--- void CreateOutPutStructures() ---done.");
532  return;
533 }
TProfile * NBT_InBTE
Definition: ShowRec.h:96
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
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
TFile * FILE_ShowTracks
Definition: ShowRec.h:71
TH2F * Hist_NBT_InBTE
Definition: ShowRec.h:97
Int_t cmd_PAEND
Definition: ShowRec.h:13
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
TString STRING_ShowShowerName
Definition: ShowRec.h:67
TString STREAM_ShowRecEffName
Definition: ShowRec.h:66
Int_t cmd_LT
Definition: ShowRec.h:19
TH2F * Hist_NBTeMC_InBTE
Definition: ShowRec.h:99
TTree * TREE_ShowRecEff
Definition: ShowRec.h:62
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
Double_t GLOBAL_InBT_E
Definition: ShowRec.h:44
Int_t GLOBAL_EvtBT_MC
Definition: ShowRec.h:49
TProfile * NBTeMC_NBT
Definition: ShowRec.h:94
TProfile * NBTallMC_purall
Definition: ShowRec.h:90
TProfile * NBTeMC_pure
Definition: ShowRec.h:88
Double_t GLOBAL_EvtBT_TanTheta
Definition: ShowRec.h:50
Int_t GLOBAL_EvtBT_Flag
Definition: ShowRec.h:49
Int_t cmd_FZHP
Definition: ShowRec.h:22
Int_t cmd_MC
Definition: ShowRec.h:20

◆ CreateTreeBranchShowerTree()

TTree* CreateTreeBranchShowerTree ( Int_t  ParaSetNr)
7865 {
7866  Log(2, "ShowRec.cpp", "--- TTree* CreateTreeBranchShowerTree() ---");
7867 
7868 
7869  // ParasetNr == -1 (no paraset from the paradefinition.root file is given and the
7870  // standard built in parasets are used: "treebranch" instead of "treebranch_-1"
7871  // ParasetNr != -1 ( paraset from the paradefinition.root file is given)
7872 
7873  TString treenname;
7874  if (ParaSetNr==-1) {
7875  treenname="treebranch";
7876  }
7877  else {
7878  treenname=TString(Form("treebranch_%d",ParaSetNr));
7879  }
7880 
7881  TTree* eShowerTree = new TTree(treenname,treenname);
7882  eShowerTree->Branch("number_eventb",&shower_number_eventb,"number_eventb/I");
7883  eShowerTree->Branch("sizeb",&shower_sizeb,"sizeb/I");
7884  eShowerTree->Branch("sizeb15",&shower_sizeb15,"sizeb15/I");
7885  eShowerTree->Branch("sizeb20",&shower_sizeb20,"sizeb20/I");
7886  eShowerTree->Branch("sizeb30",&shower_sizeb30,"sizeb30/I");
7887  eShowerTree->Branch("isizeb",&shower_isizeb,"isizeb/I");
7888  eShowerTree->Branch("xb",shower_xb,"xb[sizeb]/F");
7889  eShowerTree->Branch("yb",shower_yb,"yb[sizeb]/F");
7890  eShowerTree->Branch("zb",shower_zb,"zb[sizeb]/F");
7891  eShowerTree->Branch("txb",shower_txb,"txb[sizeb]/F");
7892  eShowerTree->Branch("tyb",shower_tyb,"tyb[sizeb]/F");
7893  eShowerTree->Branch("nfilmb",shower_nfilmb,"nfilmb[sizeb]/I");
7894  eShowerTree->Branch("ntrace1simub",shower_ntrace1simub,"ntrace1simu[sizeb]/I",128000); // s.eMCEvt
7895  eShowerTree->Branch("ntrace2simub",shower_ntrace2simub,"ntrace2simu[sizeb]/I",128000); // s.eW
7896  eShowerTree->Branch("ntrace3simub",shower_ntrace3simub,"ntrace3simu[sizeb]/F",128000); // s.eP
7897  eShowerTree->Branch("ntrace4simub",shower_ntrace4simub,"ntrace4simu[sizeb]/I",128000); // s.eFlag
7898  eShowerTree->Branch("chi2btkb",shower_chi2btkb,"chi2btkb[sizeb]/F");
7899  eShowerTree->Branch("deltarb",shower_deltarb,"deltarb[sizeb]/F");
7900  eShowerTree->Branch("deltathetab",shower_deltathetab,"deltathetab[sizeb]/F");
7901  eShowerTree->Branch("deltaxb",shower_deltaxb,"deltaxb[sizeb]/F");
7902  eShowerTree->Branch("deltayb",shower_deltayb,"deltayb[sizeb]/F");
7903  eShowerTree->Branch("tagprimary",shower_tagprimary,"tagprimary[sizeb]/F");
7904  eShowerTree->Branch("energy_shot_particle",&shower_energy_shot_particle,"energy_shot_particle/F");
7905  eShowerTree->Branch("E_MC",&shower_energy_shot_particle,"E_MC/F");
7906  eShowerTree->Branch("showerID",&shower_showerID,"showerID/I");
7907  eShowerTree->Branch("idb",shower_idb,"idb/I");
7908  eShowerTree->Branch("plateb",shower_plateb,"plateb[sizeb]/I");
7909  eShowerTree->Branch("deltasigmathetab",shower_deltasigmathetab,"deltasigmathetab[59]/F");
7910  eShowerTree->Branch("lengthfilmb",&shower_numberofilms,"lengthfilmb/I",128000);
7911  eShowerTree->Branch("purityb",&shower_purb,"purityb/F",128000); // shower purity
7912  eShowerTree->Branch("trackdensb",&shower_trackdensb,"trackdensb/F",128000); // track density _around_ the shower (not _in_ shower)
7913  eShowerTree->Branch("nholesb",&shower_numberofholes,"nholesb/I",128000); // #of (single) empty plates
7914  eShowerTree->Branch("nholesmaxb",&shower_numberofholesconseq,"nholesmaxb/I",128000); // #of (consecutive) empty plates
7915 
7916  eShowerTree->Branch("axis_xb",&shower_axis_xb,"shower_axis_xb/F"); // Shower Axis Values...
7917  eShowerTree->Branch("axis_yb",&shower_axis_yb,"shower_axis_yb/F");
7918  eShowerTree->Branch("axis_zb",&shower_axis_zb,"shower_axis_zb/F");
7919  eShowerTree->Branch("axis_txb",&shower_axis_txb,"shower_axis_txb/F");
7920  eShowerTree->Branch("axis_tyb",&shower_axis_tyb,"shower_axis_tyb/F");
7921 
7922  // distuingish variable for more than one kind of showers merged into treebranch
7923  eShowerTree->Branch("filetype",&shower_filetype,"filetype/I");
7924 
7925  eShowerTree->SetDirectory(FILE_ShowShower);
7926 
7927  if (gEDBDEBUGLEVEL>2) {
7928  cout << "--- CreateTreeBranchShowerTree: eShowerTree: Name, Entries:"<<endl;
7929  cout << eShowerTree->GetName() << " " << eShowerTree->GetEntries() <<endl;
7930  cout << "------eShowerTree-----------------------------------------"<<endl;
7931  }
7932  return eShowerTree;
7933 }
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
Int_t ParaSetNr
Definition: CreateParaset_BW_Alg.C:23

◆ Fill2GlobalInBTArray()

void Fill2GlobalInBTArray ( )
8986  {
8987 
8988  // if we have a vertex file we can cut for InBT tracks with a given vertex (to pure up the starting inbt sample)
8989  // (for now 100micron ip). (electrons,pi+-);
8990  // (for now 250micron ip). (photons.);
8991  // (for now 300micron ip). (other.);
8992 // if (cmd_vtx!=1) return;
8993  if (cmd_vtx==0) return;
8994 // if (cmd_MC!=1) return; // why did we say that we wanna have only starting mc inbts?
8995  // also it can be possible that we wanna seacrh all in bt from the volume to an given
8996  // vertex, for a mc event (but not necessarily for mc In BTs).
8997  // better comment it out?... ah, i know why because otherwise, we do not know which mc event vtx to take... so what to do???
8998 
8999  Float_t cutIPMax=100;
9000  if (cmd_vtx==2) cutIPMax=250;
9001  if (cmd_vtx==3) cutIPMax=500;
9002  if (cmd_vtx==4) cutIPMax=1000;
9003  if (cmd_vtx==5) cutIPMax=5000;
9004 
9005  Float_t cutZVtxDist=999999;
9006 
9007  TObjArray* GLOBAL_InBTArray2 = new TObjArray();
9008  cout << "Fill2GlobalInBTArray Calc IPs for the " << GLOBAL_InBTArray->GetEntries() << " entries" << endl;
9009 
9010  for (Int_t i=0; i<GLOBAL_InBTArray->GetEntries(); ++i) {
9011  if (i%1000==0) cout << "." << flush;
9012  EdbSegP* s1=(EdbSegP*)GLOBAL_InBTArray->At(i);
9013  // Calculate IP:
9014  // in case InBT is of BGType, we check for the GBMC variable set.
9015  Int_t MCEvt=s1->MCEvt();
9016  if (MCEvt<0 && cmd_GBMC>0) MCEvt=cmd_GBMC;
9017 
9018  Double_t ip=CalcIP(s1,Double_t(GLOBAL_VtxArrayX[MCEvt]),Double_t(GLOBAL_VtxArrayY[MCEvt]),Double_t(GLOBAL_VtxArrayZ[MCEvt]));
9019 
9020  if (ip>cutIPMax) continue;
9021 
9022  cutZVtxDist=s1->Z()-Double_t(GLOBAL_VtxArrayZ[MCEvt]);
9023  if (i==0||i==GLOBAL_InBTArray->GetEntries()-1) {
9024  cout << "INBT " << i << " :VTX:X:Y:Z: " << GLOBAL_VtxArrayX[MCEvt] << " " << GLOBAL_VtxArrayY[MCEvt] << " " << GLOBAL_VtxArrayZ[MCEvt] << " ip= " << ip << " ZdistVtx= " << cutZVtxDist << " MCEvt= " << MCEvt << endl;
9025  }
9026 
9027  if (ip<cutIPMax) GLOBAL_InBTArray2->Add(s1);
9028  }
9029 
9030  cout << endl;
9031  cout << "Fill2GlobalInBTArray::Before IP cut " << GLOBAL_InBTArray->GetEntries() << endl;
9032  cout << "Fill2GlobalInBTArray::After IP cut("<<cutIPMax<<") " << GLOBAL_InBTArray2->GetEntries() << endl;
9033 // Swap Arrays:
9034  GLOBAL_InBTArray= GLOBAL_InBTArray2;
9035  cout << GLOBAL_InBTArray->GetEntries() <<endl;
9036 
9037 
9038  return;
9039 }
Int_t cmd_vtx
Definition: ShowRec.h:25
TObjArray * GLOBAL_InBTArray
Definition: ShowRec.h:74
EdbSegP * s1
Definition: tlg2pattern.C:30

◆ FillGlobalInBTArray()

void FillGlobalInBTArray ( )

MAYBE THIS DOESNT YET WORK FOR DOWNSTREAM LINKINT TYPE if (s2->PID()>firstplate) continue; if (s2->PID()<middleplate) continue;

TEST, now we choose something different, ratio of highest P to other thrack: <10 if (TMath::Abs(highestP_at_lowestZ[jjjj]-highestP[jjjj])>200.0) {

— ONLY DEBUG —

— ONLY DEBUG —

939 {
940  Log(2, "ShowRec.cpp", "--- void FillGlobalInBTArray() ---");
941 
942  //--------------------------------------------------------
943  // To fill the Initiator BT array from the gAli
944  // watching boundary conditions for the Plates, MC Cut.
945  //--------------------------------------------------------
946  GLOBAL_InBTArray = new TObjArray(99999);
947  GLOBAL_ShowerSegArray = new TObjArray(99999);
948  EdbSegP *segment;
949  //--------------------------------------------------------
950  // Informational Debug Output
951  cout << "---!! DOWNSTREAM ORDER ASSUMED !!---"<<endl;
952  cout << "---!! IF PROGRAM CRASH HERE, CHECK YOUR INPUT FP,NP;MP;LP !!---"<<endl;
953  Int_t npat = GLOBAL_gAli->Npatterns(); //number of plates
954  Int_t firstplate= npat-cmd_FP;
955  Int_t middleplate= npat-cmd_MP;
956  Int_t actualplate= npat-cmd_FP;
957  Int_t lastplate= TMath::Max(npat-cmd_LP-1,0);
958  Float_t GLOBAL_gAli__firstplate_Z=GLOBAL_gAli->GetPattern(firstplate)->Z();
959  Float_t GLOBAL_gAli__middleplate_Z=GLOBAL_gAli->GetPattern(middleplate)->Z();
960  Float_t GLOBAL_gAli__lastplate_Z=GLOBAL_gAli->GetPattern(lastplate)->Z();
961  //--------------------------------------------------------
962  if (gEDBDEBUGLEVEL>2) {
963  cout << "--- FillGlobalInBTArray: DOWNSTREAM ORDER" <<endl;
964  cout << "--- npat = " << npat << endl;
965  cout << "--- firstplate = " << firstplate << endl;
966  cout << "--- middleplate = " << middleplate << endl;
967  cout << "--- lastplate = " << lastplate << endl;
968  cout << " GLOBAL_gAli->GetPattern(firstplate)->Z() = " << GLOBAL_gAli->GetPattern(firstplate)->Z() << endl;
969  cout << " GLOBAL_gAli->GetPattern(middleplate)->Z() = " << GLOBAL_gAli->GetPattern(middleplate)->Z() << endl;
970  }
971  //--------------------------------------------------------
972 
973  // return;
974 
975 
976  //--------------------------------------------------------
977  // Do this in case of -cmd_LT==1,2,3
978  // 1: all starting BTs of a track are taken.
979  // 2: all ending BTs of a track are taken.
980  // 3: all BTs of a track are taken.
981  //--------------------------------------------------------
982  if (cmd_LT==1||cmd_LT==2||cmd_LT==3||cmd_LT==4) {
983  if (gEDBDEBUGLEVEL>2) cout << "--- Doing tracking case cmd_LT==1,2,3,4"<<endl;
984  EdbSegP * s2=0;
985  EdbTrackP *t = 0;
986  TFile * fil = new TFile("linked_tracks.root");
987  TTree* tr= (TTree*)fil->Get("tracks");
988  TClonesArray *seg= new TClonesArray("EdbSegP",60);
989  int nentr = int(tr->GetEntries());
990  int nseg,n0,npl;
991  cout << nentr << " entries Total"<<endl;
992  tr->SetBranchAddress("t." , &t );
993  tr->SetBranchAddress("s" , &seg );
994  tr->SetBranchAddress("nseg" , &nseg );
995  tr->SetBranchAddress("n0" , &n0 );
996  tr->SetBranchAddress("npl" , &npl );
997  tr->Show(0);
998 
999  int percent=100;
1000  cout << "--- Doing tracking case cmd_LT==1,2,3,4 with percent value of "<< percent << endl;
1001 
1002  for (int i=0; i<nentr; i++ ) {
1003  //if (i%10!=0) continue;
1004  tr->GetEntry(i);
1005  if (gEDBDEBUGLEVEL>3) tr->Show(i);
1006  // Take only Basetracks from tracks which pass 3 or more plates:
1007  if (npl<3) continue;
1008 
1009  // depending on cmd_LT=1,2,3 different loops have to be gone through:
1010  for (int k=0; k<nseg; k++ ) {
1011  //cout << "----- Doing i= " << i << " and k= " << k<< endl;
1012  if (cmd_LT==1 && k>0) continue; // only first BT
1013  if (cmd_LT==2 && k<nseg-1) continue; // only last BT
1014  // Take first BT of the tracks:
1015  s2=(EdbSegP*) seg->At(k);
1016  // Check via PID if this segment is within the desired range:
1017  // Only valid for upstream...
1021  // Test if with Z values it is better:
1022  if (s2->Z()>GLOBAL_gAli__lastplate_Z) continue;
1023  if (s2->Z()>GLOBAL_gAli__middleplate_Z) continue;
1024  if (s2->Z()<GLOBAL_gAli__firstplate_Z) continue;
1025 
1026  segment=(EdbSegP*)s2->Clone();
1027 
1028  if (cmd_MC==1 && segment->MCEvt()<0) continue; // do not add segment.
1029  if (cmd_MC==1 && cmd_MCFL>0 && Abs(segment->Flag())!=cmd_MCFL) continue; // do not add segment with wrong flag.
1030  else GLOBAL_InBTArray->Add(segment); // otherwise do.
1031 
1032  if (gEDBDEBUGLEVEL>2) segment->PrintNice();
1033 
1034 
1035  // Case Of LT==4, take only the first BT which appears between [FP..MP]
1036  // Then if we have a BT for this track, we finish this loop and move to
1037  // the next Track:
1038  if (cmd_LT==4) k=nseg; // this means automatically finish this loop...
1039 
1040  } // of for(int k=0; k<nseg; k++ )
1041  } // for(int i=0; i<nentr; i++ )
1042  delete tr;
1043  delete fil;
1044 
1045  if (gEDBDEBUGLEVEL>2) cout << "--- Filled " << GLOBAL_InBTArray->GetEntries() << " Segments into GLOBAL_InBTArray."<<endl;
1046 
1047  } // end of Do this in case of -cmd_LT==1
1048 
1049 
1050  //--------------------------------------------------------
1051  // Do this in case of -cmd_LT==0 && cmd_FZHP==0
1052  //--------------------------------------------------------
1053  if (cmd_MC<2&&cmd_LT==0 && cmd_FZHP==0) {
1054  cout << "Do this in case of cmd_MC<2&& -cmd_LT==0 && cmd_FZHP==0 " << endl;
1055  for (Int_t nr=middleplate; nr<=firstplate; ++nr) {
1056  for (Int_t n=0; n<GLOBAL_gAli->GetPattern(nr)->GetN(); ++n) {
1057  segment=GLOBAL_gAli->GetPattern(nr)->GetSegment(n);
1058  if (cmd_MC==1 && segment->MCEvt()<0) continue; // do not add segment.
1059  if (cmd_MC==1 && cmd_MCFL>0 && Abs(segment->Flag())!=cmd_MCFL) continue; // do not add segment with wrong flag.
1060  else GLOBAL_InBTArray->Add(segment); // otherwise do.
1061 
1062  if (gEDBDEBUGLEVEL>2) segment->PrintNice();
1063  }
1064  }
1065  } // Do this in case of -cmd_LT==0 && cmd_FZHP==0
1066 
1067  //--------------------------------------------------------
1068  // Do this in case of -cmd_MC==2 (only InBT from [middleplate..middleplate]
1069  //--------------------------------------------------------
1070  if (cmd_MC==2) {
1071  cout << "Do this in case of cmd_MC==2 " << endl;
1072  for (Int_t nr=middleplate; nr<=middleplate; ++nr) {
1073  for (Int_t n=0; n<GLOBAL_gAli->GetPattern(nr)->GetN(); ++n) {
1074  segment=GLOBAL_gAli->GetPattern(nr)->GetSegment(n);
1075  if (cmd_MC==2 && segment->MCEvt()<0) continue; // do not add segment.
1076  if (cmd_MC==2 && cmd_MCFL>0 && Abs(segment->Flag())!=cmd_MCFL) continue; // do not add segment with wrong flag.
1077  else GLOBAL_InBTArray->Add(segment); // otherwise do.
1078  if (gEDBDEBUGLEVEL>2) segment->PrintNice();
1079  }
1080  }
1081  } // Do this in case of -cmd_MC==2
1082 
1083  //--------------------------------------------------------
1084  // Do this in case of -cmd_MC==3 (only InBT from [middleplate..lastplate]
1085  //--------------------------------------------------------
1086  if (cmd_MC==3) {
1087  cout << "Do this in case of cmd_MC==3 " << endl;
1088  for (Int_t nr=middleplate; nr<=lastplate; ++nr) {
1089  for (Int_t n=0; n<GLOBAL_gAli->GetPattern(nr)->GetN(); ++n) {
1090  segment=GLOBAL_gAli->GetPattern(nr)->GetSegment(n);
1091  if (cmd_MC==3 && segment->MCEvt()<0) continue; // do not add segment.
1092  if (cmd_MC==3 && cmd_MCFL>0 && Abs(segment->Flag())!=cmd_MCFL) continue; // do not add segment with wrong flag.
1093  else GLOBAL_InBTArray->Add(segment); // otherwise do.
1094  if (gEDBDEBUGLEVEL>2) segment->PrintNice();
1095  }
1096  }
1097  } // Do this in case of -cmd_MC==3
1098 
1099 
1100  //--------------------------------------------------------
1101  // Do this in case of cmd_MC<2 and -cmd_LT==0 and cmd_FirstZHighestP==1
1102  //--------------------------------------------------------
1103  if (cmd_MC<2&&cmd_FZHP>=1 && cmd_LT==0) {
1104  cout << "// Do this in case of cmd_MC<2&&cmd_FZHP>=1 && cmd_LT==0" << endl;
1105 
1106  EdbSegP* segtest=0;
1107  float lowestZ[99999];
1108  for (int i=0; i<99999; i++) {
1109  lowestZ[i]=9999999;
1110  }
1111  float lowestZ_at_highestP[99999];
1112  for (int i=0; i<99999; i++) {
1113  lowestZ_at_highestP[i]=9999999;
1114  }
1115  float highestP[99999];
1116  for (int i=0; i<99999; i++) {
1117  highestP[i]=-1;
1118  }
1119  float highestP_at_lowestZ[99999];
1120  for (int i=0; i<99999; i++) {
1121  highestP_at_lowestZ[i]=-1;
1122  }
1123  int lowestZPlateForEvent[99999];
1124  for (int i=0; i<99999; i++) {
1125  lowestZPlateForEvent[i]=-1;
1126  }
1127  float desiredZ[99999];
1128  for (int i=0; i<99999; i++) {
1129  desiredZ[i]=9999999;
1130  }
1131  float desiredP[99999];
1132  for (int i=0; i<99999; i++) {
1133  desiredP[i]=-1;
1134  }
1135  int maxEvt=0;
1136 
1137 
1138  cout << "-------------------DOING FIRST LOOP NOW ------------------------"<<endl;
1139 
1140  Int_t helperMC=0;
1141 
1142  // First get lowest Z positions in any case,
1143  // and highest P value of all gAli patterns:
1144  for (Int_t nr=middleplate; nr<=firstplate; ++nr) {
1145  //cout <<" GLOBAL_gAli->GetPattern(nr)->Z() = " << GLOBAL_gAli->GetPattern(nr)->Z() << endl;
1146  for (Int_t n=0; n<GLOBAL_gAli->GetPattern(nr)->GetN(); ++n) {
1147  segtest=GLOBAL_gAli->GetPattern(nr)->GetSegment(n);
1148 
1149  helperMC=segtest->MCEvt();
1150 
1151  if (helperMC<0) continue;
1152  if (helperMC>maxEvt) maxEvt=helperMC;
1153  if (segtest->P()>highestP[helperMC]) {
1154  highestP[helperMC]=segtest->P();
1155  lowestZ_at_highestP[helperMC]=segtest->Z();
1156  }
1157  if (cmd_FZHP==1&&segtest->Z()>lowestZ[helperMC]) continue;
1158 
1159  lowestZ[helperMC]=segtest->Z();
1160  lowestZPlateForEvent[helperMC]=nr;
1161  }
1162  }
1163 
1164 
1165 
1166  cout << "-------------------DOING 2nd LOOP NOW ------------------------"<<endl;
1167 
1168  // int jjjj=1780;
1169  // cout << "lowestZ[jjjj] = " << lowestZ[jjjj] << " highestP[jjjj] = " << highestP[jjjj] << " lowestZPlateForEvent[]= " << lowestZPlateForEvent[jjjj] <<endl;
1170  // cout << "highestP_at_lowestZ[jjjj] = " << highestP_at_lowestZ[jjjj] << " TMath::Abs(highestP_at_lowestZ[jjjj]-highestP[jjjj]) " << TMath::Abs(highestP_at_lowestZ[jjjj]-highestP[jjjj]) << "--lowestZ_at_highestP[jjjj] "<<lowestZ_at_highestP[jjjj] << endl;
1171 
1172 
1173  Bool_t shuffle_sameposition_BTs=kFALSE;
1174  // Bool_t shuffle_sameposition_BTs=kTRUE;
1175 
1176  // Then compare highest then look for highest P at lowest Z positions:
1177  for (Int_t nr=middleplate; nr<=firstplate; ++nr) {
1178  //cout <<" GLOBAL_gAli->GetPattern(nr)->Z() = " << GLOBAL_gAli->GetPattern(nr)->Z() << endl;
1179  for (Int_t n=0; n<GLOBAL_gAli->GetPattern(nr)->GetN(); ++n) {
1180  segtest=GLOBAL_gAli->GetPattern(nr)->GetSegment(n);
1181  helperMC=segtest->MCEvt();
1182  if (helperMC<0) continue;
1183  if (nr!=lowestZPlateForEvent[helperMC]) continue;
1184 
1185  if (segtest->P()>highestP_at_lowestZ[helperMC]) { // can comment this to shuffle first starting BTs
1186  highestP_at_lowestZ[helperMC]=segtest->P();
1187  desiredZ[helperMC]=segtest->Z();
1188  desiredP[helperMC]=segtest->P();
1189  } // can comment this to shuffle first starting BTs
1190 
1191  // If shuffle then set the values, not even comparing "segtest->P()>highestP_at_lowestZ[helperMC]"
1192  if (shuffle_sameposition_BTs) {
1193  highestP_at_lowestZ[helperMC]=segtest->P();
1194  desiredZ[helperMC]=segtest->Z();
1195  desiredP[helperMC]=segtest->P();
1196  }
1197 
1198  }
1199  }
1200 
1201  // Remark: here we take at the lowest Z position th BT which has the largest P() value. NOrmally, if you have
1202  // both, e+ and e- you want to reconstruct yout gamma-shower, no matter from which BT you start.
1203  // Test: for 2GeV and 0.5GeV Gammas the resulting shower distirbutions look already similar, if ou either start recon-
1204  // structing from higher P() BT, or randomly. Just a very slight shift to higher sizeb if you take higher P() BT.
1205 
1206  // Now Check for all MC events if the difference inP() is greater 200 MeV:
1207  // a) if not: then take lowestZ_at_highestP with highestP
1208  // b) if : then take lowestZ with highestP_at_lowestZ
1209 
1210  cout << "-------------------DOING 3rd LOOP NOW ------------------------"<<endl;
1211 
1212 
1213  for (int jjjj=1; jjjj<=maxEvt; ++jjjj) {
1214  if (gEDBDEBUGLEVEL>2) {
1215  cout << "---Event "<< jjjj << endl;
1216  cout << "TMath::Abs(highestP_at_lowestZ[jjjj]-highestP[jjjj]) " << TMath::Abs(highestP_at_lowestZ[jjjj]-highestP[jjjj]) << endl;
1217  cout << "Ratio highestP[jjjj]/highestP_at_lowestZ[jjjj] " << highestP[jjjj]/highestP_at_lowestZ[jjjj] << endl;
1218  }
1221  if (highestP[jjjj]/highestP_at_lowestZ[jjjj]>10) {
1222  desiredZ[jjjj]=lowestZ_at_highestP[jjjj];
1223  desiredP[jjjj]=highestP[jjjj];
1224  }
1225 
1226  if (cmd_FZHP==2) {
1227  desiredZ[jjjj]=lowestZ_at_highestP[jjjj];
1228  desiredP[jjjj]=highestP[jjjj];
1229  }
1230 
1231 
1232  if (gEDBDEBUGLEVEL>2) {
1233  cout << "---Event "<< jjjj << endl;
1234  cout << "lowestZ[jjjj] = " << lowestZ[jjjj] << " highestP[jjjj] = " << highestP[jjjj] << " lowestZPlateForEvent[]= " << lowestZPlateForEvent[jjjj] <<endl;
1235  cout << "highestP_at_lowestZ[jjjj] = " << highestP_at_lowestZ[jjjj] << " TMath::Abs(highestP_at_lowestZ[jjjj]-highestP[jjjj]) " << TMath::Abs(highestP_at_lowestZ[jjjj]-highestP[jjjj]) << "--lowestZ_at_highestP[jjjj] "<<lowestZ_at_highestP[jjjj] << endl;
1236  cout << "desiredZ[jjjj] = " << desiredZ[jjjj] << " desiredP[jjjj] = " << desiredP[jjjj] << endl;
1237  }
1238  }
1239 
1240 
1241  cout << "-------------------DOING 4th LOOP NOW ------------------------"<<endl;
1242 
1243  helperMC=0;
1244 
1245  for (Int_t nr=middleplate; nr<=firstplate; ++nr) {
1246  for (Int_t n=0; n<GLOBAL_gAli->GetPattern(nr)->GetN(); ++n) {
1247  segment=GLOBAL_gAli->GetPattern(nr)->GetSegment(n);
1248  helperMC=segment->MCEvt();
1249  if (cmd_MC==1 && helperMC<0) continue; // do not add segment.
1250  //if (cmd_MC==1 && cmd_MCFL>0 && Abs(segment->Flag())!=cmd_MCFL) continue; // do not add segment with wrong flag.
1251 
1252  if (segment->Z()!=desiredZ[helperMC]) continue; // do not add segment if it is beyond the first Z position
1253  if (segment->P()!=desiredP[helperMC]) continue; // do not add segment then if it is lower the highest P
1254  //cout <<"MCEvt " << segment->MCEvt() << " lowestZ " << lowestZ[segment->MCEvt()] << " highestP " << highestP[segment->MCEvt()] <<endl;
1255 
1256  if (helperMC>maxEvt) maxEvt=helperMC;
1257 
1258  GLOBAL_InBTArray->Add(segment); // otherwise do.
1259  //if (gEDBDEBUGLEVEL>2) segment->PrintNice();
1260  }
1261  }
1262 
1263 //------------------------------------ DEBUG
1264  for (Int_t nn=1; nn<=maxEvt; ++nn) {
1265  if (gEDBDEBUGLEVEL>2) cout << " MC Event --- " << nn << " desiredZ = "<< desiredZ[nn] << " desiredP = " << desiredP[nn] << " " << endl;
1266  }
1267 //------------------------------------
1268 
1269 
1270  } // Do this in case of -cmd_LT==0 and cmd_FirstZHighestP==1
1271 
1272 
1273  cout << "GLOBAL_InBTArray filling done.................."<<endl;
1274 
1275 
1276  if (GLOBAL_InBTArray->GetEntries()==0) {
1277  cout << "--- GLOBAL_InBTArray->GetEntries() = 0 . RETURN FILL FUNCTION !" << endl;
1278  return;
1279  }
1280 
1281 
1283  if (gEDBDEBUGLEVEL>1) {
1284  EdbSegP* seg0=(EdbSegP*)GLOBAL_InBTArray->At(0);
1285  EdbSegP* segend=(EdbSegP*)GLOBAL_InBTArray->At(GLOBAL_InBTArray->GetEntries()-1);
1286  cout << "--- GLOBAL_InBTArray->GetEntries() = " << GLOBAL_InBTArray->GetEntries() << endl;
1287  cout << "--- GLOBAL_InBTArray->At(0) = " << endl;
1288  seg0->PrintNice();
1289  cout << "--- GLOBAL_InBTArray->At(Last) = " << endl;
1290  segend->PrintNice();
1291  }
1292 
1293 
1294 
1295 
1296 
1297  if (gEDBDEBUGLEVEL>3) {
1298  int isMCThere[100000];
1299  int nr;
1300  for (Int_t nn=0; nn<99999; ++nn) {
1301  isMCThere[nn]=0;
1302  }
1303  if (gEDBDEBUGLEVEL>3) cout << "INFO Printing double counted MCEvt basetracks:" << endl;
1304  int maxEvt=0;
1305  int tmp=0;
1306  for (Int_t nn=0; nn<GLOBAL_InBTArray->GetEntries(); ++nn) {
1307  EdbSegP* seg=(EdbSegP*)GLOBAL_InBTArray->At(nn);
1308  nr=seg->MCEvt();
1309  if (nr>0) {
1310  tmp=isMCThere[nr];
1311  ++tmp;
1312  isMCThere[nr]=tmp;
1313  }
1314  if (nr>maxEvt) maxEvt=nr;
1315  if (isMCThere[nr]>1) if (gEDBDEBUGLEVEL>2) seg->PrintNice();
1316  }
1317  for (Int_t nn=1; nn<=maxEvt; ++nn) {
1318  if (isMCThere[nn]==0) {
1319  cout << " MC Event --- " << nn << " is not contained in InBTArray"<<endl;
1320  }
1321  if (isMCThere[nn]>1) {
1322  cout << "INFO MC Event --- " << nn << " is : " << isMCThere[nn] << " times contained in InBTArray"<<endl;
1323 
1324  }
1325  }
1326  }
1328 
1329 
1330 
1331  //--------------------------------------------------------
1332  // no need to fill these arrays if only reconstruction is done
1333  //--------------------------------------------------------
1334  if (cmd_OUTPUTLEVEL==1) return;
1335  //--------------------------------------------------------
1336 
1337 
1338 
1339 
1340 
1341 
1342  //--------------------------------------------------------
1343  // No need to fill these arrays anymore, since we have access to global event
1344  // information via the Brick.root G4 source file
1345  //--------------------------------------------------------
1346  cout << "------------------- No need to fill these arrays anymore, since we have access to global event ------------------------"<<endl;
1347  cout << "------------------- information via the Brick.root G4 source file. Return Fill() function now. ------------------------"<<endl;
1348  return;
1349  //--------------------------------------------------------
1350 
1351 
1352 
1353 
1354 
1355 
1356 
1357 
1358  //--------------------------------------------------------
1359  // Fill the values for GLOBAL_EvtBT_xxxArray variables.
1360  //--------------------------------------------------------
1361  if (gEDBDEBUGLEVEL>=2) cout << "--- Fill the values for GLOBAL_EvtBT_xxxArray variables now..." <<endl;
1362 
1363  // Reset variables:
1364  for (Int_t nn=0; nn<99999; ++nn) {
1365  GLOBAL_EvtBT_FlagArray[nn]=-999;
1366  GLOBAL_EvtBT_MCArray[nn]=-1;
1367  GLOBAL_EvtBT_EArray[nn]=0;
1369  GLOBAL_EvtBT_ZArray[nn]=9999999;
1370  }
1371 
1372  if (gEDBDEBUGLEVEL>=2) cout << "--- GLOBAL_EvtBT_xxxArray reseted..." <<endl;
1373 
1374  npat = GLOBAL_gAli->Npatterns();
1375 
1376  EdbSegP* helpsegArr;
1377  EdbSegP* helpsegAll;
1378  Float_t helptx,helpty,helpP,helpZ;
1379 
1380  // Calculate Values for the very first plate the corresponding
1381  // basetrack appears in. Do only for MC Events....
1382  for (Int_t i=0; i<GLOBAL_InBTArray->GetEntries(); ++i) {
1383 
1384  if (GLOBAL_InBTArray->GetEntries()>99999-1) {
1385  cout << "WARNING: GLOBAL_InBTArray->GetEntries()>99999-1: Stop Filling...."<<endl;
1386  break;
1387  }
1388 
1389  if (gEDBDEBUGLEVEL==2) if ((i%1)==0) cout <<"--- Filling event: "<<Form("%4d",i)<< "\r\r\r\r" <<flush;
1390 
1391  helpsegArr=(EdbSegP*)GLOBAL_InBTArray->At(i);
1392  if (helpsegArr->MCEvt()<0) continue;
1393 
1394  // Loop over whole BrickVolume:
1395  for (Int_t nr2=npat-1; nr2>=middleplate; --nr2) {
1396  //for (Int_t nr2=npat-1; nr2>=0; --nr2) {
1397  for (Int_t nn=0; nn<GLOBAL_gAli->GetPattern(nr2)->GetN(); ++nn) {
1398 
1399  helpsegAll = GLOBAL_gAli->GetPattern(nr2)->GetSegment(nn);
1400  helptx=helpsegAll->TX();
1401  helpty=helpsegAll->TY();
1402  helpP=helpsegAll->P();
1403  helpZ=helpsegAll->Z();
1404 
1405  if (helpsegAll->MCEvt()==helpsegArr->MCEvt() &&helpsegAll->Flag()==helpsegArr->Flag()) {
1406  //Now compare first P() and then Z():
1407  if ( GLOBAL_EvtBT_EArray[i]>helpP ) continue;
1408  if ( GLOBAL_EvtBT_ZArray[i]<helpZ ) continue;
1409  //Now update values:
1410  GLOBAL_EvtBT_EArray[i]=helpP;
1411  GLOBAL_EvtBT_ZArray[i]=helpZ;
1412  GLOBAL_EvtBT_MCArray[i]=helpsegAll->MCEvt();
1413  GLOBAL_EvtBT_TanThetaArray[i]=TMath::Sqrt(helptx*helptx+helpty*helpty);
1414  GLOBAL_EvtBT_FlagArray[i]=helpsegAll->Flag();
1415  }
1416  }
1417  }
1418  } // end of Calculate Values for the very first plate the corresponding
1419  if (gEDBDEBUGLEVEL==2) cout << endl<<flush;
1420 
1421  if (gEDBDEBUGLEVEL>3) {
1422  cout << "Comparison: GLOBAL_InBT_E GLOBAL_InBT_E "<< endl;
1423  float ttheta;
1424  for (Int_t i=0; i<GLOBAL_InBTArray->GetEntries(); ++i) {
1425  helpsegArr=(EdbSegP*)GLOBAL_InBTArray->At(i);
1426  ttheta=TMath::Sqrt(helpsegArr->TX()*helpsegArr->TX()+helpsegArr->TY()*helpsegArr->TY());
1427  cout << "i = " << i << "--------------------------------------------------"<<endl;
1428  cout << "MCEVT: " << helpsegArr->MCEvt() << " " << GLOBAL_EvtBT_MCArray[i] << endl;
1429  cout << "P: " << helpsegArr->P() << " " << GLOBAL_EvtBT_EArray[i] << endl;
1430  cout << "ttheta: " << ttheta << " " << GLOBAL_EvtBT_TanThetaArray[i] << endl;
1431  cout << "Flag: " << helpsegArr->Flag() << " " << GLOBAL_EvtBT_FlagArray[i] << endl;
1432  cout << "Z: " << helpsegArr->Z() << " " << GLOBAL_EvtBT_ZArray[i] << endl;
1433  }
1434  }
1435 
1436  return;
1437 }
TTree * tr
Definition: Shower_E_FromShowerRoot.C:5
Int_t npat
Definition: Xi2HatStartScript.C:33
EdbPVRec * GLOBAL_gAli
Definition: ShowRec.h:73
Int_t cmd_OUTPUTLEVEL
Definition: ShowRec.h:33
TTree * t
Definition: check_shower.C:4
Int_t Npatterns() const
Definition: EdbPattern.h:380
EdbPattern * GetPattern(int id) const
Definition: EdbPattern.cxx:1887
Float_t P() const
Definition: EdbSegP.h:149
void PrintNice() const
Definition: EdbSegP.cxx:418
Definition: EdbPattern.h:118
EdbSegP * s2
Definition: tlg2pattern.C:31

◆ FillOutPutStructures()

void FillOutPutStructures ( )
7683 {
7684  if (cmd_OUTPUTLEVEL==1) return;
7685 
7686  Log(2, "ShowRec.cpp", "--- void FillOutPutStructures() ---");
7687 
7688  STREAM_ShowRecEff.open(STREAM_ShowRecEffName,ios::app); // Fill Later, Open now :-)
7690 
7691  Int_t PARASETNR,INBTSHOWERNR;
7692  Double_t EvtBT_E,EvtBT_TanTheta;
7693  Int_t EvtBT_Flag,EvtBT_MC;
7694  Double_t InBT_E,InBT_TanTheta;
7695  Int_t InBT_Flag,InBT_MC;
7696  Int_t NBT,NBTMC,NBTallMC,NBTeMC;
7697  Double_t purall,pure;
7698  Double_t effall,effe;
7699  Double_t trckdens;
7700 
7701  TREE_ShowRecEff->SetBranchAddress("PARASETNR", &PARASETNR);
7702  TREE_ShowRecEff->SetBranchAddress("ShowerNr", &INBTSHOWERNR);
7703 
7704  TREE_ShowRecEff->SetBranchAddress("EvtBT_E", &EvtBT_E);
7705  TREE_ShowRecEff->SetBranchAddress("EvtBT_TanTheta", &EvtBT_TanTheta);
7706  TREE_ShowRecEff->SetBranchAddress("EvtBT_Flag", &EvtBT_Flag);
7707  TREE_ShowRecEff->SetBranchAddress("EvtBT_MC", &EvtBT_MC);
7708 
7709  TREE_ShowRecEff->SetBranchAddress("InBT_E", &InBT_E);
7710  TREE_ShowRecEff->SetBranchAddress("InBT_TanTheta", &InBT_TanTheta);
7711  TREE_ShowRecEff->SetBranchAddress("InBT_Flag", &InBT_Flag);
7712  TREE_ShowRecEff->SetBranchAddress("InBT_MC", &InBT_MC);
7713 
7714  TREE_ShowRecEff->SetBranchAddress("NBT", &NBT);
7715  TREE_ShowRecEff->SetBranchAddress("NBTMC", &NBTMC);
7716  TREE_ShowRecEff->SetBranchAddress("NBTallMC", &NBTallMC);
7717  TREE_ShowRecEff->SetBranchAddress("NBTeMC", &NBTeMC);
7718  TREE_ShowRecEff->SetBranchAddress("purall", &purall);
7719  TREE_ShowRecEff->SetBranchAddress("pure", &pure);
7720 
7721  TREE_ShowRecEff->SetBranchAddress("effall", &effall);
7722  TREE_ShowRecEff->SetBranchAddress("effe", &effe);
7723  TREE_ShowRecEff->SetBranchAddress("trckdens", &trckdens);
7724 
7725  for (int i=0; i<TREE_ShowRecEff->GetEntries(); ++i) {
7726 
7727  if (gEDBDEBUGLEVEL>3) TREE_ShowRecEff->Show(i);
7728  TREE_ShowRecEff->GetEntry(i);
7729 
7730  STREAM_ShowRecEff << setw(10) << cmd_PADI;
7731  STREAM_ShowRecEff << setw(10) << cmd_BTPA;
7732  STREAM_ShowRecEff << setw(10) << cmd_BGTP;
7733  STREAM_ShowRecEff << setw(10) << cmd_ALTP;
7734  STREAM_ShowRecEff << setw(10) << cmd_FP;
7735  STREAM_ShowRecEff << setw(10) << cmd_MP;
7736  STREAM_ShowRecEff << setw(10) << cmd_LP;
7737  STREAM_ShowRecEff << setw(10) << cmd_NP;
7738 
7739  STREAM_ShowRecEff << setw(10) << cmd_LT;
7740  STREAM_ShowRecEff << setw(10) << cmd_MC;
7741 
7742  STREAM_ShowRecEff << setw(14) << PARASETNR;
7743  STREAM_ShowRecEff << setw(14) << INBTSHOWERNR;
7744 
7745  STREAM_ShowRecEff << setw(10) << EvtBT_E;
7746  STREAM_ShowRecEff << setw(14) << EvtBT_TanTheta;
7747  STREAM_ShowRecEff << setw(14) << EvtBT_Flag;
7748  STREAM_ShowRecEff << setw(10) << EvtBT_MC;
7749 
7750  STREAM_ShowRecEff << setw(10) << InBT_E;
7751  STREAM_ShowRecEff << setw(14) << InBT_TanTheta;
7752  STREAM_ShowRecEff << setw(14) << InBT_Flag;
7753  STREAM_ShowRecEff << setw(10) << InBT_MC;
7754 
7755  STREAM_ShowRecEff << setw(10) << NBT;
7756  STREAM_ShowRecEff << setw(10) << NBTallMC;
7757  STREAM_ShowRecEff << setw(10) << NBTeMC;
7758  STREAM_ShowRecEff << setw(10) << purall;
7759  STREAM_ShowRecEff << setw(10) << pure;
7760  STREAM_ShowRecEff << setw(10) << effall;
7761  STREAM_ShowRecEff << setw(10) << effe;
7762  STREAM_ShowRecEff << setw(10) << trckdens;
7763  STREAM_ShowRecEff << endl;
7764 
7765  // ---------
7766  NBTeMC_pure->Fill(pure,NBTeMC);
7767  NBTallMC_purall->Fill(purall,NBTallMC);
7768 
7769  NBTeMC_NBTMC->Fill(NBTallMC,NBTeMC);
7770  NBTeMC_NBT->Fill(NBT,NBTeMC);
7771 
7772  NBT_InBTE->Fill(InBT_E/1000.0,NBT);
7773  NBTeMC_InBTE->Fill(InBT_E/1000.0,NBTeMC);
7774 
7775  pure_InBTE->Fill(InBT_E/1000.0,pure);
7776  purall_InBTE->Fill(InBT_E/1000.0,purall);
7777  // ---------
7778  Hist_NBTeMC_pure->Fill(pure,NBTeMC);
7779  Hist_NBTallMC_purall->Fill(purall,NBTallMC);
7780 
7781  Hist_NBTeMC_NBTMC->Fill(NBTallMC,NBTeMC);
7782  Hist_NBTeMC_NBT->Fill(NBT,NBTeMC);
7783 
7784  Hist_NBT_InBTE->Fill(InBT_E/1000.0,NBT);
7785  Hist_NBTeMC_InBTE->Fill(InBT_E/1000.0,NBTeMC);
7786 
7787  Hist_pure_InBTE->Fill(InBT_E/1000.0,pure);
7788  Hist_purall_InBTE->Fill(InBT_E/1000.0,purall);
7789 
7790  }
7791 
7792  FILE_ShowRecEff->cd();
7793  TREE_ShowRecEff->Write();
7794 
7795  FILE_ShowRecHistos->cd();
7796  TCanvas* ShowRecEffPlots= new TCanvas("ShowRecEffPlots","ShowRecEffPlots",1200,1200);
7797  ShowRecEffPlots->Divide(2,4);
7798  ShowRecEffPlots->cd(1);
7799  NBTeMC_pure->Draw();
7800  ShowRecEffPlots->cd(2);
7801  NBTallMC_purall->Draw();
7802  ShowRecEffPlots->cd(3);
7803  NBTeMC_NBTMC->Draw();
7804  ShowRecEffPlots->cd(4);
7805  NBTeMC_NBT->Draw();
7806  ShowRecEffPlots->cd(5);
7807  NBT_InBTE->Draw();
7808  ShowRecEffPlots->cd(6);
7809  NBTeMC_InBTE->Draw();
7810  ShowRecEffPlots->cd(7);
7811  pure_InBTE->Draw();
7812  ShowRecEffPlots->cd(7);
7813  purall_InBTE->Draw();
7814  TCanvas* ShowRecEffPlots2= new TCanvas("ShowRecEffPlots2","ShowRecEffPlots2",1200,1200);
7815  ShowRecEffPlots2->Divide(2,4);
7816  ShowRecEffPlots2->cd(1);
7817  Hist_NBTeMC_pure->Draw("colz");
7818  ShowRecEffPlots2->cd(2);
7819  Hist_NBTallMC_purall->Draw("colz");
7820  ShowRecEffPlots2->cd(3);
7821  Hist_NBTeMC_NBTMC->Draw("colz");
7822  ShowRecEffPlots2->cd(4);
7823  Hist_NBTeMC_NBT->Draw("colz");
7824  ShowRecEffPlots2->cd(5);
7825  Hist_NBT_InBTE->Draw("colz");
7826  ShowRecEffPlots2->cd(6);
7827  Hist_NBTeMC_InBTE->Draw("colz");
7828  ShowRecEffPlots2->cd(7);
7829  Hist_pure_InBTE->Draw("colz");
7830  ShowRecEffPlots2->cd(8);
7831  Hist_purall_InBTE->Draw("colz");
7832 
7833  NBTeMC_pure->Write();
7834  NBTallMC_purall->Write();
7835  NBTeMC_NBTMC->Write();
7836  NBTeMC_NBT->Write();
7837  NBT_InBTE->Write();
7838  NBTeMC_InBTE->Write();
7839  Hist_NBTeMC_pure->Write();
7840  Hist_NBTallMC_purall->Write();
7841  Hist_NBTeMC_NBTMC->Write();
7842  Hist_NBTeMC_NBT->Write();
7843  Hist_NBT_InBTE->Write();
7844  Hist_NBTeMC_InBTE->Write();
7845  Hist_pure_InBTE->Write();
7846  Hist_purall_InBTE->Write();
7847 
7848  ShowRecEffPlots->Write();
7849  ShowRecEffPlots2->Write();
7850  return;
7851 }
void InitCutParameters()
Definition: ShowRec.cpp:7546
ofstream STREAM_ShowRecEff
Definition: ShowRec.h:59
new TCanvas()

◆ FillShowerAxis()

void FillShowerAxis ( )
8794  {
8795  cout << "IMPLEMENTED IN ... TransferShowerObjectArrayIntoEntryOfTreebranchShowerTree ... CHECK THERE..."<<endl;
8796  return;
8797 }

◆ FindFollowingBTs()

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

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

6599 {
6600  Log(4, "ShowRec.cpp", "--- Bool_t FindFollowingBTs() ---");
6601  cout << "WARNING::WARNING Bool_t FindFollowingBTs() ... IS NOT SUPPORTED ANYMORE. RETURN kFALSE now !!!"<<endl;
6602  return kFALSE;
6603 
6604  // ATTENTION NEW CUT CONDITION ITRODUCED...
6605  // SIGMA OF DTHETA CUT IS DEPENDING AN DIFERNECE TO INBT PLATE....
6606  // CUT_dtheta=1.5,2.0,2.5*CUT_dtheta_original
6607  int diff_pid=0;
6608  Float_t CUTFACTOR=1.0;
6609  if (TMath::Abs(InBT->PID()-s->PID()) <3) CUTFACTOR=1.0;
6610  if (TMath::Abs(InBT->PID()-s->PID()) >2) CUTFACTOR=1.5;
6611  if (TMath::Abs(InBT->PID()-s->PID()) >5) CUTFACTOR=2.0;
6612  // cout << TMath::Abs(InBT->PID()-s->PID()) << " " << CUTFACTOR << endl;
6613  //NORMAL:
6614  CUTFACTOR=1.0;
6615 
6616  EdbSegP* s_TestBT;
6617  EdbSegP* seg;
6618  Int_t nentries=showersegarray->GetEntries();
6619  Double_t dZ;
6620 
6621  // For the very first Z position we do not test
6622  // if testBT has Preceeders, only if it it has a BT around (case for e+e- coming from gammma):
6623  // Take 50microns and 80mrad in (dR/dT) around.
6624  // This does not affect the normal results, but helps for
6625  // events which may have a second BT close to InBT (like in e+e-)
6626  if (s->Z()==InBT->Z()) {
6627  //cout << "Test here..."<<endl;
6628  //cout << "GetdeltaTheta(s, InBT)= " << GetdeltaTheta(s, InBT) << endl;
6629  //cout << "GetdeltaRWithPropagation(s, InBT)= " << GetdeltaRWithPropagation(s, InBT) << endl;
6630  if (GetdeltaTheta(s, InBT) < 0.08 && GetdeltaRWithPropagation(s, InBT) < 50.0) {
6631  return kTRUE;
6632  }
6633  //cout << "Test here...done. Not fullfilled condition."<<endl;
6634  }
6635 
6636 
6637  // it is true to use local_gAli since this is given over in the function head as local_gAli ...
6638  Int_t local_gAli_npat=local_gAli->Npatterns();
6639  //if (gEDBDEBUGLEVEL>2)
6640  // cout << "--- local_gAli_npat= " << local_gAli_npat << endl;
6641 
6642  // Loop over all plates of local_gAli, since this is already
6643  // extracted with the right numbers of plates...
6644  for (Int_t patterloop_cnt=local_gAli_npat-1; patterloop_cnt>=0; --patterloop_cnt) {
6645  if (gEDBDEBUGLEVEL>3) cout << "--- --- Doing patterloop_cnt= " << patterloop_cnt << endl;
6646 
6647  //cout << local_gAli->GetPattern(patterloop_cnt)->Z() << " " << InBT->Z() << endl;
6648  if (local_gAli->GetPattern(patterloop_cnt)->Z()<InBT->Z()) continue;
6649  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..
6650 
6651  for (Int_t btloop_cnt=0; btloop_cnt<local_gAli->GetPattern(patterloop_cnt)->GetN(); ++btloop_cnt) {
6652  s_TestBT = (EdbSegP*)local_gAli->GetPattern(patterloop_cnt)->GetSegment(btloop_cnt);
6653  if (gEDBDEBUGLEVEL>3) seg->PrintNice();
6654 
6655 
6656  dZ=TMath::Abs(s_TestBT->Z()-s->Z());
6658  if (dZ<0.1&&TMath::Abs(s_TestBT->X()-s->X())<1.0) continue; // Exclude the case of same Basetracks:
6659  if (dZ>(4*1300.0)+30.0) continue; // Exclude the case of more than 4 plates after...
6660 
6661 
6662  if (GetdeltaThetaSingleAngles(s, s_TestBT) > CUTFACTOR*CUT_PARAMETER[3] ) continue;
6663  if (GetdeltaRWithPropagation(s, s_TestBT) > CUT_PARAMETER[2]) continue;
6664  return kTRUE;
6665  }
6666 
6667  }
6668 
6669  //---------------------------------------------
6670  return kFALSE;
6671 }
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 nentries
Definition: check_shower.C:40
Int_t PID() const
Definition: EdbSegP.h:145

◆ FindPrecedingBTs()

Bool_t FindPrecedingBTs ( EdbSegP s,
EdbSegP InBT,
EdbPVRec gAli,
TObjArray *  showersegarray 
)
6765 {
6766  Log(4, "ShowRec.cpp", "--- Bool_t FindPrecedingBTs() ---");
6767 
6768  int diff_pid=0;
6769  Float_t CUTFACTOR=1.0;
6770  if (TMath::Abs(InBT->PID()-s->PID()) <3) CUTFACTOR=1.0;
6771  if (TMath::Abs(InBT->PID()-s->PID()) >2) CUTFACTOR=1.0;
6772  if (TMath::Abs(InBT->PID()-s->PID()) >5) CUTFACTOR=2.0;
6773 
6774  EdbSegP* s_TestBT;
6775  Int_t nentries=showersegarray->GetEntries();
6776  Double_t dZ;
6777 
6778  // Dont check the BT before the InBT position:
6779  if (s->Z()<InBT->Z()) {
6780  return kFALSE;
6781  }
6782 
6783  // For the very first Z position we do not test
6784  // if testBT has Preceeders, only if it it has a BT around (case for e+e- coming from gammma):
6785  // Take 50microns and 80mrad in (dR/dT) around.
6786  // This does not affect the normal results, but helps for
6787  // events which may have a second BT close to InBT (like in e+e-)
6788  if (s->Z()==InBT->Z()) {
6789  //cout << "Test here..."<<endl;
6790  //cout << "GetdeltaTheta(s, InBT)= " << GetdeltaTheta(s, InBT) << endl;
6791  //cout << "GetdeltaRWithPropagation(s, InBT)= " << GetdeltaRWithPropagation(s, InBT) << endl;
6792  if (GetdeltaTheta(s, InBT) < 0.08 && GetdeltaRWithPropagation(s, InBT) < 50.0) {
6793  return kTRUE;
6794  }
6795  //cout << "Test here...done. Not fullfilled condition."<<endl;
6796  }
6797 
6798  for (Int_t i=nentries-1; i>=0; --i) {
6799  s_TestBT = (EdbSegP*)( showersegarray->At(i) );
6800 
6801  if (gEDBDEBUGLEVEL>3) cout << "--- --- Do "<< s_TestBT->ID() << " " << s_TestBT->PID() << " " << s_TestBT->MCEvt() <<" " << s_TestBT->Z() << endl;
6802 
6803  dZ=TMath::Abs(s_TestBT->Z()-s->Z());
6804  if (dZ<30) continue; // Exclude the case of same Zpositions...
6805  if (dZ>(3*1300.0)+30.0) continue; // Exclude the case of more than 4 plates before...
6806 
6807  if (gEDBDEBUGLEVEL>3) cout << "--- --- Checking dT,dR and dZ for i: " << i << " " << GetdeltaTheta(s, s_TestBT) << " " << GetdeltaRWithPropagation(s, s_TestBT) << " "<<dZ << endl;
6808 
6809  if (GetdeltaTheta(s, s_TestBT) > CUTFACTOR*CUT_PARAMETER[3] ) continue;
6810  if (GetdeltaRWithPropagation(s, s_TestBT) > CUT_PARAMETER[2]) continue;
6811 
6812  if (gEDBDEBUGLEVEL>3) cout << "--- --- Checking dT,dR and dZ for i: " << i << " " << GetdeltaTheta(s, s_TestBT) << " " << GetdeltaRWithPropagation(s, s_TestBT) << " "<<dZ << " ok!"<<endl;
6813  return kTRUE;
6814  }
6815  //---------------------------------------------
6816  return kFALSE;
6817 }
Int_t ID() const
Definition: EdbSegP.h:144

◆ FindPrecedingBTs_local_gAli()

Bool_t FindPrecedingBTs_local_gAli ( EdbSegP s,
EdbSegP InBT,
EdbPVRec local_gAli,
TObjArray *  showersegarray 
)
6680 {
6681  Log(4, "ShowRec.cpp", "--- Bool_t FindPrecedingBTs_local_gAli() ---");
6682 
6683  int diff_pid=0;
6684  Float_t CUTFACTOR=1.0;
6685  if (TMath::Abs(InBT->PID()-s->PID()) <3) CUTFACTOR=1.0;
6686  if (TMath::Abs(InBT->PID()-s->PID()) >2) CUTFACTOR=1.0;
6687  if (TMath::Abs(InBT->PID()-s->PID()) >5) CUTFACTOR=2.0;
6688 
6689  EdbSegP* s_TestBT;
6690  EdbSegP* seg;
6691  Int_t nentries=showersegarray->GetEntries();
6692  Double_t dZ;
6693 
6694 
6695  // Dont check the BT before the InBT position:
6696  if (s->Z()<InBT->Z()) {
6697  return kFALSE;
6698  }
6699 
6700  // For the very first Z position we do not test
6701  // if testBT has Preceeders, only if it it has a BT around (case for e+e- coming from gammma):
6702  // Take 50microns and 80mrad in (dR/dT) around.
6703  // This does not affect the normal results, but helps for
6704  // events which may have a second BT close to InBT (like in e+e-)
6705  if (s->Z()==InBT->Z()) {
6706  //cout << "Test here..."<<endl;
6707  //cout << "GetdeltaThetaSingleAngles(s, InBT)= " << GetdeltaThetaSingleAngles(s, InBT) << endl;
6708  //cout << "GetdeltaRWithPropagation(s, InBT)= " << GetdeltaRWithPropagation(s, InBT) << endl;
6709  if (GetdeltaThetaSingleAngles(s, InBT) < 0.08 && GetdeltaRWithPropagation(s, InBT) < 50.0) {
6710  return kTRUE;
6711  }
6712  //cout << "Test here...done. Not fullfilled condition."<<endl;
6713  }
6714 
6715 
6716  // it is true to use local_gAli since this is given over in the function head as local_gAli ...
6717  Int_t local_gAli_npat=local_gAli->Npatterns();
6718  //if (gEDBDEBUGLEVEL>2)
6719  // cout << "--- local_gAli_npat= " << local_gAli_npat << endl;
6720 
6721  // Loop over all plates of local_gAli, since this is already
6722  // extracted with the right numbers of plates...
6723  for (Int_t patterloop_cnt=local_gAli_npat-1; patterloop_cnt>=0; --patterloop_cnt) {
6724  if (gEDBDEBUGLEVEL>3) cout << "--- --- Doing patterloop_cnt= " << patterloop_cnt << endl;
6725 
6726  //cout << local_gAli->GetPattern(patterloop_cnt)->Z() << " " << InBT->Z() << endl;
6727  if (local_gAli->GetPattern(patterloop_cnt)->Z()<InBT->Z()) continue;
6728  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..
6729 
6730  for (Int_t btloop_cnt=0; btloop_cnt<local_gAli->GetPattern(patterloop_cnt)->GetN(); ++btloop_cnt) {
6731  s_TestBT = (EdbSegP*)local_gAli->GetPattern(patterloop_cnt)->GetSegment(btloop_cnt);
6732  if (gEDBDEBUGLEVEL>3) seg->PrintNice();
6733 
6734 
6735  dZ=TMath::Abs(s_TestBT->Z()-s->Z());
6736 
6737  // test only BTs which have LOWER Z (so they are before)....
6738  if (s_TestBT->Z()-s->Z()>=0) continue;
6739 
6740  if (dZ<30) continue; // Exclude the case of same Zpositions...
6741  if (dZ<0.1&&TMath::Abs(s_TestBT->X()-s->X())<1.0) continue; // Exclude the case of same Basetracks:
6742 
6743  // but why not search in both directions foreward and afterward ???
6744  if (dZ>(3.0*1300.0+30.0)) continue; // Exclude the case of more than 4 plates after...
6745 
6746  if (GetdeltaThetaSingleAngles(s, s_TestBT) > CUTFACTOR*CUT_PARAMETER[3] ) continue;
6747  if (GetdeltaRWithPropagation(s, s_TestBT) > CUT_PARAMETER[2]) continue;
6748  return kTRUE;
6749  }
6750 
6751  }
6752 
6753  //---------------------------------------------
6754  return kFALSE;
6755 }

◆ FindPrecedingBTsSingleThetaAngle()

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

11.06.2010: New including case:

6826 {
6827  Log(4, "ShowRec.cpp", "--- Bool_t FindPrecedingBTsSingleThetaAngle() ---");
6828 
6829  int diff_pid=0;
6830  Float_t CUTFACTOR=1.0;
6831  if (TMath::Abs(InBT->PID()-s->PID()) <3) CUTFACTOR=1.0;
6832  if (TMath::Abs(InBT->PID()-s->PID()) >2) CUTFACTOR=1.0;
6833 
6834  EdbSegP* s_TestBT;
6835  Int_t nentries=showersegarray->GetEntries();
6836  Double_t dZ;
6837 
6838  // Dont check the BT before the InBT position:
6839  if (s->Z()<InBT->Z()) {
6840  return kFALSE;
6841  }
6842 
6843  // For the very first Z position we do not test
6844  // if testBT has Preceeders, only if it it has a BT around (case for e+e- coming from gammma):
6845  // Take 50microns and 80mrad in (dR/dT) around.
6846  // This does not affect the normal results, but helps for
6847  // events which may have a second BT close to InBT (like in e+e-)
6848  if (s->Z()==InBT->Z()) {
6849  /*
6850  cout << "Bool_t FindPrecedingBTsSingleThetaAngle(EdbSegP* s, EdbSegP* InBT, EdbPVRec *gAli, TObjArray* showersegarray)" << endl;
6851  cout << "Test here... for s ( " << s << " ) and InBT ( " << InBT << " ) :" << endl;
6852  s->PrintNice();
6853  InBT->PrintNice();
6854  cout << "GetdeltaThetaSingleAngles(s, InBT)= " << GetdeltaThetaSingleAngles(s, InBT) << endl;
6855  cout << "GetdeltaRWithPropagation(s, InBT)= " << GetdeltaRWithPropagation(s, InBT) << endl;
6856  */
6857  if (GetdeltaThetaSingleAngles(s, InBT) < 0.08 && GetdeltaRWithPropagation(s, InBT) < 50.0) {
6858  return kTRUE;
6859  }
6860  //cout << "Test here...done. Not fullfilled condition."<<endl;
6861  }
6862 
6863 
6865  Float_t nmaxholes=3.0;
6866  if (CUT_PARAMETER[4]==3) nmaxholes=3.0;
6867  if (CUT_PARAMETER[4]==5) nmaxholes=5.0;
6868  if (CUT_PARAMETER[4]==9) nmaxholes=9.0;
6869 // cout << "DEBUG CUT_PARAMETER[4] = " << CUT_PARAMETER[4] << endl;
6870 // cout << "DEBUG nmaxholes = " << nmaxholes << endl;
6871 
6872  for (Int_t i=nentries-1; i>=0; --i) {
6873  s_TestBT = (EdbSegP*)( showersegarray->At(i) );
6874 
6875  if (gEDBDEBUGLEVEL>3) cout << "--- --- Do "<< s_TestBT->ID() << " " << s_TestBT->PID() << " " << s_TestBT->MCEvt() <<" " << s_TestBT->Z() << endl;
6876 
6877  dZ=TMath::Abs(s_TestBT->Z()-s->Z());
6878  if (dZ<30) continue; // Exclude the case of same Zpositions...
6879  if (dZ>(nmaxholes*1300.0)+30.0) continue; // Exclude the case of more than 4 plates before...
6880 
6881  if (gEDBDEBUGLEVEL>3) cout << "--- --- Checking dT,dR and dZ for i: " << i << " " << GetdeltaThetaSingleAngles(s, s_TestBT) << " " << GetdeltaRWithPropagation(s, s_TestBT) << " "<<dZ << endl;
6882 
6883  if (GetdeltaThetaSingleAngles(s, s_TestBT) > CUTFACTOR*CUT_PARAMETER[3] ) continue;
6884  if (GetdeltaRWithPropagation(s, s_TestBT) > CUT_PARAMETER[2]) continue;
6885 
6886  if (gEDBDEBUGLEVEL>3) {
6887  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;
6888  s->PrintNice();
6889  s_TestBT->PrintNice();
6890  }
6891  return kTRUE;
6892  }
6893  //---------------------------------------------
6894 
6895  return kFALSE;
6896 }

◆ FindPrecedingBTsSingleThetaAngleTCDEBUG()

Bool_t FindPrecedingBTsSingleThetaAngleTCDEBUG ( EdbSegP s,
EdbSegP InBT,
EdbPVRec gAli,
TObjArray *  showersegarray 
)
6904 {
6905  Log(4, "ShowRec.cpp", "--- Bool_t FindPrecedingBTsSingleThetaAngleTCDEBUG() ---");
6906 
6907  Float_t CUTFACTOR=1.0;
6908 
6909  EdbSegP* s_TestBT;
6910  Int_t nentries=showersegarray->GetEntries();
6911  Double_t dZ;
6912 
6913  // Dont check the BT before the InBT position:
6914  if (s->Z()<InBT->Z()) {
6915  return kFALSE;
6916  }
6917 
6918 
6919 
6920  // For the very first Z position we do not test
6921  // if testBT has Preceeders, only if it it has a BT around (case for e+e- coming from gammma):
6922  // Take 50microns and 80mrad in (dR/dT) around.
6923  // This does not affect the normal results, but helps for
6924  // events which may have a second BT close to InBT (like in e+e-)
6925  if (TMath::Abs(s->Z()-InBT->Z())<5.0) {
6926  //cout << "Test here..."<<endl;
6927  //cout << "GetdeltaThetaSingleAngles(s, InBT)= " << GetdeltaThetaSingleAngles(s, InBT) << endl;
6928  //cout << "GetdeltaRWithPropagation(s, InBT)= " << GetdeltaRWithPropagation(s, InBT) << endl;
6929  if (GetdeltaThetaSingleAngles(s, InBT) < 0.08 && GetdeltaRWithPropagation(s, InBT) < 50.0) {
6930  return kTRUE;
6931  }
6932 
6933 
6934  //cout << "Test here...done. Not fullfilled condition."<<endl;
6935  }
6936 
6937 
6938  for (Int_t i=nentries-1; i>=0; --i) {
6939  s_TestBT = (EdbSegP*)( showersegarray->At(i) );
6940 
6941  // cout << "--- --- FindPrecedingBTsSingleThetaAngleTCDEBUG Do "<< s_TestBT->ID() << " " << s_TestBT->PID() << " " << s_TestBT->MCEvt() <<" " << s_TestBT->Z() << endl;
6942 
6943  dZ=TMath::Abs(s_TestBT->Z()-s->Z());
6944  if (dZ<30) continue; // Exclude the case of same Zpositions...
6945  if (dZ>(3*1300.0)+30.0) continue; // Exclude the case of more than 4 plates before...
6946 
6947  Float_t interim_dT=GetdeltaThetaSingleAngles(s, s_TestBT);
6948  Float_t interim_dRProp=GetdeltaRWithPropagation(s, s_TestBT);
6949 
6950  // cout << "--- --- FindPrecedingBTsSingleThetaAngleTCDEBUG Checking dT,dR and dZ for i: " << i << " " << interim_dT << " " << interim_dRProp << " "<<dZ << endl;
6951 
6952  if (GetdeltaThetaSingleAngles(s, s_TestBT) > CUTFACTOR*CUT_PARAMETER[3] ) continue;
6953  if (GetdeltaRWithPropagation(s, s_TestBT) > CUT_PARAMETER[2]) continue;
6954 
6955  // cout << "--- --- Checking dT,dR and dZ: ok!"<<endl;
6956  return kTRUE;
6957  }
6958  //---------------------------------------------
6959 
6960  return kFALSE;
6961 }

◆ Get_NN_ALG_MLP()

void Get_NN_ALG_MLP ( TTree *  simu,
Int_t  parasetnr 
)
5991 {
5992  if (!gROOT->GetClass("TMultiLayerPerceptron")) {
5993  gSystem->Load("libMLP");
5994  }
5995 
5996 //-----------------------------------------------------------------------------
5997 //-
5998 //-
5999 //- WE USE FOR NN_ALG and the PARAMETERSETS For it the following conventions:
6000 //-
6001 //- NCUTSteps = 20;
6002 //- MLP Structure:
6003 //-
6004 //- a) Paraset [0..20[
6005 //- first five variables.
6006 //- b) Paraset [20..40[
6007 //- first ten variables.
6008 //- c) Paraset [40..60[
6009 //- all (30) variables.
6010 //- d) ....(something else)
6011 //-
6012 //- As Trainingssample we use EXP2500 Events, Padi 199 ... 196 with b11845 BG
6013 //- additionally as BG samples b99999GENERICBG and b99998GENERICBG
6014 //- (both with no signal...)
6015 //-
6016 //-
6017 //- Take care thet the added Traingssample has about the same traingssampledata for BG and SG
6018 //-
6019 //-----------------------------------------------------------------------------
6020 
6021 // Define NN_ALG charactereistic variables:
6022  Float_t dT_InBT_To_TestBT=0;
6023  Float_t dR_InBT_To_TestBT=0;
6024  Float_t dR_TestBT_To_InBT=0;
6025  Float_t zDist_TestBT_To_InBT=0;
6026  Float_t SpatialDist_TestBT_To_InBT=0;
6027  Float_t zDiff_TestBT_To_InBT=0;
6028  Float_t dT_NextBT_To_TestBT=0;
6029  Float_t dR_NextBT_To_TestBT=0;
6030  Float_t mean_dT_2before=0;
6031  Float_t mean_dR_2before=0;
6032  Float_t mean_dT_before=0;
6033  Float_t mean_dR_before=0;
6034  Float_t mean_dT_same=0;
6035  Float_t mean_dR_same=0;
6036  Float_t mean_dT_after=0;
6037  Float_t mean_dR_after=0;
6038  Float_t mean_dT_2after=0;
6039  Float_t mean_dR_2after=0;
6040 
6041  Float_t min_dT_2before=0;
6042  Float_t min_dR_2before=0;
6043  Float_t min_dT_before=0;
6044  Float_t min_dR_before=0;
6045  Float_t min_dT_same=0;
6046  Float_t min_dR_same=0;
6047  Float_t min_dT_after=0;
6048  Float_t min_dR_after=0;
6049  Float_t min_dT_2after=0;
6050  Float_t min_dR_2after=0;
6051  Int_t nseg_1before=0;
6052  Int_t nseg_2before=0;
6053  Int_t nseg_3before=0;
6054  Int_t nseg_1after=0;
6055  Int_t nseg_2after=0;
6056  Int_t nseg_3after=0;
6057  Int_t nseg_same=0;
6058  Int_t type;
6059 
6060  TString layout="";
6061 
6062  int ann_inputneurons=CUT_PARAMETER[1];
6063 
6064  if (ann_inputneurons==5) {
6065  layout="@dT_InBT_To_TestBT,@dR_InBT_To_TestBT,@dR_TestBT_To_InBT,@zDiff_TestBT_To_InBT,@SpatialDist_TestBT_To_InBT:6:5:type";
6066  }
6067  if (ann_inputneurons==10) {
6068  layout="@dT_InBT_To_TestBT,@dR_InBT_To_TestBT,@dR_TestBT_To_InBT,@zDiff_TestBT_To_InBT,SpatialDist_TestBT_To_InBT,nseg_2before,nseg_1before,nseg_same,nseg_1after,nseg_2after:11:10:type";
6069  }
6070  if (ann_inputneurons==20) {
6071  layout="@dT_InBT_To_TestBT,@dR_InBT_To_TestBT,@dR_TestBT_To_InBT,@zDiff_TestBT_To_InBT,SpatialDist_TestBT_To_InBT,nseg_2before,nseg_1before,nseg_same,nseg_1after,nseg_2after,mean_dT_2before,mean_dT_before,mean_dT_same,mean_dT_after,mean_dT_2after,mean_dR_2before,mean_dR_before,mean_dR_same,mean_dR_after,mean_dR_2after:21:20:type";
6072  }
6073  if (ann_inputneurons==30) {
6074  layout="@dT_InBT_To_TestBT,@dR_InBT_To_TestBT,@dR_TestBT_To_InBT,@zDiff_TestBT_To_InBT,SpatialDist_TestBT_To_InBT,nseg_2before,nseg_1before,nseg_same,nseg_1after,nseg_2after,mean_dT_2before,mean_dT_before,mean_dT_same,mean_dT_after,mean_dT_2after,mean_dR_2before,mean_dR_before,mean_dR_same,mean_dR_after,mean_dR_2after,min_dT_2before,min_dT_before,min_dT_same,min_dT_after,min_dT_2after,min_dR_2before,min_dR_before,min_dR_same,min_dR_after,min_dR_2after:31:30:type";
6075  }
6076 
6077  cout << "ann_inputneurons: " << ann_inputneurons << endl;
6078  cout << "Layout of ANN: " << layout << endl;
6079 
6080 // Create the network:
6081  TMlpANN = new TMultiLayerPerceptron(layout,simu,"(Entry$)%2","(Entry$+1)%2");
6082 
6083  return;
6084 }
TMultiLayerPerceptron * TMlpANN
Definition: ShowRec.h:340
TTree * simu
Definition: testBGReduction_By_ANN.C:12
Int_t type
Definition: testBGReduction_By_ANN.C:15

◆ GetConeOrTubeDistanceToBTOfShowerArray()

Bool_t GetConeOrTubeDistanceToBTOfShowerArray ( EdbSegP sa,
EdbSegP InBT,
TObjArray *  showersegarray,
Double_t  CylinderRadius,
Double_t  ConeAngle 
)
7073 {
7074 
7075  Bool_t isTrueForBT=kFALSE;
7076  Int_t lastI=0;
7077  Double_t factor=1.0;
7078 
7079  EdbSegP* s_TestBT;
7080  Int_t nentries=showersegarray->GetEntries();
7081  //cout << "nentries=showersegarray->GetEntries(); " << nentries << endl;
7082 
7083  // Now call GetConeOrTubeDistanceToInBT for every BT which was reconstructed up to now in the shower:
7084  for (Int_t i=0; i<nentries; i++) {
7085  s_TestBT = (EdbSegP*)( showersegarray->At(i) );
7086  // Dont check the BT which is before or same Z as the BaseTrack(i) position:
7087  // But ---not--- for the first Basetrack. There we allow it!
7088  //if (s_TestBT->Z()>=sa->Z() && i>0) continue;
7089  if (s_TestBT->Z()>sa->Z() ) continue;
7090 
7091  lastI=i;
7092 
7093  if (i==0) {
7094  factor=1.0;
7095  }
7096  else {
7097  factor=3.0;
7098  }
7099 
7100 
7101  if (GetConeOrTubeDistanceToInBT(sa, s_TestBT, factor*CylinderRadius, factor*ConeAngle)==kTRUE) {
7102  isTrueForBT=kTRUE;
7103  break;
7104  }
7105 
7106  //if (i>0) cout << "GetConeOrTubeDistanceToBTOfShowerArray:: i="<<i<<endl;
7107 
7108  }
7109 
7110 
7111  if (isTrueForBT) {
7112  //if (lastI>0) cout <<"for i= " << lastI<< " return true with factor "<< factor << endl;
7113  return kTRUE;
7114  }
7115 
7116  return kFALSE;
7117 }
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

6991 {
6992  Log(4,"ShowRec.cpp", "--- Bool_t GetConeOrTubeDistanceToInBT() ---");
6993 
6994  TVector3 x1(InBT->X(),InBT->Y(),InBT->Z());
6995  TVector3 x2(sa->X(),sa->Y(),sa->Z());
6996  TVector3 direction_x1(InBT->TX()*1300,InBT->TY()*1300,1300);
6997  TVector3 direction_x2(sa->TX()*1300,sa->TY()*1300,1300);
6998  TVector3 u1=x2-x1;
6999 
7000  Double_t direction_x1_norm= direction_x1.Mag();
7001  Double_t cosangle= (direction_x1*u1)/(u1.Mag()*direction_x1_norm);
7002  Double_t angle = TMath::ACos(cosangle);
7003  // NO THIS IS NOT THE CONE ANGLE!!
7004 
7005  TVector3 direction_1(InBT->TX()*1300,InBT->TY()*1300,1300);
7006  TVector3 direction_2(sa->TX()*1300,sa->TY()*1300,1300);
7007 
7008  /*
7009  cout <<"------"<<endl;
7010  cout << "angle = " << angle << endl;
7011  cout << "angle V2 = " << x1.Angle(x2) << endl;
7012  cout << "angle V3 = " << direction_x1.Angle(direction_x2) << endl;
7013  cout << "angle V4 = " << direction_1.Angle(direction_2) << " " << direction_1.Angle(direction_2)/3.14*180.0 << endl;
7014 
7015  cout << "angle V5 direction_x1.Angle(u1 = " << direction_x1.Angle(u1) << endl;
7016  cout << "angle V5 u1.Angle(direction_x1 = " << u1.Angle(direction_x1) << endl;
7017  */
7018  angle=u1.Angle(direction_x1);
7019 
7020 
7021  // For the case where the two basetracks have same z position
7022  // the angle is about 90 degree so it makes no sense to calculate it...
7023  // therefore we set it artificially to zero:
7024  if (TMath::Abs(InBT->Z()-sa->Z())<5.0 ) {
7025  angle=0.0;
7026  //if (gEDBDEBUGLEVEL>3) //cout << "same z position, set angle artificially to zero" << endl;
7027  }
7028 
7029  // cout << "--- Bool_t GetConeOrTubeDistanceToInBT() ---"<<endl;
7030  // InBT->PrintNice();
7031  // sa->PrintNice();
7032  // cout << "angle= " << angle << " ConeAngle= " << ConeAngle << endl;
7033 
7034 
7035  // If this InBT is in z position AFTER the testBT, the cone goes in the other direction and therefore, we have
7036  // to mirror the angle by 180 degree:
7037  if (angle>TMath::Pi()/2.0) {
7038  angle=TMath::Abs(TMath::Pi()-angle);
7039  //cout << "reverse angle: " << angle << endl;
7040  }
7041 
7043  if (angle>ConeAngle) {
7044  return kFALSE;
7045  }
7046 
7048  Double_t TubeDistance = 1.0/direction_x1_norm * ( (x2-x1).Cross(direction_x1) ).Mag();
7049  // cout << "CylinderRadius= " << CylinderRadius << " TubeDistance= " << TubeDistance << endl;
7050  if (TubeDistance>CylinderRadius) {
7051  return kFALSE;
7052  }
7053 
7054  return kTRUE;
7055 }

◆ GetdeltaRNoPropagation()

Double_t GetdeltaRNoPropagation ( EdbSegP s,
EdbSegP stest 
)
7230 {
7231  Log(4, "ShowRec.cpp", "--- Bool_t GetdeltaRNoPropagation() ---");
7232  return TMath::Sqrt((s->X()-stest->X())*(s->X()-stest->X())+(s->Y()-stest->Y())*(s->Y()-stest->Y()));
7233 }

◆ GetdeltaRWithPropagation()

Double_t GetdeltaRWithPropagation ( EdbSegP s,
EdbSegP stest 
)
7212 {
7213  Log(4, "ShowRec.cpp", "--- Bool_t GetdeltaRWithPropagation() ---");
7214  // Propagate s to z-position of stest:
7215  Double_t zorig;
7216  Double_t dR;
7217  zorig=s->Z();
7218  s->PropagateTo(stest->Z());
7219  dR=(s->X()-stest->X())*(s->X()-stest->X())+(s->Y()-stest->Y())*(s->Y()-stest->Y());
7220  dR=TMath::Sqrt(dR);
7221  s->PropagateTo(zorig);
7222  return dR;
7223 }

◆ GetdeltaTheta()

Double_t GetdeltaTheta ( EdbSegP s1,
EdbSegP s2 
)
7240 {
7241  Log(4, "ShowRec.cpp", "--- Bool_t GetdeltaTheta() ---");
7242 
7243  Double_t tx1,tx2,ty1,ty2;
7244  tx1=s1->TX();
7245  tx2=s2->TX();
7246  ty1=s1->TY();
7247  ty2=s2->TY();
7248  // 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...
7249  //Double_t dt= TMath::Sqrt( (tx1-tx2)*(tx1-tx2) + (ty1-ty2)*(ty1-ty2) ); // new version to test... => implemented in GetdeltaThetaSingleAngles
7250  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()
7251  return dt;
7252 }

◆ GetdeltaThetaSingleAngles()

Double_t GetdeltaThetaSingleAngles ( EdbSegP s1,
EdbSegP s2 
)
7259 {
7260  Log(4, "ShowRec.cpp", "--- Bool_t GetdeltaThetaSingleAngles() ---");
7261 
7262  Double_t tx1,tx2,ty1,ty2;
7263  tx1=s1->TX();
7264  tx2=s2->TX();
7265  ty1=s1->TY();
7266  ty2=s2->TY();
7267  //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...
7268  Double_t dt= TMath::Sqrt( (tx1-tx2)*(tx1-tx2) + (ty1-ty2)*(ty1-ty2) ); // new version to test...
7269  return dt;
7270 }

◆ GetEvent_ParasetDefinitionTree()

void GetEvent_ParasetDefinitionTree ( Int_t  nr)
1441 {
1442  Log(2, "ShowRec.cpp", "--- void GetEvent_ParasetDefinitionTree() ---");
1443 
1444  Double_t dr_max,dt_max,coneangle,tubedist;
1445  Int_t nholes_max;
1446  Double_t ann_output;
1447  Int_t ann_inputneurons;
1448  Double_t distMin_max;
1449  Int_t tracksegs_max;
1450  Double_t distMin_dt_max;
1452  // ALTP 10: GS from libShowRec
1453  Double_t cut_gs_cut_dip=150;
1454  Double_t cut_gs_cut_dmin=40;
1455  Double_t cut_gs_cut_dr=60;
1456  Double_t cut_gs_cut_dz=19000;
1457  Double_t cut_gs_cut_dtheta=0.06;
1458  Double_t cut_gs_cut_piddiff=1;
1459  Int_t cut_gs_cut_oppositeflag=0;
1460 
1461  if (cmd_ALTP==0) {
1462  TREE_ParaSetDefinitions->SetBranchAddress("CUT_ZYLINDER_R_MAX",&tubedist);
1463  TREE_ParaSetDefinitions->SetBranchAddress("CUT_ZYLINDER_ANGLE_MAX",&coneangle);
1464  TREE_ParaSetDefinitions->SetBranchAddress("CUT_SHOWERFOLLOWERBT_DR_MAX",&dr_max);
1465  TREE_ParaSetDefinitions->SetBranchAddress("CUT_SHOWERFOLLOWERBT_DTAN_MAX",&dt_max);
1466  TREE_ParaSetDefinitions->GetEntry(nr);
1467  if (nr==-1) {
1468  TREE_ParaSetDefinitions->GetEntry(0);
1469  if (gEDBDEBUGLEVEL>2) cout << "--- Got TREE_ParaSetDefinitions->GetEntry(0) instead of -1 due to no given PARAMETERSET_DEFINITIONFILE.root file."<<endl;
1470  }
1471  for (int i=0; i<10; i++ ) {
1472  CUT_PARAMETER[i]=0.0;
1473  }
1474  TREE_ParaSetDefinitions->Show(nr);
1475  CUT_PARAMETER[0]=tubedist;
1476  CUT_PARAMETER[1]=coneangle;
1477  CUT_PARAMETER[2]=dr_max;
1478  CUT_PARAMETER[3]=dt_max;
1479  }
1480  else if (cmd_ALTP==1) {
1481  cout << "TODO"<<endl;
1482  }
1483  else if (cmd_ALTP==2) {
1484  TREE_ParaSetDefinitions->SetBranchAddress("CUT_ZYLINDER_R_MAX",&tubedist);
1485  TREE_ParaSetDefinitions->SetBranchAddress("CUT_ZYLINDER_ANGLE_MAX",&coneangle);
1486  TREE_ParaSetDefinitions->SetBranchAddress("CUT_SHOWERFOLLOWERBT_DR_MAX",&dr_max);
1487  TREE_ParaSetDefinitions->SetBranchAddress("CUT_SHOWERFOLLOWERBT_DTAN_MAX",&dt_max);
1488  TREE_ParaSetDefinitions->GetEntry(nr);
1489  if (nr==-1) {
1490  TREE_ParaSetDefinitions->GetEntry(0);
1491  if (gEDBDEBUGLEVEL>2) cout << "--- Got TREE_ParaSetDefinitions->GetEntry(0) instead of -1 due to no given PARAMETERSET_DEFINITIONFILE.root file."<<endl;
1492  }
1493  for (int i=0; i<10; i++ ) {
1494  CUT_PARAMETER[i]=0.0;
1495  }
1496  TREE_ParaSetDefinitions->Show(nr);
1497  CUT_PARAMETER[0]=tubedist;
1498  CUT_PARAMETER[1]=coneangle;
1499  CUT_PARAMETER[2]=dr_max;
1500  CUT_PARAMETER[3]=dt_max;
1501 
1502  }
1503  else if (cmd_ALTP==3) {
1504  TREE_ParaSetDefinitions->Print();
1505  TREE_ParaSetDefinitions->SetBranchAddress("CUT_ANN_OUTPUT",&ann_output);
1506  TREE_ParaSetDefinitions -> SetBranchAddress("CUT_ANN_INPUTNEURONS",&ann_inputneurons);
1507 
1508  for (int i=0; i<10; i++ ) {
1509  CUT_PARAMETER[i]=0.0;
1510  }
1511 
1512  TREE_ParaSetDefinitions->GetEntry(0);
1513  CUT_PARAMETER[0]=ann_output;
1514  CUT_PARAMETER[1]=ann_inputneurons;
1515  if (nr==-1) {
1516  TREE_ParaSetDefinitions->GetEntry(0);
1517  if (gEDBDEBUGLEVEL>2) cout << "--- Got TREE_ParaSetDefinitions->GetEntry(0) instead of -1 due to no given PARAMETERSET_DEFINITIONFILE.root file."<<endl;
1518  }
1519  cout << "TODO"<<endl;
1520  }
1521  else if (cmd_ALTP==4) {
1522  cout << "--- Got TREE_ParaSetDefinitions->GetEntry(0) cmd_ALTP==4 "<<endl;
1523  TREE_ParaSetDefinitions->SetBranchAddress("CUT_ZYLINDER_R_MAX",&tubedist);
1524  TREE_ParaSetDefinitions->SetBranchAddress("CUT_ZYLINDER_ANGLE_MAX",&coneangle);
1525  TREE_ParaSetDefinitions->SetBranchAddress("CUT_SHOWERFOLLOWERBT_DR_MAX",&dr_max);
1526  TREE_ParaSetDefinitions->SetBranchAddress("CUT_SHOWERFOLLOWERBT_DTAN_MAX",&dt_max);
1527  TREE_ParaSetDefinitions->SetBranchAddress("CUT_NHOLES_MAX",&nholes_max);
1528 
1529  TREE_ParaSetDefinitions->GetEntry(nr);
1530  if (nr==-1) {
1531  TREE_ParaSetDefinitions->GetEntry(0);
1532  if (gEDBDEBUGLEVEL>2) cout << "--- Got TREE_ParaSetDefinitions->GetEntry(0) instead of -1 due to no given PARAMETERSET_DEFINITIONFILE.root file."<<endl;
1533  }
1534  for (int i=0; i<10; i++ ) {
1535  CUT_PARAMETER[i]=0.0;
1536  }
1537  TREE_ParaSetDefinitions->Show(nr);
1538  CUT_PARAMETER[0]=tubedist;
1539  CUT_PARAMETER[1]=coneangle;
1540  CUT_PARAMETER[2]=dr_max;
1541  CUT_PARAMETER[3]=dt_max;
1542  CUT_PARAMETER[4]=nholes_max;
1543 
1544 
1545  }
1546 
1547  else if (cmd_ALTP==5) {
1548  Double_t CUT_P; // s->P()
1549  Double_t CUT_ALISUBSIZE; // eAli_local_half_size
1550  cout << "--- Got TREE_ParaSetDefinitions->GetEntry(0) cmd_ALTP==5 "<<endl;
1551  TREE_ParaSetDefinitions->SetBranchAddress("CUT_P",&CUT_P);
1552  TREE_ParaSetDefinitions->SetBranchAddress("CUT_ALISUBSIZE",&CUT_ALISUBSIZE);
1553  TREE_ParaSetDefinitions->GetEntry(nr);
1554  if (nr==-1) {
1555  TREE_ParaSetDefinitions->GetEntry(0);
1556  if (gEDBDEBUGLEVEL>2) cout << "--- Got TREE_ParaSetDefinitions->GetEntry(0) instead of -1 due to no given PARAMETERSET_DEFINITIONFILE.root file."<<endl;
1557  }
1558 
1559  for (int i=0; i<10; i++ ) {
1560  CUT_PARAMETER[i]=0.0;
1561  }
1562  TREE_ParaSetDefinitions->Show(nr);
1563  CUT_PARAMETER[0]=CUT_P;
1565 
1566  }
1567 
1568 
1569  else if (cmd_ALTP==6) {
1570  cout << "--- Got TREE_ParaSetDefinitions->GetEntry(0) cmd_ALTP==6 "<<endl;
1571  TREE_ParaSetDefinitions->SetBranchAddress("CUT_ZYLINDER_R_MAX",&tubedist);
1572  TREE_ParaSetDefinitions->SetBranchAddress("CUT_ZYLINDER_ANGLE_MAX",&coneangle);
1573  TREE_ParaSetDefinitions->SetBranchAddress("CUT_SHOWERFOLLOWERBT_DR_MAX",&dr_max);
1574  TREE_ParaSetDefinitions->SetBranchAddress("CUT_SHOWERFOLLOWERBT_DTAN_MAX",&dt_max);
1575  TREE_ParaSetDefinitions->SetBranchAddress("CUT_TRACKATTACH_DISTMIN",&distMin_max);
1576  TREE_ParaSetDefinitions->SetBranchAddress("CUT_TRACKATTACH_DTAN_MAX",&distMin_dt_max);
1577  TREE_ParaSetDefinitions->SetBranchAddress("CUT_TRACKATTACH_NTRACKSEG",&tracksegs_max);
1578  TREE_ParaSetDefinitions->GetEntry(nr);
1579  if (nr==-1) {
1580  TREE_ParaSetDefinitions->GetEntry(0);
1581  if (gEDBDEBUGLEVEL>2) cout << "--- Got TREE_ParaSetDefinitions->GetEntry(0) instead of -1 due to no given PARAMETERSET_DEFINITIONFILE.root file."<<endl;
1582  }
1583 
1584  for (int i=0; i<10; i++ ) {
1585  CUT_PARAMETER[i]=0.0;
1586  }
1587  TREE_ParaSetDefinitions->Show(nr);
1588  CUT_PARAMETER[0]=tubedist;
1589  CUT_PARAMETER[1]=coneangle;
1590  CUT_PARAMETER[2]=dr_max;
1591  CUT_PARAMETER[3]=dt_max;
1592 
1593  CUT_PARAMETER[4]=distMin_max;
1594  CUT_PARAMETER[5]=distMin_dt_max;
1595  CUT_PARAMETER[6]=tracksegs_max;
1596  }
1597 
1598 
1599  else if (cmd_ALTP==7||cmd_ALTP==9) {
1600  cout << "--- Got TREE_ParaSetDefinitions->GetEntry(0) cmd_ALTP==7 "<<endl;
1601  TREE_ParaSetDefinitions->SetBranchAddress("CUT_ZYLINDER_R_MAX",&tubedist);
1602  TREE_ParaSetDefinitions->SetBranchAddress("CUT_ZYLINDER_ANGLE_MAX",&coneangle);
1603  TREE_ParaSetDefinitions->SetBranchAddress("CUT_SHOWERFOLLOWERBT_DR_MAX",&dr_max);
1604  TREE_ParaSetDefinitions->SetBranchAddress("CUT_SHOWERFOLLOWERBT_DTAN_MAX",&dt_max);
1605  TREE_ParaSetDefinitions->GetEntry(nr);
1606  if (nr==-1) {
1607  TREE_ParaSetDefinitions->GetEntry(0);
1608  if (gEDBDEBUGLEVEL>2) cout << "--- Got TREE_ParaSetDefinitions->GetEntry(0) instead of -1 due to no given PARAMETERSET_DEFINITIONFILE.root file."<<endl;
1609  }
1610  for (int i=0; i<10; i++ ) {
1611  CUT_PARAMETER[i]=0.0;
1612  }
1613  TREE_ParaSetDefinitions->Show(nr);
1614  CUT_PARAMETER[0]=tubedist;
1615  CUT_PARAMETER[1]=coneangle;
1616  CUT_PARAMETER[2]=dr_max;
1617  CUT_PARAMETER[3]=dt_max;
1618  }
1619 
1620 
1621  else if (cmd_ALTP==8) {
1622  cout << "--- Get TREE_ParaSetDefinitions->GetEntry(0) cmd_ALTP==8 "<<endl;
1623  TREE_ParaSetDefinitions->SetBranchAddress("CUT_BACK_DMIN",&cut_back_dmin);
1624  TREE_ParaSetDefinitions->SetBranchAddress("CUT_BACK_DTHETA",&cut_back_dtheta);
1625  TREE_ParaSetDefinitions->SetBranchAddress("CUT_BACK_DR",&cut_back_dr);
1626  TREE_ParaSetDefinitions->SetBranchAddress("CUT_BACK_DZ",&cut_back_dz);
1627  TREE_ParaSetDefinitions->SetBranchAddress("CUT_FOR_DMIN",&cut_for_dmin);
1628  TREE_ParaSetDefinitions->SetBranchAddress("CUT_FOR_DTHETA",&cut_for_dtheta);
1629  TREE_ParaSetDefinitions->SetBranchAddress("CUT_FOR_DR",&cut_for_dr);
1630  TREE_ParaSetDefinitions->SetBranchAddress("CUT_FOR_DZ",&cut_for_dz);
1631  TREE_ParaSetDefinitions->GetEntry(nr);
1632  cout << TREE_ParaSetDefinitions->GetEntries() << endl;
1633  cout << "GAGA nr = " << nr << endl;
1634 
1635  if (nr==-1) {
1636  TREE_ParaSetDefinitions->GetEntry(0);
1637  if (gEDBDEBUGLEVEL>2) cout << "--- Got TREE_ParaSetDefinitions->GetEntry(0) instead of -1 due to no given PARAMETERSET_DEFINITIONFILE.root file."<<endl;
1638  }
1639  for (int i=0; i<10; i++ ) {
1640  CUT_PARAMETER[i]=0.0;
1641  }
1642  TREE_ParaSetDefinitions->Show(nr);
1651  }
1652 
1653  else if (cmd_ALTP==10) {
1654  cout << "--- Got TREE_ParaSetDefinitions->GetEntry(0) cmd_ALTP==10 "<<endl;
1661  TREE_ParaSetDefinitions -> SetBranchAddress("CUT_GS_CUT_OPPOSITEFLAG",&cut_gs_cut_oppositeflag);
1662 
1663  TREE_ParaSetDefinitions->GetEntry(nr);
1664  if (nr==-1) {
1665  TREE_ParaSetDefinitions->GetEntry(0);
1666  if (gEDBDEBUGLEVEL>2) cout << "--- Got TREE_ParaSetDefinitions->GetEntry(0) instead of -1 due to no given PARAMETERSET_DEFINITIONFILE.root file."<<endl;
1667  }
1668  for (int i=0; i<10; i++ ) {
1669  CUT_PARAMETER[i]=0.0;
1670  }
1671  TREE_ParaSetDefinitions->Show(nr);
1679  }
1680 
1681 
1682  if (gEDBDEBUGLEVEL>3) { } ;
1684  cout << "--- CUT_PARAMETER 0 1 2 3: " << CUT_PARAMETER[0] <<" "<<CUT_PARAMETER[1]<<" "<< CUT_PARAMETER[2] <<" "<< CUT_PARAMETER[3] <<endl;
1685  cout << "--- CUT_PARAMETER 4 5 6 7: " << CUT_PARAMETER[4] <<" "<<CUT_PARAMETER[5]<<" "<< CUT_PARAMETER[6]<< " "<< CUT_PARAMETER[7]<<" "<<endl;
1686 
1687 
1688  return;
1689 }
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
Double_t CUT_P
Definition: CreateParaset_SA_Alg.C:1
Double_t CUT_ALISUBSIZE
Definition: CreateParaset_SA_Alg.C:18
TTree * TREE_ParaSetDefinitions
Definition: ShowRec.h:65
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
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 
)
7384 {
7385  // cout << "GetMeansBeforeAndAfter( XX, " << patterloop_cnt << " , Seg, " << n_patterns << ", " << BeforeOrAfter << endl;
7386  mean_dT=-1;
7387  mean_dR=-1;
7388 
7389  float Z_minus1=0;
7390  float Z_normal=local_gAli->GetPattern(patterloop_cnt)->Z();
7391  float Z_plus1=0;
7392 
7393  int npat=local_gAli->Npatterns();
7394  Bool_t edge_npat_upper=kFALSE;
7395  Bool_t edge_npat_lower=kFALSE;
7396  Int_t Factor=-1;
7397 
7398  if (patterloop_cnt==npat-1) {
7399  edge_npat_upper=kTRUE;
7400  }
7401  if (patterloop_cnt==0) {
7402  edge_npat_lower=kTRUE;
7403  }
7404 
7405  if (!edge_npat_lower) {
7406  Z_minus1=local_gAli->GetPattern(patterloop_cnt-1)->Z();
7407  if (Z_minus1<Z_normal) Factor=1;
7408  }
7409  if (!edge_npat_upper) {
7410  Z_plus1 =local_gAli->GetPattern(patterloop_cnt+1)->Z();
7411  if (Z_plus1>Z_normal) Factor=1;
7412  }
7413  // New PID we want to have:
7414  Int_t patterloop_test=patterloop_cnt+Factor*n_patterns*BeforeOrAfter;
7415 
7416  // Does this plate exist? If not, return 0 directly:
7417  if (patterloop_test>=npat || patterloop_test<0) {
7418  //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;
7419  return 0;
7420  }
7421 
7422  // Since we have checked now for bounds we can FindCompliments:
7423  Int_t n_return=0;
7424  TObjArray array;
7425  array.Clear();
7426  EdbPattern* TestPattern= (EdbPattern*)local_gAli->GetPattern(patterloop_test);
7427  TestPattern -> FillCell(20,20,0.01,0.01);
7428  n_return = TestPattern->FindCompliments(*seg,array,3,3);
7429  //cout << " Found " << n_return << " compliments in 2,2 sigma area:" << endl;
7430 
7431  if (n_return==0) return n_return;
7432 
7433  //seg->PrintNice();
7434  for (int i=0; i<n_return; i++) {
7435  EdbSegP* s_of_array=(EdbSegP*)array.At(i);
7436  if (i==0) {
7437  mean_dT=0;
7438  mean_dR=0;
7439  }
7440  //s_of_array->PrintNice();
7441  mean_dT+=GetdeltaThetaSingleAngles(seg,s_of_array);
7442  mean_dR+=GetdeltaRNoPropagation(seg,s_of_array);
7443  }
7444  if (n_return>0) mean_dT=mean_dT/(Double_t)n_return;
7445  if (n_return>0) mean_dR=mean_dR/(Double_t)n_return;
7446 
7447  // cout << " mean_dT = " << mean_dT << endl;
7448  // cout << " mean_dR = " << mean_dR << endl;
7449 
7450  // „Hab ich mich aus einfachsten Verhältnissen emporgequält, um dann zu bitten?“
7451  return n_return;
7452 }
Double_t GetdeltaRNoPropagation(EdbSegP *s, EdbSegP *stest)
Definition: ShowRec.cpp:7229
Definition: EdbPattern.h:280
int FindCompliments(EdbSegP &s, TObjArray &arr, float nsig, float nsigt)
Definition: EdbPattern.cxx:1447

◆ GetMinimumDist()

Double_t GetMinimumDist ( EdbSegP seg1,
EdbSegP seg2 
)
8581  {
8582  // calculate minimum distance of 2 lines.
8583  // use the data of (the selected object)->X(), Y(), Z(), TX(), TY().
8584  // means, if the selected object == segment, use the data of the segment. or it == track, the use the fitted data.
8585  // original code from Tomoko Ariga
8586  // double calc_dmin(EdbSegP *seg1, EdbSegP *seg2, double *dminz = NULL){
8587 
8588  double x1,y1,z1,ax1,ay1;
8589  double x2,y2,z2,ax2,ay2;
8590  double s1,s2,s1bunsi,s1bunbo,s2bunsi,s2bunbo;
8591  double p1x,p1y,p1z,p2x,p2y,p2z,p1p2;
8592 
8593  if (seg1->ID()==seg2->ID()&&seg1->PID()==seg2->PID()) return 0.0;
8594 
8595  x1 = seg1->X();
8596  y1 = seg1->Y();
8597  z1 = seg1->Z();
8598  ax1= seg1->TX();
8599  ay1= seg1->TY();
8600 
8601  x2 = seg2->X();
8602  y2 = seg2->Y();
8603  z2 = seg2->Z();
8604  ax2= seg2->TX();
8605  ay2= seg2->TY();
8606 
8607 
8608  s1bunsi=(ax2*ax2+ay2*ay2+1)*(ax1*(x2-x1)+ay1*(y2-y1)+z2-z1) - (ax1*ax2+ay1*ay2+1)*(ax2*(x2-x1)+ay2*(y2-y1)+z2-z1);
8609  s1bunbo=(ax1*ax1+ay1*ay1+1)*(ax2*ax2+ay2*ay2+1) - (ax1*ax2+ay1*ay2+1)*(ax1*ax2+ay1*ay2+1);
8610  s2bunsi=(ax1*ax2+ay1*ay2+1)*(ax1*(x2-x1)+ay1*(y2-y1)+z2-z1) - (ax1*ax1+ay1*ay1+1)*(ax2*(x2-x1)+ay2*(y2-y1)+z2-z1);
8611  s2bunbo=(ax1*ax1+ay1*ay1+1)*(ax2*ax2+ay2*ay2+1) - (ax1*ax2+ay1*ay2+1)*(ax1*ax2+ay1*ay2+1);
8612  s1=s1bunsi/s1bunbo;
8613  s2=s2bunsi/s2bunbo;
8614  p1x=x1+s1*ax1;
8615  p1y=y1+s1*ay1;
8616  p1z=z1+s1*1;
8617  p2x=x2+s2*ax2;
8618  p2y=y2+s2*ay2;
8619  p2z=z2+s2*1;
8620  p1p2=sqrt( (p1x-p2x)*(p1x-p2x)+(p1y-p2y)*(p1y-p2y)+(p1z-p2z)*(p1z-p2z) );
8621 
8622 
8623  return p1p2;
8624 }

◆ 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 
)
7296 {
7297  // cout << "GetMinsBeforeAndAfter( XX, " << patterloop_cnt << " , Seg, " << n_patterns << ", " << BeforeOrAfter << endl;
7298  min_dT=-1;
7299  min_dR=-1;
7300 
7301  float Z_minus1=0;
7302  float Z_normal=local_gAli->GetPattern(patterloop_cnt)->Z();
7303  float Z_plus1=0;
7304 
7305  int npat=local_gAli->Npatterns();
7306  Bool_t edge_npat_upper=kFALSE;
7307  Bool_t edge_npat_lower=kFALSE;
7308  Int_t Factor=-1;
7309 
7310  if (patterloop_cnt==npat-1) {
7311  edge_npat_upper=kTRUE;
7312  }
7313  if (patterloop_cnt==0) {
7314  edge_npat_lower=kTRUE;
7315  }
7316 
7317  if (!edge_npat_lower) {
7318  Z_minus1=local_gAli->GetPattern(patterloop_cnt-1)->Z();
7319  if (Z_minus1<Z_normal) Factor=1;
7320  }
7321  if (!edge_npat_upper) {
7322  Z_plus1 =local_gAli->GetPattern(patterloop_cnt+1)->Z();
7323  if (Z_plus1>Z_normal) Factor=1;
7324  }
7325  // New PID we want to have:
7326  Int_t patterloop_test=patterloop_cnt+Factor*n_patterns*BeforeOrAfter;
7327 
7328  // Does this plate exist? If not, return 0 directly:
7329  if (patterloop_test>=npat || patterloop_test<0) {
7330  //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;
7331  return 0;
7332  }
7333 
7334  // Since we have checked now for bounds we can FindCompliments:
7335  Int_t n_return=0;
7336  TObjArray array;
7337  array.Clear();
7338  EdbPattern* TestPattern= (EdbPattern*)local_gAli->GetPattern(patterloop_test);
7339  TestPattern -> FillCell(20,20,0.01,0.01);
7340  n_return = TestPattern->FindCompliments(*seg,array,3,3);
7341  //cout << " Found " << n_return << " compliments in 2,2 sigma area:" << endl;
7342 
7343  if (n_return==0) return n_return;
7344 
7345  if (n_return==1) {
7346  EdbSegP* s_of_array=(EdbSegP*)array.At(0);
7347  min_dT=GetdeltaThetaSingleAngles(seg,s_of_array);
7348  min_dR=GetdeltaRNoPropagation(seg,s_of_array);
7349  }
7350 
7351 
7352  Float_t tmp_min_dT=-1;
7353  Float_t tmp_min_dR=-1;
7354  Float_t tmp2_min_dT=-1;
7355  Float_t tmp2_min_dR=-1;
7356  Float_t angle;
7357  Float_t dist;
7358 
7359  if (n_return>1) {
7360  for (int i=0; i<n_return; i++) {
7361  EdbSegP* s_of_array=(EdbSegP*)array.At(i);
7362  if (i==0) {
7363  min_dT=999999;
7364  min_dR=9999999;
7365  }
7366  angle=(Float_t)GetdeltaThetaSingleAngles(seg,s_of_array);
7367  tmp_min_dT=min_dT;
7368  tmp2_min_dT=TMath::Min(angle, tmp_min_dT);
7369  min_dT=tmp2_min_dT;
7370 
7371  dist=(Float_t)GetdeltaRNoPropagation(seg,s_of_array);
7372  tmp_min_dR=min_dR;
7373  tmp2_min_dR=TMath::Min(dist, tmp_min_dR);
7374  min_dR=tmp2_min_dR;
7375  }
7376  }
7377  return n_return;
7378 }

◆ GetNSegBeforeAndAfter()

Int_t GetNSegBeforeAndAfter ( EdbPVRec local_gAli,
Int_t  patterloop_cnt,
EdbSegP seg,
Int_t  n_patterns,
Int_t  BeforeOrAfter 
)
7463 {
7464  // cout << "GetNSegBeforeAndAfter( XX, " << patterloop_cnt << " , Seg, " << n_patterns << ", " << BeforeOrAfter << endl;
7465 
7466  float Z_minus1=0;
7467  float Z_normal=local_gAli->GetPattern(patterloop_cnt)->Z();
7468  float Z_plus1=0;
7469 
7470  int npat=local_gAli->Npatterns();
7471  Bool_t edge_npat_upper=kFALSE;
7472  Bool_t edge_npat_lower=kFALSE;
7473  Int_t Factor=-1;
7474 
7475  if (patterloop_cnt==npat-1) {
7476  edge_npat_upper=kTRUE;
7477  }
7478  if (patterloop_cnt==0) {
7479  edge_npat_lower=kTRUE;
7480  }
7481 
7482  if (!edge_npat_lower) {
7483  Z_minus1=local_gAli->GetPattern(patterloop_cnt-1)->Z();
7484  // cout << "WHAT IS GREATER? Z_normal Z_minus1 " << Z_normal << " " << Z_minus1 << endl;
7485  //Factor=(Int_t)TMath::Sign(Z_normal,Z_minus1);
7486  if (Z_minus1<Z_normal) Factor=1;
7487  }
7488  if (!edge_npat_upper) {
7489  Z_plus1 =local_gAli->GetPattern(patterloop_cnt+1)->Z();
7490  // cout << "WHAT IS GREATER? Z_normal Z_plus1 " << Z_normal << " " << Z_plus1 << endl;
7491  if (Z_plus1>Z_normal) Factor=1;
7492  }
7493 
7494  // cout << Z_minus1 << endl;
7495  // cout << Z_normal << endl;
7496  // cout << Z_plus1 << endl;
7497  // cout << "Is edge_npat_lower = " << edge_npat_lower << endl;
7498  // cout << "Is edge_npat_upper = " << edge_npat_upper << endl;
7499  // cout << "Factor = " << Factor << endl;
7500 
7501  // New PID we want to have:
7502  Int_t patterloop_test=patterloop_cnt+Factor*n_patterns*BeforeOrAfter;
7503  // cout << "So NEW n_patterns would be " << patterloop_test << endl;
7504 
7505  // Does this plate exist? If not, return 0 directly:
7506  if (patterloop_test>=npat || patterloop_test<0) {
7507  //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;
7508  return 0;
7509  }
7510 
7511  // Since we have checked now for bounds we can FindCompliments:
7512  TObjArray array;
7513  array.Clear();
7514  EdbPattern* TestPattern= (EdbPattern*)local_gAli->GetPattern(patterloop_test);
7515  TestPattern -> FillCell(20,20,0.01,0.01);
7516  int n_return = TestPattern->FindCompliments(*seg,array,3,3);
7517  //cout << " Found " << n_return << " compliments in 2,2 sigma area:" << endl;
7518 
7519  return n_return;
7520 }

◆ GetSpatialDist()

Double_t GetSpatialDist ( EdbSegP s1,
EdbSegP s2 
)
7277 {
7278  Log(4, "ShowRec.cpp", "--- Bool_t GetSpatialDist() ---");
7279  // Mainly Z values should dominate... since the are at the order of 10k microns and x,y of 1k microns
7280  Double_t x1,x2,y1,y2,z1,z2;
7281  x1=s1->X();
7282  x2=s2->X();
7283  y1=s1->Y();
7284  y2=s2->Y();
7285  z1=s1->Z();
7286  z2=s2->Z();
7287  Double_t dist= TMath::Sqrt( (x1-x2)*(x1-x2) + (y1-y2)*(y1-y2) + (z1-z2)*(z1-z2) );
7288  //cout << "dist = " << dist << endl;
7289  return dist;
7290 }

◆ InitCutParameters()

void InitCutParameters ( )
7547 {
7548  Log(2, "ShowRec.cpp", "--- void InitCutParameters() ---");
7549  // Following the convention:
7550  // -FP -LP -MP -NP
7551  // -PADI -BTPA -BGTP -ALTP
7552  // -LT -MC
7553  STREAM_ShowRecEff << setw(10) << "#PADI";
7554  STREAM_ShowRecEff << setw(10) << "BTPA";
7555  STREAM_ShowRecEff << setw(10) << "BGTP";
7556  STREAM_ShowRecEff << setw(10) << "ALTP";
7557  STREAM_ShowRecEff << setw(10) << "FP";
7558  STREAM_ShowRecEff << setw(10) << "MP";
7559  STREAM_ShowRecEff << setw(10) << "LP";
7560  STREAM_ShowRecEff << setw(10) << "NP";
7561 
7562  STREAM_ShowRecEff << setw(10) << "LT";
7563  STREAM_ShowRecEff << setw(10) << "MC";
7564 
7565  STREAM_ShowRecEff << setw(14) << "PARASETNR";
7566  STREAM_ShowRecEff << setw(14) << "INBTSHOWERNR";
7567 
7568  STREAM_ShowRecEff << setw(10) << "EvtBT_E";
7569  STREAM_ShowRecEff << setw(14) << "EvtBT_TT";
7570  STREAM_ShowRecEff << setw(14) << "EvtBT_Flag";
7571  STREAM_ShowRecEff << setw(10) << "EvtBT_MC";
7572 
7573  STREAM_ShowRecEff << setw(10) << "InBT_E";
7574  STREAM_ShowRecEff << setw(14) << "InBT_TT";
7575  STREAM_ShowRecEff << setw(14) << "InBT_Flag";
7576  STREAM_ShowRecEff << setw(10) << "InBT_MC";
7577 
7578  STREAM_ShowRecEff << setw(10) << "NBT";
7579  STREAM_ShowRecEff << setw(10) << "NBTallMC";
7580  STREAM_ShowRecEff << setw(10) << "NBTeMC";
7581  STREAM_ShowRecEff << setw(10) << "purall";
7582  STREAM_ShowRecEff << setw(10) << "pure";
7583 
7584  STREAM_ShowRecEff << setw(10) << "effall";
7585  STREAM_ShowRecEff << setw(10) << "effe";
7586  STREAM_ShowRecEff << setw(10) << "trckdens";
7587  STREAM_ShowRecEff << endl;
7588  return;
7589 }

◆ IsSameSegment()

Bool_t IsSameSegment ( EdbSegP seg1,
EdbSegP seg2 
)
8857  {
8858  if (TMath::Abs(seg1->X()-seg2->X())<0.01) {
8859  if (TMath::Abs(seg1->Y()-seg2->Y())<0.01) {
8860  if (TMath::Abs(seg1->TY()-seg2->TY())<0.01) {
8861  if (TMath::Abs(seg1->TX()-seg2->TX())<0.01) {
8862  return kTRUE;
8863  }
8864  }
8865  }
8866  }
8867  return kFALSE;
8868 }

◆ IsShowerSortedZ()

Bool_t IsShowerSortedZ ( TObjArray *  showerarray)
8801  {
8802  // Condition: z[0]<= z[1]<=....<=z[nseg]
8803  if (showerarray->GetEntries()<1) return kTRUE;
8804  EdbSegP* s0;
8805  EdbSegP* s1;
8806  for (int i=0; i<showerarray->GetEntries()-1; i++) {
8807  s0= (EdbSegP*)showerarray->At(i);
8808  s1= (EdbSegP*)showerarray->At(i+1);
8809  if (s0->Z()>s1->Z()) return kFALSE;
8810  }
8811  return kTRUE;
8812 }

◆ Load_NN_ALG_MLP_weights()

void Load_NN_ALG_MLP_weights ( TMultiLayerPerceptron *  mlp,
Int_t  parasetnr 
)
6089 {
6090  int ann_inputneurons=CUT_PARAMETER[1];
6091 
6092  if (ann_inputneurons==5) {
6093  mlp->LoadWeights("ANN_WEIGHTS_PARASET_0_To_20.txt");
6094  gSystem->Exec("ls -ltr ANN_WEIGHTS_PARASET_0_To_20.txt");
6095  }
6096  if (ann_inputneurons==10) {
6097  mlp->LoadWeights("ANN_WEIGHTS_PARASET_20_To_40.txt");
6098  }
6099  if (ann_inputneurons==20) {
6100  mlp->LoadWeights("ANN_WEIGHTS_PARASET_40_To_60.txt");
6101  }
6102  if (ann_inputneurons==30) {
6103  mlp->LoadWeights("ANN_WEIGHTS_PARASET_60_To_80.txt");
6104  }
6105 
6106  mlp->GetStructure();
6107 
6108  return;
6109 }
TMultiLayerPerceptron * mlp
Definition: testBGReduction_By_ANN.C:61

◆ main()

int main ( int  argc,
char *  argv[] 
)
13 {
14  if (argc < 2) {
15  cout << "-----------------------------------------------"<<endl;
16  cout << "--- ShowRec ---" << endl;
17  cout << "-----------------------------------------------"<<endl;
18  cout << "--- Usage: ShowRec -FP -LP -MP -NP -PADI -BTPA -BGTP -ALTP -PASTART -PAEND lnk.def ---" << endl<< endl;
19  cout << "--- \t\t : -FP FirstPlate \t (1..56..)\n";
20  cout << "--- \t\t : -LP LastPlate \t (2..57..) \n";
21  cout << "--- \t\t : -MP MiddlePlate \t (FP..LP..)\n";
22  cout << "--- \t\t : -NP NumberofPlates \t (1..56..)\n";
23  cout << "--- \t\t : -LT use LinkedTracks.root (for InBT) \t (0,1(1st track), 2(last track),3(all tracks),4(track in [fp,mp])\n";
24  cout << "--- \t\t : -MC use only MC -Events (for InBT) \t (0: all(Sim+BG), 1: only SIM, 2: all from [MP..MP]\n";
25  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";
26  cout << "--- \t\t : -FZHP use a) firstZ position, b) highest P (MC-Events) & first Z pos. (for InBT) c) highest P (for InBT)\t (0,1; only with -MC1)\n";
27  cout << "--- \t\t : -FLMC use only MC Flag \t (PdgId)\n";
28  cout << "--- \t\t : -ALI use gALI either from cp.root files (0) or from linkedtracks.root (1) or from volume root file: ScanVolume_Ali.root (2) or from volume tracks root file: ScanVolumeLinkedTracks_Ali (3)\n";
29  cout << "--- \t\t : -MIXMC Extract Subpattern with all MCEvents mixed! --!WARNING!-- \n";
30  cout << "--- \t\t : -EXTHETA Extract Subpattern with Delta Theta Cut on Initiator BT angle. \n";
31  cout << "--- \t\t : -PADI ParentDirectory (only for naming the output file)\n";
32  cout << "--- \t\t : -BTPA BasetrackParametrisation (only for naming the output file)\n";
33  cout << "--- \t\t : -BGTP BackgroundType (only for naming the output file)\n";
34  cout << "--- \t\t : -ALTP AlgorythmType \n";
35  cout << "--- \t\t\t : 0: ReconstructShowers_CT ().. \n";
36  cout << "--- \t\t\t : 1: ReconstructShowers_CL (NOT USED ANYMORE, EXPERIMENTAL)\n";
37  cout << "--- \t\t\t : 2: ReconstructShowers_CA \n";
38  cout << "--- \t\t\t : 3: ReconstructShowers_NN \n";
39  cout << "--- \t\t\t : 4: ReconstructShowers_OI \n";
40  cout << "--- \t\t\t : 5: ReconstructShowers_SA (MC Events only)\n";
41  cout << "--- \t\t\t : 6: ReconstructShowers_TC \n";
42  cout << "--- \t\t\t : 7: ReconstructShowers_RC \n";
43  cout << "--- \t\t\t : 8: ReconstructShowers_BW (EXPERIMENTAL, BEST PARAMETERS STILL TO BE SEARCHED)\n";
44  cout << "--- \t\t\t : 9: ReconstructShowers_AG (EXPERIMENTAL, BEST PARAMETERS STILL TO BE SEARCHED)\n";
45  cout << "--- \t\t\t : 10: ReconstructShowers_GS (same Implementation as in libShowRec----- BEST PARAMETERS STILL TO BE SEARCHED)\n";
46 
47  cout << "--- \t\t : -PASTART ParametersetStart \n";
48  cout << "--- \t\t : -PAEND ParameterSetEnd \n";
49  cout << "--- \t\t : -CUTTP Algorithm CutType: 0: standard, 1:high_pur 2: high_eff 3: FJ_HighPur 4: FJ_Standard \n";
50  cout << "--- \t\t : -CLEAN InputData BG Cleaning: 0: No, 1:20BT/mm2 2: 40BT/mm2 3:10BT/mm2 4:60BT/mm2 \n";
51  cout << "--- \t\t : InputData BG Cleaning: 10: Remove DoubleBT and Passing, No dens cut, 11: &&10BT/mm2 12: &&20BT/mm2 13: &&30BT/mm2 ... \n";
52  cout << "--- \t\t : -FILETP Filetype: Additional (distinguish-) variable to be written into treebranch. (only for naming the output tree)\n";
53  cout << "--- \t\t : -GBMC Global MC: addition variable to tell the program which MCEvt is doing (if only one is done).\n";
54  cout << "--- \t\t : -DEBUG gEDBDEBUGLEVEL \t (1..5)\n";
55  cout << "--- \t\t : -OUT OUTPUTLEVEL \t (1,2,3)\n";
56  cout << "--- \t\t : -STOP STOPLEVEL \t (0,1,2,3)\n";
57  cout << "--- Usage: ShowRec -FP1 -LP31 -MP1 -NP30 -FZHP1 -MC1 -ALTP4 -PASTART0 -PAEND0 lnk.def ---" << endl<< endl;
58  cout << "--- Usage: ShowRec -FP1 -LP31 -MP30 -NP30 -FZHP1 -MC1 -ALTP4 lnk_all.def ---" << endl<< endl;
59  cout << "--- Usage: ShowRec -FZHP1 -MC1 lnk_all.def ---" << endl<< endl;
60  cout << "--- Usage: ShowRec -LT1 -MC1 lnk_all.def ---" << endl<< endl;
61  cout << "-----------------------------------------------"<<endl;
62  return 0;
63  }
64 
65  //----------------------------------------------------------------------------------
67  //----------------------------------------------------------------------------------
68 
69 
70  //----------------------------------------------------------------------------------
71  //-C- Take over values from the command line:
72  //-C- wARNING !!!
73  // TWO OPTIONS ARE NOT ALLOWED TO HAVE THE SAME CHARACTER CODE, otherwise complications
74  // will appear: -MC and -MCMIX WILL NOT WORK!! use -MC and -MIXMC
75  //----------------------------------------------------------------------------------
76 
77  char *name = argv[argc];
78  for (int i=1; i<argc; i++ ) {
79  char *key = argv[i];
80 
81  if (!strncmp(key,"-FP",3)) {
82  if (strlen(key)>3) {
83  sscanf(key+3,"%d",&cmd_FP);
84  }
85  }
86  else if (!strncmp(key,"-LP",3)) {
87  if (strlen(key)>3) {
88  sscanf(key+3,"%d",&cmd_LP);
89  }
90  }
91  else if (!strncmp(key,"-NP",3)) {
92  if (strlen(key)>3) {
93  sscanf(key+3,"%d",&cmd_NP);
94  }
95  }
96  else if (!strncmp(key,"-MP",3)) {
97  if (strlen(key)>3) {
98  sscanf(key+3,"%d",&cmd_MP);
99  }
100  }
101 
102  else if (!strncmp(key,"-PADI",5)) {
103  if (strlen(key)>5) {
104  sscanf(key+5,"%d",&cmd_PADI);
105  }
106  }
107  else if (!strncmp(key,"-BTPA",5)) {
108  if (strlen(key)>5) {
109  sscanf(key+5,"%d",&cmd_BTPA);
110  }
111  }
112  else if (!strncmp(key,"-BGTP",5)) {
113  if (strlen(key)>5) {
114  sscanf(key+5,"%d",&cmd_BGTP);
115  }
116  }
117  else if (!strncmp(key,"-ALTP",5)) {
118  if (strlen(key)>5) {
119  sscanf(key+5,"%d",&cmd_ALTP);
120  }
121  }
122 
123  else if (!strncmp(key,"-PASTART",8)) {
124  if (strlen(key)>8) {
125  sscanf(key+8,"%d",&cmd_PASTART);
126  }
127  }
128  else if (!strncmp(key,"-PAEND",6)) {
129  if (strlen(key)>6) {
130  sscanf(key+6,"%d",&cmd_PAEND);
131  }
132  }
133 
134  else if (!strncmp(key,"-CUTTP",6)) {
135  if (strlen(key)>6) {
136  sscanf(key+6,"%d",&cmd_CUTTP);
137  }
138  }
139 
140  else if (!strncmp(key,"-CLEAN",6)) {
141  if (strlen(key)>6) {
142  sscanf(key+6,"%d",&cmd_CLEAN);
143  }
144  }
145 
146 
147  else if (!strncmp(key,"-LT",3)) {
148  if (strlen(key)>3) {
149  sscanf(key+3,"%d",&cmd_LT);
150  }
151  }
152  else if (!strncmp(key,"-MC",3)) {
153  if (strlen(key)>3) {
154  sscanf(key+3,"%d",&cmd_MC);
155  }
156  }
157  else if (!strncmp(key,"-FLMC",5)) {
158  if (strlen(key)>5) {
159  sscanf(key+5,"%d",&cmd_MCFL);
160  }
161  }
162  else if (!strncmp(key,"-FZHP",5)) {
163  if (strlen(key)>5) {
164  sscanf(key+5,"%d",&cmd_FZHP);
165  }
166  }
167  else if (!strncmp(key,"-ALI",4)) {
168  if (strlen(key)>4) {
169  sscanf(key+4,"%d",&cmd_ALI);
170  }
171  }
172  else if (!strncmp(key,"-MIXMC",6)) {
173  if (strlen(key)>6) {
174  sscanf(key+6,"%d",&cmd_MCMIX);
175  }
176  }
177  else if (!strncmp(key,"-EXTHETA",8)) {
178  if (strlen(key)>8) {
179  sscanf(key+8,"%d",&cmd_EXTHETA);
180  }
181  }
182  else if (!strncmp(key,"-VTX",4)) {
183  if (strlen(key)>4) {
184  sscanf(key+4,"%d",&cmd_vtx);
185  }
186  }
187 
188  else if (!strncmp(key,"-DEBUG",6)) {
189  if (strlen(key)>6) {
190  sscanf(key+6,"%d",&cmd_gEDBDEBUGLEVEL);
191  }
192  }
193  else if (!strncmp(key,"-OUT",4)) {
194  if (strlen(key)>4) {
195  sscanf(key+4,"%d",&cmd_OUTPUTLEVEL);
196  }
197  }
198  else if (!strncmp(key,"-STOP",5)) {
199  if (strlen(key)>5) {
200  sscanf(key+5,"%d",&cmd_STOPLEVEL);
201  }
202  }
203 
204  else if (!strncmp(key,"-FILETP",7)) {
205  if (strlen(key)>7) {
206  sscanf(key+7,"%d",&cmd_FILETP);
207  }
208  }
209 
210  else if (!strncmp(key,"-GBMC",5)) {
211  if (strlen(key)>5) {
212  sscanf(key+5,"%d",&cmd_GBMC);
213  }
214  }
215 
216 
217  }
219 
220  ReadDefaultValues_CommandLine(); // sorry, doesnt work, because argv and argc need
221  // to be called in the main function loop....
222  // Just used to print the values...
223  //----------------------------------------------------------------------------------
224 
225 
226 
227  //----------------------------------------------------------------------------------
229  //----------------------------------------------------------------------------------
230 
231 
232 
233  //----------------------------------------------------------------------------------
234  // Check If ParameterSet definition file is there.
238  if (cmd_STOPLEVEL==1) return 1;
239  //----------------------------------------------------------------------------------
240 
241 
242  //----------------------------------------------------------------------------------
244  //----------------------------------------------------------------------------------
245 
246 
247  //----------------------------------------------------------------------------------
248  // Read the data Objects:
250  GLOBAL_gAli->Print();
251  RewriteSegmentPIDs_BGPID_To_SGPID(GLOBAL_gAli); // I checked, this is not necessary, since PID is set new when Reading EdbVRec object.
252  // Clean the input data Objects if necessary:
253  Float_t BGTargetDensity=0;
254  // cout << "--- \t\t : -CLEAN InputData BG Cleaning: 0: No, 1:20BT/mm2 2: 40BT/mm2 3:10BT/mm2 4:60BT/mm2 \n";
255  // cout << "--- \t\t : InputData BG Cleaning: 10: Remove DoubleBT and Passing, No dens cut, 11: &&10BT/mm2 12: &&20BT/mm2 13: &&30BT/mm2 ... \n";
256  if (cmd_CLEAN==1) BGTargetDensity=20;
257  if (cmd_CLEAN==2) BGTargetDensity=40;
258  if (cmd_CLEAN==3) BGTargetDensity=10;
259  if (cmd_CLEAN==4) BGTargetDensity=60;
260  if (cmd_CLEAN==0) BGTargetDensity=1000;
261  EdbPVRQuality* PVRQualCheck;
262  EdbPVRec* new_GLOBAL_gAli;
263  EdbPVRec* newnew_GLOBAL_gAli;
264 
265  // Just density cleaning, no double or passing removal.
266  if (cmd_CLEAN!=0&&cmd_CLEAN<10) {
267  PVRQualCheck = new EdbPVRQuality(GLOBAL_gAli,BGTargetDensity);
268  new_GLOBAL_gAli = PVRQualCheck->GetEdbPVRec(1);
269  PVRQualCheck->Print();
270  GLOBAL_gAli=new_GLOBAL_gAli;
271  }
272 
273  // Density cleaning, with double and passing removal.
274  // Additional BG cleaning, depending on the last number of the number switch:
275  if (cmd_CLEAN>=10&&cmd_CLEAN<=20) {
276  cout << " THIS WILL BE THE PART WHERE REMOVE PASSING IS IMPLEMENTED !!! " << endl;
277  cout << " THIS WILL BE THE PART WHERE REMOVE DOUBLE BT IS IMPLEMENTED !!! " << endl;
278  Int_t rest=cmd_CLEAN-10;
279  Float_t BGTargetDensity=rest*10;
280  if (rest==0) BGTargetDensity=100000;
281  //cout << "BGTargetDensity " << BGTargetDensity << endl;
282  PVRQualCheck = new EdbPVRQuality(GLOBAL_gAli,BGTargetDensity);
283  new_GLOBAL_gAli = PVRQualCheck->GetEdbPVRec(1);
284  GLOBAL_gAli=new_GLOBAL_gAli;
285  GLOBAL_gAli->Print();
286  newnew_GLOBAL_gAli=PVRQualCheck->Remove_DoubleBT(GLOBAL_gAli);
287  GLOBAL_gAli=newnew_GLOBAL_gAli;
288  new_GLOBAL_gAli=PVRQualCheck->Remove_Passing(GLOBAL_gAli);
289  GLOBAL_gAli=new_GLOBAL_gAli;
290  }
291  if (cmd_STOPLEVEL==2) return 1;
292  //----------------------------------------------------------------------------------
293 
294 
295  //----------------------------------------------------------------------------------
296  // Fill the Initiator BT array:
298  BuildParametrizationsMCInfo_PGun("BRICK.TreePGunInfo.txt");
300  cout << "Fill the Initiator BT array:GLOBAL_InBTArray->GetEntries()= " << GLOBAL_InBTArray->GetEntries() << endl;
301  if (cmd_STOPLEVEL==3) return 1;
302  //----------------------------------------------------------------------------------
303 
304 
305 
306 
307 //----------------------------------------------------------------------------------
308 //- ONLY RELEVANT FOR GS Algo
309  h_GSNN_var00=new TH1F("h_GSNN_var00","h_GSNN_var00",1000,0,1000);
310  h_GSNN_var01=new TH1F("h_GSNN_var01","h_GSNN_var01",1000,0,1000);
311  h_GSNN_var02=new TH1F("h_GSNN_var02","h_GSNN_var02",1000,0,1000);
312  h_GSNN_var03=new TH1F("h_GSNN_var03","h_GSNN_var03",100,0,70000);
313  h_GSNN_var04=new TH1F("h_GSNN_var04","h_GSNN_var04",1000,0,1);
314  h_GSNN_var05=new TH1F("h_GSNN_var05","h_GSNN_var05",10,0,10);
315  h_GSNN_var06=new TH1F("h_GSNN_var06","h_GSNN_var06",1100,-1000,100);
316  f_GSNN = new TFile("f_GSNN.root","RECREATE");
317  t_GSNN= new TTree("t_GSNN","t_GSNN");
318  t_GSNN->Branch("value_GSNN_varInput",&value_GSNN_varInput,"value_GSNN_varInput/F");
319  t_GSNN->Branch("value_GSNN_var00",&value_GSNN_var00,"value_GSNN_var00/F");
320  t_GSNN->Branch("value_GSNN_var01",&value_GSNN_var01,"value_GSNN_var01/F");
321  t_GSNN->Branch("value_GSNN_var02",&value_GSNN_var02,"value_GSNN_var02/F");
322  t_GSNN->Branch("value_GSNN_var03",&value_GSNN_var03,"value_GSNN_var03/F");
323  t_GSNN->Branch("value_GSNN_var04",&value_GSNN_var04,"value_GSNN_var04/F");
324  t_GSNN->Branch("value_GSNN_var05",&value_GSNN_var05,"value_GSNN_var05/F");
325  t_GSNN->Branch("value_GSNN_var06",&value_GSNN_var06,"value_GSNN_var06/F");
326  cout << "t_GSNN SetBranchAddress done." << endl;
327 //----------------------------------------------------------------------------------
328 
329 
330  //----------------------------------------------------------------------------------
331  // Loop over (possible) Parametersets and Reconstruct Showers!
332  //----------------------------------------------------------------------------------
334  for (Int_t i=cmd_PASTART; i<=cmd_PAEND; i++) {
336  if (gEDBDEBUGLEVEL>2) cout << "Doing PARASET "<< i <<endl;
337 
339  if (gEDBDEBUGLEVEL>2) cout << "GetEvent_ParasetDefinitionTree("<<i<<") done."<<endl;
340 
342  if (gEDBDEBUGLEVEL>2) cout << "ReconstructShowers("<<i<<") done."<<endl;
343  }
344  if (cmd_STOPLEVEL==4) return 1;
345  //----------------------------------------------------------------------------------
346 
347 
348 
349 
350 
351  //----------------------------------------------------------------------------------
352  // Done with all reconstruction, fill files now:
354  //----------------------------------------------------------------------------------
355 
356 
357  f_GSNN->cd();
358  h_GSNN_var00->Write();
359  h_GSNN_var01->Write();
360  h_GSNN_var02->Write();
361  h_GSNN_var03->Write();
362  h_GSNN_var04->Write();
363  h_GSNN_var05->Write();
364  h_GSNN_var06->Write();
365  t_GSNN->Write();
366  f_GSNN->Close();
367 
368  return 0;
369 }
void FillGlobalInBTArray()
Definition: ShowRec.cpp:938
void ReadDefaultValues_CommandLine()
Definition: ShowRec.cpp:413
void FillOutPutStructures()
Definition: ShowRec.cpp:7682
Int_t Check_ParasetDefinitionFile()
Definition: ShowRec.cpp:601
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
void ReconstructShowers(Int_t nr)
Definition: ShowRec.cpp:1693
void BuildParametrizationsMCInfo_PGun(TString MCInfoFilename)
Definition: ShowRec.cpp:8904
EdbPVRec * ReadEdbPVRecObjectFromCurrentDirectory()
Definition: ShowRec.cpp:539
void Fill2GlobalInBTArray()
Definition: ShowRec.cpp:8986
void RewriteSegmentPIDs_BGPID_To_SGPID(EdbPVRec *gAli)
Definition: ShowRec.cpp:6149
void CreateOutPutStructures()
Definition: ShowRec.cpp:448
TH1F * h_GSNN_var04
Definition: ShowRec.h:415
TH1F * h_GSNN_var03
Definition: ShowRec.h:414
Float_t value_GSNN_var01
Definition: ShowRec.h:419
TFile * f_GSNN
Definition: ShowRec.h:427
Float_t value_GSNN_var02
Definition: ShowRec.h:420
Int_t cmd_CLEAN
Definition: ShowRec.h:26
Float_t value_GSNN_varInput
Definition: ShowRec.h:425
TH1F * h_GSNN_var05
Definition: ShowRec.h:416
TH1F * h_GSNN_var02
Definition: ShowRec.h:413
Int_t cmd_CUTTP
Definition: ShowRec.h:14
Float_t value_GSNN_var06
Definition: ShowRec.h:424
TH1F * h_GSNN_var06
Definition: ShowRec.h:417
Int_t cmd_FILETP
Definition: ShowRec.h:27
Float_t value_GSNN_var03
Definition: ShowRec.h:421
Int_t cmd_MCMIX
Definition: ShowRec.h:24
Int_t cmd_ALI
Definition: ShowRec.h:23
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
TTree * t_GSNN
Definition: ShowRec.h:426
Float_t value_GSNN_var04
Definition: ShowRec.h:422
Int_t cmd_STOPLEVEL
Definition: ShowRec.h:34
Int_t cmd_EXTHETA
Definition: ShowRec.h:29
Definition: EdbPVRQuality.h:38
EdbPVRec * GetEdbPVRec()
Definition: EdbPVRQuality.h:229
void Print()
Definition: EdbPVRQuality.cxx:1076
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:1853
const char * name
Definition: merge_Energy_SytematicSources_Electron.C:24

◆ MakeTracksTree()

void MakeTracksTree ( TTree *  treebranch)
8237 {
8238  if (cmd_OUTPUTLEVEL<2) return;
8239 
8240  Log(2, "ShowRec.cpp", "--- void MakeTracksTree() ---");
8241  if (gEDBDEBUGLEVEL>3) cout <<"--- --- MakeTracksTree Part 2:"<<endl;
8242 
8243  // cout << treebranch->GetName() << " treebranch->GetName(); " << endl;
8244 
8245  EdbSegP *seg;
8246  EdbTrackP *track2;
8247  EdbPVRec *ali;
8248  ali = new EdbPVRec();
8249  EdbPattern *pat=0;
8250  char fname_e[128];
8251  float x,y,tx,ty,z;
8252  int w2;
8253 
8254  for (int i=0; i<treebranch->GetEntries(); ++i) {
8255  treebranch->GetEntry(i);
8256  track2 = new EdbTrackP();
8257 
8258  for (int j=0; j<shower_sizeb; ++j) {
8259 
8260  x=shower_xb[j];
8261  y=shower_yb[j];
8262  tx=shower_txb[j];
8263  ty=shower_tyb[j];
8264  z=shower_zb[j];
8265  w2=shower_ntrace2simub[j];
8266 
8267  seg = new EdbSegP();
8268  seg->Set(j, x, y, tx, ty, w2, 0);
8269  seg->SetZ(z);
8270  seg->SetDZ(300.);
8271  // DISPLAY PROBLEM IF RIGHT PID IS USED !!!!!!!!!!!!!!
8272  pat = ali->GetPattern( seg->PID() );
8273  if (!pat) {
8274  printf("WARNING: no pattern with pid %d: creating new one!\n",seg->PID());
8275  pat = new EdbPattern( 0., 0., seg->Z() );
8276  //pat->SetID(seg->PID());
8277  ali->AddPatternAt(pat,seg->PID());
8278  ali->AddPatternAt(pat,j);
8279  }
8280  pat->AddSegment(*seg);
8281  track2->AddSegment(seg);
8282  }
8283  track2->SetSegmentsTrack(i);
8284  track2->SetID(i);
8285  track2->SetNpl(shower_nfilmb[shower_sizeb-1]);
8286  track2->SetProb(1.);
8287  track2->SetFlag(10);
8288  track2->FitTrack();
8289  ali->AddTrack(track2);
8290 
8291  // cout << "i = delete track2"<< i << endl;
8292  // delete track2;track2=0;
8293  }
8294  if (gEDBDEBUGLEVEL>3) ali->Print();
8295 
8296  // if (gEDBDEBUGLEVEL>3)
8297  // cout <<"--- --- MakeTracksTree Part 2:"<<endl;
8298 
8299  if (!ali) return;
8300  TObjArray *trarr = ali->eTracks;
8301  if (!trarr) return;
8302  float xv;
8303  xv=ali->X();
8304  float yv;
8305  yv=ali->Y();
8306 
8307  // if (gEDBDEBUGLEVEL>2)
8308  // cout <<"--- Write tracks to file: " << FILE_ShowTracks->GetName() <<endl;
8309 
8310  TString tracksname="tracks"+TString(treebranch->GetName());
8311 
8312  FILE_ShowTracks->cd();
8313  // TFile::Open(FILE_ShowTracks->GetName(),"UPDATE");
8314  TTree *tracks= new TTree(tracksname,tracksname);
8315  tracks->SetDirectory(FILE_ShowTracks);
8316  if (gEDBDEBUGLEVEL>2) cout <<"--- tracks->SetDirectory(FILE_ShowTracks)"<<endl;
8317 
8318 
8319  EdbTrackP *track = new EdbTrackP(8);
8320  EdbSegP *tr = (EdbSegP*)track;
8321  TClonesArray *segments = new TClonesArray("EdbSegP");
8322  TClonesArray *segmentsf = new TClonesArray("EdbSegP");
8323 
8324  int nseg,trid,npl,n0;
8325  float w=0.;
8326 
8327  tracks->Branch("trid",&trid,"trid/I");
8328  tracks->Branch("nseg",&nseg,"nseg/I");
8329  tracks->Branch("npl",&npl,"npl/I");
8330  tracks->Branch("n0",&n0,"n0/I");
8331  tracks->Branch("xv",&xv,"xv/F");
8332  tracks->Branch("yv",&yv,"yv/F");
8333  tracks->Branch("w",&w,"w/F");
8334  tracks->Branch("t.","EdbSegP",&tr,32000,99);
8335  tracks->Branch("s", &segments);
8336  //fitted segments is kept for linked_track.root compability
8337  tracks->Branch("sf",&segmentsf);
8338 
8339  int ntr = trarr->GetEntriesFast();
8340 
8341  if (gEDBDEBUGLEVEL>2) cout <<"--- ntr = trarr->GetEntriesFast(); " << ntr << " " << trarr->GetEntries() << endl;
8342 
8343  for (int itr=0; itr<ntr; itr++) {
8344  track = (EdbTrackP*)(trarr->At(itr));
8345  trid = track->ID();
8346  nseg = track->N();
8347  npl = track->Npl();
8348  n0 = track->N0();
8349  tr = (EdbSegP*)track;
8350  segments->Clear("C");
8351  nseg = track->N();
8352  w = track->Wgrains();
8353  EdbSegP *s=0,*sf=0;
8354  for (int is=0; is<nseg; is++) {
8355  s = track->GetSegment(is);
8356  if (s) new((*segments)[is]) EdbSegP( *s );
8357  sf = track->GetSegment(is);
8358  if (sf) new((*segmentsf)[is]) EdbSegP( *sf );
8359  }
8360  track->SetVid( 0, tracks->GetEntries() ); // put track counter in t.eVid[1]
8361  tracks->Fill();
8362  track->Clear();
8363  }
8364  tracks->Write();
8365 
8366 
8367 
8368  return;
8369 }
EdbPVRec * ali
Definition: align.C:1
TObjArray * eTracks
Definition: EdbPVRec.h:161
void AddTrack(EdbTrackP *track)
Definition: EdbPVRec.h:246
Float_t Y() const
Definition: EdbPattern.h:378
void AddPatternAt(EdbPattern *pat, int id)
Definition: EdbPattern.cxx:1873
Float_t X() const
Definition: EdbPattern.h:377
void SetProb(float prob)
Definition: EdbSegP.h:131
void SetID(int id)
Definition: EdbSegP.h:125
void SetZ(float z)
Definition: EdbSegP.h:122
void SetDZ(float dz)
Definition: EdbSegP.h:123
void SetFlag(int flag)
Definition: EdbSegP.h:127
void Set(int id, float x, float y, float tx, float ty, float w, int flag)
Definition: EdbSegP.h:86
EdbSegP * AddSegment(int i, EdbSegP &s)
Definition: EdbPattern.cxx:71
void AddSegment(EdbSegP *s)
Definition: EdbPattern.h:219
void SetNpl(int npl)
Definition: EdbPattern.h:173
int SetSegmentsTrack(int id)
Definition: EdbPattern.h:252
void FitTrack()
Definition: EdbPattern.cxx:739
Definition: bitview.h:14
TTree * tracks
Definition: check_tr.C:19

◆ Open_ParasetDefinitionFile()

Int_t Open_ParasetDefinitionFile ( )
620 {
621  Log(2, "ShowRec.cpp", "--- Int_t Open_ParasetDefinitionFile() ---");
622 
623  FILE_ParaSetDefinitions = new TFile("PARAMETERSET_DEFINITIONFILE.root","READ");
625  TREE_ParaSetDefinitions = (TTree*)FILE_ParaSetDefinitions->Get("ParaSet_Variables");
626 
628  if (gEDBDEBUGLEVEL>2) if (TREE_ParaSetDefinitions==0) cout << "WARNING: In --- Open_ParasetDefinitionFile --- Empty TREE_ParaSetDefinitions."<<endl;
629 
630  return 1;
631 }
TFile * FILE_ParaSetDefinitions
Definition: ShowRec.h:64

◆ PrintShowerObjectArray()

void PrintShowerObjectArray ( TObjArray *  segarray)
6968 {
6969  Log(3, "ShowRec.cpp", "--- Bool_t PrintShowerObjectArray() ---");
6970 
6971  if (gEDBDEBUGLEVEL>2) cout << "--- -----------------------------------------"<<endl;
6972  Int_t nent=segarray->GetEntries();
6973  if (gEDBDEBUGLEVEL>2) cout << "--- segarray->GetEntries: " << nent << endl;
6974  EdbSegP* s;
6975  if (gEDBDEBUGLEVEL>2) printf("Entry X Y Z TX TY W Chi2 MCEvt PID P Flag\n");
6976  for (int i=0; i<nent; i++) {
6977  s=(EdbSegP*)segarray->At(i);
6978  if (gEDBDEBUGLEVEL>2) printf("%8d %14.3f %14.3f %14.3f %7.4f %7.4f %7.4f %7.4f %8d %8d %6.2f %6d\n", i, s->X(), s->Y(), s->Z(), s->TX(), s->TY(),s->W(),s->Chi2(),s->MCEvt(), s->PID(), s->P(), s->Flag());
6979  }
6980  if (gEDBDEBUGLEVEL>2) cout << "--- -----------------------------------------"<<endl;
6981  Log(3, "ShowRec.cpp", "--- Bool_t PrintShowerObjectArray() done.");
6982  return;
6983 }
Float_t Chi2() const
Definition: EdbSegP.h:154
Float_t W() const
Definition: EdbSegP.h:148

◆ Read_ParasetDefinitionTree()

void Read_ParasetDefinitionTree ( )
637 {
638  Log(2, "ShowRec.cpp", "--- Int_t Read_ParasetDefinitionTree() ---");
639 
640  Double_t dr_max,dt_max,coneangle,tubedist;
641  Int_t nholes_max;
642  Double_t ann_output;
643  Int_t ann_inputneurons;
644  Double_t CUT_P;
645  Double_t CUT_ALISUBSIZE;
646  Double_t distMin_max;
647  Int_t tracksegs_max;
648  Double_t distMin_dt_max;
650 
651  // ALTP 10: GS from libShowRec
652  Double_t cut_gs_cut_dip=150;
653  Double_t cut_gs_cut_dmin=40;
654  Double_t cut_gs_cut_dr=60;
655  Double_t cut_gs_cut_dz=19000;
656  Double_t cut_gs_cut_dtheta=0.06;
657  Double_t cut_gs_cut_piddiff=1;
658  Int_t cut_gs_cut_oppositeflag=0;
659 
660  // Create on Tree if its not there and fill it with one entry:
661  if (TREE_ParaSetDefinitions==0 && (cmd_ALTP==0 || cmd_ALTP==2 || cmd_ALTP==4)) {
662  if (TREE_ParaSetDefinitions==0) cout << "WARNING: In --- Read_ParasetDefinitionTree --- Empty TREE_ParaSetDefinitions. Using only one, standard parameterset (...) ."<<endl;
663  TREE_ParaSetDefinitions = new TTree("ParaSet_Variables","ParaSet_Variables");
664  TREE_ParaSetDefinitions -> Branch("CUT_ZYLINDER_R_MAX",&tubedist,"CUT_ZYLINDER_R_MAX/D");
665  TREE_ParaSetDefinitions -> Branch("CUT_ZYLINDER_ANGLE_MAX",&coneangle,"CUT_ZYLINDER_ANGLE_MAX/D");
666  TREE_ParaSetDefinitions -> Branch("CUT_SHOWERFOLLOWERBT_DR_MAX",&dr_max,"CUT_SHOWERFOLLOWERBT_DR_MAX/D");
667  TREE_ParaSetDefinitions -> Branch("CUT_SHOWERFOLLOWERBT_DTAN_MAX",&dt_max,"CUT_SHOWERFOLLOWERBT_DTAN_MAX/D");
668  TREE_ParaSetDefinitions -> Branch("CUT_NHOLES_MAX",&nholes_max,"CUT_NHOLES_MAX/I");
669  dr_max=100.0;
670  dt_max=0.1;
671  coneangle=0.1;
672  tubedist=800.0;
673  nholes_max=3;
674 
675  if (cmd_ALTP==0||cmd_ALTP==2) {
676  if (cmd_CUTTP==2) {
677  cout << "----- cmd_CUTTP==2 -----"<<endl;
678  dr_max=100.0;
679  dt_max=0.1;
680  coneangle=0.1;
681  tubedist=800.0;
682  }
683  else if (cmd_CUTTP==1) {
684  cout << "----- cmd_CUTTP==1 -----"<<endl;
685  dr_max=100.0;
686  dt_max=0.1;
687  coneangle=0.1;
688  tubedist=800.0;
689  }
690  else {
691  cout << "----- cmd_CUTTP==else -----"<<endl;
692  dr_max=100.0;
693  dt_max=0.1;
694  coneangle=0.1;
695  tubedist=800.0; // CA ALG, cmd_ALTP==2 , CT ALG, cmd_ALTP==0
696  }
697  }
698  if (cmd_ALTP==4) {
699  if (cmd_CUTTP==4) {
700  cout << "----- cmd_CUTTP==4 : FJ_Standard -----"<<endl;
701  dr_max=150.0;
702  dt_max=0.15;
703  coneangle=0.02;
704  tubedist=800.0; // cuttype. FJ_Standard // OI ALG, cmd_ALTP==4
705  }
706  if (cmd_CUTTP==3) {
707  cout << "----- cmd_CUTTP==3 : FJ_HighPur -----"<<endl;
708  dr_max=100.0;
709  dt_max=0.05;
710  coneangle=0.025;
711  tubedist=400.0; // cuttype. FJ_HighPur // OI ALG, cmd_ALTP==4
712  }
713  else if (cmd_CUTTP==2) {
714  cout << "----- cmd_CUTTP==2 -----"<<endl;
715  dr_max=200.0;
716  dt_max=0.15;
717  coneangle=0.03;
718  tubedist=800.0; // cuttype. high eff // OI ALG, cmd_ALTP==4
719  }
720  else if (cmd_CUTTP==1) {
721  cout << "----- cmd_CUTTP==1 -----"<<endl;
722  dr_max=120.0;
723  dt_max=0.11;
724  coneangle=0.02;
725  tubedist=600.0; // cuttype. high pur // OI ALG, cmd_ALTP==4
726  }
727  else {
728  cout << "----- cmd_CUTTP==else -----"<<endl;
729  dr_max=150.0;
730  dt_max=0.15;
731  coneangle=0.02;
732  tubedist=800.0; // cuttype. FJ_Standard // OI ALG, cmd_ALTP==4
733  }
734  }
735 
736  //cout << "----------- SAME VALUES AS IN EdbShowerRec FOR tESTING... REMOVE AFTER YOURE DONE HERE!!"<<endl;
737  //if (cmd_ALTP==4) dr_max=150.0;dt_max=0.15;coneangle=0.02;tubedist=800.0; // OI ALG, cmd_ALTP==4
738 
739  // ParaSetNr CUT_ZYLINDER_R_MAX CUT_ZYLINDER_ANGLE_MAX CUT_SHOWERFOLLOWERBT_DR_MAX CUT_SHOWERFOLLOWERBT_DTAN_MAX
740  // 7001 800 0.1 100 0.1 (high NBT, middle purity)
741  // 4401 500 0.5 100 0.1 (middle NBT, high purity) (comparable to off. Recoalg.);
742 
744  if (gEDBDEBUGLEVEL>2) cout << "--- TREE_ParaSetDefinitions -> GetEntries() " << TREE_ParaSetDefinitions -> GetEntries()<<endl;
746 
747  // Reset here then also command line arguments:
748  // cmd_PASTART=0; cmd_PAEND=0;
749  // Update CUT_PARAMETER[0,1,2,3,]
750  }
751 
752  if (TREE_ParaSetDefinitions==0 && cmd_ALTP==3) {
753  TREE_ParaSetDefinitions = new TTree("ParaSet_Variables","ParaSet_Variables");
754  TREE_ParaSetDefinitions -> Branch("CUT_ANN_INPUTNEURONS",&ann_inputneurons,"CUT_ANN_INPUTNEURONS/I");
755  TREE_ParaSetDefinitions -> Branch("CUT_ANN_OUTPUT",&ann_output,"CUT_ANN_OUTPUT/D");
756  ann_output=0.85;
757  ann_inputneurons=5;
760  TREE_ParaSetDefinitions->Print();
761  }
762 
763 
764  if (TREE_ParaSetDefinitions==0 && cmd_ALTP==5) {
765  TREE_ParaSetDefinitions = new TTree("ParaSet_Variables","ParaSet_Variables");
766  TREE_ParaSetDefinitions -> Branch("CUT_P",&CUT_P,"CUT_P/D");
767  TREE_ParaSetDefinitions -> Branch("CUT_ALISUBSIZE",&CUT_ALISUBSIZE,"CUT_ALISUBSIZE/D");
768  CUT_P=0;
769  CUT_ALISUBSIZE=1000;
772  TREE_ParaSetDefinitions->Print();
773  }
774 
775  if (TREE_ParaSetDefinitions==0 && cmd_ALTP==6) {
776  TREE_ParaSetDefinitions = new TTree("ParaSet_Variables","ParaSet_Variables");
777  TREE_ParaSetDefinitions -> Branch("CUT_ZYLINDER_R_MAX",&tubedist,"CUT_ZYLINDER_R_MAX/D");
778  TREE_ParaSetDefinitions -> Branch("CUT_ZYLINDER_ANGLE_MAX",&coneangle,"CUT_ZYLINDER_ANGLE_MAX/D");
779  TREE_ParaSetDefinitions -> Branch("CUT_SHOWERFOLLOWERBT_DR_MAX",&dr_max,"CUT_SHOWERFOLLOWERBT_DR_MAX/D");
780  TREE_ParaSetDefinitions -> Branch("CUT_SHOWERFOLLOWERBT_DTAN_MAX",&dt_max,"CUT_SHOWERFOLLOWERBT_DTAN_MAX/D");
781 
782  TREE_ParaSetDefinitions -> Branch("CUT_TRACKATTACH_DISTMIN",&distMin_max,"CUT_TRACKATTACH_DISTMIN/D");
783  TREE_ParaSetDefinitions -> Branch("CUT_TRACKATTACH_DTAN_MAX",&distMin_dt_max,"CUT_TRACKATTACH_DTAN_MAX/D");
784  TREE_ParaSetDefinitions -> Branch("CUT_TRACKATTACH_NTRACKSEG",&tracksegs_max,"CUT_TRACKATTACH_NTRACKSEG/I");
785 
786  dr_max=150.0;
787  dt_max=0.13;
788  coneangle=0.025;
789  tubedist=700.0;
790  distMin_max=500;
791  tracksegs_max=1;
792  distMin_dt_max=200;
795  TREE_ParaSetDefinitions->Print();
796  }
797 
798 
799  if (TREE_ParaSetDefinitions==0 && (cmd_ALTP==7 || cmd_ALTP==9)) {
800  TREE_ParaSetDefinitions = new TTree("ParaSet_Variables","ParaSet_Variables");
801  TREE_ParaSetDefinitions -> Branch("CUT_ZYLINDER_R_MAX",&tubedist,"CUT_ZYLINDER_R_MAX/D");
802  TREE_ParaSetDefinitions -> Branch("CUT_ZYLINDER_ANGLE_MAX",&coneangle,"CUT_ZYLINDER_ANGLE_MAX/D");
803  TREE_ParaSetDefinitions -> Branch("CUT_SHOWERFOLLOWERBT_DR_MAX",&dr_max,"CUT_SHOWERFOLLOWERBT_DR_MAX/D");
804  TREE_ParaSetDefinitions -> Branch("CUT_SHOWERFOLLOWERBT_DTAN_MAX",&dt_max,"CUT_SHOWERFOLLOWERBT_DTAN_MAX/D");
805  dr_max=150.0;
806  dt_max=0.13;
807  coneangle=0.025;
808  tubedist=700.0;
811  TREE_ParaSetDefinitions->Print();
812  }
813 
814 
815  if (TREE_ParaSetDefinitions==0 && cmd_ALTP==8) {
816  TREE_ParaSetDefinitions = new TTree("ParaSet_Variables","ParaSet_Variables");
817  TREE_ParaSetDefinitions -> Branch("CUT_BACK_DMIN",&cut_back_dmin,"CUT_BACK_DMIN/D");
818  TREE_ParaSetDefinitions -> Branch("CUT_BACK_DTHETA",&cut_back_dtheta,"CUT_BACK_DTHETA/D");
819  TREE_ParaSetDefinitions -> Branch("CUT_BACK_DR",&cut_back_dr,"CUT_BACK_DR/D");
820  TREE_ParaSetDefinitions -> Branch("CUT_BACK_DZ",&cut_back_dz,"CUT_BACK_DZ/D");
821  TREE_ParaSetDefinitions -> Branch("CUT_FOR_DMIN",&cut_for_dmin,"CUT_FOR_DMIN/D");
822  TREE_ParaSetDefinitions -> Branch("CUT_FOR_DTHETA",&cut_for_dtheta,"CUT_FOR_DTHETA/D");
823  TREE_ParaSetDefinitions -> Branch("CUT_FOR_DR",&cut_for_dr,"CUT_FOR_DR/D");
824  TREE_ParaSetDefinitions -> Branch("CUT_FOR_DZ",&cut_for_dz,"CUT_FOR_DZ/D");
828  cut_back_dz=cut_for_dz=5000;
831  TREE_ParaSetDefinitions->Print();
832  }
833 
834 
835 
836  if (TREE_ParaSetDefinitions==0 && cmd_ALTP==10) {
837  TREE_ParaSetDefinitions = new TTree("ParaSet_Variables","ParaSet_Variables");
838  TREE_ParaSetDefinitions -> Branch("CUT_GS_CUT_DIP",&cut_gs_cut_dip,"CUT_GS_CUT_DIP/D");
839  TREE_ParaSetDefinitions -> Branch("CUT_GS_CUT_DMIN",&cut_gs_cut_dmin,"CUT_GS_CUT_DMIN/D");
840  TREE_ParaSetDefinitions -> Branch("CUT_GS_CUT_DR",&cut_gs_cut_dr,"CUT_GS_CUT_DR/D");
841  TREE_ParaSetDefinitions -> Branch("CUT_GS_CUT_DZ",&cut_gs_cut_dz,"CUT_GS_CUT_DZ/D");
842  TREE_ParaSetDefinitions -> Branch("CUT_GS_CUT_DTHETA",&cut_gs_cut_dtheta,"CUT_GS_CUT_DTHETA/D");
843  TREE_ParaSetDefinitions -> Branch("CUT_GS_CUT_PIDDIFF",&cut_gs_cut_piddiff,"CUT_GS_CUT_PIDDIFF/D");
844  TREE_ParaSetDefinitions -> Branch("CUT_GS_CUT_OPPOSITEFLAG",&cut_gs_cut_oppositeflag,"CUT_GS_CUT_OPPOSITEFLAG/I");
845  // PARAMETERSET_DEFINITIONFILE_LONG_GS_ALG.txt: 19642 393.212 35.5454 85.268 25062.6 0.117141 3 0
846  cut_gs_cut_dip=393;
847  cut_gs_cut_dmin=35.5;
848  cut_gs_cut_dr=85.;
849  cut_gs_cut_dz=25000;
850  cut_gs_cut_dtheta=0.11;
855  TREE_ParaSetDefinitions->Print();
856  }
857 
858 
859 
860  if (cmd_ALTP==0) {
861  TREE_ParaSetDefinitions->SetBranchAddress("CUT_ZYLINDER_R_MAX",&tubedist);
862  TREE_ParaSetDefinitions->SetBranchAddress("CUT_ZYLINDER_ANGLE_MAX",&coneangle);
863  TREE_ParaSetDefinitions->SetBranchAddress("CUT_SHOWERFOLLOWERBT_DR_MAX",&dr_max);
864  TREE_ParaSetDefinitions->SetBranchAddress("CUT_SHOWERFOLLOWERBT_DTAN_MAX",&dt_max);
865  }
866  else if (cmd_ALTP==1) {
867  cout << "TODO"<<endl;
868  }
869  else if (cmd_ALTP==2) {
870  TREE_ParaSetDefinitions->SetBranchAddress("CUT_ZYLINDER_R_MAX",&tubedist);
871  TREE_ParaSetDefinitions->SetBranchAddress("CUT_ZYLINDER_ANGLE_MAX",&coneangle);
872  TREE_ParaSetDefinitions->SetBranchAddress("CUT_SHOWERFOLLOWERBT_DR_MAX",&dr_max);
873  TREE_ParaSetDefinitions->SetBranchAddress("CUT_SHOWERFOLLOWERBT_DTAN_MAX",&dt_max);
874  }
875  else if (cmd_ALTP==4) {
876  TREE_ParaSetDefinitions->SetBranchAddress("CUT_ZYLINDER_R_MAX",&tubedist);
877  TREE_ParaSetDefinitions->SetBranchAddress("CUT_ZYLINDER_ANGLE_MAX",&coneangle);
878  TREE_ParaSetDefinitions->SetBranchAddress("CUT_SHOWERFOLLOWERBT_DR_MAX",&dr_max);
879  TREE_ParaSetDefinitions->SetBranchAddress("CUT_SHOWERFOLLOWERBT_DTAN_MAX",&dt_max);
880  TREE_ParaSetDefinitions->SetBranchAddress("CUT_NHOLES_MAX",&nholes_max);
881  }
882  else if (cmd_ALTP==5) {
883  TREE_ParaSetDefinitions->SetBranchAddress("CUT_P",&CUT_P);
884  TREE_ParaSetDefinitions->SetBranchAddress("CUT_ALISUBSIZE",&CUT_ALISUBSIZE);
885  }
886  else if (cmd_ALTP==3) {
887  TREE_ParaSetDefinitions->SetBranchAddress("CUT_ANN_OUTPUT",&ann_output);
888  TREE_ParaSetDefinitions -> SetBranchAddress("CUT_ANN_INPUTNEURONS",&ann_inputneurons);
889  }
890 
891  else if (cmd_ALTP==6) {
892  TREE_ParaSetDefinitions->SetBranchAddress("CUT_ZYLINDER_R_MAX",&tubedist);
893  TREE_ParaSetDefinitions->SetBranchAddress("CUT_ZYLINDER_ANGLE_MAX",&coneangle);
894  TREE_ParaSetDefinitions->SetBranchAddress("CUT_SHOWERFOLLOWERBT_DR_MAX",&dr_max);
895  TREE_ParaSetDefinitions->SetBranchAddress("CUT_SHOWERFOLLOWERBT_DTAN_MAX",&dt_max);
896  TREE_ParaSetDefinitions->SetBranchAddress("CUT_TRACKATTACH_DISTMIN",&distMin_max);
897  TREE_ParaSetDefinitions->SetBranchAddress("CUT_TRACKATTACH_DTAN_MAX",&distMin_dt_max);
898  TREE_ParaSetDefinitions->SetBranchAddress("CUT_TRACKATTACH_NTRACKSEG",&tracksegs_max);
899  }
900  else if (cmd_ALTP==7) {
901  TREE_ParaSetDefinitions->SetBranchAddress("CUT_ZYLINDER_R_MAX",&tubedist);
902  TREE_ParaSetDefinitions->SetBranchAddress("CUT_ZYLINDER_ANGLE_MAX",&coneangle);
903  TREE_ParaSetDefinitions->SetBranchAddress("CUT_SHOWERFOLLOWERBT_DR_MAX",&dr_max);
904  TREE_ParaSetDefinitions->SetBranchAddress("CUT_SHOWERFOLLOWERBT_DTAN_MAX",&dt_max);
905  }
906  else if (cmd_ALTP==8) {
907  TREE_ParaSetDefinitions->SetBranchAddress("CUT_BACK_DMIN",&cut_back_dmin);
908  TREE_ParaSetDefinitions->SetBranchAddress("CUT_BACK_DTHETA",&cut_back_dtheta);
909  TREE_ParaSetDefinitions->SetBranchAddress("CUT_BACK_DR",&cut_back_dr);
910  TREE_ParaSetDefinitions->SetBranchAddress("CUT_BACK_DZ",&cut_back_dz);
911  TREE_ParaSetDefinitions->SetBranchAddress("CUT_FOR_DMIN",&cut_for_dmin);
912  TREE_ParaSetDefinitions->SetBranchAddress("CUT_FOR_DTHETA",&cut_for_dtheta);
913  TREE_ParaSetDefinitions->SetBranchAddress("CUT_FOR_DR",&cut_for_dr);
914  TREE_ParaSetDefinitions->SetBranchAddress("CUT_FOR_DZ",&cut_for_dz);
915  }
916 
917  else if (cmd_ALTP==10) {
925  }
926 
927  // Check: if PASTART is given (a number), but PAEND is default, then set
928  // PAEND to PASTART
930 
931  if (gEDBDEBUGLEVEL>2) cout << "--- Updated commandline values: cmd_PASTART=" << cmd_PASTART << " and cmd_PAEND=" << cmd_PAEND << endl;
932 
933  return;
934 }
cout<< tr-> GetEntries()<< endl
ParaSet Fill()
ParaSet Branch("CUT_BACK_DMIN",&cut_back_dmin,"CUT_BACK_DMIN/D")

◆ ReadDefaultValues_CommandLine()

void ReadDefaultValues_CommandLine ( )
413  {
414 
415  cout << "-----------------------------------------------"<<endl;
416  cout << "--- \t\t : -FP FirstPlate " << cmd_FP << endl;
417  cout << "--- \t\t : -LP LastPlate " << cmd_LP << endl;
418  cout << "--- \t\t : -MP MiddlePlate " << cmd_MP << endl;
419  cout << "--- \t\t : -NP NumberofPlates " << cmd_NP << endl;
420  cout << "--- \t\t : -LT use LinkedTracks.root " << cmd_LT << endl;
421  cout << "--- \t\t : -MC use only MC Events " << cmd_MC << endl;
422  cout << "--- \t\t : -MCFL use only MC Flag " << cmd_MCFL << endl;
423  cout << "--- \t\t : -FZHP use first Z-position of Event Occurence " << cmd_FZHP << endl;
424  cout << "--- \t\t : -ALI use which Ali " << cmd_ALI << endl;
425  cout << "--- \t\t : -MCMIX use MCMIX :DANGEROUS !!! ... Be Careful! " << cmd_MCMIX << endl;
426  cout << "--- \t\t : -EXTHETA Extract Subpattern with Delta Theta Cut on Initiator BT angle " << cmd_EXTHETA << endl;
427  cout << "--- \t\t : -VTX For InBT: Cut to IP for MC vertex " << cmd_vtx << endl;
428  cout << "--- \t\t : -PADI ParentDirectory " << cmd_PADI << endl;
429  cout << "--- \t\t : -BTPA BasetrackParametrisation " << cmd_BTPA << endl;
430  cout << "--- \t\t : -BGTP BackgroundType " << cmd_BGTP << endl;
431  cout << "--- \t\t : -ALTP AlgorythmType " << cmd_ALTP << endl;
432  cout << "--- \t\t : -PASTART ParametersetStart " << cmd_PASTART << endl;
433  cout << "--- \t\t : -PAEND ParameterSetEnd " << cmd_PAEND << endl;
434  cout << "--- \t\t : -CUTTP Algo Cuttype " << cmd_CUTTP << endl;
435  cout << "--- \t\t : -CLEAN InputData BG Cleaning " << cmd_CLEAN << endl;
436  cout << "--- \t\t : -FILETP FILE Type tag " << cmd_FILETP << endl;
437  cout << "--- \t\t : -GBMC Global MC Evt type tag " << cmd_GBMC << endl;
438  cout << "--- \t\t : -DEBUG DEBUGLEVEL " << cmd_gEDBDEBUGLEVEL << endl;
439  cout << "--- \t\t : -OUT OUTPUTLEVEL " << cmd_OUTPUTLEVEL << endl;
440  cout << "--- \t\t : -STOP STOPLEVEL " << cmd_STOPLEVEL << endl;
441  cout << "-----------------------------------------------"<<endl<<endl;
442  return;
443 }

◆ ReadEdbPVRecObjectFromCurrentDirectory()

EdbPVRec* ReadEdbPVRecObjectFromCurrentDirectory ( )
540 {
541  Log(2, "ShowRec.cpp", "--- EdbPVRec* ReadEdbPVRecObjectFromCurrentDirectory() ---");
542 
543  // Create EdbPVRec on the heap:
544  EdbPVRec *gAli= new EdbPVRec();
545 
546 // cmd_ALI==0: read gAli from lnk.def Basetracks
547 // cmd_ALI==1: read gAli from linked.tracks.root
548 // cmd_ALI==2: read gAli from ScanVolume_Ali.root
549 // cmd_ALI==3: read gAli from ScanVolumeLinkedTracks_Ali.root
550 
551  if (cmd_ALI==3) {
552  Log(2, "ShowRec.cpp", "--- EdbPVRec* ReadEdbPVRecObjectFromCurrentDirectory() cmd_ALI==3: read gAli from ScanVolumeLinkedTracks_Ali.root");
553  TFile* f= new TFile("ScanVolumeLinkedTracks_Ali.root");
554  gAli= (EdbPVRec*) f->Get("EdbPVRec");
555  return gAli;
556  }
557  if (cmd_ALI==2) {
558  Log(2, "ShowRec.cpp", "--- EdbPVRec* ReadEdbPVRecObjectFromCurrentDirectory() cmd_ALI==2: read gAli from ScanVolume_Ali.root");
559  TFile* f= new TFile("ScanVolume_Ali.root");
560  f->ls();
561  gAli= (EdbPVRec*) f->Get("EdbPVRec");
562  return gAli;
563  }
564 
565  //-----------------------------------
566  // current dir has to contain:
567  // default.par, lnk_all.lst, lnk_all.def
568  // data, par directory
569  //-----------------------------------
570  // DECLARE MAIN OBJECTS
571  EdbDataProc *dset;
572  // Data set initialization
573  dset = new EdbDataProc("lnk_all.def");
574  // Volume initialization
575  // The differentiation LT or not is made when Filling the array
576  // new: (4.2.2010) can distinguish between gAli from cp.root or from linked tracks
577 
578  if (cmd_ALI==1) {
579  Log(2, "ShowRec.cpp", "--- EdbPVRec* ReadEdbPVRecObjectFromCurrentDirectory() cmd_ALI==1: read gAli from linked.tracks.root");
580  dset->InitVolume(100, ""); // Read in (all) BT from linked_tracks.root
581  }
582  if (cmd_ALI==0) {
583  Log(2, "ShowRec.cpp", "--- EdbPVRec* ReadEdbPVRecObjectFromCurrentDirectory() cmd_ALI==0: read gAli from lnk.def Basetracks");
584 
585  dset->InitVolume(0, ""); // Read in (all) BT from cp.root.
586  }
587 
588  // Create EdbPVRec on the heap:
589 // EdbPVRec *gAli= new EdbPVRec();
590  // Get Pattern Volume Reconstruction object
591  gAli = dset->PVR();
592  //-------------------------------------
593  if (gEDBDEBUGLEVEL>3) gAli->Print();
594  //-------------------------------------
595  return gAli;
596 }
EdbDataProc * dset
Definition: RecDispEX.C:9
FILE * f
Definition: RecDispMC.C:150
Definition: EdbDataSet.h:180
EdbPVRec * PVR() const
Definition: EdbDataSet.h:197
int InitVolume(int datatype=0, const char *rcut="1")
Definition: EdbDataSet.cxx:2071
EdbPVRec gAli
Definition: emvertex.cpp:20

◆ Reco_CL_AssignZValueToGroup()

Int_t Reco_CL_AssignZValueToGroup ( Double_t  z,
Double_t  z0,
Int_t  NGroupedPLATES,
Int_t  PLATESPerGroup 
)
1861 {
1862  // z: Position of BT to be checked,
1863  // z0: ZStart if for example FIRSTPLATE z=3900 (PLATE 4) instead of 0
1864  Int_t actplate=(Int_t)(z-z0)/1300+1;
1865  Int_t actgroup=(actplate-1)/PLATESPerGroup;
1866  // cout << "z z0 actplate "<< z << " " << z0 << " " <<actplate << endl;
1867  // cout << "actplate actgroup "<< actplate << " " << actgroup << endl;
1868  //This Assignment seems ok.
1869  return actgroup;
1870 }
brick z0
Definition: RecDispMC.C:106

◆ Reco_CL_BuildGlobalHistogramsOnHeap()

void Reco_CL_BuildGlobalHistogramsOnHeap ( )
1873 {
1874  TString HistoNameTitle="XXX";
1875  for (Int_t h=0; h<50; h++) {
1876  // cout << "Creating Hist2DimOnlyBG_Groupe_ " << h << endl;
1877  HistoNameTitle=TString(Form("Hist2DimOnlyBG_Groupe_%d",h));
1878  Hist2DimOnlyBGOneGroupedPlate[h]=new TH2F(HistoNameTitle,HistoNameTitle,10,0,1,10,0,1);
1879  // cout << "Creating Hist2DimOnlySimOneEvent_Groupe_ " << h << endl;
1880  HistoNameTitle=TString(Form("Hist2DimOnlySimOneEvent_Groupe_%d",h));
1881  Hist2DimOnlySimOneEventOneGroupedPlate[h]=new TH2F(HistoNameTitle,HistoNameTitle,10,0,1,10,0,1);
1882  // cout << "Creating Hist2DimBGAndSimOneEvent_Groupe_ " << h << endl;
1883  HistoNameTitle=TString(Form("Hist2DimBGAndSimOneEvent_Groupe_%d",h));
1884  Hist2DimBGAndSimOneEventOneGroupedPlate[h]=new TH2F(HistoNameTitle,HistoNameTitle,10,0,1,10,0,1);
1885  }
1886  return;
1887 }
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);

1694 {
1695  Log(2, "ShowRec.cpp", "--- void ReconstructShowers() ---");
1696 
1697 
1698  //-----------------------------------
1699  // Create the ShowerOutputtree:
1701  //-----------------------------------
1702 
1703 
1704  //-----------------------------------
1705  // Call main Reconstruction function:
1706  //-----------------------------------
1707  if (cmd_ALTP==0) {
1708  cout << "ReconstructShowers:: cmd_ALTP==0 ReconstructShowers_CT() IS NOW THE SAME AS CA ALG! "<< endl;
1709  cout << "ReconstructShowers:: cmd_ALTP==0 ReconstructShowers_CTA() Reconstruction of ParameterSet: "<< nr <<endl;
1711  }
1712  else if (cmd_ALTP==1) {
1713  cout << "TODO... CL ...."<<endl;
1715  }
1716  else if (cmd_ALTP==2) {
1717  cout << "ReconstructShowers:: cmd_ALTP==2 ReconstructShowers_CA() Reconstruction of ParameterSet: "<< nr <<endl;
1719  }
1720  else if (cmd_ALTP==3) {
1721  cout << "ReconstructShowers:: cmd_ALTP==3 ReconstructShowers_NN() Reconstruction of ParameterSet: "<< nr <<endl;
1723  }
1724  else if (cmd_ALTP==4) {
1725  cout << "ReconstructShowers:: cmd_ALTP==4 ReconstructShowers_OI() Reconstruction of ParameterSet: "<< nr <<endl;
1727  }
1728  else if (cmd_ALTP==5) {
1729  cout << "ReconstructShowers:: cmd_ALTP==5 ReconstructShowers_SA() Reconstruction of ParameterSet: "<< nr <<endl;
1731  }
1732  else if (cmd_ALTP==6) {
1733  cout << "ReconstructShowers:: cmd_ALTP==6 ReconstructShowers_TC() Reconstruction of ParameterSet: "<< nr <<endl;
1735  }
1736  else if (cmd_ALTP==7) {
1737  cout << "ReconstructShowers:: cmd_ALTP==7 ReconstructShowers_RC() Reconstruction of ParameterSet: "<< nr <<endl;
1739  }
1740  else if (cmd_ALTP==8) {
1741  cout << "ReconstructShowers:: cmd_ALTP==8 ReconstructShowers_BW() Reconstruction of ParameterSet: "<< nr <<endl;
1743  }
1744  else if (cmd_ALTP==9) {
1745  cout << "ReconstructShowers:: cmd_ALTP==9 ReconstructShowers_AG() Reconstruction of ParameterSet: "<< nr <<endl;
1747  }
1748  else if (cmd_ALTP==10) {
1749  cout << "ReconstructShowers:: cmd_ALTP==10 ReconstructShowers_GS() Reconstruction of ParameterSet: "<< nr <<endl;
1751  }
1752 
1753  else if (cmd_ALTP==999) {
1754  cout << "ReconstructShowers:: cmd_ALTP==9999 OpenMP TEST!!!!!"<<endl;
1756  }
1757  //-----------------------------------
1758 
1759 
1760  //-----------------------------------
1761  if (TREE_ShowShower->GetEntries()<1) {
1762  cout << "//-----------------------------------------------------------------------------//"<<endl;
1763  cout << " Hey Guy, I am so sorry, but NO , I repeat NO shower has been reconstructed!"<< endl;
1764  cout << "//-----------------------------------------------------------------------------//"<<endl;
1765  }
1766  cout << "TREE_ShowShower->GetEntries() = " << TREE_ShowShower->GetEntries()<< endl;
1767  //-----------------------------------
1768 
1769  //-----------------------------------
1770  // MakeShowerTree:
1771  // Writing showers in treebranch style
1772  // as done by FJ algorithm.
1773  //-----------------------------------
1774  FILE_ShowShower->cd();
1775  TREE_ShowShower->Write("",TObject::kOverwrite);
1776  //-----------------------------------
1777 
1778 
1779  //-----------------------------------
1780  // MakeTracksTree:
1781  // Writing showers in tracks style
1782  // copied almost verbatim from GL.
1783  //-----------------------------------
1785  cout << "Make Tracks Tree commented out!!!"<< endl;
1786  //-----------------------------------
1787 
1788 
1789  //-----------------------------------
1790  // Delete the ShowerOutputtree:
1791  delete TREE_ShowShower;
1792  TREE_ShowShower=0;
1793  //-----------------------------------
1794 
1795 
1796  return;
1797 }
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

◆ ReconstructShowers_AG()

void ReconstructShowers_AG ( )
5146 {
5147  Log(2, "ShowRec.cpp", "--- void ReconstructShowers_AG() ---");
5148 
5149  //-----------------------------------------------------------------
5150  // Main function for reconstruction of "Advanced Gamma" Algorithm
5151  //-----------------------------------------------------------------
5152 
5153  //-----------------------------------
5154  // For each InitiatorBT this is
5155  // divided in several small parts:
5156  //
5157  // 1) Make local_gAli with cut parameters, Make GetPID of InBT and corresponding of plates
5158  // 3) Loop over (whole) local_gAli, check BT for Cuts
5159  // 4) Calculate pur/eff/NBT numbers
5160  // 5) Fill Trees
5161  //-----------------------------------
5162 
5163  // Define Helper Variables:
5164  EdbPVRec* local_gAli;
5165  EdbSegP* InBT;
5166  EdbSegP* seg;
5167  Float_t local_gAli_pat_interim_halfsize=0;
5168 
5171 
5172  //-----------------------------------------------------------------
5173  // Since GLOBAL_InBTArray is filled in ascending ordering by zpositon
5174  // We use the descending loop to begin with BT with lowest z first.
5175  for (Int_t i=GLOBAL_InBTArrayEntries-1; i>=0; --i) {
5176 
5177  //-----------------------------------
5178  // CounterOutPut
5179  if (gEDBDEBUGLEVEL==2) if ((i%1)==0) cout << GLOBAL_InBTArrayEntries <<" InBT in total, still to do:"<<Form("%4d",i)<< "\r\r\r\r"<<flush;
5180  //-----------------------------------
5181 
5182  //-----------------------------------
5183  // Get InitiatorBT from GLOBAL_InBTArray
5184  InBT=(EdbSegP*)GLOBAL_InBTArray->At(i);
5185  //--------
5186  GLOBAL_InBT_E=InBT->P();
5187  GLOBAL_InBT_TanTheta=TMath::Sqrt(InBT->TX()*InBT->TX()+InBT->TY()*InBT->TY());
5188  GLOBAL_InBT_Flag=InBT->Flag();
5189  GLOBAL_InBT_MC=InBT->MCEvt();
5190  //--------
5191  Int_t local_NBT=0;
5192  Int_t local_NBTMC=0;
5193  Int_t local_NBTallMC=0;
5194  Int_t local_NBTeMC=0;
5195  float_t local_pure=-1;
5196  float_t local_purall=-1;
5197  Int_t npat_int=0;
5198  Int_t npat_total=0;
5199  Int_t npatN=0;
5200  Int_t npat_Neff=0;
5201  Int_t NBT_Neff=0;
5202  Int_t NBTMC_Neff=0;
5203  Int_t NBTMCe_Neff=0;
5204  //--------
5205 
5206  if (gEDBDEBUGLEVEL>2) {
5207  cout << endl << endl << "--- Starting Shower for Number " << i << " now: "<<endl;
5208  InBT->PrintNice();
5209  }
5210  //-----------------------------------
5211 
5212  //-----------------------------------
5213  // 1) Make local_gAli with cut parameters:
5214  //-----------------------------------
5215  local_gAli = TransformEdbPVRec(GLOBAL_gAli, InBT);
5216  // Add InBT to GLOBAL_ShowerSegArray
5217  GLOBAL_ShowerSegArray -> Add(InBT);
5218  //-----------------------------------
5219 
5220 
5221  //-----------------------------------
5222  // 2) Loop over (whole) local_gAli, check InitiatorBT
5223  // 2) compatible with a segment forming a e+e- pair:
5224  //-----------------------------------
5225  Int_t NPairs=0,PIDDIFF=0,minPIDDIFF=0;
5226 
5227  Int_t local_gAli_npat=local_gAli->Npatterns();
5228  Int_t btloop_cnt_N=0;
5229  for (Int_t patterloop_cnt=local_gAli_npat-1; patterloop_cnt>=0; --patterloop_cnt) {
5230  if (gEDBDEBUGLEVEL>3) cout << "--- --- Doing patterloop_cnt= " << patterloop_cnt << endl;
5231  btloop_cnt_N=local_gAli->GetPattern(patterloop_cnt)->GetN();
5232  if (local_gAli->GetPattern(patterloop_cnt)->Z()<InBT->Z()) continue;
5233  if (TMath::Abs(local_gAli->GetPattern(patterloop_cnt)->Z()-InBT->Z())>3000) continue;
5234  if (local_gAli->GetPattern(patterloop_cnt)->Z()<InBT->Z()) continue;
5235  for (Int_t btloop_cnt=0; btloop_cnt<btloop_cnt_N; ++btloop_cnt) {
5236  seg = (EdbSegP*)local_gAli->GetPattern(patterloop_cnt)->GetSegment(btloop_cnt);
5237  if (gEDBDEBUGLEVEL>3) seg->PrintNice();
5238  if (IsSameSegment(seg,InBT)) continue;
5239  PIDDIFF=TMath::Abs(seg->PID()-InBT->PID());
5240  if (GetMinimumDist(InBT,seg)>50) continue;
5241  if (GetdR(InBT,seg)>200) continue;
5242  if (GetdeltaThetaSingleAngles(InBT,seg)>0.5) continue;
5243  if (PIDDIFF>minPIDDIFF) continue;
5244  // cout << " GetMinimumDist(InBT,seg); " << GetMinimumDist(InBT,seg) << "PIDDIFF "<< PIDDIFF<< endl;
5245 
5247  minPIDDIFF=PIDDIFF;
5248  }
5249  }
5251  // return;
5252 
5253  //-----------------------------------
5254  // 2) Loop over (whole) local_gAli, check BT for Cuts
5255  //-----------------------------------
5256  if (gEDBDEBUGLEVEL>2) cout << "--- local_gAli_npat= " << local_gAli_npat << endl;
5257 
5258  // Loop over all plates of local_gAli, since this is already
5259  // extracted with the right numbers of plates...
5260  for (Int_t patterloop_cnt=local_gAli_npat-1; patterloop_cnt>=0; --patterloop_cnt) {
5261  if (gEDBDEBUGLEVEL>3) cout << "--- --- Doing patterloop_cnt= " << patterloop_cnt << endl;
5262  btloop_cnt_N=local_gAli->GetPattern(patterloop_cnt)->GetN();
5263 
5264  // if pattern is before the Initiator BT->Z() position we just go on:
5265  if (local_gAli->GetPattern(patterloop_cnt)->Z()<InBT->Z()) continue;
5266 
5267  for (Int_t btloop_cnt=0; btloop_cnt<btloop_cnt_N; ++btloop_cnt) {
5268  seg = (EdbSegP*)local_gAli->GetPattern(patterloop_cnt)->GetSegment(btloop_cnt);
5269  if (gEDBDEBUGLEVEL>3) seg->PrintNice();
5270 
5271  // Now apply cut conditions: Advanced Gamma Alg --------------------
5273  if (!FindPrecedingBTsSingleThetaAngle(seg, InBT, local_gAli, GLOBAL_ShowerSegArray)) continue;
5274  // end of cut conditions: Advanced Gamma Alg --------------------
5275 
5276  // If we arrive here, Basetrack seg has passed criteria
5277  // and is then added to the shower array:
5278  // Check if its not the InBT which is already added:
5279  // if (IsSameSegment(seg,InBT)) { ; } // do nothing;
5280  // else {GLOBAL_ShowerSegArray -> Add(seg);}
5282  }
5283 
5284 
5285  // Calc BT density around shower:
5286  EdbPattern* pat_interim=local_gAli->GetPattern(patterloop_cnt);
5287  CalcTrackDensity(pat_interim,local_gAli_pat_interim_halfsize,npat_int,npat_total,npatN);
5288 
5289  // Calc TrackNumbers for plate for efficency numbers:
5290  CalcEfficencyNumbers(pat_interim, InBT->MCEvt(), NBT_Neff, NBTMC_Neff ,NBTMCe_Neff);
5291  }
5292  // end of loop over all plates of local_gAli
5293 
5295 
5296 
5297 
5298 
5299  Int_t s_NBT=0;
5300  Int_t s_NBTMC=0;
5301  Int_t s_NBTallMC=0;
5302  Int_t s_NBTeMC=0;
5303  Double_t s_eff=0;
5304  Double_t s_purall=0;
5305  Double_t s_pure=0;
5306  CalcEffPurOfShower(GLOBAL_ShowerSegArray, s_NBT, s_NBTMC, s_NBTallMC, s_NBTeMC, s_purall, s_pure);
5307 
5308  //-----------------------------------
5309  // 4) Calculate pur/eff/NBT numbers,
5310  // not needed when only reconstruction
5311  // done:
5312  //-----------------------------------
5313  if (cmd_OUTPUTLEVEL>=2 || cmd_OUTPUTLEVEL==0 ) {
5314  Int_t NBT=0;
5315  Int_t NBTMC=0;
5316  Int_t NBTallMC=0;
5317  Int_t NBTeMC=0;
5318  Double_t eff, purall, pure;
5319  CalcEffPurOfShower2(GLOBAL_ShowerSegArray, NBT, NBTMC, NBTallMC, NBTeMC, purall, pure, NBT_Neff, NBTMC_Neff ,NBTMCe_Neff);
5320 
5321  // Fill only for MC Event:
5322  if (GLOBAL_InBT_MC>0) {
5327  }
5329  }
5330 
5331 
5332  //-----------------------------------
5333  // 5) Fill Tree:
5334  //-----------------------------------
5335  TREE_ShowRecEff->Fill();
5336  if (gEDBDEBUGLEVEL>3) TREE_ShowRecEff->Show(TREE_ShowRecEff->GetEntries()-1);
5337 
5338 
5339  //-----------------------------------
5340  // 6a) Transfer ShowerArray to treebranchTreeEntry:
5341  //-----------------------------------
5342  if (cmd_OUTPUTLEVEL>0) {
5344  }
5345 
5346 
5347  //------------------------------------
5348  // Reset and delete important things:
5349  // also to avoid memory problems ...
5350  //-----------------------------------
5351  GLOBAL_ShowerSegArray->Clear();
5352  if (gEDBDEBUGLEVEL>3) cout << "--- ---GLOBAL_ShowerSegArray->GetEntries(): "<< GLOBAL_ShowerSegArray->GetEntries() << endl;
5353  delete local_gAli;
5354  local_gAli=0;
5356  //------------------------------------
5357  }
5358  // end of loop over GLOBAL_InBTArrayEntries
5359  //-----------------------------------------------------------------
5360 
5361  if (gEDBDEBUGLEVEL==2) cout << endl<<flush;
5362  if (gEDBDEBUGLEVEL>3) cout << "---TREE_ShowRecEff->GetEntries() ... " << TREE_ShowRecEff->GetEntries() << endl;
5363  if (gEDBDEBUGLEVEL>3) cout << "---GLOBAL_INBTSHOWERNR ... " << GLOBAL_INBTSHOWERNR<< endl;
5364 
5365 
5366  return;
5367 }
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
EdbPVRec * TransformEdbPVRec(EdbPVRec *gAli, EdbSegP *InitiatorBT)
DEBUG OPENMP TEST!!!!!!!
Definition: ShowRec.cpp:6299
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
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

◆ ReconstructShowers_BW()

void ReconstructShowers_BW ( )

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

4764 {
4765  Log(2, "ShowRec.cpp", "--- void ReconstructShowers_BW() ---");
4766 
4767  //-----------------------------------------------------------------
4768  // Main function for reconstruction of "BackWard" Algorithm
4769  //-----------------------------------------------------------------
4770 
4771  //-----------------------------------
4772  // For each InitiatorBT this is
4773  // divided in several small parts:
4774  //
4775  // 1) Make local_gAli with cut parameters, Make GetPID of InBT and corresponding of plates
4776  // 3) Loop over (whole) local_gAli, check BT for Cuts
4777  // 4) Calculate pur/eff/NBT numbers
4778  // 5) Fill Trees
4779  //-----------------------------------
4780 
4781  //-----------------------------------
4782  // Algorithm Iteration Steps:
4783  //
4784  // 0) Start Adjust Shower Axis, Virtual Vertex
4785  // 0) Calc dR/dT/dIP(trk,trk) to same plate.
4786  // ---Loop up to firstplate;
4787  // // ---Loop for deltaN (plate)=1,2,3:
4788  // // // 1) Calc dR/dT/dIP(trk,trk) to backward plate.
4789  // // // 1) Check for already in shower array; add BT to shower
4790  // // // 1) Adjust Shower Axis, Adjust Virtual Vertex
4791  // // ---Loop for deltaN (plate)=1,2,3:
4792  // ---Loop up to firstplate;
4793  // 2) Adjust Shower Axis, Virtual Vertex.
4794  //
4795  //-----------------------------------
4796 
4797 
4798  // Define Helper Variables:
4799  EdbPVRec* local_gAli;
4800  EdbSegP* InBT;
4801  EdbSegP* seg;
4802  EdbSegP* segShower;
4803  EdbSegP* ShowerAxis;
4804  EdbVertex* VirtualVertex;
4805  Float_t local_gAli_pat_interim_halfsize=0;
4806  Double_t dR,dT,dminDist;
4807 
4810 
4811  //-----------------------------------------------------------------
4812  // Since GLOBAL_InBTArray is filled in ascending ordering by zpositon
4813  // We use the descending loop to begin with BT with lowest z first.
4814  for (Int_t i=GLOBAL_InBTArrayEntries-1; i>=0; --i) {
4815 
4816  //-----------------------------------
4817  // CounterOutPut
4818  if (gEDBDEBUGLEVEL==2) if ((i%1)==0) cout << GLOBAL_InBTArrayEntries <<" InBT in total, still to do:"<<Form("%4d",i)<< "\r\r\r\r"<<flush;
4819  //-----------------------------------
4820 
4821  //-----------------------------------
4822  // Get InitiatorBT from GLOBAL_InBTArray
4823  InBT=(EdbSegP*)GLOBAL_InBTArray->At(i);
4824  //--------
4825  GLOBAL_InBT_E=InBT->P();
4826  GLOBAL_InBT_TanTheta=TMath::Sqrt(InBT->TX()*InBT->TX()+InBT->TY()*InBT->TY());
4827  GLOBAL_InBT_Flag=InBT->Flag();
4828  GLOBAL_InBT_MC=InBT->MCEvt();
4829  //--------
4830  Int_t local_NBT=0;
4831  Int_t local_NBTMC=0;
4832  Int_t local_NBTallMC=0;
4833  Int_t local_NBTeMC=0;
4834  float_t local_pure=-1;
4835  float_t local_purall=-1;
4836  Int_t npat_int=0;
4837  Int_t npat_total=0;
4838  Int_t npatN=0;
4839  Int_t show_NP=0;
4840  Int_t npat_Neff=0;
4841  Int_t NBT_Neff=0;
4842  Int_t NBTMC_Neff=0;
4843  Int_t NBTMCe_Neff=0;
4844  //--------
4845 
4846  if (gEDBDEBUGLEVEL!=2) {
4847  cout << endl << endl << "--- Starting Shower for Number " << i << " (MCEvt=" << InBT->MCEvt() << ") now: "<<endl;
4848  InBT->PrintNice();
4849  cout << "InBT->P() " << InBT->P() << endl;
4850  }
4851  //-----------------------------------
4852 
4853  //-----------------------------------
4854  // 1) Make local_gAli with cut parameters:
4855  //-----------------------------------
4856  local_gAli = TransformEdbPVRec_BackWard(GLOBAL_gAli, InBT);
4857  // Add InBT to GLOBAL_ShowerSegArray
4858  GLOBAL_ShowerSegArray -> Add(InBT);
4859  if (gEDBDEBUGLEVEL>2) cout << "--- TransformEdbPVRec done."<<endl;
4860  //-----------------------------------
4861 
4862 
4863  //-----------------------------------
4864  // 2) Start at plate for Initator BT:
4865  //-----------------------------------
4866  Int_t local_gAli_npat=local_gAli->Npatterns();
4867  Int_t btloop_cnt_N=0;
4868  // if (gEDBDEBUGLEVEL>2)
4869  cout << "--- Starting BACKWARD Reco... ---" << endl;
4870  if (gEDBDEBUGLEVEL>2) cout << "--- local_gAli_npat= " << local_gAli_npat << endl;
4871 
4872  Int_t patterloop_cnt_InBT=-1;
4873  Float_t patterloop_cnt_InBT_Z=0;
4874  for (Int_t patterloop_cnt=0; patterloop_cnt<local_gAli_npat; patterloop_cnt++) {
4875  if (gEDBDEBUGLEVEL>3) cout << "--- --- Doing patterloop_cnt= " << patterloop_cnt << endl;
4876  // if pattern is after the Initiator BT->Z() position we stop:
4877  if (local_gAli->GetPattern(patterloop_cnt)->Z()<InBT->Z()) continue;
4878  patterloop_cnt_InBT=patterloop_cnt;
4879  patterloop_cnt_InBT_Z=local_gAli->GetPattern(patterloop_cnt)->Z();
4880  }
4881  if (gEDBDEBUGLEVEL>2) cout << "--- patterloop_cnt_InBT= " << patterloop_cnt_InBT << endl;
4882  if (gEDBDEBUGLEVEL>2) cout << "--- patterloop_cnt_InBT_Z= " << patterloop_cnt_InBT_Z << endl;
4883 
4884  // Check wich Steptype is needed for BackwardStepping:
4885  // Convention: -1 if Patter(0)_Z<Pattern(npat)_Z
4886  // Convention: +1 if Patter(0)_Z>Pattern(npat)_Z
4887  Int_t StepNr=0;
4888  if (gEDBDEBUGLEVEL>2) cout << "local_gAli->GetPattern(0)->Z() " << local_gAli->GetPattern(0)->Z() << endl;
4889  if (gEDBDEBUGLEVEL>2) cout << "local_gAli->GetPattern(local_gAli_npat-1)->Z() " << local_gAli->GetPattern(local_gAli_npat-1)->Z() << endl;
4890  if (local_gAli->GetPattern(0)->Z() > local_gAli->GetPattern(local_gAli_npat-1)->Z()) {
4891  StepNr=1;
4892  }
4893  else {
4894  StepNr=-1;
4895  }
4896  if (gEDBDEBUGLEVEL>2) cout << "--- StepNr for going backwards (decreasing Z) to next plate= " << StepNr << endl;
4897 
4898  // return;
4899  Bool_t FP_reached=kFALSE;
4900  Int_t patterloop_cnt=patterloop_cnt_InBT;
4901  if (StepNr==1) patterloop_cnt=patterloop_cnt_InBT;
4902  if (StepNr==-1) cout << "DONT KNOW HERE WHICH patterloop_cnt=local_gAli_npat-1; to calculate!!! " << endl;
4903 
4904  // Loop over all plates of local_gAli, since this is already
4905  // extracted with the right numbers of plates...
4906  while (!FP_reached) {
4907  if (gEDBDEBUGLEVEL>2) cout << " FP NOT YET REACHED .... << doing patterloop_cnt = " << patterloop_cnt << endl;
4908  btloop_cnt_N=local_gAli->GetPattern(patterloop_cnt)->GetN();
4909  if (gEDBDEBUGLEVEL>2) cout << " FP NOT YET REACHED .... << with btloop_cnt_N = " << btloop_cnt_N << endl;
4910 
4911  // Loop over all BTs in the actual plate. Calculate dR/dT/dIP to
4912  // all BTs which are already in the shower (at beginning it is
4913  // only the InBT.
4914  for (Int_t btloop_cnt=0; btloop_cnt<btloop_cnt_N; ++btloop_cnt) {
4915  seg = (EdbSegP*)local_gAli->GetPattern(patterloop_cnt)->GetSegment(btloop_cnt);
4916  if (gEDBDEBUGLEVEL>3) seg->PrintNice();
4917 
4918  Bool_t add_seg=kFALSE;
4919  if (gEDBDEBUGLEVEL>3) cout << "btloop_cnt (ot of ) " << btloop_cnt << " ( " << btloop_cnt_N << " ) " << endl;
4920 
4921  // Now apply cut conditions: BACKWARD Alg --------------------
4922  // Check for dTheta to tracks already in shower:
4923  Int_t actualEntries=GLOBAL_ShowerSegArray->GetEntries();
4924  if (gEDBDEBUGLEVEL>3) cout << "actualEntries of GLOBAL_ShowerSegArray: " << actualEntries << endl;
4925  for (int i=0; i<actualEntries; ++i) {
4926  segShower=(EdbSegP*)GLOBAL_ShowerSegArray->At(i);
4927  Float_t dZ=TMath::Abs(segShower->Z()-seg->Z());
4928  dT=GetdeltaThetaSingleAngles(seg,segShower); // DO NOT TAKE GetdeltaTheta since this is calculation based on absolute theta differences (not on TX,TY relative ones) !!
4929  dR=GetdR(seg,segShower);
4930  dminDist=GetMinimumDist(seg,segShower);
4931  if (gEDBDEBUGLEVEL>3) cout << "btloop_cnt i dT dR dminDist dZ: " << btloop_cnt << " " << i << " " << dT << " " << dR << " " << dminDist << " " << dZ << endl;
4932  if (TMath::Abs(dZ)>CUT_PARAMETER[3]) continue;
4933  if (TMath::Abs(dT)>CUT_PARAMETER[1]) continue;
4934  if (TMath::Abs(dR)>CUT_PARAMETER[2]) continue;
4935  if (TMath::Abs(dminDist)>CUT_PARAMETER[0]) continue;
4936  if (gEDBDEBUGLEVEL>3) cout << "try to add this BT (if not already in there...) "<< endl;
4937  add_seg=kTRUE;
4938  break;
4939  } // of for (int i=0; i<actualEntries; ++i)
4940  if (add_seg) {
4942  EdbSegP* BT_1=(EdbSegP*)GLOBAL_ShowerSegArray->At(0);
4943  EdbSegP* BT_2=(EdbSegP*)GLOBAL_ShowerSegArray->At(GLOBAL_ShowerSegArray->GetEntries()-1);
4944  show_NP=TMath::Max(show_NP,TMath::Abs(BT_1->PID()-BT_2->PID())+1);
4945  //cout << "show_NP = " << show_NP << endl;
4946  }
4947  } // of for (Int_t btloop_cnt=0; btloop_cnt<btloop_cnt_N; ++btloop_cnt)
4948 
4949  // Now goto next plate:
4950  patterloop_cnt=patterloop_cnt+StepNr;
4951  if (patterloop_cnt<0) FP_reached=kTRUE;
4952  if (patterloop_cnt>=local_gAli_npat) FP_reached=kTRUE;
4953  // Or we stop also if the number of plates is more than cmd_NP
4954  if (show_NP>=cmd_NP) FP_reached=kTRUE;
4955  } // while (!FP_reached)
4956 
4957 
4959  if (cmd_OUTPUTLEVEL>=2 || cmd_OUTPUTLEVEL==0 ) {
4960  Int_t NBT=0;
4961  Int_t NBTMC=0;
4962  Int_t NBTallMC=0;
4963  Int_t NBTeMC=0;
4964  Double_t purall, pure;
4965  CalcEffPurOfShower(GLOBAL_ShowerSegArray, NBT, NBTMC, NBTallMC, NBTeMC, purall, pure);
4971  }
4972 
4973  if (gEDBDEBUGLEVEL>2) cout << " Check if its sorted: GLOBAL_ShowerSegArray->At(0)->Z() should be the lowest one...continue;" << endl;
4974  if (gEDBDEBUGLEVEL>2) cout << " IsShowerSortedZ(GLOBAL_ShowerSegArray) " << IsShowerSortedZ(GLOBAL_ShowerSegArray) << endl;
4976 
4977  // After Sort Shower we can build axis right now...
4979  ShowerAxis->PrintNice();
4980  Float_t mindTTT=999999;
4981  Int_t mindTTT_h=0;
4982  for (int h=0; h<GLOBAL_ShowerSegArray->GetEntries(); ++h) {
4983  segShower=(EdbSegP*)GLOBAL_ShowerSegArray->At(h);
4984  // segShower->PrintNice();
4985  if (segShower->Z()!=ShowerAxis->Z()) continue;
4986  Float_t dTTT = GetdeltaTheta(ShowerAxis,segShower); //cout << "dTTT = " << dTTT << endl;
4987  if (dTTT<mindTTT) {
4988  mindTTT=dTTT;
4989  mindTTT_h=h;
4990  }
4991  }
4992 
4993  // Now here comes the forward (==downstream==inbeamdirection) reconstruction
4994  if (gEDBDEBUGLEVEL>2) cout << "--- Starting FORWARD Reco... ---" << endl;
4995 
4996  // Just take the BT which is closest to shower axis:
4997  ShowerAxis=(EdbSegP*)GLOBAL_ShowerSegArray->At(mindTTT_h);
4998  GLOBAL_ShowerSegArray->Clear();
4999  // The First we have to add by hand because in the reco routine there has to be at least one BT to check.
5000  GLOBAL_ShowerSegArray->Add(ShowerAxis);
5001  if (gEDBDEBUGLEVEL>3) ShowerAxis->PrintNice();
5002 
5003  for (Int_t patterloop_cnt=0; patterloop_cnt<local_gAli_npat; patterloop_cnt++) {
5004  if (gEDBDEBUGLEVEL>3) cout << "--- --- Doing patterloop_cnt= " << patterloop_cnt << endl;
5005  // if pattern is after the ShowerAxis BT->Z() position we stop:
5006  if (local_gAli->GetPattern(patterloop_cnt)->Z()<ShowerAxis->Z()) continue;
5007  patterloop_cnt_InBT=patterloop_cnt;
5008  patterloop_cnt_InBT_Z=local_gAli->GetPattern(patterloop_cnt)->Z();
5009  }
5010  if (gEDBDEBUGLEVEL>2) cout << "--- patterloop_cnt_InBT= " << patterloop_cnt_InBT << endl;
5011  if (gEDBDEBUGLEVEL>2) cout << "--- patterloop_cnt_InBT_Z= " << patterloop_cnt_InBT_Z << endl;
5012 
5013  // InvertSpeNr now for forward Step:
5014  Int_t StepNrForward=StepNr*-1;
5015  StepNr=StepNrForward;
5016  show_NP=0;
5017 
5018  Bool_t LP_reached=kFALSE;
5019  patterloop_cnt=patterloop_cnt_InBT;
5020 
5021  while (!LP_reached) {
5022  if (gEDBDEBUGLEVEL>2) cout << " LP NOT YET REACHED .... << doing patterloop_cnt = " << patterloop_cnt << endl;
5023  btloop_cnt_N=local_gAli->GetPattern(patterloop_cnt)->GetN();
5024  if (gEDBDEBUGLEVEL>2) cout << " LP NOT YET REACHED .... << with btloop_cnt_N = " << btloop_cnt_N << endl;
5025 
5026  // Loop over all BTs in the actual plate. Calculate dR/dT/dIP to
5027  // all BTs which are already in the shower (at beginning it is
5028  // only the InBT.
5029  for (Int_t btloop_cnt=0; btloop_cnt<btloop_cnt_N; ++btloop_cnt) {
5030  seg = (EdbSegP*)local_gAli->GetPattern(patterloop_cnt)->GetSegment(btloop_cnt);
5031  if (gEDBDEBUGLEVEL>3) seg->PrintNice();
5032  Bool_t add_seg=kFALSE;
5033  if (gEDBDEBUGLEVEL>3) cout << "btloop_cnt (ot of ) " << btloop_cnt << " ( " << btloop_cnt_N << " ) " << endl;
5034 
5035  // Now apply cut conditions: BACKWARD Alg --------------------
5036  // Check for dTheta to tracks already in shower:
5037  Int_t actualEntries=GLOBAL_ShowerSegArray->GetEntries();
5038  if (gEDBDEBUGLEVEL>3) cout << "actualEntries of GLOBAL_ShowerSegArray: " << actualEntries << endl;
5039  for (int i=0; i<actualEntries; ++i) {
5040  segShower=(EdbSegP*)GLOBAL_ShowerSegArray->At(i);
5041  Float_t dZ=TMath::Abs(segShower->Z()-seg->Z());
5042  dT=GetdeltaThetaSingleAngles(seg,segShower); // DO NOT TAKE GetdeltaTheta since this is calculation based on absolute theta differences (not on TX,TY relative ones) !!
5043  dR=GetdR(seg,segShower);
5044  dminDist=GetMinimumDist(seg,segShower);
5045  if (gEDBDEBUGLEVEL>3) cout << "btloop_cnt i dT dR dminDist dZ: " << btloop_cnt << " " << i << " " << dT << " " << dR << " " << dminDist << " " << dZ << endl;
5046  if (TMath::Abs(dZ)>CUT_PARAMETER[7]) continue;
5047  if (TMath::Abs(dT)>CUT_PARAMETER[5]) continue;
5048  if (TMath::Abs(dR)>CUT_PARAMETER[6]) continue;
5049  if (TMath::Abs(dminDist)>CUT_PARAMETER[4]) continue;
5050  if (gEDBDEBUGLEVEL>3) cout << "try to add this BT (if not already in there...) "<< endl;
5051  add_seg=kTRUE;
5052  break;
5053  } // of for (int i=0; i<actualEntries; ++i)
5054  if (add_seg) {
5056  EdbSegP* BT_1=(EdbSegP*)GLOBAL_ShowerSegArray->At(0);
5057  EdbSegP* BT_2=(EdbSegP*)GLOBAL_ShowerSegArray->At(GLOBAL_ShowerSegArray->GetEntries()-1);
5058  show_NP=TMath::Max(show_NP,TMath::Abs(BT_1->PID()-BT_2->PID())+1);
5059  //cout << "show_NP = " << show_NP << endl;
5060  }
5061  } // of for (Int_t btloop_cnt=0; btloop_cnt<btloop_cnt_N; ++btloop_cnt)
5062 
5063 
5064  // Calc BT density around shower:
5065  EdbPattern* pat_interim=local_gAli->GetPattern(patterloop_cnt);
5066  CalcTrackDensity(pat_interim,local_gAli_pat_interim_halfsize,npat_int,npat_total,npatN);
5067 
5068  // Calc TrackNumbers for plate for efficency numbers:
5069  CalcEfficencyNumbers(pat_interim, InBT->MCEvt(), NBT_Neff, NBTMC_Neff ,NBTMCe_Neff);
5070 
5071  // Now goto next plate:
5072  patterloop_cnt=patterloop_cnt+StepNr;
5073  if (patterloop_cnt<0) LP_reached=kTRUE;
5074  if (patterloop_cnt>=local_gAli_npat) LP_reached=kTRUE;
5075  // Or we stop also if the number of plates is more than cmd_NP
5076  if (show_NP>=cmd_NP) LP_reached=kTRUE;
5077 
5078  } // of while (!LP_reached)
5080 
5081  //-----------------------------------
5082  // 4) Calculate pur/eff/NBT numbers,
5083  // not needed when only reconstruction
5084  // done:
5085  //-----------------------------------
5086  if (cmd_OUTPUTLEVEL>=2 || cmd_OUTPUTLEVEL==0 ) {
5087  Int_t NBT=0;
5088  Int_t NBTMC=0;
5089  Int_t NBTallMC=0;
5090  Int_t NBTeMC=0;
5091  Double_t eff, purall, pure;
5092  CalcEffPurOfShower2(GLOBAL_ShowerSegArray, NBT, NBTMC, NBTallMC, NBTeMC, purall, pure, NBT_Neff, NBTMC_Neff ,NBTMCe_Neff);
5093 
5094  // Fill only for MC Event:
5095  if (GLOBAL_InBT_MC>0) {
5100  }
5102  }
5103 
5104 
5105 
5106  //-----------------------------------
5107  // 5) Fill Tree:
5108  //-----------------------------------
5109  TREE_ShowRecEff->Fill();
5110  if (gEDBDEBUGLEVEL>3) TREE_ShowRecEff->Show(TREE_ShowRecEff->GetEntries()-1);
5111 
5112 
5113  //-----------------------------------
5114  // 6a) Transfer ShowerArray to treebranchTreeEntry:
5115  //-----------------------------------
5116  if (cmd_OUTPUTLEVEL>0) {
5118  }
5119 
5120  //------------------------------------
5121  // Reset and delete important things:
5122  // also to avoid memory problems ...
5123  //-----------------------------------
5124  GLOBAL_ShowerSegArray->Clear();
5125  if (gEDBDEBUGLEVEL>3) cout << "--- ---GLOBAL_ShowerSegArray->GetEntries(): "<< GLOBAL_ShowerSegArray->GetEntries() << endl;
5126  delete local_gAli;
5127  local_gAli=0;
5129  //------------------------------------
5130  }
5131  // end of loop over GLOBAL_InBTArrayEntries
5132  //-----------------------------------------------------------------
5133 
5134  if (gEDBDEBUGLEVEL==2) cout << endl<<flush;
5135  if (gEDBDEBUGLEVEL>3) cout << "---TREE_ShowRecEff->GetEntries() ... " << TREE_ShowRecEff->GetEntries() << endl;
5136  if (gEDBDEBUGLEVEL>3) cout << "---GLOBAL_INBTSHOWERNR ... " << GLOBAL_INBTSHOWERNR<< endl;
5137 
5138 
5139  return;
5140 }
EdbPVRec * TransformEdbPVRec_BackWard(EdbPVRec *gAli, EdbSegP *InitiatorBT)
Definition: ShowRec.cpp:6413
Bool_t IsShowerSortedZ(TObjArray *showerarray)
Definition: ShowRec.cpp:8801
void SortShowerZ(TObjArray *showerarray)
Definition: ShowRec.cpp:8816
EdbSegP * BuildShowerAxis(TObjArray *ShowerSegArray)
Definition: ShowRec.cpp:8629

◆ ReconstructShowers_CA()

void ReconstructShowers_CA ( )
2650 {
2651  Log(2, "ShowRec.cpp", "--- void ReconstructShowers_CA() ---");
2652 
2653  //-----------------------------------------------------------------
2654  // Main function for reconstruction of ConeAdvanced Algorithm
2655  //-----------------------------------------------------------------
2656 
2657  //-----------------------------------
2658  // For each InitiatorBT this is
2659  // divided in several small parts:
2660  //
2661  // 1) Make local_gAli with cut parameters, Make GetPID of InBT and corresponding of plates
2662  // 3) Loop over (whole) local_gAli, check BT for Cuts
2663  // 4) Calculate pur/eff/NBT numbers
2664  // 5) Fill Trees
2665  //-----------------------------------
2666 
2667  // Define Helper Variables:
2668  EdbPVRec* local_gAli;
2669  EdbSegP* InBT;
2670  EdbSegP* seg;
2671  Float_t local_gAli_pat_interim_halfsize=0;
2672 
2675  cout << "GLOBAL_InBTArrayEntries = " << GLOBAL_InBTArrayEntries << endl;
2676 
2677 
2678  //-----------------------------------------------------------------
2679  // Since GLOBAL_InBTArray is filled in ascending ordering by zpositon
2680  // We use the descending loop to begin with BT with lowest z first.
2681  for (Int_t i=GLOBAL_InBTArrayEntries-1; i>=0; --i) {
2682 
2683  //-----------------------------------
2684  // CounterOutPut
2685  if (gEDBDEBUGLEVEL==2) if ((i%1)==0) cout << GLOBAL_InBTArrayEntries <<" InBT in total, still to do:"<<Form("%4d",i)<< "\r\r\r\r"<<flush;
2686  if (gEDBDEBUGLEVEL==1) {
2687  int modulo=GLOBAL_InBTArrayEntries/20;
2688  if ((i%modulo)==0) cout << i <<" : 5% more done"<<endl;
2689  }
2690  //-----------------------------------
2691 
2692  //-----------------------------------
2693  // Get InitiatorBT from GLOBAL_InBTArray
2694  InBT=(EdbSegP*)GLOBAL_InBTArray->At(i);
2695  //--------
2696  GLOBAL_InBT_E=InBT->P();
2697  GLOBAL_InBT_TanTheta=TMath::Sqrt(InBT->TX()*InBT->TX()+InBT->TY()*InBT->TY());
2698  GLOBAL_InBT_Flag=InBT->Flag();
2699  GLOBAL_InBT_MC=InBT->MCEvt();
2700  //--------
2701  Int_t local_NBT=0;
2702  Int_t local_NBTMC=0;
2703  Int_t local_NBTallMC=0;
2704  Int_t local_NBTeMC=0;
2705  float_t local_pure=-1;
2706  float_t local_purall=-1;
2707  Int_t npat_int=0;
2708  Int_t npat_total=0;
2709  Int_t npatN=0;
2710  Int_t npat_Neff=0;
2711  Int_t NBT_Neff=0;
2712  Int_t NBTMC_Neff=0;
2713  Int_t NBTMCe_Neff=0;
2714  //--------
2715 
2716  if (gEDBDEBUGLEVEL>2) {
2717  cout << endl << endl << "--- Starting Shower for Number " << i << " now: "<<endl;
2718  InBT->PrintNice();
2719  }
2720  //-----------------------------------
2721 
2722  //-----------------------------------
2723  // 1) Make local_gAli with cut parameters:
2724  //-----------------------------------
2725  local_gAli = TransformEdbPVRec(GLOBAL_gAli, InBT);
2726  // Add InBT to GLOBAL_ShowerSegArray
2727  GLOBAL_ShowerSegArray -> Add(InBT);
2728  //-----------------------------------
2729 
2730 
2731  //-----------------------------------
2732  // 2) Loop over (whole) local_gAli, check BT for Cuts
2733  //-----------------------------------
2734  Int_t local_gAli_npat=local_gAli->Npatterns();
2735  if (gEDBDEBUGLEVEL>2) cout << "--- local_gAli_npat= " << local_gAli_npat << endl;
2736 
2737  // Loop over all plates of local_gAli, since this is already
2738  // extracted with the right numbers of plates...
2739  for (Int_t patterloop_cnt=local_gAli_npat-1; patterloop_cnt>=0; --patterloop_cnt) {
2740  if (gEDBDEBUGLEVEL>3) cout << "--- --- Doing patterloop_cnt= " << patterloop_cnt << endl;
2741 
2742  for (Int_t btloop_cnt=0; btloop_cnt<local_gAli->GetPattern(patterloop_cnt)->GetN(); ++btloop_cnt) {
2743  seg = (EdbSegP*)local_gAli->GetPattern(patterloop_cnt)->GetSegment(btloop_cnt);
2744  if (gEDBDEBUGLEVEL>3) seg->PrintNice();
2745 
2746  // Now apply cut conditions: CA ConeAdvanced Alg --------------------
2747  if (!GetConeOrTubeDistanceToInBT(seg, InBT, CUT_PARAMETER[0], CUT_PARAMETER[1])) continue;
2748  if (!FindPrecedingBTs(seg, InBT, local_gAli, GLOBAL_ShowerSegArray)) continue;
2749  // end of cut conditions: CA ConeAdvanced Alg --------------------
2750 
2751  // If we arrive here, Basetrack seg has passed criteria
2752  // and is then added to the shower array:
2753  // Check if its not the InBT which is already added:
2754  if (seg->X()==InBT->X()&&seg->Y()==InBT->Y()) {
2755  ; // do nothing;
2756  }
2757  else {
2758  GLOBAL_ShowerSegArray -> Add(seg);
2759  }
2760  }
2761  // Calc BT density around shower:
2762  EdbPattern* pat_interim=local_gAli->GetPattern(patterloop_cnt);
2763  CalcTrackDensity(pat_interim,local_gAli_pat_interim_halfsize,npat_int,npat_total,npatN);
2764 
2765  // Calc TrackNumbers for plate for efficency numbers:
2766  CalcEfficencyNumbers(pat_interim, InBT->MCEvt(), NBT_Neff, NBTMC_Neff ,NBTMCe_Neff);
2767  }
2768  // end of loop over all plates of local_gAli
2770 
2771 
2772  //-----------------------------------
2773  // 4) Calculate pur/eff/NBT numbers,
2774  // not needed when only reconstruction
2775  // done:
2776  //-----------------------------------
2777  if (cmd_OUTPUTLEVEL>=2 || cmd_OUTPUTLEVEL==0 ) {
2778  Int_t NBT=0;
2779  Int_t NBTMC=0;
2780  Int_t NBTallMC=0;
2781  Int_t NBTeMC=0;
2782  Double_t eff, purall, pure;
2783  CalcEffPurOfShower2(GLOBAL_ShowerSegArray, NBT, NBTMC, NBTallMC, NBTeMC, purall, pure, NBT_Neff, NBTMC_Neff ,NBTMCe_Neff);
2784 
2785  // Fill only for MC Event:
2786  if (GLOBAL_InBT_MC>0) {
2791  }
2793  }
2794 
2795 
2796  //-----------------------------------
2797  // 5) Fill Tree:
2798  //-----------------------------------
2799  TREE_ShowRecEff->Fill();
2800  if (gEDBDEBUGLEVEL>3) TREE_ShowRecEff->Show(TREE_ShowRecEff->GetEntries()-1);
2801 
2802 
2803  //-----------------------------------
2804  // 6a) Transfer ShowerArray to treebranchTreeEntry:
2805  //-----------------------------------
2806  if (cmd_OUTPUTLEVEL>0) {
2808  }
2809 
2810 
2811  //------------------------------------
2812  // Reset and delete important things:
2813  // also to avoid memory problems ...
2814  //-----------------------------------
2815  GLOBAL_ShowerSegArray->Clear();
2816  if (gEDBDEBUGLEVEL>3) cout << "--- ---GLOBAL_ShowerSegArray->GetEntries(): "<< GLOBAL_ShowerSegArray->GetEntries() << endl;
2817  delete local_gAli;
2818  local_gAli=0;
2820  //------------------------------------
2821  }
2822  // end of loop over GLOBAL_InBTArrayEntries
2823  //-----------------------------------------------------------------
2824 
2825  if (gEDBDEBUGLEVEL==2) cout << endl<<flush;
2826  if (gEDBDEBUGLEVEL>3) cout << "---TREE_ShowRecEff->GetEntries() ... " << TREE_ShowRecEff->GetEntries() << endl;
2827  if (gEDBDEBUGLEVEL>3) cout << "---GLOBAL_INBTSHOWERNR ... " << GLOBAL_INBTSHOWERNR<< endl;
2828 
2829 
2830  return;
2831 }
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

1893 {
1894  Log(2, "ShowRec.cpp", "--- void ReconstructShowers_CL() ---");
1895 
1896  //-----------------------------------------------------------------
1897  // Main function for reconstruction of CLuster Algorithm
1898  //-----------------------------------------------------------------
1899  //
1900  // For each InitiatorBT this is
1901  // divided in several small parts:
1902  // 1) Make local_gAli with cut parameters, Make GetPID of InBT and corresponding of plates
1903  // 3) Loop over (whole) local_gAli, check BT for Cuts
1904  // 4) Calculate pur/eff/NBT numbers
1905  // 5) Fill Trees
1906  //-----------------------------------
1907 
1908  //-----------------------------------
1909  // 0) Predefinitions
1910  //-----------------------------------
1911 
1912  // Set ClusterBoxSize of X,Y in microns: (f.e. 50x50)
1913  Float_t BOXSIZE=50;
1914  Float_t ClusterBoxSizeX=BOXSIZE;
1915  Float_t ClusterBoxSizeY=ClusterBoxSizeX;
1916  Float_t ClusterBoxSize[]= {ClusterBoxSizeX,ClusterBoxSizeY};
1917 
1918  // Set GLOBAL Boundaries of the BrickSize, depends on your MC Simulation and on your scanned BG size
1919  // Later we will set the frame size, which can be f.e. 1mmX1mm, 3mmX3mm ...
1920  // This does not need to be changed...
1921  Float_t LeftX=-11000;
1922  Float_t RightX=21000;
1923  Float_t LeftY=-11000;
1924  Float_t RightY=16000;
1925 
1926  cout << " ......."<<endl;
1927  // Set SquareSize of The gAliSub -> Coorseponds to the totral scan Area:
1928  Float_t VIEWSIZE=1000;
1929  Float_t gAliSub_Length_X=VIEWSIZE;
1930  Float_t gAliSub_Length_Y=VIEWSIZE; //1mm
1931 
1932  // Calculate how many NbinsX,Y are needed:
1933  Int_t NbinsX=Int_t((RightX-LeftX)/ClusterBoxSizeX);
1934  Int_t NbinsY=Int_t((RightY-LeftY)/ClusterBoxSizeY);
1935 
1936 
1937  cout << " ......."<<endl;
1938 
1939  Int_t NPLATES=GLOBAL_gAli->Npatterns();
1940  Int_t NbinsZ=NPLATES;
1941 
1942  // Calculate how many NbinsX,Y are needed:
1943  Int_t NbinsX_gAliSub=Int_t((gAliSub_Length_X)/ClusterBoxSizeX);
1944  Int_t NbinsY_gAliSub=Int_t((gAliSub_Length_Y)/ClusterBoxSizeY);
1945 
1946  // Arrays for the Spectrum source and dests...
1947  Float_t ** source = new float *[NbinsX];
1948  for (Int_t cnti=0; cnti<NbinsX; cnti++) {
1949  source[cnti]=new float[NbinsY];
1950  }
1951  Float_t ** dest = new float *[NbinsX];
1952  for (Int_t cnti=0; cnti<NbinsX; cnti++) {
1953  dest[cnti]=new float[NbinsY];
1954  }
1955 
1956  // Arrays for the Spectrum source and dests...
1957  Float_t ** source_gAliSub = new float *[NbinsX_gAliSub];
1958  for (Int_t cnti=0; cnti<NbinsX_gAliSub; cnti++) {
1959  source_gAliSub[cnti]=new float[NbinsY_gAliSub];
1960  }
1961  Float_t ** dest_gAliSub = new float *[NbinsX_gAliSub];
1962  for (Int_t cnti=0; cnti<NbinsX_gAliSub; cnti++) {
1963  dest_gAliSub[cnti]=new float[NbinsY_gAliSub];
1964  }
1965 
1966  // Fil Exptrapoalted BT with direction into next plate?
1967  Bool_t FillTANData=kTRUE;
1968  cout << " ......."<<endl;
1969 
1970  // Plates to be grouped Together:
1971  Int_t PLATESPERGROUP=1;
1972  Int_t FIRSTPLATE=0;
1973  Int_t LASTPLATE=0;
1974  Int_t MAXPLATE=GLOBAL_gAli->Npatterns()-1;
1975  Int_t NGroupedPLATES=ceil( (Double_t)NPLATES/(Double_t)PLATESPERGROUP);
1976 
1977  // Spectrum Position Peaks
1978  Float_t* fPositionX;
1979  Float_t* fPositionY;
1980  Int_t fNPeaks;
1981 
1982  // Start Position...
1983  Float_t StartPosX,StartPosY,StartPosTX,StartPosTY;
1984 
1985  // Calculate the z-positions for the grouped plates:
1986  Float_t ZPosGroupedPlates[50];
1988  cout << "gAli->GetPattern(firstplate)->GetSegment(0)->Z; "<<GLOBAL_gAli->GetPattern(0)->Z()<<endl;
1989  cout << "gAli->GetPattern(lastplate)->GetSegment(0)->Z; "<<GLOBAL_gAli->GetPattern(GLOBAL_gAli->Npatterns()-1)->Z()<<endl;
1991 
1992  for (Int_t i=0; i<NGroupedPLATES; i++) {
1993  ZPosGroupedPlates[i]=GLOBAL_gAli->GetPattern(0)->Z()+PLATESPERGROUP*1300*i;
1995  cout << "i PLATESPERGROUP NGroupedPLATES ZPosGroupedPlates[i] " << i << " " << PLATESPERGROUP << " " << NGroupedPLATES << " " << ZPosGroupedPlates[i] << " " << endl;
1996  }
1997 
1999  if (gEDBDEBUGLEVEL==2) {
2000  cout << "NbinsX = " << NbinsX << endl;
2001  cout << "NbinsY = " << NbinsY << endl;
2002  cout << "NbinsZ = " << NbinsZ << endl;
2003  cout << "NbinsX_gAliSub = " << NbinsX_gAliSub << endl;
2004  cout << "NbinsY_gAliSub = " << NbinsY_gAliSub << endl;
2005  cout << "FIRSTPLATE= "<<FIRSTPLATE<<endl;
2006  cout << "LASTPLATE= "<<LASTPLATE<<endl;
2007  cout << "MAXPLATE= "<<MAXPLATE<<endl;
2008  cout << "NPLATES= "<<NPLATES<<endl;
2009  cout << "NGroupedPLATES= "<<NGroupedPLATES<<endl;
2010  cout << "PLATESPERGROUP= "<<PLATESPERGROUP<<endl;
2011  }
2013 
2014  //=========================================
2015  // Create the 2Dim Histograms:
2017  // Create the 2Dim Histograms:
2018  Hist2DimOnlyBGAllPlates= new TH2F();
2021  // Create the 3Dim Histograms:
2022  Hist3DimOnlyBG = new TH3F();
2023  Hist3DimRecoEvent_gAli = new TH3F();
2024  //=========================================
2025  // Allocate TSectrum2 pointer on the heap, and try to speed up program....
2026  spectrum2dim= new TSpectrum2();
2027  spectrum2dim->Print();
2028  //=========================================
2029 
2030 
2031  // Define Helper Variables:
2032  EdbPVRec* local_gAli;
2033  EdbSegP* InBT;
2034  EdbSegP* seg;
2035  Float_t local_gAli_pat_interim_halfsize=0;
2036 
2039  cout << "GLOBAL_InBTArrayEntries = " << GLOBAL_InBTArrayEntries << endl;
2040 
2041  TClonesArray *as;
2042  EdbSegP *sa;
2043  EdbPattern *as_pattern;
2044  EdbPattern *as_pattern_sub;
2045 
2046 
2047  //-----------------------------------------------------------------
2048  // Since GLOBAL_InBTArray is filled in ascending ordering by zpositon
2049  // We use the descending loop to begin with BT with lowest z first.
2050  // for (Int_t i=GLOBAL_InBTArrayEntries-1; i>=0; --i) {
2051  for (Int_t i=GLOBAL_InBTArrayEntries-1; i>=GLOBAL_InBTArrayEntries-1; --i) {
2052 
2053  //-----------------------------------
2054  // CounterOutPut
2055  if (gEDBDEBUGLEVEL==2) if ((i%1)==0) cout << GLOBAL_InBTArrayEntries <<" InBT in total, still to do:"<<Form("%4d",i)<< "\r\r\r\r"<<flush;
2056  if (gEDBDEBUGLEVEL==1) {
2057  int modulo=GLOBAL_InBTArrayEntries/20;
2058  if ((i%modulo)==0) cout << i <<" : 5% more done"<<endl;
2059  }
2060  //-----------------------------------
2061 
2062  //-----------------------------------
2063  // Get InitiatorBT from GLOBAL_InBTArray
2064  InBT=(EdbSegP*)GLOBAL_InBTArray->At(i);
2065  //--------
2066  GLOBAL_InBT_E=InBT->P();
2067  GLOBAL_InBT_TanTheta=TMath::Sqrt(InBT->TX()*InBT->TX()+InBT->TY()*InBT->TY());
2068  GLOBAL_InBT_Flag=InBT->Flag();
2069  GLOBAL_InBT_MC=InBT->MCEvt();
2070  //--------
2071  Int_t local_NBT=0;
2072  Int_t local_NBTMC=0;
2073  Int_t local_NBTallMC=0;
2074  Int_t local_NBTeMC=0;
2075  float_t local_pure=-1;
2076  float_t local_purall=-1;
2077  Int_t npat_int=0;
2078  Int_t npat_total=0;
2079  Int_t npatN=0;
2080  Int_t npat_Neff=0;
2081  Int_t NBT_Neff=0;
2082  Int_t NBTMC_Neff=0;
2083  Int_t NBTMCe_Neff=0;
2084  //--------
2085 
2086  if (gEDBDEBUGLEVEL>2) {
2087  cout << endl << endl << "--- Starting Shower for Number " << i << " now: "<<endl;
2088  InBT->PrintNice();
2089  }
2090  //-----------------------------------
2091 
2092  //-----------------------------------
2093  // 1) Make local_gAli with cut parameters:
2094  //-----------------------------------
2095  local_gAli = TransformEdbPVRec(GLOBAL_gAli, InBT);
2096  // Add InBT to GLOBAL_ShowerSegArray
2097  GLOBAL_ShowerSegArray -> Add(InBT);
2098  //-----------------------------------
2099 
2100  //-----------------------------------
2101  // 1a) Set Some Variables
2102  //-----------------------------------
2103  StartPosX=InBT->X();
2104  StartPosY=InBT->Y();
2105  StartPosTX=InBT->TX();
2106  StartPosTY=InBT->TY();
2107  //-----------------------------------
2108 
2109  //-----------------------------------
2110  // 1b) Now SetBins for the 2D, 3D Histograms for THIS (specific) Event
2111  //-----------------------------------
2112 
2113  cout << "Reset now some other histos"<<endl;
2114  for (Int_t h=0; h<50; h++) {
2115  Hist2DimOnlyBGOneGroupedPlate[h]->Reset();
2118  }
2119 
2120  cout << "Reset now some other SetNameTitle "<<endl;
2121  Hist2DimOnlyBGAllPlates->SetNameTitle("Hist2DimOnlyBGAllPlates","Hist2DimOnlyBGAllPlates");
2122  Hist2DimOnlySimOneEventAllPlates->SetNameTitle("Hist2DimOnlySimOneEventAllPlates","Hist2DimOnlySimOneEventAllPlates");
2123  Hist2DimBGAndSimOneEventAllPlates->SetNameTitle("Hist2DimBGAndSimOneEventAllPlates","Hist2DimBGAndSimOneEventAllPlates");
2124  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);
2125  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);
2126  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);
2127 
2128  cout << "Reset now some other SetNameTitle "<<endl;
2129  Hist3DimOnlyBG->SetNameTitle("Hist3DimOnlyBG","Hist3DimOnlyBG");
2130  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);
2131  Hist3DimRecoEvent_gAli->SetNameTitle("Hist3DimRecoEvent_gAli","Hist3DimRecoEvent_gAli");
2132  Hist3DimRecoEvent_gAli->SetBins( NbinsX, LeftX, RightX, NbinsY, LeftY, RightY, NGroupedPLATES, (FIRSTPLATE-1)*1300, (LASTPLATE)*1300);
2133 
2134  cout << "Reset now some other SetNameTitle "<<endl;
2135  Hist2DimOnlyBGAllPlates->Reset();
2138  Hist3DimOnlyBG->Reset();
2139  Hist3DimRecoEvent_gAli->Reset();
2140 
2141  //-----------------------------------
2142  // 1c) Define the Histograms Bounds and Bins,
2143  // 1c) Since Bounds are depending on h ...
2144  //-----------------------------------
2145  Float_t InBT_X=InBT->X();
2146  Float_t InBT_TX=InBT->TX();
2147  Float_t InBT_X_Extrapolated;
2148  Float_t InBT_Y=InBT->Y();
2149  Float_t InBT_TY=InBT->TY();
2150  Float_t InBT_Y_Extrapolated;
2151  Float_t InBT_Z=InBT->Z();
2152  for (Int_t h=0; h<NGroupedPLATES; h++) {
2153  //cout << "--------------------"<<endl;
2154  Float_t zdiff=ZPosGroupedPlates[h]-InBT_Z;
2155  InBT_X_Extrapolated=InBT_X+InBT_TX*zdiff;
2156  InBT_Y_Extrapolated=InBT_Y+InBT_TY*zdiff;
2157  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;
2158  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;
2159  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);
2160  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);
2161  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);
2162  }
2163  //=========================================
2164 
2165 
2166 
2167  //-----------------------------------
2168  // 1c) Loop over (whole) local_gAli, Fill the Histograms (from firstplate up to lastplate)
2169  //-----------------------------------
2170  Int_t val, val_tan;
2171  Int_t local_gAli_npat=local_gAli->Npatterns();
2172  if (gEDBDEBUGLEVEL>2) cout << "--- local_gAli_npat= " << local_gAli_npat << endl;
2173 
2174  // Loop over all plates of local_gAli, since this is already
2175  // extracted with the right numbers of plates...
2176  for (Int_t patterloop_cnt=local_gAli_npat-1; patterloop_cnt>=0; --patterloop_cnt) {
2177  if (gEDBDEBUGLEVEL>3) cout << "--- --- Doing patterloop_cnt= " << patterloop_cnt << endl;
2178 
2179  as = (TClonesArray*)local_gAli->GetPattern(patterloop_cnt)->GetSegments();
2180  as_pattern= (EdbPattern*)local_gAli->GetPattern(patterloop_cnt);
2181 
2182  cout << "===DEBUG patterloop_cnt= " << patterloop_cnt << " Z pos (k) " << local_gAli->GetPattern(patterloop_cnt)->Z() << endl; // get Z pos of the plate k
2183  cout << "===DEBUG (patterloop_cnt) EdbSegments in the Pattern (total): " << as->GetEntries() << endl;
2184 
2185  for (Int_t h=0; h<as->GetEntries(); h++) {
2186  sa = (EdbSegP*)( as->At(h) );
2188  val=Reco_CL_AssignZValueToGroup(sa->Z(), ZPosGroupedPlates[0], NGroupedPLATES, PLATESPERGROUP);
2189  cout << "entry, val "<<h << " " << val<<endl;
2190  Hist2DimBGAndSimOneEventOneGroupedPlate[val]->Fill(sa->X(),sa->Y());
2191  if (sa->MCEvt()<0) Hist2DimOnlyBGOneGroupedPlate[val]->Fill(sa->X(),sa->Y());
2192  if (FillTANData) {
2193  val_tan=Reco_CL_AssignZValueToGroup(sa->Z()+1300, ZPosGroupedPlates[0], NGroupedPLATES, PLATESPERGROUP);
2194  cout << "(TAN) entry, val_tan "<<h << " " << val_tan<<endl;
2195  if (val_tan>=NGroupedPLATES) {
2197  ++val_tan; // Project the last on beack to its owns
2198  cout << "(TAN) val_tan changed to "<<h << " " << val_tan<<endl;
2199  }
2200  Hist2DimBGAndSimOneEventOneGroupedPlate[val_tan]->Fill(sa->X()+sa->TX()*1300,sa->Y()+sa->TY()*1300);
2201  if (sa->MCEvt()<0) Hist2DimOnlyBGOneGroupedPlate[val_tan]->Fill(sa->X()+sa->TX()*1300,sa->Y()+sa->TY()*1300);
2202  }
2203  if (sa->MCEvt()<0) continue;
2204  if (sa->MCEvt()!=GLOBAL_InBT_MC) continue;
2205  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;
2206  Hist2DimOnlySimOneEventOneGroupedPlate[val]->Fill(sa->X(),sa->Y());
2207  if (FillTANData) {
2208  Hist2DimOnlySimOneEventOneGroupedPlate[val_tan]->Fill(sa->X()+sa->TX()*1300,sa->Y()+sa->TY()*1300);
2209  }
2210  }
2211 
2212  } //of Loop over all plates of local_gAli,
2213 
2214 
2215  cout<<endl<<endl;
2216  cout <<"Loop over the Grouped plates and search for spectrum peaks in each groupedPlate."<<endl;
2219  for (Int_t h=0; h<NGroupedPLATES; h++) {
2220 
2222  for (Int_t cnti = 0; cnti < NbinsX_gAliSub; cnti++) {
2223  for (Int_t cntj = 0; cntj < NbinsY_gAliSub; cntj++) {
2224  source[cnti][cntj] = 0; // Reset source before filling it new...
2225  dest[cnti][cntj] = 0; // Reset dest before filling it new...
2226  source[cnti][cntj] = Hist2DimBGAndSimOneEventOneGroupedPlate[h]->GetBinContent(cnti + 1,cntj + 1);
2227  }
2228  }
2231  Int_t nfound=0;
2232  cout << " Do now peak search..."<<endl;
2233  nfound = spectrum2dim->SearchHighRes(source, dest, NbinsX_gAliSub, NbinsY_gAliSub, 2, 20, kTRUE, 10, kFALSE, 5);// TO BE OPTIMIZED...
2234  cout << " Peak search finished. Go on."<<endl;
2237  spectrum_interim->Reset();
2239  Int_t interimsbin=0;
2240  TAxis *xax;
2241  TAxis *yax;
2242  TAxis *zax;
2243  Double_t xax_bin_value;
2244  Double_t yax_bin_value;
2245  Double_t zax_bin_value;
2246  Double_t value;
2247 
2249  for (Int_t ii = 0; ii < NbinsX_gAliSub; ii++) {
2250  for (Int_t jj = 0; jj < NbinsY_gAliSub; jj++) {
2251  value=dest[ii][jj];
2252  spectrum_interim->SetBinContent(ii + 1,jj + 1, value);
2253  }
2254  }
2255  Float_t THRESHOLD_SMOOTHED_DEST=0.5;
2256  cout << "THRESHOLD_SMOOTHED_DEST spectrum_interim->GetMaximum() : " << THRESHOLD_SMOOTHED_DEST << " " << spectrum_interim->GetMaximum()<< endl;
2257  cout << "----------_"<<endl;
2258 
2259  Double_t spec_int_maximum=spectrum_interim->GetMaximum();
2260 
2263  for (Int_t ii = 0; ii < NbinsX_gAliSub; ii++) {
2264  for (Int_t jj = 0; jj < NbinsY_gAliSub; jj++) {
2265  // cout << " h ii jj THRESHOLD_SMOOTHED_DEST dest[ii][jj] "<< h << " " << ii << " " << jj << " " << THRESHOLD_SMOOTHED_DEST << " " << dest[ii][jj] << endl;
2266  if (dest[ii][jj]<THRESHOLD_SMOOTHED_DEST*spec_int_maximum) continue;
2267  value=dest[ii][jj];
2268  spectrum_interim->SetBinContent(ii + 1,jj + 1, value);
2269  xax_bin_value=spectrum_interim->GetXaxis()->GetBinCenter(ii + 1);
2270  yax_bin_value=spectrum_interim->GetYaxis()->GetBinCenter(jj + 1);
2271  zax_bin_value=ZPosGroupedPlates[h];
2272  // cout <<" xax_bin ii jj (xyz) value "<< xax_bin_value << " " << ii << " " << jj<< " " <<xax_bin_value << " " << yax_bin_value<< " " << zax_bin_value<<" " << value << endl;
2273  Hist3DimRecoEvent_gAli->Fill(xax_bin_value,yax_bin_value,zax_bin_value, value);
2274  }
2275  }
2276  cout << "THRESHOLD_SMOOTHED_DEST spectrum_interim->GetMaximum() : " << THRESHOLD_SMOOTHED_DEST << " " << spectrum_interim->GetMaximum()<< endl;
2277  cout << "----------_"<<endl;
2278 
2279  //AllGroupsSimPlusBGittedSpectrum->cd(h+1);
2280  //spectrum_interim->DrawCopy("colz");
2281  }
2284 
2285 
2286 
2287 
2288 
2289  return;
2290 
2291  //-----------------------------------
2292  // 2) Loop over (whole) local_gAli, check BT for Cuts
2293  //-----------------------------------
2294  // Int_t local_gAli_npat=local_gAli->Npatterns();
2295  if (gEDBDEBUGLEVEL>2) cout << "--- local_gAli_npat= " << local_gAli_npat << endl;
2296 
2297  // Loop over all plates of local_gAli, since this is already
2298  // extracted with the right numbers of plates...
2299  for (Int_t patterloop_cnt=local_gAli_npat-1; patterloop_cnt>=0; --patterloop_cnt) {
2300  if (gEDBDEBUGLEVEL>3) cout << "--- --- Doing patterloop_cnt= " << patterloop_cnt << endl;
2301 
2302  for (Int_t btloop_cnt=0; btloop_cnt<local_gAli->GetPattern(patterloop_cnt)->GetN(); ++btloop_cnt) {
2303  seg = (EdbSegP*)local_gAli->GetPattern(patterloop_cnt)->GetSegment(btloop_cnt);
2304  if (gEDBDEBUGLEVEL>3) seg->PrintNice();
2305 
2306  // Now apply cut conditions: CT ConeTube Alg --------------------
2307  if (!GetConeOrTubeDistanceToInBT(seg, InBT, CUT_PARAMETER[0], CUT_PARAMETER[1])) continue;
2308  if (!FindPrecedingBTs(seg, InBT, local_gAli, GLOBAL_ShowerSegArray)) continue;
2309  // end of cut conditions: CT ConeTube Alg --------------------
2310 
2311  // If we arrive here, Basetrack seg has passed criteria
2312  // and is then added to the shower array:
2313  // Check if its not the InBT which is already added:
2314  if (seg->X()==InBT->X()&&seg->Y()==InBT->Y()) {
2315  ; // do nothing;
2316  }
2317  else {
2318  GLOBAL_ShowerSegArray -> Add(seg);
2319  }
2320  }
2321  // Calc BT density around shower:
2322  EdbPattern* pat_interim=local_gAli->GetPattern(patterloop_cnt);
2323  CalcTrackDensity(pat_interim,local_gAli_pat_interim_halfsize,npat_int,npat_total,npatN);
2324 
2325  // Calc TrackNumbers for plate for efficency numbers:
2326  CalcEfficencyNumbers(pat_interim, InBT->MCEvt(), NBT_Neff, NBTMC_Neff ,NBTMCe_Neff);
2327  }
2328  // end of loop over all plates of local_gAli
2330 
2331  //-----------------------------------
2332  // 4) Calculate pur/eff/NBT numbers,
2333  // not needed when only reconstruction
2334  // done:
2335  //-----------------------------------
2336  if (cmd_OUTPUTLEVEL>=2 || cmd_OUTPUTLEVEL==0 ) {
2337  Int_t NBT=0;
2338  Int_t NBTMC=0;
2339  Int_t NBTallMC=0;
2340  Int_t NBTeMC=0;
2341  Double_t eff, purall, pure;
2342  CalcEffPurOfShower2(GLOBAL_ShowerSegArray, NBT, NBTMC, NBTallMC, NBTeMC, purall, pure, NBT_Neff, NBTMC_Neff ,NBTMCe_Neff);
2343 
2344  // Fill only for MC Event:
2345  if (GLOBAL_InBT_MC>0) {
2350  }
2352  }
2353 
2354 
2355  //-----------------------------------
2356  // 5) Fill Tree:
2357  //-----------------------------------
2358  TREE_ShowRecEff->Fill();
2359  if (gEDBDEBUGLEVEL>3) TREE_ShowRecEff->Show(TREE_ShowRecEff->GetEntries()-1);
2360 
2361 
2362  //-----------------------------------
2363  // 6a) Transfer ShowerArray to treebranchTreeEntry:
2364  //-----------------------------------
2365  if (cmd_OUTPUTLEVEL>0) {
2367  }
2368 
2369 
2370  //------------------------------------
2371  // Reset and delete important things:
2372  // also to avoid memory problems ...
2373  //-----------------------------------
2374  GLOBAL_ShowerSegArray->Clear();
2375  if (gEDBDEBUGLEVEL>3) cout << "--- ---GLOBAL_ShowerSegArray->GetEntries(): "<< GLOBAL_ShowerSegArray->GetEntries() << endl;
2376  delete local_gAli;
2377  local_gAli=0;
2379  //------------------------------------
2380  }
2381  // end of loop over GLOBAL_InBTArrayEntries
2382  //-----------------------------------------------------------------
2383 
2384  if (gEDBDEBUGLEVEL==2) cout << endl<<flush;
2385  if (gEDBDEBUGLEVEL>3) cout << "---TREE_ShowRecEff->GetEntries() ... " << TREE_ShowRecEff->GetEntries() << endl;
2386  if (gEDBDEBUGLEVEL>3) cout << "---GLOBAL_INBTSHOWERNR ... " << GLOBAL_INBTSHOWERNR<< endl;
2387 
2388 
2389  return;
2390 }
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 ( )
2463 {
2464  Log(2, "ShowRec.cpp", "--- void ReconstructShowers_CT() ---");
2465 
2466  //-----------------------------------------------------------------
2467  // Main function for reconstruction of ConeTube Algorithm
2468  //-----------------------------------------------------------------
2469  //
2470  // For each InitiatorBT this is
2471  // divided in several small parts:
2472  // 1) Make local_gAli with cut parameters, Make GetPID of InBT and corresponding of plates
2473  // 3) Loop over (whole) local_gAli, check BT for Cuts
2474  // 4) Calculate pur/eff/NBT numbers
2475  // 5) Fill Trees
2476  //-----------------------------------
2477 
2478  // Define Helper Variables:
2479  EdbPVRec* local_gAli;
2480  EdbSegP* InBT;
2481  EdbSegP* seg;
2482  Float_t local_gAli_pat_interim_halfsize=0;
2483 
2486  cout << "GLOBAL_InBTArrayEntries = " << GLOBAL_InBTArrayEntries << endl;
2487 
2488  //-----------------------------------------------------------------
2489  // Since GLOBAL_InBTArray is filled in ascending ordering by zpositon
2490  // We use the descending loop to begin with BT with lowest z first.
2491  for (Int_t i=GLOBAL_InBTArrayEntries-1; i>=0; --i) {
2492 
2493  //-----------------------------------
2494  // CounterOutPut
2495  if (gEDBDEBUGLEVEL==2) if ((i%1)==0) cout << GLOBAL_InBTArrayEntries <<" InBT in total, still to do:"<<Form("%4d",i)<< "\r\r\r\r"<<flush;
2496  if (gEDBDEBUGLEVEL==1) {
2497  int modulo=GLOBAL_InBTArrayEntries/20;
2498  if ((i%modulo)==0) cout << i <<" : 5% more done"<<endl;
2499  }
2500  //-----------------------------------
2501 
2502  //-----------------------------------
2503  // Get InitiatorBT from GLOBAL_InBTArray
2504  InBT=(EdbSegP*)GLOBAL_InBTArray->At(i);
2505  //--------
2506  GLOBAL_InBT_E=InBT->P();
2507  GLOBAL_InBT_TanTheta=TMath::Sqrt(InBT->TX()*InBT->TX()+InBT->TY()*InBT->TY());
2508  GLOBAL_InBT_Flag=InBT->Flag();
2509  GLOBAL_InBT_MC=InBT->MCEvt();
2510  //--------
2511  Int_t local_NBT=0;
2512  Int_t local_NBTMC=0;
2513  Int_t local_NBTallMC=0;
2514  Int_t local_NBTeMC=0;
2515  float_t local_pure=-1;
2516  float_t local_purall=-1;
2517  Int_t npat_int=0;
2518  Int_t npat_total=0;
2519  Int_t npatN=0;
2520  Int_t npat_Neff=0;
2521  Int_t NBT_Neff=0;
2522  Int_t NBTMC_Neff=0;
2523  Int_t NBTMCe_Neff=0;
2524  //--------
2525 
2526  if (gEDBDEBUGLEVEL>2) {
2527  cout << endl << endl << "--- Starting Shower for Number " << i << " now: "<<endl;
2528  InBT->PrintNice();
2529  }
2530  //-----------------------------------
2531 
2532  //-----------------------------------
2533  // 1) Make local_gAli with cut parameters:
2534  //-----------------------------------
2535  local_gAli = TransformEdbPVRec(GLOBAL_gAli, InBT);
2536  // Add InBT to GLOBAL_ShowerSegArray
2537  GLOBAL_ShowerSegArray -> Add(InBT);
2538  //-----------------------------------
2539 
2540 
2541  //-----------------------------------
2542  // 2) Loop over (whole) local_gAli, check BT for Cuts
2543  //-----------------------------------
2544  Int_t local_gAli_npat=local_gAli->Npatterns();
2545  if (gEDBDEBUGLEVEL>2) cout << "--- local_gAli_npat= " << local_gAli_npat << endl;
2546 
2547  // Loop over all plates of local_gAli, since this is already
2548  // extracted with the right numbers of plates...
2549  for (Int_t patterloop_cnt=local_gAli_npat-1; patterloop_cnt>=0; --patterloop_cnt) {
2550  if (gEDBDEBUGLEVEL>3) cout << "--- --- Doing patterloop_cnt= " << patterloop_cnt << endl;
2551 
2552  for (Int_t btloop_cnt=0; btloop_cnt<local_gAli->GetPattern(patterloop_cnt)->GetN(); ++btloop_cnt) {
2553  seg = (EdbSegP*)local_gAli->GetPattern(patterloop_cnt)->GetSegment(btloop_cnt);
2554  if (gEDBDEBUGLEVEL>3) seg->PrintNice();
2555 
2556  // Now apply cut conditions: CT ConeTube Alg --------------------
2557  if (!GetConeOrTubeDistanceToInBT(seg, InBT, CUT_PARAMETER[0], CUT_PARAMETER[1])) continue;
2558  if (!FindPrecedingBTs(seg, InBT, local_gAli, GLOBAL_ShowerSegArray)) continue;
2559  // end of cut conditions: CT ConeTube Alg --------------------
2560 
2561  // If we arrive here, Basetrack seg has passed criteria
2562  // and is then added to the shower array:
2563  // Check if its not the InBT which is already added:
2564  if (seg->X()==InBT->X()&&seg->Y()==InBT->Y()) {
2565  ; // do nothing;
2566  }
2567  else {
2568  GLOBAL_ShowerSegArray -> Add(seg);
2569  }
2570  }
2571  // Calc BT density around shower:
2572  EdbPattern* pat_interim=local_gAli->GetPattern(patterloop_cnt);
2573  CalcTrackDensity(pat_interim,local_gAli_pat_interim_halfsize,npat_int,npat_total,npatN);
2574 
2575  // Calc TrackNumbers for plate for efficency numbers:
2576  CalcEfficencyNumbers(pat_interim, InBT->MCEvt(), NBT_Neff, NBTMC_Neff ,NBTMCe_Neff);
2577  }
2578  // end of loop over all plates of local_gAli
2580 
2581  //-----------------------------------
2582  // 4) Calculate pur/eff/NBT numbers,
2583  // not needed when only reconstruction
2584  // done:
2585  //-----------------------------------
2586  if (cmd_OUTPUTLEVEL>=2 || cmd_OUTPUTLEVEL==0 ) {
2587  Int_t NBT=0;
2588  Int_t NBTMC=0;
2589  Int_t NBTallMC=0;
2590  Int_t NBTeMC=0;
2591  Double_t eff, purall, pure;
2592  CalcEffPurOfShower2(GLOBAL_ShowerSegArray, NBT, NBTMC, NBTallMC, NBTeMC, purall, pure, NBT_Neff, NBTMC_Neff ,NBTMCe_Neff);
2593 
2594  // Fill only for MC Event:
2595  if (GLOBAL_InBT_MC>0) {
2600  }
2602  }
2603 
2604 
2605  //-----------------------------------
2606  // 5) Fill Tree:
2607  //-----------------------------------
2608  TREE_ShowRecEff->Fill();
2609  if (gEDBDEBUGLEVEL>3) TREE_ShowRecEff->Show(TREE_ShowRecEff->GetEntries()-1);
2610 
2611 
2612  //-----------------------------------
2613  // 6a) Transfer ShowerArray to treebranchTreeEntry:
2614  //-----------------------------------
2615  if (cmd_OUTPUTLEVEL>0) {
2617  }
2618 
2619 
2620  //------------------------------------
2621  // Reset and delete important things:
2622  // also to avoid memory problems ...
2623  //-----------------------------------
2624  GLOBAL_ShowerSegArray->Clear();
2625  if (gEDBDEBUGLEVEL>3) cout << "--- ---GLOBAL_ShowerSegArray->GetEntries(): "<< GLOBAL_ShowerSegArray->GetEntries() << endl;
2626  delete local_gAli;
2627  local_gAli=0;
2629  //------------------------------------
2630  }
2631  // end of loop over GLOBAL_InBTArrayEntries
2632  //-----------------------------------------------------------------
2633 
2634  if (gEDBDEBUGLEVEL==2) cout << endl<<flush;
2635  if (gEDBDEBUGLEVEL>3) cout << "---TREE_ShowRecEff->GetEntries() ... " << TREE_ShowRecEff->GetEntries() << endl;
2636  if (gEDBDEBUGLEVEL>3) cout << "---GLOBAL_INBTSHOWERNR ... " << GLOBAL_INBTSHOWERNR<< endl;
2637 
2638 
2639  return;
2640 }

◆ 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 !!!


5372 {
5373  Log(2, "ShowRec.cpp", "--- void ReconstructShowers_GS() ---");
5374  //-----------------------------------------------------------------
5375  // Main function for reconstruction of "Gamma Search" Algorithm
5376  //-----------------------------------------------------------------
5377 
5378 
5379 
5380  //-----------------------------------
5381  // For each InitiatorBT this is
5382  // divided in several small parts:
5383  //
5384  // 1) Make local_gAli with cut parameters, Make GetPID of InBT and corresponding of plates
5385  // 3) Loop over (whole) local_gAli, search and check BT pairs for suts
5386  // 4) Calculate pur/eff/NBT numbers
5387  // 5) Fill Trees
5388  //-----------------------------------
5389 
5390  // Define Helper Variables:
5391  EdbPVRec* local_gAli;
5392  EdbSegP* InBT;
5393  EdbSegP* seg;
5394  Float_t local_gAli_pat_interim_halfsize=0;
5395 
5398 
5399  Bool_t IsFirstLoopCount=kTRUE;
5400  Int_t LastGlobalMCEventNr=1;
5401 
5402  EdbVertex* vtx=new EdbVertex();
5403 
5404  //-----------------------------------------------------------------
5405  // Since GLOBAL_InBTArray is filled in ascending ordering by zpositon
5406  // We use the descending loop to begin with BT with lowest z first.
5407  for (Int_t i=GLOBAL_InBTArrayEntries-1; i>=0; --i) {
5408 
5409  //-----------------------------------
5410  // CounterOutPut
5411  if (gEDBDEBUGLEVEL==2) if ((i%1)==0) cout << GLOBAL_InBTArrayEntries <<" InBT in total, still to do:"<<Form("%4d",i)<< "\r\r\r\r"<<flush;
5412  //-----------------------------------
5413 
5414  //-----------------------------------
5415  // Get InitiatorBT from GLOBAL_InBTArray
5416  InBT=(EdbSegP*)GLOBAL_InBTArray->At(i);
5417  //--------
5418  GLOBAL_InBT_E=InBT->P();
5419  GLOBAL_InBT_TanTheta=TMath::Sqrt(InBT->TX()*InBT->TX()+InBT->TY()*InBT->TY());
5420  GLOBAL_InBT_Flag=InBT->Flag();
5421  GLOBAL_InBT_MC=InBT->MCEvt();
5422  //--------
5423  Int_t local_NBT=0;
5424  Int_t local_NBTMC=0;
5425  Int_t local_NBTallMC=0;
5426  Int_t local_NBTeMC=0;
5427  float_t local_pure=-1;
5428  float_t local_purall=-1;
5429  Int_t npat_int=0;
5430  Int_t npat_total=0;
5431  Int_t npatN=0;
5432  Int_t npat_Neff=0;
5433  Int_t NBT_Neff=0;
5434  Int_t NBTMC_Neff=0;
5435  Int_t NBTMCe_Neff=0;
5436  //--------
5437 
5438  if (gEDBDEBUGLEVEL>2) {
5439  cout << endl << endl << "--- Starting Shower for Number " << i << " now: "<<endl;
5440  InBT->PrintNice();
5441  }
5442  //-----------------------------------
5443 
5444 
5445 
5446  //-----------------------------------
5447  // 0) Set vtx according to MC event,
5448  // or to a half plate backward propagated segment.
5449  // Do this only if the value -GBMC is NOT set,
5450  // (in the case -GBMC is set, we should know the vertex anyway).
5451  //-----------------------------------
5452  //
5453  if (GLOBAL_InBT_MC>LastGlobalMCEventNr) LastGlobalMCEventNr=GLOBAL_InBT_MC;
5454  //
5455  //
5456  if (GLOBAL_InBT_MC<0&& cmd_GBMC<0) {
5457  // This is an "equalization" effect. If we dont put this in, we will have BG base
5458  // tracks always extrapolated to themselves, but SIM basetracks extrapolated to
5459  // the vertex. This leads to a wrong deltaZ distribution which spoils the
5460  // ANN Training.
5461  if( IsFirstLoopCount==kTRUE) cout << "Option: GLOBAL_InBT_MC<0&& cmd_GBMC<0"<<endl;
5462  vtx->SetXYZ(GLOBAL_VtxArrayX[LastGlobalMCEventNr],GLOBAL_VtxArrayY[LastGlobalMCEventNr],GLOBAL_VtxArrayZ[LastGlobalMCEventNr]);
5463  }
5464  //
5465  else if (GLOBAL_InBT_MC<0 && cmd_GBMC==0) {
5466  if( IsFirstLoopCount==kTRUE) cout << "Option: GLOBAL_InBT_MC<0 && cmd_GBMC==0"<<endl;
5467  vtx->SetXYZ(InBT->X()-650*InBT->TX(),InBT->Y()-650*InBT->TY(),InBT->Z()-650);
5468  }
5469  else if (GLOBAL_InBT_MC<0 && cmd_GBMC>0) {
5470  if( IsFirstLoopCount==kTRUE) cout << "Option: GLOBAL_InBT_MC<0 && cmd_GBMC>0"<<endl;
5472  }
5473  else if (GLOBAL_InBT_MC>0 && GLOBAL_IsBrickTreePGunInfo==kFALSE) {
5474  if( IsFirstLoopCount==kTRUE) cout << "Option: GLOBAL_InBT_MC>0 && GLOBAL_IsBrickTreePGunInfo==kFALSE"<<endl;
5475  vtx->SetXYZ(InBT->X()-650*InBT->TX(),InBT->Y()-650*InBT->TY(),InBT->Z()-650);
5476  }
5477  else {
5478  if( IsFirstLoopCount==kTRUE) cout << "Option: else"<<endl;
5480  }
5481  vtx->SetMC(GLOBAL_InBT_MC);
5482 
5483  if (gEDBDEBUGLEVEL>2) {
5484  cout << "The vtx info for this MC event: X:Y:Z:MC: " << vtx->X() << " " << vtx->Y() << " " << vtx->Z() << " " << GLOBAL_InBT_MC << endl;
5485  cout << "The vtx info for this MC event: IP(INBT,vtx): " << CalcIP(InBT,vtx)<< endl;
5486  }
5487  //-----------------------------------
5488 
5489 
5490 
5491  //-----------------------------------
5492  // 1) Make local_gAli with cut parameters:
5493  //-----------------------------------
5494  local_gAli = TransformEdbPVRec(GLOBAL_gAli, InBT);
5495 
5496  // IN THIS ALGORITHM WE DO NOT YET AUTOMATICALLY ADD THE FIRST BT
5497  // SINCE WE NEED AN ADDIITONAL VERTEX CUT OF THIS FIRST BT TO CHECK!
5498  // // Add InBT to GLOBAL_ShowerSegArray
5499  // GLOBAL_ShowerSegArray -> Add(InBT);
5500  //-----------------------------------
5501 
5502 
5503  //-----------------------------------
5504  // 2) Loop over (whole) local_gAli, check InitiatorBT
5505  // 2) compatible with a segment forming a e+e- pair:
5506  // 2) (Loop over all plates of local_gAli, since this is already
5507  // 2) extracted with the right numbers of plates...)
5508  //-----------------------------------
5509  Int_t local_gAli_npat=local_gAli->Npatterns();
5510  Int_t btloop_cnt_N=0;
5511 
5515 
5516 
5517 
5518  Int_t npat=local_gAli->Npatterns();
5519  Int_t pat_one_bt_cnt_max,pat_two_bt_cnt_max=0;
5520  EdbPattern* pat_one=0;
5521  EdbPattern* pat_two=0;
5522  EdbSegP* Segment=0;
5523  EdbSegP* Segment2=0;
5524  Float_t distZ,IP_Pair_To_InBT,IP_Pair_To_InBT_SegSum;
5525  Float_t IP_Pair_To_InBT_Seg2;
5526 
5527 
5528  Segment = InBT;
5529  IP_Pair_To_InBT=CalcIP(Segment, vtx);
5532 
5533 
5534 
5535 
5536 
5537 
5538 
5539  // Loop over pattern for the first BT of the pairs:
5540  // Start first with the pattern with the lowest Z position.
5541  pat_one=local_gAli->GetPatternZLowestHighest(1);
5542  Float_t pat_one_Z=pat_one->Z();
5543  pat_one_bt_cnt_max=pat_one->GetN();
5544 
5545  for (Int_t pat_one_cnt=0; pat_one_cnt<npat; ++pat_one_cnt) {
5546 
5547 
5548  if (pat_one_cnt>0) {
5549  pat_one=(EdbPattern*)local_gAli->NextPattern(pat_one_Z,1);
5550  pat_one_Z=pat_one->Z();
5551  pat_one_bt_cnt_max=pat_one->GetN();
5552  }
5553 
5554  // Check if pattern Z() equals the InBZ->Z(), since we wanna have the
5555  // pattern one the pattern to contain the InBT:
5556  distZ=pat_one->Z()-InBT->Z();
5557  if (TMath::Abs(distZ)>10) continue;
5558  //cout << "distZ (pat_one->Z()-InBT->Z())= " << distZ << endl;
5559 
5560  // Check if InBT fulfills criteria for IP to vertex:
5561  if (IP_Pair_To_InBT>CUT_PARAMETER[0]) continue;
5562  // Check if InBT fulfills criteria for z-diff to vertex:
5563  if ((InBT->Z()-vtx->Z())>CUT_PARAMETER[3]) continue;
5564 
5565  // Now here we can add InBT since it passed also the vertex cut.
5566  // Therefore, the Reconstructed Shower has always InBT as first BT stored.
5567  if (GLOBAL_ShowerSegArray->GetEntries()==0) {
5568  GLOBAL_ShowerSegArray->Add(InBT);
5569  if (gEDBDEBUGLEVEL>2) {
5570  cout << "I have added the first InBT " << InBT << " to GLOBAL_ShowerSegArray." << endl;
5571  InBT->PrintNice();
5572  }
5573  }
5574 
5575  // Check if pattern dist Z to Vtx is ok:
5576  distZ=pat_one->Z()-vtx->Z();
5577  // Z distance has to be greater zero, cause the InBT
5578  // and other pair BTs shall come downstream the vertex:
5579  if (distZ<0) continue;
5580  //cout << "distZ (pat_one->Z()-vtx->Z();) = " << distZ << endl;
5581 
5582  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;
5583 
5584 
5585  // Loop over pattern for the second BT of the pairs:
5586  //
5587  //cout << "// Loop over pattern for the second BT of the pairs: "<< endl;
5588 
5589  pat_two=local_gAli->GetPatternZLowestHighest(1);
5590  Float_t pat_two_Z=pat_two->Z();
5591  pat_two_bt_cnt_max=pat_two->GetN();
5592 
5593  for (Int_t pat_two_cnt=0; pat_two_cnt<npat; ++pat_two_cnt) {
5594 
5595  if (pat_two_cnt>0) {
5596  pat_two=(EdbPattern*)local_gAli->NextPattern(pat_two_Z,1);
5597  pat_two_Z=pat_two->Z();
5598  pat_two_bt_cnt_max=pat_two->GetN();
5599  }
5600 
5601  // PID diff of two plates may be maximum [0..PidDIFFN]
5602  if (TMath::Abs(pat_one_cnt-pat_two_cnt)>CUT_PARAMETER[5]) continue;
5603 
5604  // pattern two should come downstream pattern one:
5605  if (pat_two->Z()<pat_one->Z()) continue;
5606 
5607 
5608  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;
5609 
5610 
5611  for (Int_t pat_one_bt_cnt=0; pat_one_bt_cnt<pat_one_bt_cnt_max; ++pat_one_bt_cnt) {
5616 
5617  for (Int_t pat_two_bt_cnt=0; pat_two_bt_cnt<pat_two_bt_cnt_max; ++pat_two_bt_cnt) {
5618  Segment2 = (EdbSegP*)pat_two->GetSegment(pat_two_bt_cnt);
5619 
5620  // Ceck if segments are not (by chance) the same:
5621  if (Segment2==Segment) continue;
5622  if (Segment2->ID()==Segment->ID()&&Segment2->PID()==Segment->PID()) continue;
5623  if (IsSameSegment(Segment2,Segment)) continue;
5624 
5625 
5626 
5629 
5630  // Now apply cut conditions: GS GAMMA SEARCH Alg --------------------
5631 
5632  // Check if IP of both to vtx (BT) is ok:
5633  IP_Pair_To_InBT_Seg2 =CalcIP(Segment2, vtx);
5634  if (IP_Pair_To_InBT_Seg2>CUT_PARAMETER[0]) continue;
5635 
5636  // if InBT is flagged as MC InBT, take care that only BG or same MC basetracks are taken:
5637  if (InBT->MCEvt()>0) if (Segment->MCEvt()>0&&Segment2->MCEvt()>0) if (Segment->MCEvt()!=Segment2->MCEvt()) continue;
5638  if (InBT->MCEvt()>0) if (Segment->MCEvt()>0&&Segment2->MCEvt()>0) if (Segment->MCEvt()!=InBT->MCEvt()) continue;
5639  if (InBT->MCEvt()>0) if (Segment->MCEvt()>0&&Segment2->MCEvt()>0) if (Segment2->MCEvt()!=InBT->MCEvt()) continue;
5640 
5641  // In case of two MC events, check for e+ e- pairs
5642  // Do this ONLY IF parameter eParaValue[6] is set to choose different Flag() pairs:
5643  if (InBT->MCEvt()>0 && CUT_PARAMETER[6]==1) {
5644  if (Segment->MCEvt()>0&&Segment2->MCEvt()>0) {
5645  if ((Segment2->Flag()+Segment->Flag())!=0) continue;
5646  }
5647  }
5648 
5649  // a) Check dR between tracks:
5650  if (GetdeltaRWithPropagation(Segment,Segment2)>CUT_PARAMETER[2]) continue;
5651  // b) Check dT between tracks:
5652  if (GetdeltaThetaSingleAngles(Segment,Segment2)>CUT_PARAMETER[4]) continue;
5653  // c) Check dMinDist between tracks:
5654  if (GetMinimumDist(Segment,Segment2)>CUT_PARAMETER[1]) continue;
5655 
5656  // f) Check if this is not a possible fake doublet which is
5657  // sometimes caused by view overlap in the scanning:
5658  // in the EdbPVRQuality class this will be done at start for the whole
5659  // PVR object so this will be later on obsolete.
5661  //
5662  // end of cut conditions: GS GAMMA SEARCH Alg --------------------
5663  //
5664 
5665 
5666  if (gEDBDEBUGLEVEL>3) {
5667  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;
5668  cout << "EdbShowAlg_GS::FindPairs GetdeltaRWithPropagation(Segment,Segment2) = " << GetdeltaRWithPropagation(Segment,Segment2) << endl;
5669  cout << "EdbShowAlg_GS::FindPairs GetdeltaThetaSingleAngles(Segment,Segment2) = " << GetdeltaThetaSingleAngles(Segment,Segment2) << endl;
5670  cout << "EdbShowAlg_GS::FindPairs GetMinimumDist(Segment,Segment2) = " << GetMinimumDist(Segment,Segment2) << endl;
5671  cout << "EdbShowAlg_GS::FindPairs CalcIP(BetterSegment,InBT) = " << IP_Pair_To_InBT << endl;
5672  }
5673 
5674  if (gEDBDEBUGLEVEL>3) cout <<"------------"<< endl;
5675 
5676  // And Add Segment2 to to shower array:
5677 // cout << "// Add Segment2 to to shower array (AddBTToArrayWithCeck):" << endl;
5678  Bool_t isContained = AddBTToArrayWithCeck(Segment2, GLOBAL_ShowerSegArray);
5679  //PrintShowerObjectArray(GLOBAL_ShowerSegArray);
5680 // cout << " isContained == " << isContained << endl;
5681  if (isContained==kTRUE) continue;
5682 
5683  } //for (Int_t pat_two_bt_cnt=0; ...
5684 
5685  } //for (Int_t pat_one_bt_cnt=0; ...
5686 
5687  } // for (Int_t pat_two_cnt=0; ...
5688 
5689 
5690  // Now here do the usual rest for BG density calculation:
5691  //...
5692  // Calc BT density around shower:
5693  EdbPattern* pat_interim=local_gAli->GetPattern(pat_one_cnt);
5694  CalcTrackDensity(pat_interim,local_gAli_pat_interim_halfsize,npat_int,npat_total,npatN);
5695 
5696  // Calc TrackNumbers for plate for efficency numbers:
5697  CalcEfficencyNumbers(pat_interim, InBT->MCEvt(), NBT_Neff, NBTMC_Neff ,NBTMCe_Neff);
5698 
5699  } //for (Int_t pat_one_cnt=0; ...
5700 
5701 
5705 
5706  if (gEDBDEBUGLEVEL>2) cout << " GLOBAL_ShowerSegArray->GetEntries() " << GLOBAL_ShowerSegArray->GetEntries() << endl;
5707 
5711 
5712  if (GLOBAL_ShowerSegArray->GetEntries()>1) {
5713 
5714  Segment=(EdbSegP*)GLOBAL_ShowerSegArray->At(0);
5715  Segment2=(EdbSegP*)GLOBAL_ShowerSegArray->At(1);
5716 
5717 
5718 
5719  if (gEDBDEBUGLEVEL>2) {
5720  cout << "ONLY FOR THE ANN TRAINING FOR GS ALGO: " << endl;
5721  cout << "DO THIS ONLY IF YOU HAVE PAIRS !!!: " << endl;
5722  cout << "YES WE HAVE A PAIR Print all segs in the array: " << endl;
5723  for (int l=0; l<GLOBAL_ShowerSegArray->GetEntries(); ++l) {
5725  s->PrintNice();
5726  }
5727 // Segment->PrintNice();
5728 // Segment2->PrintNice();
5729  cout << "Print again the InBT for crosscheck: InBT= " << endl;
5730  InBT->PrintNice();
5731  cout << "Address of Segment = " << Segment << endl;
5732  cout << "Address of Segment2 = " << Segment2 << endl;
5733  }
5734 
5735 
5736 
5737  // Implicitly, we assume that InBT= Seg->At(0), which I checked is
5738  // correct. Also in the code it is done this way that InBT is added
5739  // as first BT.
5740  //Segment->PrintNice();
5741  //Segment2->PrintNice();
5742  //InBT->PrintNice();
5743 
5744  IP_Pair_To_InBT_Seg2=CalcIP(Segment2,vtx);
5745  IP_Pair_To_InBT=CalcIP(Segment,vtx);
5746 
5747  // Check if both basetracks have a vertex which is upstream
5748  // of both tracks (only then the two BT are really pointing).
5749  TObjArray *segments = new TObjArray(2);
5750  segments->Clear();
5751  segments->Add(Segment);
5752  segments->Add(Segment2);
5753  EdbVertex* vetex = new EdbVertex();
5754  vetex = CalcVertex(segments);
5755  cout << "Calculated helper _vetex_ out of the first two segments. " << endl;
5756  cout <<"vetex ->X,Y,Z: " << vetex ->X() << " " << vetex ->Y() << " " << vetex ->Z()<< endl;
5757  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;
5758  cout << "Check: TMath::Min(Segment->Z(),Segment2->Z()) " << TMath::Min(Segment->Z(),Segment2->Z()) << endl;
5759  cout <<"Segment->Z(): " << Segment->Z() << " Segment2->Z() " << Segment2->Z() << endl;
5760  cout << "Address of Segment = " << Segment << endl;
5761  cout << "Address of Segment2 = " << Segment2 << endl;
5762  if (vetex ->Z()> TMath::Min(Segment->Z(),Segment2->Z()) ) {
5763  cout << " Hmm, do nothing..." << endl;
5764  }
5765  else {
5766 
5767  Float_t IP_Seg1ToVtxSeg1Seg2=0;
5768  Float_t IP_Seg2ToVtxSeg1Seg2=0;
5769  IP_Seg1ToVtxSeg1Seg2 = CalcIP(Segment ,vetex);
5770  IP_Seg2ToVtxSeg1Seg2 = CalcIP(Segment2,vetex);
5771 
5772  Int_t eRecoMode=2;
5773  cout << "WARNING eRecoMode konstant set to =2 TODO .... change on prompt!!" << endl;
5774  Float_t eValueGSNN_var00;
5775  Float_t IP_InBT_To_Vtx=IP_Pair_To_InBT;
5776  if (eRecoMode==0) eValueGSNN_var00=IP_InBT_To_Vtx;
5777  if (eRecoMode==1) eValueGSNN_var00=IP_InBT_To_Vtx;
5778  if (eRecoMode==2) {
5779  eValueGSNN_var00=TMath::Min(IP_Seg1ToVtxSeg1Seg2,IP_Seg2ToVtxSeg1Seg2);
5780  }
5781 
5782  h_GSNN_var00->Fill(eValueGSNN_var00);
5783  h_GSNN_var01->Fill(GetMinimumDist(Segment,Segment2));
5784  h_GSNN_var02->Fill(GetdeltaRWithPropagation(Segment,Segment2));
5785  h_GSNN_var03->Fill(InBT->Z()-vtx->Z());
5786  h_GSNN_var04->Fill(GetdeltaThetaSingleAngles(Segment,Segment2));
5787  h_GSNN_var05->Fill(TMath::Abs(Segment->PID()-Segment2->PID()));
5788  h_GSNN_var06->Fill(Segment2->Flag()+Segment->Flag());
5789 
5790  // Purity 1: Input = 1.0;
5791  // Purity 0.5: Input = 0.5;
5792  // Purity else: Input = 0.0;
5793  if (Segment2->Flag()+Segment->Flag()==0&&TMath::Abs(Segment2->Flag())==11&&Segment->MCEvt()>0) {
5795  }
5796  else if (Segment2->Flag()+Segment->Flag()!=0&&TMath::Abs(Segment2->Flag())==11&&Segment->MCEvt()>0) {
5797  value_GSNN_varInput=0.5;
5798  }
5799  else {
5801  }
5802  value_GSNN_var00=eValueGSNN_var00;
5803  value_GSNN_var01=GetMinimumDist(Segment,Segment2);
5804  value_GSNN_var02=GetdeltaRWithPropagation(Segment,Segment2);
5805  value_GSNN_var03=InBT->Z()-vtx->Z();
5806  value_GSNN_var04=GetdeltaThetaSingleAngles(Segment,Segment2);
5807  value_GSNN_var05=TMath::Abs(Segment->PID()-Segment2->PID());
5808  value_GSNN_var06=Segment2->Flag()+Segment->Flag();
5809 
5810  t_GSNN->Fill();
5811 
5812  cout << "I have filled the GSNN Tree now. End of this bracket." << endl;
5813  }
5814  }
5816 
5818 
5819  Int_t s_NBT=0;
5820  Int_t s_NBTMC=0;
5821  Int_t s_NBTallMC=0;
5822  Int_t s_NBTeMC=0;
5823  Double_t s_eff=0;
5824  Double_t s_purall=0;
5825  Double_t s_pure=0;
5826  CalcEffPurOfShower(GLOBAL_ShowerSegArray, s_NBT, s_NBTMC, s_NBTallMC, s_NBTeMC, s_purall, s_pure);
5827 
5828  //-----------------------------------
5829  // 4) Calculate pur/eff/NBT numbers,
5830  // not needed when only reconstruction
5831  // done:
5832  //-----------------------------------
5833  if (cmd_OUTPUTLEVEL>=2 || cmd_OUTPUTLEVEL==0 ) {
5834  Int_t NBT=0;
5835  Int_t NBTMC=0;
5836  Int_t NBTallMC=0;
5837  Int_t NBTeMC=0;
5838  Double_t eff, purall, pure;
5839  CalcEffPurOfShower2(GLOBAL_ShowerSegArray, NBT, NBTMC, NBTallMC, NBTeMC, purall, pure, NBT_Neff, NBTMC_Neff ,NBTMCe_Neff);
5840 
5841 
5842  // Fill only for MC Event:
5843  if (GLOBAL_InBT_MC>0) {
5848  }
5850  }
5851 // cout << "// 4) Calculate pur/eff/NBT numbers...done." << endl;
5852 
5853 
5854 // XXXDEBUG
5855 
5856  //-----------------------------------
5857  // 5) Fill Tree:
5858  //-----------------------------------
5859  if (gEDBDEBUGLEVEL>2) cout << "// 5) Fill Tree:" << endl;
5860  TREE_ShowRecEff->Fill();
5861  if (gEDBDEBUGLEVEL>3) TREE_ShowRecEff->Show(TREE_ShowRecEff->GetEntries()-1);
5862 
5863 
5864  //-----------------------------------
5865  // 6a) Transfer ShowerArray to treebranchTreeEntry:
5866  //-----------------------------------
5867  if (cmd_OUTPUTLEVEL>0) {
5868  //cout << "// 6a) Transfer ShowerArray to treebranchTreeEntry:" << endl;
5870  }
5871 
5872 
5873  //------------------------------------
5874  // Reset and delete important things:
5875  // also to avoid memory problems ...
5876  //-----------------------------------
5877  GLOBAL_ShowerSegArray->Clear();
5878  if (gEDBDEBUGLEVEL>2) cout << "--- --- after clear: GLOBAL_ShowerSegArray->GetEntries(): "<< GLOBAL_ShowerSegArray->GetEntries() << endl;
5879  delete local_gAli;
5880  local_gAli=0;
5882  //------------------------------------
5883 
5884 
5885 
5886  IsFirstLoopCount=kFALSE;
5887  }
5888  // end of loop over GLOBAL_InBTArrayEntries
5889  //-----------------------------------------------------------------
5890 
5891  if (gEDBDEBUGLEVEL==2) cout << endl<<flush;
5892  if (gEDBDEBUGLEVEL>3) cout << "---TREE_ShowRecEff->GetEntries() ... " << TREE_ShowRecEff->GetEntries() << endl;
5893  if (gEDBDEBUGLEVEL>3) cout << "---GLOBAL_INBTSHOWERNR ... " << GLOBAL_INBTSHOWERNR<< endl;
5894 
5895 
5896 
5897  Log(2, "ShowRec.cpp", "--- void ReconstructShowers_GS() done.");
5898  return;
5899 }
EdbVertex * CalcVertex(TObjArray *segments)
Definition: ShowRec.cpp:9043
EdbPattern * GetPatternZLowestHighest(Bool_t lowestZ=kTRUE) const
Definition: EdbPattern.cxx:1982
EdbPattern * NextPattern(float z, int dir) const
Definition: EdbPattern.cxx:2086

◆ ReconstructShowers_NN()

void ReconstructShowers_NN ( )
3245 {
3246  Log(2, "ShowRec.cpp", "--- void ReconstructShowers_NN() ---");
3247 
3248  //-----------------------------------------------------------------
3249  // Main function for reconstruction of NN Algorithm
3250  //-----------------------------------------------------------------
3251 
3252  //-----------------------------------
3253  // For each InitiatorBT this is
3254  // divided in several small parts:
3255  //
3256  // 1) Make local_gAli with cut parameters, Make GetPID of InBT and corresponding of plates
3257  // 3) Loop over (whole) local_gAli, check BT for Cuts
3258  // 4) Calculate pur/eff/NBT numbers
3259  // 5) Fill Trees
3260  //-----------------------------------
3261 
3262 
3263  // Define NN_ALG charactereistic variables:
3264  Float_t dT_InBT_To_TestBT=0;
3265  Float_t dR_InBT_To_TestBT=0;
3266  Float_t dR_TestBT_To_InBT=0;
3267  Float_t zDist_TestBT_To_InBT=0;
3268  Float_t SpatialDist_TestBT_To_InBT=0;
3269  Float_t zDiff_TestBT_To_InBT=0;
3270  Float_t dT_NextBT_To_TestBT=0;
3271  Float_t dR_NextBT_To_TestBT=0;
3272  Float_t mean_dT_2before=0;
3273  Float_t mean_dR_2before=0;
3274  Float_t mean_dT_before=0;
3275  Float_t mean_dR_before=0;
3276  Float_t mean_dT_same=0;
3277  Float_t mean_dR_same=0;
3278  Float_t mean_dT_after=0;
3279  Float_t mean_dR_after=0;
3280  Float_t mean_dT_2after=0;
3281  Float_t mean_dR_2after=0;
3282 
3283  Float_t min_dT_2before=0;
3284  Float_t min_dR_2before=0;
3285  Float_t min_dT_before=0;
3286  Float_t min_dR_before=0;
3287  Float_t min_dT_same=0;
3288  Float_t min_dR_same=0;
3289  Float_t min_dT_after=0;
3290  Float_t min_dR_after=0;
3291  Float_t min_dT_2after=0;
3292  Float_t min_dR_2after=0;
3293  Int_t nseg_1before=0;
3294  Int_t nseg_2before=0;
3295  Int_t nseg_3before=0;
3296  Int_t nseg_1after=0;
3297  Int_t nseg_2after=0;
3298  Int_t nseg_3after=0;
3299  Int_t nseg_same=0;
3300  Int_t type;
3301 
3302  // Variables and things important for neural Network:
3303  TTree *simu = new TTree("MonteCarlo", "Filtered Monte Carlo Events");
3304  simu->Branch("dT_InBT_To_TestBT", &dT_InBT_To_TestBT, "dT_InBT_To_TestBT/F");
3305  simu->Branch("dR_InBT_To_TestBT", &dR_InBT_To_TestBT, "dR_InBT_To_TestBT/F");
3306  simu->Branch("dR_TestBT_To_InBT", &dR_TestBT_To_InBT, "dR_TestBT_To_InBT/F");
3307  simu->Branch("zDiff_TestBT_To_InBT", &zDiff_TestBT_To_InBT, "zDiff_TestBT_To_InBT/F");
3308  simu->Branch("SpatialDist_TestBT_To_InBT", &SpatialDist_TestBT_To_InBT, "SpatialDist_TestBT_To_InBT/F");
3309  simu->Branch("nseg_1before", &nseg_1before, "nseg_1before/I");
3310  simu->Branch("nseg_2before", &nseg_2before, "nseg_2before/I");
3311  simu->Branch("nseg_same", &nseg_same, "nseg_same/I");
3312  simu->Branch("nseg_1after", &nseg_1after, "nseg_1after/I");
3313  simu->Branch("nseg_2after", &nseg_2after, "nseg_2after/I");
3314  //---------
3315  simu->Branch("mean_dT_2before", &mean_dT_2before, "mean_dT_2before/F");
3316  simu->Branch("mean_dT_before", &mean_dT_before, "mean_dT_before/F");
3317  simu->Branch("mean_dT_same", &mean_dT_same, "mean_dT_same/F");
3318  simu->Branch("mean_dT_after", &mean_dT_after, "mean_dT_after/F");
3319  simu->Branch("mean_dT_2after", &mean_dT_2after, "mean_dT_2after/F");
3320  //---------
3321  simu->Branch("mean_dR_2before", &mean_dR_2before, "mean_dR_2before/F");
3322  simu->Branch("mean_dR_before", &mean_dR_before, "mean_dR_before/F");
3323  simu->Branch("mean_dR_same", &mean_dR_same, "mean_dR_same/F");
3324  simu->Branch("mean_dR_after", &mean_dR_after, "mean_dR_after/F");
3325  simu->Branch("mean_dR_2after", &mean_dR_2after, "mean_dR_2after/F");
3326  //---------
3327  simu->Branch("min_dT_2before", &min_dT_2before, "min_dT_2before/F");
3328  simu->Branch("min_dT_before", &min_dT_before, "min_dT_before/F");
3329  simu->Branch("min_dT_same", &min_dT_same, "min_dT_same/F");
3330  simu->Branch("min_dT_after", &min_dT_after, "min_dT_after/F");
3331  simu->Branch("min_dT_2after", &min_dT_2after, "min_dT_2after/F");
3332  //---------
3333  simu->Branch("min_dR_2before", &min_dR_2before, "min_dR_2before/F");
3334  simu->Branch("min_dR_before", &min_dR_before, "min_dR_before/F");
3335  simu->Branch("min_dR_same", &min_dR_same, "min_dR_same/F");
3336  simu->Branch("min_dR_after", &min_dR_after, "min_dR_after/F");
3337  simu->Branch("min_dR_2after", &min_dR_2after, "min_dR_2after/F");
3338 
3339  simu->Branch("type", &type, "type/I");
3340  Double_t params[8];
3341  //------------------------------
3342  TTree *simu_SG = (TTree *)simu->Clone();//new TTree("TreeSignalBT", "TreeSignalBT");
3343  simu_SG->SetName("TreeSignalBT");
3344  simu_SG->SetTitle("TreeSignalBT");
3345  TTree *simu_BG = (TTree *)simu->Clone();// TTree *simu_BG = new TTree("TreeBackgroundBT", "TreeBackgroundBT");
3346  simu_BG->SetName("TreeBackgroundBT");
3347  simu_BG->SetTitle("TreeBackgroundBT");
3348  //------------------------------
3349 
3350 
3351  // Create Histograms:
3352  // Only in Case of Training:
3353  if (var_NN_DoTrain==kTRUE) {
3355  cout << "histos created"<<endl;
3356  }
3357 
3358  // Get the right TMLP for the right Parameterset:
3361  cout << TMlpANN->GetStructure() << endl;
3362  // return;
3363 
3364  // Define Helper Variables:
3365  EdbPVRec* local_gAli;
3366  EdbSegP* InBT;
3367  EdbSegP* seg;
3368  Float_t local_gAli_pat_interim_halfsize=0;
3369 
3372 
3373  //-----------------------------------------------------------------
3374  // Since GLOBAL_InBTArray is filled in ascending ordering by zpositon
3375  // We use the descending loop to begin with BT with lowest z first.
3376  for (Int_t i=GLOBAL_InBTArrayEntries-1; i>=0; --i) {
3377 
3378  //-----------------------------------
3379  // CounterOutPut
3380  if (gEDBDEBUGLEVEL==2) if ((i%1)==0) cout << GLOBAL_InBTArrayEntries <<" InBT in total, still to do:"<<Form("%4d",i)<< "\r\r\r\r"<<flush;
3381  //-----------------------------------
3382 
3383  //-----------------------------------
3384  // Get InitiatorBT from GLOBAL_InBTArray
3385  InBT=(EdbSegP*)GLOBAL_InBTArray->At(i);
3386  //--------
3387  GLOBAL_InBT_E=InBT->P();
3388  GLOBAL_InBT_TanTheta=TMath::Sqrt(InBT->TX()*InBT->TX()+InBT->TY()*InBT->TY());
3389  GLOBAL_InBT_Flag=InBT->Flag();
3390  GLOBAL_InBT_MC=InBT->MCEvt();
3391  //--------
3392  Int_t local_NBT=0;
3393  Int_t local_NBTMC=0;
3394  Int_t local_NBTallMC=0;
3395  Int_t local_NBTeMC=0;
3396  float_t local_pure=-1;
3397  float_t local_purall=-1;
3398  Int_t npat_int=0;
3399  Int_t npat_total=0;
3400  Int_t npatN=0;
3401  Int_t npat_Neff=0;
3402  Int_t NBT_Neff=0;
3403  Int_t NBTMC_Neff=0;
3404  Int_t NBTMCe_Neff=0;
3405  //--------
3406 
3407  if (gEDBDEBUGLEVEL>2) {
3408  cout << endl << endl << "--- Starting Shower for Number " << i << " now: "<<endl;
3409  InBT->PrintNice();
3410  }
3411  //-----------------------------------
3412 
3413  //-----------------------------------
3414  // 1) Make local_gAli with cut parameters:
3415  //-----------------------------------
3416  local_gAli = TransformEdbPVRec(GLOBAL_gAli, InBT);
3417  // Add InBT to GLOBAL_ShowerSegArray
3418  GLOBAL_ShowerSegArray -> Add(InBT);
3419  //-----------------------------------
3420 
3421 
3422  //-----------------------------------
3423  // 1a) Reset characteristic variables:
3424  //-----------------------------------
3425  dT_InBT_To_TestBT=0;
3426  dR_InBT_To_TestBT=0;
3427  dR_TestBT_To_InBT=0;
3428  zDiff_TestBT_To_InBT=0;
3429  mean_dT_2before=0;
3430  mean_dR_2before=0;
3431  mean_dT_before=0;
3432  mean_dR_before=0;
3433  mean_dT_same=0;
3434  mean_dR_same=0;
3435  mean_dT_after=0;
3436  mean_dR_after=0;
3437  mean_dT_2after=0;
3438  mean_dR_2after=0;
3439  nseg_1before=0;
3440  nseg_2before=0;
3441  nseg_1after=0;
3442  nseg_2after=0;
3443  nseg_same=0;
3444  min_dT_2before=0;
3445  min_dR_2before=0;
3446  min_dT_before=0;
3447  min_dR_before=0;
3448  min_dT_same=0;
3449  min_dR_same=0;
3450  min_dT_after=0;
3451  min_dR_after=0;
3452  min_dT_2after=0;
3453  min_dR_2after=0;
3454 
3455  int ann_inputneurons=CUT_PARAMETER[1];
3456 
3457 
3458  //-----------------------------------
3459  // 2) Loop over (whole) local_gAli, check BT for Cuts
3460  //-----------------------------------
3461  Int_t local_gAli_npat=local_gAli->Npatterns();
3462  if (gEDBDEBUGLEVEL>2) cout << "--- local_gAli_npat= " << local_gAli_npat << endl;
3463 
3464  // Loop over all plates of local_gAli, since this is already
3465  // extracted with the right numbers of plates...
3466  for (Int_t patterloop_cnt=local_gAli_npat-1; patterloop_cnt>=0; --patterloop_cnt) {
3467  if (gEDBDEBUGLEVEL>3) cout << "--- --- Doing patterloop_cnt= " << patterloop_cnt << endl;
3468 
3469  // Needed to have StepX,Y,TX,TY bins set for the FindCompliments Function.
3470  //EdbPattern* ActualPattern = (EdbPattern*)local_gAli->GetPattern(patterloop_cnt);
3471  //ActualPattern -> FillCell(20,20,0.01,0.01);
3472 
3473  for (Int_t btloop_cnt=0; btloop_cnt<local_gAli->GetPattern(patterloop_cnt)->GetN(); ++btloop_cnt) {
3474  seg = (EdbSegP*)local_gAli->GetPattern(patterloop_cnt)->GetSegment(btloop_cnt);
3475  if (gEDBDEBUGLEVEL>3) seg->PrintNice();
3476 
3477 
3478  // Now calculate NN Histogram Inputvariables: --------------------
3479  // 1) zDiff_TestBT_To_InBT and SpatialDist_TestBT_To_InBT
3480  zDiff_TestBT_To_InBT=seg->Z()-InBT->Z();
3481  SpatialDist_TestBT_To_InBT=GetSpatialDist(seg,InBT);
3482  // 2) dT_InBT_To_TestBT
3483  dT_InBT_To_TestBT=GetdeltaThetaSingleAngles(seg,InBT);
3484  // 3) dR_InBT_To_TestBT (propagation order matters)
3485  // In calculation it makes a difference if InBT is extrapolated to Z-pos of seg or vice versa.
3486  dR_InBT_To_TestBT=GetdeltaRWithPropagation(InBT, seg);
3487  dR_TestBT_To_InBT=GetdeltaRWithPropagation(seg,InBT);
3488 
3489 
3490  // 4) nseg_1before,nseg_2before,nseg_1after,nseg_2after:
3491  if (ann_inputneurons==10) {
3492  nseg_2before = GetNSegBeforeAndAfter(local_gAli,patterloop_cnt,seg,2,-1);
3493  nseg_1before = GetNSegBeforeAndAfter(local_gAli,patterloop_cnt,seg,1,-1);
3494  nseg_same = GetNSegBeforeAndAfter(local_gAli,patterloop_cnt,seg,0, 1);
3495  nseg_1after = GetNSegBeforeAndAfter(local_gAli,patterloop_cnt,seg,1, 1);
3496  nseg_2after = GetNSegBeforeAndAfter(local_gAli,patterloop_cnt,seg,2, 1);
3497  }
3498 
3499  // 5) mean_dT,dR nseg_1before,nseg_2before,nseg_1after,nseg_2after: mean of all dTheta and dR compliment segments:
3500  if (ann_inputneurons==20) {
3501  GetMeansBeforeAndAfter(mean_dT_2before,mean_dR_2before,local_gAli,patterloop_cnt,seg,2,-1);
3502  GetMeansBeforeAndAfter(mean_dT_before,mean_dR_before,local_gAli,patterloop_cnt,seg,1,-1);
3503  GetMeansBeforeAndAfter(mean_dT_same,mean_dR_same,local_gAli,patterloop_cnt,seg,0, 1);
3504  GetMeansBeforeAndAfter(mean_dT_after,mean_dR_after,local_gAli,patterloop_cnt,seg,1, 1);
3505  GetMeansBeforeAndAfter(mean_dT_2after,mean_dR_2after,local_gAli,patterloop_cnt,seg,2, 1);
3506  }
3507 
3508  // 6) nseg_1before,nseg_2before,nseg_1after,nseg_2after: mean of all dTheta and dR compliment segments:
3509  if (ann_inputneurons==30) {
3510  GetMinsBeforeAndAfter(min_dT_2before,min_dR_2before,local_gAli,patterloop_cnt,seg,2,-1);
3511  GetMinsBeforeAndAfter(min_dT_before,min_dR_before,local_gAli,patterloop_cnt,seg,1,-1);
3512  GetMinsBeforeAndAfter(min_dT_same,min_dR_same,local_gAli,patterloop_cnt,seg,0, 1);
3513  GetMinsBeforeAndAfter(min_dT_after,min_dR_after,local_gAli,patterloop_cnt,seg,1, 1);
3514  GetMinsBeforeAndAfter(min_dT_2after,min_dR_2after,local_gAli,patterloop_cnt,seg,2, 1);
3515  }
3516  // end of calculate NN Histogram Inputvariables: --------------------
3517 
3518 
3519 
3520  // Now fill NN SG/BG Trees with the Inputvariables: --------------------
3521  // Only in Case of Training:
3522  if (var_NN_DoTrain==kTRUE) {
3523  if (seg->MCEvt()>0) {
3524  var_NN__SG__SpatialDist_TestBT_To_InBT->Fill(SpatialDist_TestBT_To_InBT);
3525  var_NN__SG__zDiff_TestBT_To_InBT->Fill(zDiff_TestBT_To_InBT);
3526  var_NN__SG__dT_InBT_To_TestBT->Fill(dT_InBT_To_TestBT);
3527  var_NN__SG__dR_TestBT_To_InBT->Fill(dR_InBT_To_TestBT);
3528  var_NN__SG__dR_InBT_To_TestBT->Fill(dR_TestBT_To_InBT);
3529  var_NN__SG__nseg_TestBT_To2BeforePlate->Fill(nseg_2before);
3530  var_NN__SG__nseg_TestBT_ToBeforePlate->Fill(nseg_1before);
3531  var_NN__SG__nseg_TestBT_ToSamePlate->Fill(nseg_same);
3532  var_NN__SG__nseg_TestBT_ToAfterPlate->Fill(nseg_1after);
3533  var_NN__SG__nseg_TestBT_To2AfterPlate->Fill(nseg_2after);
3534  //---------------
3535  if (mean_dT_2before!=-1) var_NN__SG__mean_dT_TestBT_To2BeforePlate->Fill(mean_dT_2before);
3536  if (mean_dR_2before!=-1) var_NN__SG__mean_dR_TestBT_To2BeforePlate->Fill(mean_dR_2before);
3537  if (mean_dT_before!=-1) var_NN__SG__mean_dT_TestBT_ToBeforePlate->Fill(mean_dT_before);
3538  if (mean_dR_before!=-1) var_NN__SG__mean_dR_TestBT_ToBeforePlate->Fill(mean_dR_before);
3539  if (mean_dT_same!=-1) var_NN__SG__mean_dT_TestBT_ToSamePlate->Fill(mean_dT_same);
3540  if (mean_dR_same!=-1) var_NN__SG__mean_dR_TestBT_ToSamePlate->Fill(mean_dR_same);
3541  if (mean_dT_after!=-1) var_NN__SG__mean_dT_TestBT_ToAfterPlate->Fill(mean_dT_after);
3542  if (mean_dR_after!=-1) var_NN__SG__mean_dR_TestBT_ToAfterPlate->Fill(mean_dR_after);
3543  if (mean_dT_2after!=-1) var_NN__SG__mean_dT_TestBT_To2AfterPlate->Fill(mean_dT_2after);
3544  if (mean_dR_2after!=-1) var_NN__SG__mean_dR_TestBT_To2AfterPlate->Fill(mean_dR_2after);
3545  if (min_dT_2before!=-1) var_NN__SG__min_dT_TestBT_To2BeforePlate->Fill(min_dT_2before);
3546  if (min_dR_2before!=-1) var_NN__SG__min_dR_TestBT_To2BeforePlate->Fill(min_dR_2before);
3547  if (min_dT_before!=-1) var_NN__SG__min_dT_TestBT_ToBeforePlate->Fill(min_dT_before);
3548  if (min_dR_before!=-1) var_NN__SG__min_dR_TestBT_ToBeforePlate->Fill(min_dR_before);
3549  if (min_dT_same!=-1) var_NN__SG__min_dT_TestBT_ToSamePlate->Fill(min_dT_same);
3550  if (min_dR_same!=-1) var_NN__SG__min_dR_TestBT_ToSamePlate->Fill(min_dR_same);
3551  if (min_dT_after!=-1) var_NN__SG__min_dT_TestBT_ToAfterPlate->Fill(min_dT_after);
3552  if (min_dR_after!=-1) var_NN__SG__min_dR_TestBT_ToAfterPlate->Fill(min_dR_after);
3553  if (min_dT_2after!=-1) var_NN__SG__min_dT_TestBT_To2AfterPlate->Fill(min_dT_2after);
3554  if (min_dR_2after!=-1) var_NN__SG__min_dR_TestBT_To2AfterPlate->Fill(min_dR_2after);
3555  type=1;
3556  simu_SG->Fill();
3557  simu->Fill();
3558  }
3559  if (seg->MCEvt()<0) {
3560  var_NN__BG__SpatialDist_TestBT_To_InBT->Fill(SpatialDist_TestBT_To_InBT);
3561  var_NN__BG__zDiff_TestBT_To_InBT->Fill(zDiff_TestBT_To_InBT);
3562  var_NN__BG__dT_InBT_To_TestBT->Fill(dT_InBT_To_TestBT);
3563  var_NN__BG__dR_TestBT_To_InBT->Fill(dR_TestBT_To_InBT);
3564  var_NN__BG__dR_InBT_To_TestBT->Fill(dR_InBT_To_TestBT);
3565  var_NN__BG__nseg_TestBT_To2BeforePlate->Fill(nseg_2before);
3566  var_NN__BG__nseg_TestBT_ToBeforePlate->Fill(nseg_1before);
3567  var_NN__BG__nseg_TestBT_ToSamePlate->Fill(nseg_same);
3568  var_NN__BG__nseg_TestBT_ToAfterPlate->Fill(nseg_1after);
3569  var_NN__BG__nseg_TestBT_To2AfterPlate->Fill(nseg_2after);
3570  //---------------
3571  if (mean_dT_2before!=-1) var_NN__BG__mean_dT_TestBT_To2BeforePlate->Fill(mean_dT_2before);
3572  if (mean_dR_2before!=-1) var_NN__BG__mean_dR_TestBT_To2BeforePlate->Fill(mean_dR_2before);
3573  if (mean_dT_before!=-1) var_NN__BG__mean_dT_TestBT_ToBeforePlate->Fill(mean_dT_before);
3574  if (mean_dR_before!=-1) var_NN__BG__mean_dR_TestBT_ToBeforePlate->Fill(mean_dR_before);
3575  if (mean_dT_same!=-1) var_NN__BG__mean_dT_TestBT_ToSamePlate->Fill(mean_dT_same);
3576  if (mean_dR_same!=-1) var_NN__BG__mean_dR_TestBT_ToSamePlate->Fill(mean_dR_same);
3577  if (mean_dT_after!=-1) var_NN__BG__mean_dT_TestBT_ToAfterPlate->Fill(mean_dT_after);
3578  if (mean_dR_after!=-1) var_NN__BG__mean_dR_TestBT_ToAfterPlate->Fill(mean_dR_after);
3579  if (mean_dT_2after!=-1) var_NN__BG__mean_dT_TestBT_To2AfterPlate->Fill(mean_dT_2after);
3580  if (mean_dR_2after!=-1) var_NN__BG__mean_dR_TestBT_To2AfterPlate->Fill(mean_dR_2after);
3581  //---------------
3582  if (min_dT_2before!=-1) var_NN__BG__min_dT_TestBT_To2BeforePlate->Fill(min_dT_2before);
3583  if (min_dR_2before!=-1) var_NN__BG__min_dR_TestBT_To2BeforePlate->Fill(min_dR_2before);
3584  if (min_dT_before!=-1) var_NN__BG__min_dT_TestBT_ToBeforePlate->Fill(min_dT_before);
3585  if (min_dR_before!=-1) var_NN__BG__min_dR_TestBT_ToBeforePlate->Fill(min_dR_before);
3586  if (min_dT_same!=-1) var_NN__BG__min_dT_TestBT_ToSamePlate->Fill(min_dT_same);
3587  if (min_dR_same!=-1) var_NN__BG__min_dR_TestBT_ToSamePlate->Fill(min_dR_same);
3588  if (min_dT_after!=-1) var_NN__BG__min_dT_TestBT_ToAfterPlate->Fill(min_dT_after);
3589  if (min_dR_after!=-1) var_NN__BG__min_dR_TestBT_ToAfterPlate->Fill(min_dR_after);
3590  if (min_dT_2after!=-1) var_NN__BG__min_dT_TestBT_To2AfterPlate->Fill(min_dT_2after);
3591  if (min_dR_2after!=-1) var_NN__BG__min_dR_TestBT_To2AfterPlate->Fill(min_dR_2after);
3592  type=0;
3593  simu_BG->Fill();
3594  simu->Fill();
3595  }
3596  if (seg->MCEvt()<0 || seg->MCEvt()>0) {
3597  //simu->Show(simu->GetEntries()-1); // do nothing yet...
3598  }
3599 
3600  } // if Train=TRUE
3601  // end of fill NN SG/BG Trees with the Inputvariables: --------------------
3602 
3603 
3604  Double_t params[30];
3605  // Double_t params[5];
3606  params[0]=dT_InBT_To_TestBT;
3607  params[1]=dR_InBT_To_TestBT;
3608  params[2]=dR_TestBT_To_InBT;
3609  params[3]=zDiff_TestBT_To_InBT;
3610  params[4]=SpatialDist_TestBT_To_InBT;
3611  // /*
3612  // Double_t params[15];
3613  params[5]=nseg_2before;
3614  params[6]=nseg_1before;
3615  params[7]=nseg_same;
3616  params[8]=nseg_1after;
3617  params[9]=nseg_2after;
3618 
3619  params[10]=mean_dT_2before;
3620  params[11]=mean_dT_before;
3621  params[12]=mean_dT_same;
3622  params[13]=mean_dT_after;
3623  params[14]=mean_dT_2after;
3624 
3625  params[15]=mean_dR_2before;
3626  params[16]=mean_dR_before;
3627  params[17]=mean_dR_same;
3628  params[18]=mean_dR_after;
3629  params[19]=mean_dR_2after;
3630 
3631  params[20]=min_dT_2before;
3632  params[21]=min_dT_before;
3633  params[22]=min_dT_same;
3634  params[23]=min_dT_after;
3635  params[24]=min_dT_2after;
3636 
3637  params[25]=min_dR_2before;
3638  params[26]=min_dR_before;
3639  params[27]=min_dR_same;
3640  params[28]=min_dR_after;
3641  params[29]=min_dR_2after;
3642 
3643  //---------
3644  // */
3645  Double_t value=0;
3646 
3647  //for (int hj=0; hj<5; hj++) cout << " " << params[hj];
3648  //cout << endl;
3649  value=TMlpANN->Evaluate(0, params);
3650  //if (gEDBDEBUGLEVEL>0) { for (int hj=0; hj<10; hj++) cout << " " << params[hj];cout << " , Vlaue= " << value << endl; }
3651  // cout << " Evaluated value...."<< value<<endl;
3652 
3653  // Now apply cut conditions: NEURAL NETWORK Alg --------------------
3654  if (value<CUT_PARAMETER[0]) continue;
3655  // end of cut conditions: NEURAL NETWORK Alg --------------------
3656 
3657  // If we arrive here, Basetrack seg has passed criteria
3658  // and is then added to the shower array:
3659  // Check if its not the InBT which is already added:
3660  if (seg->X()==InBT->X()&&seg->Y()==InBT->Y()) {
3661  ; // do nothing;
3662  }
3663  else {
3664  GLOBAL_ShowerSegArray -> Add(seg);
3665  }
3666  }
3667 
3668 
3669 
3670  // Calc BT density around shower:
3671  EdbPattern* pat_interim=local_gAli->GetPattern(patterloop_cnt);
3672  CalcTrackDensity(pat_interim,local_gAli_pat_interim_halfsize,npat_int,npat_total,npatN);
3673 
3674  // Calc TrackNumbers for plate for efficency numbers:
3675  CalcEfficencyNumbers(pat_interim, InBT->MCEvt(), NBT_Neff, NBTMC_Neff ,NBTMCe_Neff);
3676  }
3677  // end of loop over all plates of local_gAli
3679 
3680 
3681  //-----------------------------------
3682  // 4) Calculate pur/eff/NBT numbers,
3683  // not needed when only reconstruction
3684  // done:
3685  //-----------------------------------
3686  if (cmd_OUTPUTLEVEL>=2 || cmd_OUTPUTLEVEL==0 ) {
3687  Int_t NBT=0;
3688  Int_t NBTMC=0;
3689  Int_t NBTallMC=0;
3690  Int_t NBTeMC=0;
3691  Double_t eff, purall, pure;
3692  CalcEffPurOfShower2(GLOBAL_ShowerSegArray, NBT, NBTMC, NBTallMC, NBTeMC, purall, pure, NBT_Neff, NBTMC_Neff ,NBTMCe_Neff);
3693 
3694  // Fill only for MC Event:
3695  if (GLOBAL_InBT_MC>0) {
3700  }
3702  }
3703 
3704  //-----------------------------------
3705  // 5) Fill Tree:
3706  //-----------------------------------
3707  TREE_ShowRecEff->Fill();
3708  if (gEDBDEBUGLEVEL>3) TREE_ShowRecEff->Show(TREE_ShowRecEff->GetEntries()-1);
3709 
3710 
3711  //-----------------------------------
3712  // 6a) Transfer ShowerArray to treebranchTreeEntry:
3713  //-----------------------------------
3714  if (cmd_OUTPUTLEVEL>0) {
3716  }
3717 
3718 
3719  //------------------------------------
3720  // Reset and delete important things:
3721  // also to avoid memory problems ...
3722  //-----------------------------------
3723  GLOBAL_ShowerSegArray->Clear();
3724  if (gEDBDEBUGLEVEL>3) cout << "--- ---GLOBAL_ShowerSegArray->GetEntries(): "<< GLOBAL_ShowerSegArray->GetEntries() << endl;
3725  delete local_gAli;
3726  local_gAli=0;
3728  //------------------------------------
3729  }
3730  // end of loop over GLOBAL_InBTArrayEntries
3731  //-----------------------------------------------------------------
3732 
3733  if (gEDBDEBUGLEVEL==2) cout << endl<<flush;
3734  if (gEDBDEBUGLEVEL>3) cout << "---TREE_ShowRecEff->GetEntries() ... " << TREE_ShowRecEff->GetEntries() << endl;
3735  if (gEDBDEBUGLEVEL>3) cout << "---GLOBAL_INBTSHOWERNR ... " << GLOBAL_INBTSHOWERNR<< endl;
3736 
3737 
3738 
3739 
3740  // Only in Case of Training:
3741  if (var_NN_DoTrain==kTRUE) {
3742  cout << " Now write NN SG/BG Trees with the Inputvariables: --------------------"<<endl;
3743 
3744  TFile* fil = new TFile("NN_ALG_ANN_TrainingsFile_DefaultName.root","RECREATE");
3745  TCanvas* canv_SG = new TCanvas("canv_SG","canv_SG",800,800);
3746  canv_SG->Divide(5,4);
3747  canv_SG->cd(1);
3749  var_NN__SG__SpatialDist_TestBT_To_InBT->SetLineColor(2);
3752  var_NN__BG__SpatialDist_TestBT_To_InBT->SetLineColor(4);
3754 
3755  canv_SG->cd(2);
3757  var_NN__SG__dT_InBT_To_TestBT->SetLineColor(2);
3759  var_NN__BG__dT_InBT_To_TestBT->Draw("same");
3760  var_NN__BG__dT_InBT_To_TestBT->SetLineColor(4);
3762 
3763  canv_SG->cd(3);
3766  var_NN__SG__dR_InBT_To_TestBT->SetLineColor(2);
3768  var_NN__BG__dR_InBT_To_TestBT->Draw("same");
3769  var_NN__BG__dR_InBT_To_TestBT->SetLineColor(4);
3771 
3772  canv_SG->cd(4);
3774  var_NN__SG__nseg_TestBT_To2BeforePlate->SetLineColor(2);
3777  var_NN__BG__nseg_TestBT_To2BeforePlate->SetLineColor(4);
3779 
3780  canv_SG->cd(5);
3782  var_NN__SG__nseg_TestBT_ToBeforePlate->SetLineColor(2);
3785  var_NN__BG__nseg_TestBT_ToBeforePlate->SetLineColor(4);
3787 
3788  canv_SG->cd(6);
3790  var_NN__SG__nseg_TestBT_ToSamePlate->SetLineColor(2);
3793  var_NN__BG__nseg_TestBT_ToSamePlate->SetLineColor(4);
3795 
3796  canv_SG->cd(7);
3798  var_NN__SG__nseg_TestBT_ToAfterPlate->SetLineColor(2);
3801  var_NN__BG__nseg_TestBT_ToAfterPlate->SetLineColor(4);
3803 
3804  canv_SG->cd(8);
3806  var_NN__SG__nseg_TestBT_To2AfterPlate->SetLineColor(2);
3809  var_NN__BG__nseg_TestBT_To2AfterPlate->SetLineColor(4);
3811 
3812 
3813  //-----------------//-----------------//-----------------
3814 
3815  canv_SG->cd(9);
3822 
3823  canv_SG->cd(10);
3830 
3831  //-----------------
3832 
3833  canv_SG->cd(11);
3840 
3841  canv_SG->cd(12);
3848 
3849  //-----------------
3850 
3851  canv_SG->cd(13);
3853  var_NN__SG__mean_dT_TestBT_ToSamePlate->SetLineColor(2);
3856  var_NN__BG__mean_dT_TestBT_ToSamePlate->SetLineColor(4);
3858 
3859  canv_SG->cd(14);
3861  var_NN__SG__mean_dR_TestBT_ToSamePlate->SetLineColor(2);
3864  var_NN__BG__mean_dR_TestBT_ToSamePlate->SetLineColor(4);
3866 
3867  //-----------------
3868 
3869  canv_SG->cd(15);
3871  var_NN__SG__mean_dT_TestBT_ToAfterPlate->SetLineColor(2);
3874  var_NN__BG__mean_dT_TestBT_ToAfterPlate->SetLineColor(4);
3876 
3877  canv_SG->cd(16);
3879  var_NN__SG__mean_dR_TestBT_ToAfterPlate->SetLineColor(2);
3882  var_NN__BG__mean_dR_TestBT_ToAfterPlate->SetLineColor(4);
3884 
3885 
3886  canv_SG->cd(17);
3893 
3894  canv_SG->cd(18);
3901 
3902  canv_SG->Update();
3903 
3904 
3905 
3906  //-----------------//-----------------//-----------------
3907  TCanvas* canv_SG_2 = new TCanvas("canv_SG_2","canv_SG_2",800,800);
3908  canv_SG_2->Divide(4,4);
3909  canv_SG_2->cd(1);
3910  canv_SG_2->cd(1);
3917 
3918  canv_SG_2->cd(2);
3925 
3926  //-----------------
3927 
3928  canv_SG_2->cd(3);
3930  var_NN__SG__min_dT_TestBT_ToBeforePlate->SetLineColor(2);
3933  var_NN__BG__min_dT_TestBT_ToBeforePlate->SetLineColor(4);
3935 
3936  canv_SG_2->cd(4);
3938  var_NN__SG__min_dR_TestBT_ToBeforePlate->SetLineColor(2);
3941  var_NN__BG__min_dR_TestBT_ToBeforePlate->SetLineColor(4);
3943 
3944  //-----------------
3945 
3946  canv_SG_2->cd(5);
3948  var_NN__SG__min_dT_TestBT_ToSamePlate->SetLineColor(2);
3951  var_NN__BG__min_dT_TestBT_ToSamePlate->SetLineColor(4);
3953 
3954  canv_SG_2->cd(6);
3956  var_NN__SG__min_dR_TestBT_ToSamePlate->SetLineColor(2);
3959  var_NN__BG__min_dR_TestBT_ToSamePlate->SetLineColor(4);
3961 
3962  //-----------------
3963 
3964  canv_SG_2->cd(7);
3966  var_NN__SG__min_dT_TestBT_ToAfterPlate->SetLineColor(2);
3969  var_NN__BG__min_dT_TestBT_ToAfterPlate->SetLineColor(4);
3971 
3972  canv_SG_2->cd(8);
3974  var_NN__SG__min_dR_TestBT_ToAfterPlate->SetLineColor(2);
3977  var_NN__BG__min_dR_TestBT_ToAfterPlate->SetLineColor(4);
3979 
3980 
3981  canv_SG_2->cd(9);
3983  var_NN__SG__min_dT_TestBT_To2AfterPlate->SetLineColor(2);
3986  var_NN__BG__min_dT_TestBT_To2AfterPlate->SetLineColor(4);
3988 
3989  canv_SG_2->cd(10);
3991  var_NN__SG__min_dR_TestBT_To2AfterPlate->SetLineColor(2);
3994  var_NN__BG__min_dR_TestBT_To2AfterPlate->SetLineColor(4);
3996 
3997  canv_SG_2->cd(11);
3999  var_NN__SG__zDiff_TestBT_To_InBT->SetLineColor(2);
4001  var_NN__BG__zDiff_TestBT_To_InBT->Draw("same");
4002  var_NN__BG__zDiff_TestBT_To_InBT->SetLineColor(4);
4004 
4005 
4006  canv_SG_2->cd(12);
4008  var_NN__SG__dR_TestBT_To_InBT->SetLineColor(2);
4010  var_NN__BG__dR_TestBT_To_InBT->Draw("same");
4011  var_NN__BG__dR_TestBT_To_InBT->SetLineColor(4);
4013 
4014 
4015 
4016  TCanvas* canv_BG = new TCanvas("canv_BG","canv_BG",800,800);
4017  simu_SG->Write();
4018  simu_BG->Write();
4019  simu->Write();
4020  canv_SG->Write();
4021  canv_SG_2->Write();
4022  fil->Close();
4023  delete fil;
4024 
4025  } // Train=TRUE
4026 
4027 
4028  return;
4029 }
void Get_NN_ALG_MLP(TTree *simu, Int_t parasetnr)
Definition: ShowRec.cpp:5990
void Load_NN_ALG_MLP_weights(TMultiLayerPerceptron *mlp, Int_t parasetnr)
Definition: ShowRec.cpp:6088
void Create_NN_Alg_Histograms()
Definition: ShowRec.cpp:8425
Double_t GetSpatialDist(EdbSegP *s1, EdbSegP *s2)
Definition: ShowRec.cpp:7276
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)
Definition: ShowRec.cpp:7295
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)
Definition: ShowRec.cpp:7383
Int_t GetNSegBeforeAndAfter(EdbPVRec *local_gAli, Int_t patterloop_cnt, EdbSegP *seg, Int_t n_patterns, Int_t BeforeOrAfter)
Definition: ShowRec.cpp:7462
Bool_t var_NN_DoTrain
Definition: ShowRec.h:211
Double_t params[3]
Definition: testBGReduction_By_ANN.C:84

◆ ReconstructShowers_OI()

void ReconstructShowers_OI ( )

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

2839 {
2840  Log(2, "ShowRec.cpp", "--- void ReconstructShowers_OI() ---");
2841 
2842  //-----------------------------------------------------------------
2843  // Main function for reconstruction of OFFICIAL IMPLEMENTATION Algorithm
2844  //-----------------------------------------------------------------
2845 
2846  //-----------------------------------
2847  // For each InitiatorBT this is
2848  // divided in several small parts:
2849  //
2850  // 1) Make local_gAli with cut parameters, Make GetPID of InBT and corresponding of plates
2851  // 3) Loop over (whole) local_gAli, check BT for Cuts
2852  // 4) Calculate pur/eff/NBT numbers
2853  // 5) Fill Trees
2854  //-----------------------------------
2855 
2856  // Define Helper Variables:
2857  EdbPVRec* local_gAli;
2858  EdbSegP* InBT;
2859  EdbSegP* seg;
2860  Float_t local_gAli_pat_interim_halfsize=0;
2861 
2864 
2865  //-----------------------------------------------------------------
2866  // Since GLOBAL_InBTArray is filled in ascending ordering by zpositon
2867  // We use the descending loop to begin with BT with lowest z first.
2868  for (Int_t i=GLOBAL_InBTArrayEntries-1; i>=0; --i) {
2869 
2870  //-----------------------------------
2871  // CounterOutPut
2872  if (gEDBDEBUGLEVEL==2) if ((i%1)==0) cout << GLOBAL_InBTArrayEntries <<" InBT in total, still to do:"<<Form("%4d",i)<< "\r\r\r\r"<<flush;
2873  if (gEDBDEBUGLEVEL==1) {
2874  int modulo=TMath::Max(GLOBAL_InBTArrayEntries/20,1);
2875  if ((i%modulo)==0) cout << i <<" : 5% more done"<<endl;
2876  }
2877  //-----------------------------------
2878 
2879  //-----------------------------------
2880  // Get InitiatorBT from GLOBAL_InBTArray
2881  InBT=(EdbSegP*)GLOBAL_InBTArray->At(i);
2882  //--------
2883  GLOBAL_InBT_E=InBT->P();
2884  GLOBAL_InBT_TanTheta=TMath::Sqrt(InBT->TX()*InBT->TX()+InBT->TY()*InBT->TY());
2885  GLOBAL_InBT_Flag=InBT->Flag();
2886  GLOBAL_InBT_MC=InBT->MCEvt();
2887  //--------
2888  Int_t local_NBT=0;
2889  Int_t local_NBTMC=0;
2890  Int_t local_NBTallMC=0;
2891  Int_t local_NBTeMC=0;
2892  float_t local_pure=-1;
2893  float_t local_purall=-1;
2894  Int_t npat_int=0;
2895  Int_t npat_total=0;
2896  Int_t npatN=0;
2897  Int_t npat_Neff=0;
2898  Int_t NBT_Neff=0;
2899  Int_t NBTMC_Neff=0;
2900  Int_t NBTMCe_Neff=0;
2901  //--------
2902 
2903  if (gEDBDEBUGLEVEL>2) {
2904  cout << endl << endl << "--- Starting Shower for Number " << i << " now: "<<endl;
2905  InBT->PrintNice();
2906  }
2907  //-----------------------------------
2908 
2909  //-----------------------------------
2910  // 1) Make local_gAli with cut parameters:
2911  //-----------------------------------
2912  local_gAli = TransformEdbPVRec(GLOBAL_gAli, InBT);
2913 
2914  /*
2915  //-----------------------------------
2916  // 1) BG Clean of local_gAli
2917  // that maybe not necessary always , only for the large
2918  // MC pasted Backgrounds...
2919  //-----------------------------------
2920  Float_t BGTargetDensity=0;
2921  // cout << "--- \t\t : -CLEAN InputData BG Cleaning: 0: No, 1:20BT/mm2 2: 40BT/mm2 3:10BT/mm2 4:60BT/mm2 \n";
2922  if (cmd_CLEAN==1) BGTargetDensity=20;
2923  if (cmd_CLEAN==2) BGTargetDensity=40;
2924  if (cmd_CLEAN==3) BGTargetDensity=10;
2925  if (cmd_CLEAN==4) BGTargetDensity=60;
2926  if (cmd_CLEAN==0) BGTargetDensity=1000;
2927 
2928  EdbPVRQuality* localPVRQualCheck = new EdbPVRQuality(local_gAli,BGTargetDensity);
2929  EdbPVRec* new_local_gAli;
2930  new_local_gAli = localPVRQualCheck->GetEdbPVRec(1);
2931  localPVRQualCheck->Print();
2932  local_gAli=new_local_gAli;
2933  */
2934 
2935 // InBT->PrintNice();
2936 // gSystem->Exit(1);
2937 
2938  //-----------------------------------
2939  // Add InBT to GLOBAL_ShowerSegArray
2940  GLOBAL_ShowerSegArray -> Add(InBT);
2941  //-----------------------------------
2942 
2943 
2944  //-----------------------------------
2945  // 2) Loop over (whole) local_gAli, check BT for Cuts
2946  //-----------------------------------
2947  Int_t local_gAli_npat=local_gAli->Npatterns();
2948  if (gEDBDEBUGLEVEL>2) cout << "--- local_gAli_npat= " << local_gAli_npat << endl;
2949 
2950  // Loop over all plates of local_gAli, since this is already
2951  // extracted with the right numbers of plates...
2952  for (Int_t patterloop_cnt=local_gAli_npat-1; patterloop_cnt>=0; --patterloop_cnt) {
2953  if (gEDBDEBUGLEVEL>3) cout << "--- --- Doing patterloop_cnt= " << patterloop_cnt << endl;
2954 
2955  for (Int_t btloop_cnt=0; btloop_cnt<local_gAli->GetPattern(patterloop_cnt)->GetN(); ++btloop_cnt) {
2956  seg = (EdbSegP*)local_gAli->GetPattern(patterloop_cnt)->GetSegment(btloop_cnt);
2957  if (gEDBDEBUGLEVEL>3) seg->PrintNice();
2958 
2959  // Now apply cut conditions: OFFICIAL IMPLEMENTATION Alg --------------------
2960  if (!GetConeOrTubeDistanceToInBT(seg, InBT, CUT_PARAMETER[0], CUT_PARAMETER[1])) continue;
2961  if (!FindPrecedingBTsSingleThetaAngle(seg, InBT, local_gAli, GLOBAL_ShowerSegArray)) continue;
2962  // end of cut conditions: OFFICIAL IMPLEMENTATION Alg --------------------
2963 
2964  // If we arrive here, Basetrack seg has passed criteria
2965  // and is then added to the shower array:
2966  // Check if its not the InBT which is already added:
2967  if (seg->X()==InBT->X()&&seg->Y()==InBT->Y()) {
2968  ; // do nothing;
2969  }
2970  else {
2971  GLOBAL_ShowerSegArray -> Add(seg);
2972  }
2973  }
2974  // Calc BT density around shower:
2975  EdbPattern* pat_interim=local_gAli->GetPattern(patterloop_cnt);
2976  CalcTrackDensity(pat_interim,local_gAli_pat_interim_halfsize,npat_int,npat_total,npatN);
2977 
2978  // Calc TrackNumbers for plate for efficency numbers:
2979  CalcEfficencyNumbers(pat_interim, InBT->MCEvt(), NBT_Neff, NBTMC_Neff ,NBTMCe_Neff);
2980  }
2981  // end of loop over all plates of local_gAli
2983 
2984 
2985  //-----------------------------------
2986  // 4) Calculate pur/eff/NBT numbers,
2987  // not needed when only reconstruction
2988  // done:
2989  //-----------------------------------
2990  if (cmd_OUTPUTLEVEL>=2 || cmd_OUTPUTLEVEL==0 ) {
2991  Int_t NBT=0;
2992  Int_t NBTMC=0;
2993  Int_t NBTallMC=0;
2994  Int_t NBTeMC=0;
2995  Double_t eff, purall, pure;
2996  CalcEffPurOfShower2(GLOBAL_ShowerSegArray, NBT, NBTMC, NBTallMC, NBTeMC, purall, pure, NBT_Neff, NBTMC_Neff ,NBTMCe_Neff);
2997 
2998  // Fill only for MC Event:
2999  if (GLOBAL_InBT_MC>0) {
3004  }
3006  }
3007 
3008 
3009 
3010  //-----------------------------------
3011  // 5) Fill Tree:
3012  //-----------------------------------
3013  TREE_ShowRecEff->Fill();
3014  if (gEDBDEBUGLEVEL>3) TREE_ShowRecEff->Show(TREE_ShowRecEff->GetEntries()-1);
3015 
3016 
3017  //-----------------------------------
3018  // 6a) Transfer ShowerArray to treebranchTreeEntry:
3019  //-----------------------------------
3020  if (cmd_OUTPUTLEVEL>0) {
3022  }
3023 
3024 
3025  //------------------------------------
3026  // Reset and delete important things:
3027  // also to avoid memory problems ...
3028  //-----------------------------------
3029  GLOBAL_ShowerSegArray->Clear();
3030  if (gEDBDEBUGLEVEL>3) cout << "--- ---GLOBAL_ShowerSegArray->GetEntries(): "<< GLOBAL_ShowerSegArray->GetEntries() << endl;
3031  delete local_gAli;
3032  local_gAli=0;
3034  //------------------------------------
3035  }
3036  // end of loop over GLOBAL_InBTArrayEntries
3037  //-----------------------------------------------------------------
3038 
3039  if (gEDBDEBUGLEVEL==2) cout << endl<<flush;
3040  if (gEDBDEBUGLEVEL>3) cout << "---TREE_ShowRecEff->GetEntries() ... " << TREE_ShowRecEff->GetEntries() << endl;
3041  if (gEDBDEBUGLEVEL>3) cout << "---GLOBAL_INBTSHOWERNR ... " << GLOBAL_INBTSHOWERNR<< endl;
3042 
3043 
3044  return;
3045 }

◆ ReconstructShowers_OI2()

void ReconstructShowers_OI2 ( )

DEPRECIATED !!!!

3235 {
3237  Log(2, "ShowRec.cpp", "--- void ReconstructShowers_OI2() --- DEPRECIATED !!!! RETURN !!!");
3238  return;
3239 }

◆ ReconstructShowers_OPENMP()

void ReconstructShowers_OPENMP ( )
2398  {
2399  cout << endl << "=======================================================" << endl << endl;
2400  gEDBDEBUGLEVEL=3;
2402  cout << "GLOBAL_InBTArrayEntries = " << GLOBAL_InBTArrayEntries << endl;
2403  int tid=0;
2404  int i=0;
2405  int nthreads=0;
2406  int chunk=2;
2407 
2408  #pragma omp parallel shared(nthreads) private(i,tid)
2409  {
2410  // cout << "tid = omp_get_thread_num() " << omp_get_thread_num() << endl;
2411  if (tid == 0)
2412  {
2413  // nthreads = omp_get_num_threads();
2414  printf("Number of threads = %d\n", nthreads);
2415  }
2416 
2417  printf("Thread %d starting...\n",tid);
2418 
2420 
2421  cout << endl;
2422 
2423  #pragma omp for
2424  for (Int_t ii=GLOBAL_InBTArrayEntries-1; ii>=0; --ii) {
2425  EdbSegP* seg = (EdbSegP*) GLOBAL_InBTArray -> At(ii);
2426  printf("Thread %d: %i execute now ReconstructShowers_OPENMP_TEST \n",tid,ii);
2427  seg->PrintNice();
2428  TObjArray LOCAL_ShowerSegArray;
2429  ReconstructShowers_OPENMP_TEST(seg, LOCAL_ShowerSegArray);
2430  printf("Thread %d: %i %d entires in LOCAL_ShowerSegArray: \n",tid,ii,LOCAL_ShowerSegArray.GetEntries() );
2431  }
2432 
2433  } /* end of parallel section */
2434 
2435 
2436  // endo of OPENMP_session
2437  return;
2438 }
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 !!!!

2439  {
2440 
2441  // Dummy Function: Create 4 Segments just by propagating to 2=2,3,4,5*InBT->Z();
2442  array.Add(InBT);
2443  for (Int_t j=0; j<3; ++j) {
2444  cout << " j = " << j << endl;
2445  EdbSegP* s=new EdbSegP(j,InBT->X(),InBT->Y(),InBT->TX(),InBT->TY());
2446  s->SetZ(InBT->Z());
2447  s->PropagateTo((j+1)*1300+InBT->Z());
2448  s->SetMC(InBT->MCEvt(),InBT->MCEvt());
2449  s->PrintNice();
2450  array.Add(s);
2451  }
2452  //PrintShowerObjectArray(array);
2453 
2454  cout << " Since GLOBAL_ShowerSegArray is global we SHOULD expect here parallel conflicts !!!! " << endl;
2455  return;
2456 }
void SetMC(int mEvt, int mTrack)
Definition: EdbSegP.h:138

◆ ReconstructShowers_RC()

void ReconstructShowers_RC ( )

last to variables are dummyvariabes.

if this is in, it doesnt work for iteratet ShowerAxisCenterGravityBT

4492 {
4493  Log(2, "ShowRec.cpp", "--- void ReconstructShowers_RC() ---");
4494 
4495  //-----------------------------------------------------------------
4496  // Main function for reconstruction of "Recursive Cone" Algorithm
4497  //-----------------------------------------------------------------
4498 
4499  //-----------------------------------
4500  // For each InitiatorBT this is
4501  // divided in several small parts:
4502  //
4503  // 1) Make local_gAli with cut parameters, Make GetPID of InBT and corresponding of plates
4504  // 3) Loop over (whole) local_gAli, check BT for Cuts
4505  // 4) Calculate pur/eff/NBT numbers
4506  // 5) Fill Trees
4507  //-----------------------------------
4508 
4509  // Define Helper Variables:
4510  EdbPVRec* local_gAli;
4511  EdbSegP* InBT;
4512  EdbSegP* seg;
4513  Float_t local_gAli_pat_interim_halfsize=0;
4514 
4517 
4518  //-----------------------------------------------------------------
4519  // Since GLOBAL_InBTArray is filled in ascending ordering by zpositon
4520  // We use the descending loop to begin with BT with lowest z first.
4521  for (Int_t i=GLOBAL_InBTArrayEntries-1; i>=0; --i) {
4522 
4523  //-----------------------------------
4524  // CounterOutPut
4525  if (gEDBDEBUGLEVEL==2) if ((i%1)==0) cout << GLOBAL_InBTArrayEntries <<" InBT in total, still to do:"<<Form("%4d",i)<< "\r\r\r\r"<<flush;
4526  //-----------------------------------
4527 
4528  //-----------------------------------
4529  // Get InitiatorBT from GLOBAL_InBTArray
4530  InBT=(EdbSegP*)GLOBAL_InBTArray->At(i);
4531  //--------
4532  GLOBAL_InBT_E=InBT->P();
4533  GLOBAL_InBT_TanTheta=TMath::Sqrt(InBT->TX()*InBT->TX()+InBT->TY()*InBT->TY());
4534  GLOBAL_InBT_Flag=InBT->Flag();
4535  GLOBAL_InBT_MC=InBT->MCEvt();
4536  //--------
4537  Int_t local_NBT=0;
4538  Int_t local_NBTMC=0;
4539  Int_t local_NBTallMC=0;
4540  Int_t local_NBTeMC=0;
4541  float_t local_pure=-1;
4542  float_t local_purall=-1;
4543  Int_t npat_int=0;
4544  Int_t npat_total=0;
4545  Int_t npatN=0;
4546  Int_t npat_Neff=0;
4547  Int_t NBT_Neff=0;
4548  Int_t NBTMC_Neff=0;
4549  Int_t NBTMCe_Neff=0;
4550  //--------
4551 
4552  if (gEDBDEBUGLEVEL>2) {
4553  cout << endl << endl << "--- Starting Shower for Number " << i << " now: "<<endl;
4554  InBT->PrintNice();
4555  }
4556  //-----------------------------------
4557 
4558  //-----------------------------------
4559  // 1) Make local_gAli with cut parameters:
4560  //-----------------------------------
4561  local_gAli = TransformEdbPVRec(GLOBAL_gAli, InBT);
4562  // Add InBT to GLOBAL_ShowerSegArray
4563  GLOBAL_ShowerSegArray -> Add(InBT);
4564  //-----------------------------------
4565 
4566  //-----------------------------------
4567  // 2) Loop over (whole) local_gAli, check BT for Cuts
4568  //-----------------------------------
4569  Int_t local_gAli_npat=local_gAli->Npatterns();
4570  Int_t btloop_cnt_N=0;
4571  if (gEDBDEBUGLEVEL>2) cout << "--- local_gAli_npat= " << local_gAli_npat << endl;
4572 
4573  // Loop over all plates of local_gAli, since this is already
4574  // extracted with the right numbers of plates...
4575  for (Int_t patterloop_cnt=local_gAli_npat-1; patterloop_cnt>=0; --patterloop_cnt) {
4576  if (gEDBDEBUGLEVEL>3) cout << "--- --- Doing patterloop_cnt= " << patterloop_cnt << endl;
4577  btloop_cnt_N=local_gAli->GetPattern(patterloop_cnt)->GetN();
4578 
4579  // if pattern is before the Initiator BT->Z() position we just go on:
4580  if (local_gAli->GetPattern(patterloop_cnt)->Z()<InBT->Z()) continue;
4581 
4582  for (Int_t btloop_cnt=0; btloop_cnt<btloop_cnt_N; ++btloop_cnt) {
4583  seg = (EdbSegP*)local_gAli->GetPattern(patterloop_cnt)->GetSegment(btloop_cnt);
4584  if (gEDBDEBUGLEVEL>3) seg->PrintNice();
4585 
4586  // Now apply cut conditions: RECURSIVE CONE Alg --------------------
4588  if (!FindPrecedingBTsSingleThetaAngle(seg, InBT, local_gAli, GLOBAL_ShowerSegArray)) continue;
4589  // end of cut conditions: RECURSIVE CONE Alg --------------------
4590 
4591  // If we arrive here, Basetrack seg has passed criteria
4592  // and is then added to the shower array:
4593  // Check if its not the InBT which is already added:
4595  }
4596 
4597  // Calc BT density around shower:
4598  EdbPattern* pat_interim=local_gAli->GetPattern(patterloop_cnt);
4599  CalcTrackDensity(pat_interim,local_gAli_pat_interim_halfsize,npat_int,npat_total,npatN);
4600 
4601  // Calc TrackNumbers for plate for efficency numbers:
4602  CalcEfficencyNumbers(pat_interim, InBT->MCEvt(), NBT_Neff, NBTMC_Neff ,NBTMCe_Neff);
4603  }
4604  // end of loop over all plates of local_gAli
4605 
4607 
4608  Int_t f_NBT=0;
4609  Int_t f_NBTMC=0;
4610  Int_t f_NBTallMC=0;
4611  Int_t f_NBTeMC=0;
4612  Double_t f_eff=0;
4613  Double_t f_purall=0;
4614  Double_t f_pure=0;
4615  CalcEffPurOfShower(GLOBAL_ShowerSegArray, f_NBT, f_NBTMC, f_NBTallMC, f_NBTeMC, f_purall, f_pure);
4617 
4618  //-----------------------------------
4619  // 3) Try RE-ITERATION over (whole) local_gAli!!
4620  // 3) Using the iterated shower Gravity Center!
4621  // 3)
4622  // 3) WILL NOT WORK FOR ELECTRONS ... CAUSE FISRT POSITION IS SHIFTED AFTER ITERATION !!!
4623  // 3) DEPRECIAPTED
4624  // 3) DEPRECIAPTED .... DO NOT USE IT NOW!!!!!!!!!!!!!!
4625  // 3) DEPRECIAPTED (even if it works we dont need to reevaluate the
4626  // 3) efficency numbers anymore, since calculated above)
4627  //-----------------------------------
4628 
4629  Bool_t DoIteration=kFALSE;
4630  // Bool_t DoIteration=kTRUE// 3) DEPRECIAPTED .... DO NOT USE IT NOW!!!!!!!!!!!!!!
4631 
4632  if (DoIteration) {
4633 
4634  cout << "-------------------------------------------"<<endl;
4635  EdbSegP* ShowerAxisCenterGravityBT = BuildShowerAxis(GLOBAL_ShowerSegArray);
4636  GLOBAL_ShowerSegArray->Clear();
4637  //-----------------------------------
4638  // 3) Loop again over (whole) local_gAli, check BT for Cuts
4639  //-----------------------------------
4640  local_gAli_npat=local_gAli->Npatterns();
4641  btloop_cnt_N=0;
4642  if (gEDBDEBUGLEVEL>2) cout << "--- local_gAli_npat= " << local_gAli_npat << endl;
4643 
4644  // Loop over all plates of local_gAli, since this is already
4645  // extracted with the right numbers of plates...
4646  for (Int_t patterloop_cnt=local_gAli_npat-1; patterloop_cnt>=0; --patterloop_cnt) {
4647  if (gEDBDEBUGLEVEL>3) cout << "--- --- Doing patterloop_cnt= " << patterloop_cnt << endl;
4648  btloop_cnt_N=local_gAli->GetPattern(patterloop_cnt)->GetN();
4649 
4650  for (Int_t btloop_cnt=0; btloop_cnt<btloop_cnt_N; ++btloop_cnt) {
4651  seg = (EdbSegP*)local_gAli->GetPattern(patterloop_cnt)->GetSegment(btloop_cnt);
4652  if (gEDBDEBUGLEVEL>3) seg->PrintNice();
4653 
4654  // Now apply cut conditions: RECURSIVE CONE Alg --------------------
4655  // if (!GetConeOrTubeDistanceToBTOfShowerArray(seg, ShowerAxisCenterGravityBT, GLOBAL_ShowerSegArray, CUT_PARAMETER[0], CUT_PARAMETER[1])) continue;
4657  if (!FindPrecedingBTsSingleThetaAngle(seg, ShowerAxisCenterGravityBT, local_gAli, GLOBAL_ShowerSegArray)) continue;
4658  // end of cut conditions: RECURSIVE CONE Alg --------------------
4659 
4660  // If we arrive here, Basetrack seg has passed criteria
4661  // and is then added to the shower array:
4662  // Check if its not the InBT which is already added:
4663  // if (seg->X()==ShowerAxisCenterGravityBT->X()&&seg->Y()==ShowerAxisCenterGravityBT->Y()) { ; } // do nothing;
4664  // else {GLOBAL_ShowerSegArray -> Add(seg);}
4666  }
4667  }
4668  // end of loop over all plates of local_gAli
4670  cout << "-------------------------------------------"<<endl;
4671 
4672 
4673  } // of if (DoIteration)
4674 
4675  Int_t s_NBT=0;
4676  Int_t s_NBTMC=0;
4677  Int_t s_NBTallMC=0;
4678  Int_t s_NBTeMC=0;
4679  Double_t s_eff=0;
4680  Double_t s_purall=0;
4681  Double_t s_pure=0;
4682  CalcEffPurOfShower(GLOBAL_ShowerSegArray, s_NBT, s_NBTMC, s_NBTallMC, s_NBTeMC, s_purall, s_pure);
4683 
4684  //-----------------------------------
4685  // 4) Calculate pur/eff/NBT numbers,
4686  // not needed when only reconstruction
4687  // done:
4688  //-----------------------------------
4689  if (cmd_OUTPUTLEVEL>=2 || cmd_OUTPUTLEVEL==0 ) {
4690  Int_t NBT=0;
4691  Int_t NBTMC=0;
4692  Int_t NBTallMC=0;
4693  Int_t NBTeMC=0;
4694  Double_t eff, purall, pure;
4695  CalcEffPurOfShower2(GLOBAL_ShowerSegArray, NBT, NBTMC, NBTallMC, NBTeMC, purall, pure, NBT_Neff, NBTMC_Neff ,NBTMCe_Neff);
4696 
4697  // Fill only for MC Event:
4698  if (GLOBAL_InBT_MC>0) {
4703  }
4705  }
4706 
4707 
4708  //-----------------------------------
4709  // 5) Fill Tree:
4710  //-----------------------------------
4711  TREE_ShowRecEff->Fill();
4712  if (gEDBDEBUGLEVEL>3) TREE_ShowRecEff->Show(TREE_ShowRecEff->GetEntries()-1);
4713 
4714 
4715  //-----------------------------------
4716  // 6a) Transfer ShowerArray to treebranchTreeEntry:
4717  //-----------------------------------
4718  if (cmd_OUTPUTLEVEL>0) {
4720  }
4721 
4722 
4723  //-----------------------------------
4724  // 7) cout some numbers from shower reco:
4725  //-----------------------------------
4726  if (gEDBDEBUGLEVEL>2) {
4727  cout << "------------------------------- _NUMBERS ----------------------"<<endl;
4728  cout << "ITERATION 0 : --- NBT = " << f_NBT << endl;
4729  cout << "ITERATION 0 : --- NBTMC = " << f_NBTMC << endl;
4730  cout << "ITERATION 0 : --- purall = " << f_purall << endl;
4731  cout << "------------"<<endl;
4732  cout << "ITERATION 1 : --- NBT = " << s_NBT << endl;
4733  cout << "ITERATION 1 : --- NBTMC = " << s_NBTMC << endl;
4734  cout << "ITERATION 1 : --- purall = " << s_purall << endl;
4735  cout << "NUMBERS " << f_NBT << " " << f_NBTMC << " " << f_purall << " " << s_NBT << " " << s_NBTMC << " " << s_purall << " " << endl;
4736  }
4737 
4738  //------------------------------------
4739  // Reset and delete important things:
4740  // also to avoid memory problems ...
4741  //-----------------------------------
4742  GLOBAL_ShowerSegArray->Clear();
4743  if (gEDBDEBUGLEVEL>3) cout << "--- ---GLOBAL_ShowerSegArray->GetEntries(): "<< GLOBAL_ShowerSegArray->GetEntries() << endl;
4744  delete local_gAli;
4745  local_gAli=0;
4747  //------------------------------------
4748  }
4749  // end of loop over GLOBAL_InBTArrayEntries
4750  //-----------------------------------------------------------------
4751 
4752  if (gEDBDEBUGLEVEL==2) cout << endl<<flush;
4753  if (gEDBDEBUGLEVEL>3) cout << "---TREE_ShowRecEff->GetEntries() ... " << TREE_ShowRecEff->GetEntries() << endl;
4754  if (gEDBDEBUGLEVEL>3) cout << "---GLOBAL_INBTSHOWERNR ... " << GLOBAL_INBTSHOWERNR<< endl;
4755 
4756 
4757  return;
4758 }

◆ ReconstructShowers_SA()

void ReconstructShowers_SA ( )
3051 {
3052  Log(2, "ShowRec.cpp", "--- void ReconstructShowers_SA() ---");
3053 
3054  //-----------------------------------------------------------------
3055  // Main function for reconstruction of SA Algorithm : only MCEvents with different cuts on MC parameters
3056  //-----------------------------------------------------------------
3057 
3058  //-----------------------------------
3059  // For each InitiatorBT this is
3060  // divided in several small parts:
3061  //
3062  // 1) Make local_gAli with cut parameters, Make GetPID of InBT and corresponding of plates
3063  // 3) Loop over (whole) local_gAli, check BT for Cuts
3064  // 4) Calculate pur/eff/NBT numbers
3065  // 5) Fill Trees
3066  //-----------------------------------
3067 
3068  // Define Helper Variables:
3069  EdbPVRec* local_gAli;
3070  EdbSegP* InBT;
3071  EdbSegP* seg;
3072  Float_t local_gAli_pat_interim_halfsize=0;
3073 
3076 
3077  //-----------------------------------------------------------------
3078  // Since GLOBAL_InBTArray is filled in ascending ordering by zpositon
3079  // We use the descending loop to begin with BT with lowest z first.
3080  for (Int_t i=GLOBAL_InBTArrayEntries-1; i>=0; --i) {
3081 
3082  //-----------------------------------
3083  // CounterOutPut
3084  if (gEDBDEBUGLEVEL==2) if ((i%1)==0) cout << GLOBAL_InBTArrayEntries <<" InBT in total, still to do:"<<Form("%4d",i)<< "\r\r\r\r"<<flush;
3085  //-----------------------------------
3086 
3087  //-----------------------------------
3088  // Get InitiatorBT from GLOBAL_InBTArray
3089  InBT=(EdbSegP*)GLOBAL_InBTArray->At(i);
3090  //--------
3091  GLOBAL_InBT_E=InBT->P();
3092  GLOBAL_InBT_TanTheta=TMath::Sqrt(InBT->TX()*InBT->TX()+InBT->TY()*InBT->TY());
3093  GLOBAL_InBT_Flag=InBT->Flag();
3094  GLOBAL_InBT_MC=InBT->MCEvt();
3095  //--------
3096  Int_t local_NBT=0;
3097  Int_t local_NBTMC=0;
3098  Int_t local_NBTallMC=0;
3099  Int_t local_NBTeMC=0;
3100  float_t local_pure=-1;
3101  float_t local_purall=-1;
3102  Int_t npat_int=0;
3103  Int_t npat_total=0;
3104  Int_t npatN=0;
3105  Int_t npat_Neff=0;
3106  Int_t NBT_Neff=0;
3107  Int_t NBTMC_Neff=0;
3108  Int_t NBTMCe_Neff=0;
3109  //--------
3110 
3111  if (gEDBDEBUGLEVEL>2) {
3112  cout << endl << endl << "--- Starting Shower for Number " << i << " now: "<<endl;
3113  InBT->PrintNice();
3114  }
3115  //-----------------------------------
3116 
3117  //-----------------------------------
3118  // 1) Make local_gAli with cut parameters:
3119  //-----------------------------------
3120  //local_gAli = TransformEdbPVRec(GLOBAL_gAli, InBT);
3121  local_gAli = TransformEdbPVRec_SA(GLOBAL_gAli, InBT); // Especially for SA-Algorithm to set the size of the local_gAli also.
3122 
3123  // Add InBT to GLOBAL_ShowerSegArray
3124  GLOBAL_ShowerSegArray -> Add(InBT);
3125  //-----------------------------------
3126 
3127 
3128  //-----------------------------------
3129  // 2) Loop over (whole) local_gAli, check BT for Cuts
3130  //-----------------------------------
3131  Int_t local_gAli_npat=local_gAli->Npatterns();
3132  if (gEDBDEBUGLEVEL>2) cout << "--- local_gAli_npat= " << local_gAli_npat << endl;
3133 
3134  // Loop over all plates of local_gAli, since this is already
3135  // extracted with the right numbers of plates...
3136  for (Int_t patterloop_cnt=local_gAli_npat-1; patterloop_cnt>=0; --patterloop_cnt) {
3137  if (gEDBDEBUGLEVEL>3) cout << "--- --- Doing patterloop_cnt= " << patterloop_cnt << endl;
3138 
3139  for (Int_t btloop_cnt=0; btloop_cnt<local_gAli->GetPattern(patterloop_cnt)->GetN(); ++btloop_cnt) {
3140  seg = (EdbSegP*)local_gAli->GetPattern(patterloop_cnt)->GetSegment(btloop_cnt);
3141  if (gEDBDEBUGLEVEL>3) seg->PrintNice();
3142 
3143  // Now apply cut conditions: ReconstructShowers_SA Alg --------------------
3144  if (seg->MCEvt()<0) continue;
3145  if (seg->P() < CUT_PARAMETER[0]) continue;
3146  // end of cut conditions: ReconstructShowers_SA Alg --------------------
3147 
3148  // If we arrive here, Basetrack seg has passed criteria
3149  // and is then added to the shower array:
3150  // Check if its not the InBT which is already added:
3151  if (seg->X()==InBT->X()&&seg->Y()==InBT->Y()) {
3152  ; // do nothing;
3153  }
3154  else {
3155  GLOBAL_ShowerSegArray -> Add(seg);
3156  }
3157  }
3158 
3159  // Calc BT density around shower:
3160  EdbPattern* pat_interim=local_gAli->GetPattern(patterloop_cnt);
3161  CalcTrackDensity(pat_interim,local_gAli_pat_interim_halfsize,npat_int,npat_total,npatN);
3162 
3163  // Calc TrackNumbers for plate for efficency numbers:
3164  CalcEfficencyNumbers(pat_interim, InBT->MCEvt(), NBT_Neff, NBTMC_Neff ,NBTMCe_Neff);
3165  }
3166  // end of loop over all plates of local_gAli
3168 
3169 
3170  //-----------------------------------
3171  // 4) Calculate pur/eff/NBT numbers,
3172  // not needed when only reconstruction
3173  // done:
3174  //-----------------------------------
3175  if (cmd_OUTPUTLEVEL>=2 || cmd_OUTPUTLEVEL==0 ) {
3176  Int_t NBT=0;
3177  Int_t NBTMC=0;
3178  Int_t NBTallMC=0;
3179  Int_t NBTeMC=0;
3180  Double_t eff, purall, pure;
3181  CalcEffPurOfShower2(GLOBAL_ShowerSegArray, NBT, NBTMC, NBTallMC, NBTeMC, purall, pure, NBT_Neff, NBTMC_Neff ,NBTMCe_Neff);
3182 
3183  // Fill only for MC Event:
3184  if (GLOBAL_InBT_MC>0) {
3189  }
3191  }
3192 
3193 
3194  //-----------------------------------
3195  // 5) Fill Tree:
3196  //-----------------------------------
3197  TREE_ShowRecEff->Fill();
3198  if (gEDBDEBUGLEVEL>3) TREE_ShowRecEff->Show(TREE_ShowRecEff->GetEntries()-1);
3199 
3200 
3201  //-----------------------------------
3202  // 6a) Transfer ShowerArray to treebranchTreeEntry:
3203  //-----------------------------------
3204  if (cmd_OUTPUTLEVEL>0) {
3206  }
3207 
3208 
3209  //------------------------------------
3210  // Reset and delete important things:
3211  // also to avoid memory problems ...
3212  //-----------------------------------
3213  GLOBAL_ShowerSegArray->Clear();
3214  if (gEDBDEBUGLEVEL>3) cout << "--- ---GLOBAL_ShowerSegArray->GetEntries(): "<< GLOBAL_ShowerSegArray->GetEntries() << endl;
3215  delete local_gAli;
3216  local_gAli=0;
3218  //------------------------------------
3219  }
3220  // end of loop over GLOBAL_InBTArrayEntries
3221  //-----------------------------------------------------------------
3222 
3223  if (gEDBDEBUGLEVEL==2) cout << endl<<flush;
3224  if (gEDBDEBUGLEVEL>3) cout << "---TREE_ShowRecEff->GetEntries() ... " << TREE_ShowRecEff->GetEntries() << endl;
3225  if (gEDBDEBUGLEVEL>3) cout << "---GLOBAL_INBTSHOWERNR ... " << GLOBAL_INBTSHOWERNR<< endl;
3226 
3227 
3228  return;
3229 }
EdbPVRec * TransformEdbPVRec_SA(EdbPVRec *gAli, EdbSegP *InitiatorBT)
Definition: ShowRec.cpp:6506

◆ ReconstructShowers_TC()

void ReconstructShowers_TC ( )
4035 {
4036  Log(2, "ShowRec.cpp", "--- void ReconstructShowers_TC() ---");
4037 
4038  //-----------------------------------------------------------------
4039  // Main function for reconstruction of TC "Track(s) (in) Cone" Algorithm
4040  // Connects tracks to ConteTube Reconstructed Object like in the CA or OI Alg.
4041  //-----------------------------------------------------------------
4042 
4043  //-----------------------------------
4044  // For each InitiatorBT this is
4045  // divided in several small parts:
4046  //
4047  // 1) Make local_gAli with cut parameters, Make GetPID of InBT and corresponding of plates
4048  // 2a) Loop over (whole) local_gAli, check BT for Cuts (ConeTube)
4049  // 2b) Loop over (whole) tracks from a linked_tracks file, try to attach these tracks to BT of these within the cone
4050  // 2c) Loop over (whole) attached basetracks, start ConeTube Reconstruction for these BT itsself.
4051  // 4) Calculate pur/eff/NBT numbers
4052  // 5) Fill Trees
4053  //-----------------------------------
4054 
4055  // Define Helper Variables:
4056  EdbPVRec* local_gAli;
4057  EdbSegP* InBT;
4058  EdbSegP* seg;
4059  Float_t local_gAli_pat_interim_halfsize=0;
4060 
4063 
4064  Float_t gAliZMax=TMath::Max(GLOBAL_gAli->GetPattern(GLOBAL_gAli->Npatterns()-1)->Z(),GLOBAL_gAli->GetPattern(0)->Z());
4065 
4066  if (gEDBDEBUGLEVEL>2) {
4067  cout << "--- --- --- Printing GLOBAL_InBTArray MaximumZ Position " << gAliZMax << " --- --- ---"<<endl;
4069  }
4070 
4071  // Define TObjArray which contains Bastracks Clones from the tracking.
4072  EdbSegP * segment=0;
4073  EdbSegP * s2=0;
4074  EdbTrackP *t = 0;
4075  TFile * fil = new TFile("linked_tracks.root");
4076  TTree* tr= (TTree*)fil->Get("tracks");
4077  TClonesArray *segClonesArray= new TClonesArray("EdbSegP",60);
4078  int nentr = int(tr->GetEntries());
4079  int nseg,n0,npl;
4080  cout << "Of linked_tracks we have " << nentr << " entries Total"<<endl;
4081  tr->SetBranchAddress("t." , &t );
4082  tr->SetBranchAddress("s" , &segClonesArray );
4083  tr->SetBranchAddress("nseg" , &nseg );
4084  tr->SetBranchAddress("n0" , &n0 );
4085  tr->SetBranchAddress("npl" , &npl );
4086  if (gEDBDEBUGLEVEL>2) tr->Show(0);
4087 
4088  cout << "Try Creating Arrays"<< endl;
4089  TObjArray* LOCAL_TrackBTArray= new TObjArray(nentr);
4090  TObjArray* LOCAL_NewAddedBTArray= new TObjArray(nentr);
4091  cout << "Creating Arrays done."<< endl;
4092 
4093  for (int i=0; i<nentr; i++ ) {
4094  //if (i%10!=0) continue;
4095  tr->GetEntry(i);
4096 
4097  if (gEDBDEBUGLEVEL>3) cout << i << " t.eX Y Z " << t->X() << " "<< t->Y() << " "<< t->Z() << endl;
4098 
4099  // // Take only Basetracks from tracks which pass 3 or more plates:
4100  // if (npl<3) continue;
4101 
4102 
4103  // Take only tracks which are inside the gAli Volume:
4104  // Cause Linking is done with all 57 plates, but reconstruction can be done of coure on less:
4105  s2=(EdbSegP*) segClonesArray->At(nseg-1);
4106  if (s2->Z()>gAliZMax) {
4107  cout << " TrackEND is outside of gALi Volume! Dont take track." << endl;
4108  continue;
4109  }
4110 
4111  // CUTPARAMETER[6]=CUT_TRACKATTACH_NTRACKSEG
4112  // CUT_TRACKATTACH_NTRACKSEG ranges from [0..nseg-2]
4113  // nseg ranges from [2..nseg-1]
4114 
4115  int takeN=TMath::Min(nseg-1,int(CUT_PARAMETER[6])+1);
4116  //cout << " takeN = " << takeN << endl;
4117 
4118  for (int hh=0; hh<takeN; hh++) {
4119  // Take first BT of the tracks:
4120  s2=(EdbSegP*) segClonesArray->At(hh);
4121  if (gEDBDEBUGLEVEL>3) s2->PrintNice();
4122 
4123  // Note: here we take all tracks, regardingless if they are in our desired range. (FP,MP,LP)
4124  // This we check further down:
4125  // Clone segment, otherwise it will be overwritten by the next.
4126  segment=(EdbSegP*)s2->Clone();
4127  // Add it to LOCAL_TrackBTArray
4128  LOCAL_TrackBTArray->Add(segment);
4129  }
4130  //cout << "for (int hh=0; hh<takeN; hh++) done."<<endl;
4131 
4132  }
4133  delete tr;
4134  delete fil;
4135 
4136  if (gEDBDEBUGLEVEL>1) cout << "--- Filled " << LOCAL_TrackBTArray->GetEntries() << " Segments into LOCAL_TrackBTArray."<<endl;
4137 
4138 
4139  //-----------------------------------------------------------------
4140  // Since GLOBAL_InBTArray is filled in ascending ordering by zpositon
4141  // We use the descending loop to begin with BT with lowest z first.
4142  // This part of the Algorithm is the same as OI Alg part:
4143  for (Int_t i=GLOBAL_InBTArrayEntries-1; i>=0; --i) {
4144 
4145  //-----------------------------------
4146  // CounterOutPut
4147  if (gEDBDEBUGLEVEL==2) if ((i%1)==0) cout << GLOBAL_InBTArrayEntries <<" InBT in total, still to do:"<<Form("%4d",i)<< "\r\r\r\r"<<flush;
4148  //-----------------------------------
4149 
4150  //-----------------------------------
4151  // Get InitiatorBT from GLOBAL_InBTArray
4152  InBT=(EdbSegP*)GLOBAL_InBTArray->At(i);
4153  //--------
4154  GLOBAL_InBT_E=InBT->P();
4155  GLOBAL_InBT_TanTheta=TMath::Sqrt(InBT->TX()*InBT->TX()+InBT->TY()*InBT->TY());
4156  GLOBAL_InBT_Flag=InBT->Flag();
4157  GLOBAL_InBT_MC=InBT->MCEvt();
4158  //--------
4159  Int_t local_NBT=0;
4160  Int_t local_NBTMC=0;
4161  Int_t local_NBTallMC=0;
4162  Int_t local_NBTeMC=0;
4163  float_t local_pure=-1;
4164  float_t local_purall=-1;
4165  Int_t npat_int=0;
4166  Int_t npat_total=0;
4167  Int_t npatN=0;
4168  Int_t npat_Neff=0;
4169  Int_t NBT_Neff=0;
4170  Int_t NBTMC_Neff=0;
4171  Int_t NBTMCe_Neff=0;
4172  //--------
4173 
4174  if (gEDBDEBUGLEVEL>2) {
4175  cout << endl << endl << "--- Starting Shower for Number " << i << " now: "<<endl;
4176  InBT->PrintNice();
4177  cout << " InBT->MCEvt() "<< InBT->MCEvt() << " InBT->P() " << InBT->P() << endl;
4178  }
4179  //-----------------------------------
4180 
4181  //-----------------------------------
4182  // 1) Make local_gAli with cut parameters:
4183  //-----------------------------------
4184  local_gAli = TransformEdbPVRec(GLOBAL_gAli, InBT);
4185  //local_gAli = TransformEdbPVRec_SA(GLOBAL_gAli, InBT); // Especially for SA-Algorithm to set the size of the local_gAli also.
4186 
4187  // Add InBT to GLOBAL_ShowerSegArray
4188  GLOBAL_ShowerSegArray -> Add(InBT);
4189  //-----------------------------------
4190 
4191 
4192  //-----------------------------------
4193  // 2a) Loop over (whole) local_gAli, check BT for Cuts
4194  //-----------------------------------
4195  Int_t local_gAli_npat=local_gAli->Npatterns();
4196  if (gEDBDEBUGLEVEL>2) cout << "--- local_gAli_npat= " << local_gAli_npat << endl;
4197 
4198  // Loop over all plates of local_gAli, since this is already
4199  // extracted with the right numbers of plates...
4200  for (Int_t patterloop_cnt=local_gAli_npat-1; patterloop_cnt>=0; --patterloop_cnt) {
4201  if (gEDBDEBUGLEVEL>3) cout << "--- --- Doing patterloop_cnt= " << patterloop_cnt << endl;
4202 
4203  for (Int_t btloop_cnt=0; btloop_cnt<local_gAli->GetPattern(patterloop_cnt)->GetN(); ++btloop_cnt) {
4204  seg = (EdbSegP*)local_gAli->GetPattern(patterloop_cnt)->GetSegment(btloop_cnt);
4205  if (gEDBDEBUGLEVEL>3) seg->PrintNice();
4206 
4207  // Now apply cut conditions: TrackCone Alg --------------------
4208  // (for first iteration, thi is equivalent to OI Alg Implementation:
4209  // if (GetdeltaRWithPropagation(seg,InBT)>100) continue;
4210  // if (TMath::Abs(seg->Z()-InBT->Z())>5000) continue;
4211  if (!GetConeOrTubeDistanceToInBT(seg, InBT, CUT_PARAMETER[0], CUT_PARAMETER[1])) continue;
4212  if (!FindPrecedingBTsSingleThetaAngle(seg, InBT, local_gAli, GLOBAL_ShowerSegArray)) continue;
4213  // end of cut conditions: TrackCone IMPLEMENTATION Alg --------------------
4214 
4215  // If we arrive here, Basetrack seg has passed criteria
4216  // and is then added to the shower array:
4217  // Check if its not the InBT which is already added:
4219  }
4220 
4221  } // end of loop over all plates of local_gAli
4222 // if (gEDBDEBUGLEVEL>2) PrintShowerObjectArray(GLOBAL_ShowerSegArray);
4223 
4224 
4225  Float_t NBT_before=0;
4226  Float_t NBT_after=0;
4227  Float_t NBTMC_before=0;
4228  Float_t NBTMC_after=0;
4229  Float_t pur_before=0;
4230  Float_t pur_after=0;
4231 
4232  // Quickly calculate NEW NBT and pur------------------------
4233  EdbSegP* interim=0;
4234  for (int count=0; count<GLOBAL_ShowerSegArray->GetEntries(); count++) {
4235  NBT_before++;
4236  interim=(EdbSegP*)GLOBAL_ShowerSegArray->At(count);
4237  if (interim->MCEvt()>0) NBTMC_before++;
4238  }
4239  pur_before=(Float_t)NBTMC_before/(Float_t)NBT_before;
4240  // Quickly calculate NEW NBT and pur------------------------
4241 
4242 
4243 
4244  //-----------------------------------
4245  // 2b) Loop over (whole) tracks from a linked_tracks file, try to attach these tracks to BT of these within the cone
4246  // wARNING,wARNING: the linked tracks root file BaseTrack PIDs and the PIDs of the BTs in the eAli DO NOT
4247  // NECESSARILY have to be identical, so please, make comparisons rather on Z instead on PID.
4248  //-----------------------------------
4249 
4250 
4251  //cout << "=============================================================================="<<endl;
4252  //cout << "=" << endl;
4253  //cout << "= NOW try to attach tracks to the reconstructed showers:" << endl;
4254 
4255  // Clear LOCAL_NewAddedBTArray to have only same MCEvts in it:
4256  LOCAL_NewAddedBTArray->Clear();
4257 
4258  int nentr_LOCAL_TrackBTArray=LOCAL_TrackBTArray->GetEntries();
4259  int nentr_GLOBAL_ShowerSegArray=GLOBAL_ShowerSegArray->GetEntries();
4260 
4261  int nentr2=nentr_LOCAL_TrackBTArray;
4262 
4263  EdbSegP* tryAttachedSegment=0;
4264  EdbSegP* alreadyTakenSegment=0;
4265 
4266  for (Int_t icount=0; icount<nentr2; icount++ ) {
4267  //for(int icount=nentr2/2; icount<(nentr2/2)+2; icount++ ) {
4268 
4269  tryAttachedSegment=(EdbSegP*)LOCAL_TrackBTArray->At(icount);
4270 
4271  // But take only segemnst with same MC Number as InBT of course!!
4272  if (tryAttachedSegment->MCEvt()>0 && tryAttachedSegment->MCEvt()!=InBT->MCEvt()) continue;
4273 
4274  //cout << "Try to attac now segment (if array) " << icount << " with: " << endl;
4275  //tryAttachedSegment->PrintNice();
4276  //cout << "to any of the already attached segments: " << endl;
4277 
4278  for (Int_t j=0; j<GLOBAL_ShowerSegArray->GetEntries(); j++ ) {
4279  alreadyTakenSegment=(EdbSegP*)GLOBAL_ShowerSegArray->At(j);
4280 
4281  Float_t dRTEST= GetdeltaRWithPropagation(tryAttachedSegment,alreadyTakenSegment);
4282  Float_t dMinDist=GetMinimumDist(tryAttachedSegment,alreadyTakenSegment);
4283  Float_t dMinDist_DT=GetdeltaThetaSingleAngles(tryAttachedSegment,alreadyTakenSegment);
4284 
4285  /*
4286  if (gEDBDEBUGLEVEL>2) {
4287  cout << " Test GLOBAL_ShowerSegArray segment (if array) " << j << " with: " << endl;
4288  alreadyTakenSegment->PrintNice();
4289  cout << " to connect: deltaRWith Propagation (tryAttachedSegment,alreadyTakenSegment) : ";
4290  cout << dRTEST;
4291  cout << " GetMinimumDist(tryAttachedSegment,alreadyTakenSegment) : " << dMinDist << " " << dMinDist_DT << endl;
4292  }
4293  */
4294 
4295  // The testing trackBT has to satisfy both criteria:
4296  // minimum Distance and deltaThetaSingleAngels
4297  // CUT_PARAMETER[4]=CUT_TRACKATTACH_DISTMIN
4298  // CUT_PARAMETER[5]=CUT_TRACKATTACH_DTAN_MAX
4299  if (dMinDist< CUT_PARAMETER[4] && dMinDist_DT< CUT_PARAMETER[5]) {
4300  LOCAL_NewAddedBTArray->Add(tryAttachedSegment);
4301  //if (gEDBDEBUGLEVEL>2) cout << "Found a close connection. Add tryAttachedSegment to LOCAL_NewAddedBTArray"<<endl;
4302  break;
4303  }
4304 
4305  } // of (int j=0;)
4306  } // of (int icount=0; );
4307 
4308  //cout << "LOCAL_NewAddedBTArray->GetEntries() = " << LOCAL_NewAddedBTArray->GetEntries() << endl;
4309  //cout << "=" << endl;
4310  //cout << "=============================================================================="<<endl;
4311 
4312 
4313  //-----------------------------------
4314  // 2c) Loop over (whole) local_gAli, again, but now with ONLY the new LOCAL_NewAddedBTArray as starting BTs
4315  // 2c) and only if the local_gAli Z position id greater equal than LOCAL_NewAddedBTArray z position:
4316  // 2c) Do this for every new added BaseTrack:
4317  // 2c) Rember that not the BaseTracks of the linked_tracks.root file are NOT given into ShowerOject array,
4318  // 2c) Only the intrinsic ones which come out from the gAli directly.
4319  // 2c) This is to avoid duplication of tracks, since the may not be totally equal in X,Y,Z
4320  // 2c) For example if tracking was done with small different par sets...
4321  //-----------------------------------
4322  //cout << " // 2c) Loop over (whole) local_gAli, again, but now with ONLY the new LOCAL_NewAddedBTArray as starting BTs"<<endl;
4323  //cout << " // 2c) LOCAL_NewAddedBTArray->GetEntries() " << LOCAL_NewAddedBTArray->GetEntries() << endl;
4324  //PrintShowerObjectArray(LOCAL_NewAddedBTArray);
4325 
4326  for (Int_t icount=0; icount<LOCAL_NewAddedBTArray->GetEntries(); icount++) {
4327 
4328  tryAttachedSegment=(EdbSegP*)LOCAL_NewAddedBTArray->At(icount);
4329  if (tryAttachedSegment->MCEvt()>0 && tryAttachedSegment->MCEvt()!=InBT->MCEvt()) continue;
4330 
4331  //cout << "// 2c) Loop over (whole) local_gAli, again, but now with ONLY the new LOCAL_NewAddedBTArray as starting BTs"<< endl;
4332  //cout << "// 2c) and only if the local_gAli Z position id greater equal than LOCAL_NewAddedBTArray z position:"<< endl;
4333  //cout << " Doing this for tryAttachedSegment " << tryAttachedSegment->X() << " " << tryAttachedSegment->Y() << " " << tryAttachedSegment->Z() << " " << tryAttachedSegment->TX() << " " << tryAttachedSegment->TY() << " " << tryAttachedSegment->MCEvt() << " " << endl;
4334 
4335  local_gAli_npat=local_gAli->Npatterns();
4336  // cout << "--- local_gAli_npat= " << local_gAli_npat << endl;
4337 
4338  // Loop over all plates of local_gAli, since this is already
4339  // extracted with the right numbers of plates...
4340  for (Int_t patterloop_cnt=local_gAli_npat-1; patterloop_cnt>=0; --patterloop_cnt) {
4341 
4342  float_t local_gAliZ=local_gAli->GetPattern(patterloop_cnt)->Z();
4343 
4344  // cout << "--- --- Doing patterloop_cnt= " << patterloop_cnt << endl;
4345  // cout << "--- --- local_gAli->GetPattern(patterloop_cnt)->Z()= " << local_gAliZ << endl;
4346  // cout << "--- --- Is tryAttachedSegment->Z() gtreater equal local_gAliZ()= " << tryAttachedSegment->Z() << " " << local_gAliZ << endl;
4347 
4348  // We do not want to search for local_gAli which has lower Z than the attacet BT itself
4349  //if (tryAttachedSegment->Z() < local_gAliZ) continue;
4350  //if (tryAttachedSegment->Z() > local_gAliZ) continue;
4351 
4352  int matches_found=0;
4353  //cout << "--- --- YES its greater, searching BTs of localgAli now for matches ?? ? GREATER OR SMALLER ???"<<endl;
4354 
4355 
4356  for (Int_t btloop_cnt=0; btloop_cnt<local_gAli->GetPattern(patterloop_cnt)->GetN(); ++btloop_cnt) {
4357  seg = (EdbSegP*)local_gAli->GetPattern(patterloop_cnt)->GetSegment(btloop_cnt);
4358  if (gEDBDEBUGLEVEL>3) seg->PrintNice();
4359 
4360  // Now what was formerly InBT is now the new tryAttachedSegment:
4361  // cout << " comparing now Segment " << seg << " (Z= " << seg->Z() << ") with the tryAttachedSegment (Z= " << tryAttachedSegment->Z() << ") GetdeltaRWithPropagation: "<< GetdeltaRWithPropagation(seg,tryAttachedSegment) << endl;
4362 
4363  // Now apply cut conditions: TrackCone Alg --------------------
4364  if (!GetConeOrTubeDistanceToInBT(seg, tryAttachedSegment, CUT_PARAMETER[0], CUT_PARAMETER[1])) continue;
4365  // cout << "Passed GetConeOrTubeDistanceToInBT"<< endl;
4366  if (!FindPrecedingBTsSingleThetaAngleTCDEBUG(seg, tryAttachedSegment, local_gAli, GLOBAL_ShowerSegArray)) continue;
4367  // cout << "Passed FindPrecedingBTsSingleThetaAngleTCDEBUG"<< endl;
4368  // end of cut conditions: TrackCone IMPLEMENTATION Alg --------------------
4369 
4370  // If we arrive here, Basetrack seg has passed criteria
4371  // and is then added to the shower array:
4372  // Check if its not the InBT which is already added:
4373  Bool_t isBTadded=kFALSE;
4375 
4376  if (gEDBDEBUGLEVEL>2) {
4377  if (isBTadded) cout << "...Yes this was a new one, and is added to shower array! ..."<< endl;
4378  if (isBTadded) seg->PrintNice();
4379  }
4380  if (isBTadded) matches_found++;
4381 
4382  } // of (Int_t btloop_cnt=0; );
4383 
4384  //if (matches_found>0) cout << "--- --- In this plate we have found _ADDITIONAL_ (more than zero) BTs: "<< matches_found << endl;
4385 
4386  // Calculate Efficency numbers only for the last element of the loop,
4387  // otherwise we add to much numbers...
4388  if (icount==LOCAL_NewAddedBTArray->GetEntries()-1) {
4389  // Calc BT density around shower:
4390  EdbPattern* pat_interim=local_gAli->GetPattern(patterloop_cnt);
4391  CalcTrackDensity(pat_interim,local_gAli_pat_interim_halfsize,npat_int,npat_total,npatN);
4392  // Calc TrackNumbers for plate for efficency numbers:
4393  CalcEfficencyNumbers(pat_interim, InBT->MCEvt(), NBT_Neff, NBTMC_Neff ,NBTMCe_Neff);
4394  }
4395 
4396  } // for (Int_t patterloop_cnt=local_gAli_npat-1; patterloop_cnt>=0; --patterloop_cnt) // end of loop over all plates of local_gAli
4397 
4398  } // for(int icount=0; icount<OCAL_NewAddedBTArray->GetEntries(); icount++ )
4399  LOCAL_NewAddedBTArray->Clear();
4400 
4401 // if (gEDBDEBUGLEVEL>2) PrintShowerObjectArray(GLOBAL_ShowerSegArray);
4402 
4403 
4404  // Quickly calculate NEW NBT and pur------------------------
4405  NBT_after=0;
4406  NBTMC_after=0;
4407  for (int count=0; count<GLOBAL_ShowerSegArray->GetEntries(); count++) {
4408  NBT_after++;
4409  interim=(EdbSegP*)GLOBAL_ShowerSegArray->At(count);
4410  if (interim->MCEvt()>0) NBTMC_after++;
4411  }
4412  pur_after=(Float_t)NBTMC_after/(Float_t)NBT_after;
4413  // Quickly calculate NEW NBT and pur------------------------
4414 
4415  if (gEDBDEBUGLEVEL>2) {
4416  cout << " Difference between before and after: " << endl;
4417  cout << " NBT = " << NBT_after << " Before: "<< NBT_before << endl;
4418  cout << " NBTMC = " << NBTMC_after << " Before: "<< NBTMC_before << endl;
4419  cout << " pur = " << pur_after << " Before: "<< pur_before << endl;
4420  }
4421 
4422  //-----------------------------------
4423  // 4) Calculate pur/eff/NBT numbers,
4424  // not needed when only reconstruction
4425  // done:
4426  //-----------------------------------
4427  if (cmd_OUTPUTLEVEL>=2 || cmd_OUTPUTLEVEL==0 ) {
4428  Int_t NBT=0;
4429  Int_t NBTMC=0;
4430  Int_t NBTallMC=0;
4431  Int_t NBTeMC=0;
4432  Double_t eff, purall, pure;
4433  CalcEffPurOfShower2(GLOBAL_ShowerSegArray, NBT, NBTMC, NBTallMC, NBTeMC, purall, pure, NBT_Neff, NBTMC_Neff ,NBTMCe_Neff);
4434 
4435  // Fill only for MC Event:
4436  if (GLOBAL_InBT_MC>0) {
4441  }
4443  }
4444 
4445 
4446  //-----------------------------------
4447  // 5) Fill Tree:
4448  //-----------------------------------
4449  TREE_ShowRecEff->Fill();
4450  if (gEDBDEBUGLEVEL>3) TREE_ShowRecEff->Show(TREE_ShowRecEff->GetEntries()-1);
4451 
4452 
4453  //-----------------------------------
4454  // 6a) Transfer ShowerArray to treebranchTreeEntry:
4455  //-----------------------------------
4456  if (cmd_OUTPUTLEVEL>0) {
4458  }
4459 
4460 
4461  //------------------------------------
4462  // Reset and delete important things:
4463  // also to avoid memory problems ...
4464  //-----------------------------------
4465 
4466  GLOBAL_ShowerSegArray->Clear();
4467  if (gEDBDEBUGLEVEL>3) cout << "--- ---GLOBAL_ShowerSegArray->GetEntries(): "<< GLOBAL_ShowerSegArray->GetEntries() << endl;
4468  delete local_gAli;
4469  local_gAli=0;
4471  //------------------------------------
4472  }
4473  // end of loop over GLOBAL_InBTArrayEntries
4474  //-----------------------------------------------------------------
4475 
4476 
4477  delete LOCAL_TrackBTArray;
4478  delete LOCAL_NewAddedBTArray;
4479 
4480  if (gEDBDEBUGLEVEL==2) cout << endl<<flush;
4481  if (gEDBDEBUGLEVEL>3) cout << "---TREE_ShowRecEff->GetEntries() ... " << TREE_ShowRecEff->GetEntries() << endl;
4482  if (gEDBDEBUGLEVEL>3) cout << "---GLOBAL_INBTSHOWERNR ... " << GLOBAL_INBTSHOWERNR<< endl;
4483 
4484 
4485  return;
4486 }
Bool_t FindPrecedingBTsSingleThetaAngleTCDEBUG(EdbSegP *s, EdbSegP *InBT, EdbPVRec *gAli, TObjArray *showersegarray)
Definition: ShowRec.cpp:6903

◆ RewriteSegmentPIDs()

void RewriteSegmentPIDs ( EdbPVRec gAli)
6120 {
6121  Log(3, "ShowRec.cpp", "--- void RewriteSegmentPIDs() ---");
6122 
6123  // This becomes necessary since when you have simaulation by ORFEO
6124  // and real measured tackground, they may have different PID() and the function
6125  // TransformEdbPVRec() will eventually not wor anymore since it relies on PIDs of
6126  // the Initiator BaseTracks, so if you start from BG Basetracks, this may crash:
6127  Bool_t eSGPID_To_BGPID=kFALSE;
6128  Bool_t eBGPID_To_SGPID=kTRUE;
6129 
6130  if (eSGPID_To_BGPID) RewriteSegmentPIDs_SGPID_To_BGPID(gAli);
6131  if (eBGPID_To_SGPID) RewriteSegmentPIDs_BGPID_To_SGPID(gAli);
6132  return;
6133 }
void RewriteSegmentPIDs_SGPID_To_BGPID(EdbPVRec *gAli)
Definition: ShowRec.cpp:6139

◆ RewriteSegmentPIDs_BGPID_To_SGPID()

void RewriteSegmentPIDs_BGPID_To_SGPID ( EdbPVRec gAli)

NEED TO WRITE BG PID TO GALI PIDS IF THERE ARE NO SG BT THERE !!! STILL IN EXPERIMENTAL PHASE !!!

6150 {
6153 
6154  // This function is inteded if you have mixture of Simulation and Data, some
6155  // of the values are not equally filled, and here the affected PID are made
6156  // same.
6157 
6158  // If during the read in procedure (via lnk.lst lnk.def the segments are automatically
6159  // assigned new values, then this is not necessary!
6160 
6161  /*
6162  EdbPatternsVolume with 11 patterns
6163  id= 0 pid= 0 x:y:z = 0.000 0.000 13000.025 n= 1001
6164  id= 1 pid= 1 x:y:z = 0.000 0.000 11700.037 n= 994
6165  id= 2 pid= 2 x:y:z = 0.000 0.000 10399.992 n= 983
6166  id= 3 pid= 3 x:y:z = 0.000 0.000 9100.037 n= 1039
6167  id= 4 pid= 4 x:y:z = 0.000 0.000 7800.044 n= 532
6168  id= 5 pid= 5 x:y:z = 0.000 0.000 6500.041 n= 964
6169  id= 6 pid= 6 x:y:z = 0.000 0.000 5200.023 n= 904
6170  id= 7 pid= 7 x:y:z = 0.000 0.000 3900.070 n= 823
6171  id= 8 pid= 8 x:y:z = 0.000 0.000 2600.014 n= 782
6172  id= 9 pid= 9 x:y:z = 0.000 0.000 1300.052 n= 783
6173  id= 10 pid= 10 x:y:z = 0.000 0.000 0.000 n= 681
6174 
6175  There should be PID(firstplate) always 1
6176  There should be PID(lastplate) always npatters-1
6177 
6178  There is a difference between the pid of the EdbPatternsVolume and the PID() of
6179  the segment couples,
6180  but at the point where the EdbPatternsVolume is read in, the information on the
6181  PID() of s.ePID is overwritten.
6182  Example: Basetracks of 01.cp.root have s.ePID==1 for Sim Basetracks
6183  after reading in, here they have pid= 10
6184 
6185  For our simulated data this has alrady written in at reconstruction level:
6186  segments of 01_001.cp.root have PID()==1 (z==0)
6187  segments of 56_001.cp.root have PID()==56 (Z==71200)
6188  segments of 57_001.cp.root have PID()==57 (Z==72500) [but pl 57 not existing in simulation]
6189  But for data from BG scannings this is arbitrarily (mostly zero)
6190  So we set this automatically here:
6191  */
6192 
6193 
6194  // return;
6195  Log(3, "ShowRec.cpp", "--- void RewriteSegmentPIDs_BGPID_To_SGPID() ---");
6196 
6197 
6198  Log(2, "ShowRec.cpp", "--- void RewriteSegmentPIDs_BGPID_To_SGPID() --- returning, because no good implementation for this function yet........");
6199  return;
6200 
6201  Int_t npat = gAli->Npatterns();
6202  Int_t nseg =0;
6203  Int_t nominal_PID_SG=1234567890;
6204  Int_t nominal_PID_gALI=1234567890;
6205 
6206  EdbSegP* testseg=0;
6207 
6208  cout << "==============DEBUG====================="<<endl;
6209 
6210  gAli->GetPattern(0)->GetSegment(0)->Print();
6211 
6212  gAli->GetPattern(npat-1)->GetSegment(0)->Print();
6213 
6214 
6215  // return;
6216 
6217  gAli->Print();
6218 
6219 
6220  // for (Int_t i=0; i<npat; ++i){
6221  for (Int_t i=0; i<npat; ++i) {
6222  nseg=gAli->GetPattern(i)->N();
6223 
6224 
6225  cout << "gAli->GetPattern(i)->PID= " << gAli->GetPattern(i)->PID() << endl;
6226  nominal_PID_gALI=gAli->GetPattern(i)->PID();
6227 
6228  cout << "this is for MCEV>0" << endl;
6229 
6230  for (Int_t ii=0; ii<nseg; ++ii) {
6231  testseg=(EdbSegP*)gAli->GetPattern(i)->GetSegment(ii);
6232  if (testseg->MCEvt()<0) continue;
6233  cout << "PID of (MC) testseg = " << testseg->PID()<< endl;
6234  // testseg->Print();
6235  break;
6236  }
6237 
6238  cout << "this is for MCEV<0" << endl;
6239 
6240  for (Int_t ii=0; ii<nseg; ++ii) {
6241  testseg=(EdbSegP*)gAli->GetPattern(i)->GetSegment(ii);
6242  if (testseg->MCEvt()>0) continue;
6243  cout << "PID of (MC) testseg = " << testseg->PID()<< endl;
6244  // testseg->Print();
6245  break;
6246  }
6247 
6248  /*
6250  // for (Int_t ii=0; ii<nseg; ++ii){
6251  Bool_t found_SG_BT=kFALSE;
6252  Int_t ii=0;
6253  while (found_SG_BT==kFALSE) {
6254  testseg=(EdbSegP*)gAli->GetPattern(i)->GetSegment(ii);
6255  if (testseg->MCEvt()<0) continue;
6256  cout << "PID of (MC) testseg = " << testseg->PID()<< endl;
6257  testseg->Print();
6258  ++ii;
6259  found_SG_BT=kTRUE;
6260  }
6261 
6262  Bool_t found_BG_BT=kFALSE;
6263  ii=0;
6264  while (found_BG_BT==kFALSE) {
6265  testseg=(EdbSegP*)gAli->GetPattern(i)->GetSegment(ii);
6266  if (testseg->MCEvt()>0) continue;
6267  cout << "PID of (MC) testseg = " << testseg->PID()<< endl;
6268  testseg->Print();
6269  ++ii;
6270  found_BG_BT=kTRUE;
6271  }
6272  */
6273 
6274 
6275  /*
6276 
6277 
6278  nominal_PID_SG=i+1; /// THIS DEPENDS STRONGLY ON THE STRUCTURE OF gALI OBJECT !!!!
6279  cout << "void RewriteSegmentPIDs_BGPID_To_SGPID() nominal_PID_SG = " << nominal_PID_SG << " set CHECK CAREFULLY. EXPERIMENTAL HELP FUNCTION PHASE!!" << endl;
6280  cout << "gAli->GetPattern(i)->PID() " << gAli->GetPattern(i)->PID() << " " << nominal_PID_SG << endl;
6281  cout << "gAli->GetPattern(i)->Z() " << gAli->GetPattern(i)->Z() << " " << nominal_PID_SG << endl;
6282  for (Int_t ii=0; ii<nseg; ++ii){
6283  if (gAli->GetPattern(i)->GetSegment(ii)->MCEvt()<0) gAli->GetPattern(i)->GetSegment(ii)->SetPID(i+1);
6284  // gAli->GetPattern(i)->GetSegment(ii)->Print();
6285  }
6286 
6287  */
6288  }
6289  return;
6290 }
int PID() const
Definition: EdbPattern.h:329
void Print(Option_t *opt="") const
Definition: EdbSegP.cxx:405

◆ RewriteSegmentPIDs_SGPID_To_BGPID()

void RewriteSegmentPIDs_SGPID_To_BGPID ( EdbPVRec gAli)
6140 {
6141  Log(3, "ShowRec.cpp", "--- void RewriteSegmentPIDs_SGPID_To_BGPID() ---");
6142  return;
6143 }

◆ SetDefaultValues_CommandLine()

void SetDefaultValues_CommandLine ( )
380  {
381 
382  Log(2, "ShowRec.cpp", "--- void SetDefaultValues_CommandLine() ---");
383 
384  //--- Default Values:
385  cmd_PADI=0;
386  cmd_BTPA=0;
387  cmd_BGTP=0;
388  cmd_ALTP=4;
389  cmd_PASTART=-1;
390  cmd_PAEND=-1;
391  cmd_FP=1;
392  cmd_LP=50;
393  cmd_MP=25;
394  cmd_NP=30;
395  cmd_LT=0;
396  Int_t cmd_MC=1;
397  Int_t cmd_MCFL=0;
398  Int_t cmd_FZHP=1;
399  Int_t cmd_vtx=0;
401  cmd_OUTPUTLEVEL=1;
402  cmd_ALI=0;
403  cmd_MCMIX=0;
404  cmd_FILETP=0;
405  cmd_GBMC=0;
406  cmd_lnkdef_name = "lnk.def";
407  cmd_EXTHETA=0;
408  return;
409 }
char * cmd_lnkdef_name
Definition: ShowRec.h:31

◆ SortShowerZ()

void SortShowerZ ( TObjArray *  showerarray)
8816  {
8817 
8818  // A simple reverting sort: assuming that segments in shower are already sorted, but in
8819  // descending direction, so we just invert them!
8820  // CANNOT BE USED WHEN segments wer put in an arbitrary way!!!
8821 
8822  if (IsShowerSortedZ(showerarray)) {
8823  if (gEDBDEBUGLEVEL>2) cout << "Shower already sorted in ascending Z-direction. Do nothing." << endl;
8824  return;
8825  }
8826  Int_t nent_showerarray=showerarray->GetEntries();
8827  Int_t nent=showerarray->GetEntries();
8828  TObjArray* interimShower = new TObjArray(nent_showerarray);
8829  if (gEDBDEBUGLEVEL>2) cout << "interif (gEDBDEBUGLEVEL>2)imShower->GetEntries() " << interimShower->GetEntries() << endl;
8830  if (gEDBDEBUGLEVEL>2) cout << "showerarray->GetEntries() " << showerarray->GetEntries() << endl;
8831  EdbSegP* s0;
8832  EdbSegP* s1;
8833  for (Int_t k=0; k<nent; ++k) {
8834  EdbSegP* s0=(EdbSegP*)showerarray->At(nent-k-1);
8835  interimShower->AddAt(s0,k);
8836  }
8837  showerarray->Clear();
8838  for (Int_t k=0; k<nent; ++k) {
8839  EdbSegP* s0=(EdbSegP*)interimShower->At(k);
8840  showerarray->AddAt(s0,k);
8841  }
8842  if (gEDBDEBUGLEVEL>2) PrintShowerObjectArray(showerarray);
8843 
8844  if (IsShowerSortedZ(showerarray)) {
8845  if (gEDBDEBUGLEVEL>2) cout << "Shower now sorted in ascending Z-direction. Done." << endl;
8846  return;
8847  }
8848  if (!IsShowerSortedZ(showerarray)) {
8849  cout << "WARNING WARNING Shower is still NOT sorted in ascending Z-direction. YOU HAVE TO CHECK MANUALLY." << endl;
8850  return;
8851  }
8852  return;
8853 }
void Clear()
Definition: EdbSegP.h:85

◆ 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.

7941 {
7942  Log(3, "ShowRec.cpp", "--- void* TransferShowerObjectArrayIntoEntryOfTreebranchShowerTree() ---");
7943 
7944  // SaveCheck if shower has at least one basetrack:
7945  if (segarray->GetEntries()<1) return;
7946 
7947  EdbSegP* seg;
7948  EdbSegP* Inseg;
7949  Int_t helper_nfilmb;
7950  Int_t diff_pid;
7951  Float_t min_shower_deltathetab=99999;
7952  Float_t min_shower_deltar=99999;
7953  Float_t test_shower_deltathetab=99999;
7954  Float_t test_shower_deltar=99999;
7955  Float_t test_shower_deltax,test_shower_deltay;
7956  Int_t max_diff_pid=0;
7957 
7958 
7959  Float_t shower_sizebNHELP=0;
7960  Float_t shower_sizebMCNHELP=0;
7961 
7962  Float_t extrapol_x,extrapol_y, extrapo_diffz;
7963 
7964  // Initialize arrays...
7965  shower_sizeb15=0;
7966  shower_sizeb20=0;
7967  shower_sizeb30=0;
7968  shower_sizeb=0;
7973  shower_filetype=0;
7974  for (int ii=0; ii<5000; ii++) {
7975  shower_xb[ii]=0;
7976  shower_yb[ii]=0;
7977  shower_zb[ii]=0;
7978  shower_txb[ii]=0;
7979  shower_tyb[ii]=0;
7980  shower_nfilmb[ii]=0;
7981  shower_tagprimary[ii]=0;
7982  shower_ntrace1simub[ii]=0;
7983  shower_ntrace2simub[ii]=0;
7984  shower_ntrace3simub[ii]=0;
7985  shower_ntrace4simub[ii]=0;
7986  shower_deltaxb[ii]=0;
7987  shower_deltayb[ii]=0;
7988  shower_chi2btkb[ii]=0;
7989  shower_idb[ii]=0;
7990  shower_plateb[ii]=0;
7991  }
7992  for (int i=1; i<59; ++i) {
7994  }
7995 
7996  // Part To calculate the TransfereedVariables....
7997  shower_sizeb=segarray->GetEntries();
7998  Inseg=(EdbSegP*)segarray->At(0);
7999  shower_energy_shot_particle=Inseg->P();
8000  shower_number_eventb=Inseg->MCEvt();
8002 
8003 
8004  if (gEDBDEBUGLEVEL>3) cout << "--- --- ---------------------"<<endl;
8005  //-------------------------------------
8006  for (int ii=0; ii<shower_sizeb; ii++) {
8007 
8008  if (ii>=5000) {
8009  cout << "WARNING: shower_sizeb ( " << shower_sizeb<< ") greater than SHOWERARRAY. Set sizeb to 4999 and Stop filling!."<<endl;
8010  shower_sizeb=4999;
8011  continue;
8012  }
8013  seg=(EdbSegP*)segarray->At(ii);
8014 
8015  //-------------------------------------
8016  shower_xb[ii]=seg->X();
8017  shower_yb[ii]=seg->Y();
8018  shower_txb[ii]=seg->TX();
8019  shower_tyb[ii]=seg->TY();
8020  shower_zb[ii]=seg->Z();
8021  shower_chi2btkb[ii]=seg->Chi2();
8022  shower_deltathetab[ii]=0.5;
8023  shower_deltarb[ii]=200;
8024  shower_tagprimary[ii]=0;
8025  if (ii==0) shower_tagprimary[ii]=1;
8026  shower_isizeb=1; // always 1, not needed anymore
8027  if (seg->MCEvt()>0) {
8028  shower_ntrace1simub[ii]=seg->MCEvt();
8029  shower_ntrace2simub[ii]=seg->W();
8030  shower_ntrace3simub[ii]=seg->P();
8031  shower_ntrace4simub[ii]=seg->Flag();
8032  }
8033  else {
8034  // keep the seg->BT settings for BG:
8035  // that come out of "normal" scanned data from fedra:
8036  // shower_ntrace1simub=-999
8037  // shower_ntrace2simub=seg->W();
8038  // shower_ntrace3simub=-999
8039  // shower_ntrace4simub=0
8040  shower_ntrace1simub[ii]=-999;
8041  shower_ntrace2simub[ii]=seg->W();
8042  shower_ntrace3simub[ii]=-999;
8043  shower_ntrace4simub[ii]=0;
8044  }
8045  shower_idb[ii]=seg->ID();
8046  shower_plateb[ii]=seg->PID();
8047 
8048 
8049  //-------------------------------------
8050  // PUT HERE: deltarb,deltarb, nflimb, sizeb15......
8051  diff_pid=TMath::Abs( Inseg->PID()-seg->PID() )+1;
8052  // (does this work for up/downsream listing??)
8053  // (yes, since InBT->PID is also changed.)
8054  // but works only if the gAli Object has no missing plates
8055  // otherwise f.e. PID(1) and PID(2) are not necessaryly abay by dZ=1300
8056  // (could be Z(1)=1300 and Z(2)=3900...)
8057 
8058  // Calc pur:
8059  // New: (16.02.2010) define purity w.r.t. MC of Initiabtor Basetrack
8060  // So if other MC-events (like in testbeam simulation case) had been taken, they
8061  // count as well as "background!"
8062  shower_sizebNHELP++;
8063  if (seg->MCEvt()==shower_number_eventb&&shower_number_eventb>0) shower_sizebMCNHELP++;
8064  // for example: InBT:MCEvt==4 and Basetrack has MCEvt==18 then
8065  // shower_sizebNHELP++, but not shower_sizebMCNHELP !!
8066  // But also: if shower_number_eventb==-999 i.e. we start from a BG basetrack
8067  // and all other shower collected BTs have MCEvt==-999 then we get also
8068  // a purity of 1.
8069  // That means shower consisting only of BG events are in that sense also "very pure".
8070  // How to deal with this?
8071  // if (shower_number_eventb=-999) then we do NOT increment
8072  // shower_sizebMCNHELP , this is by changing the statement from
8073  // if (seg->MCEvt()==shower_number_eventb) shower_sizebMCNHELP++;
8074  // to
8075  // if (seg->MCEvt()==shower_number_eventb&&shower_number_eventb>0) shower_sizebMCNHELP++;
8076 
8077  // InBT:
8078  if (ii==0) {
8079  shower_deltathetab[0]=0.5;
8080  shower_deltarb[0]=200;
8081  shower_nfilmb[0]=1;
8082  }
8083  // All other BTs:
8084  if (ii>0) {
8085  // its correct like this, since this is the way it is done in
8086  // the official FJ-Algorithm:
8087  shower_nfilmb[ii]=diff_pid;
8088  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;
8089 
8090  shower_numberofilms=TMath::Max(shower_numberofilms,diff_pid);
8091 
8092  if (diff_pid >= 15 ) shower_sizeb15++;
8093  if (diff_pid >= 20 ) shower_sizeb20++;
8094  if (diff_pid >= 30 ) shower_sizeb30++;
8095 
8096  // PUT HERE: calculation routine for shower_deltasigmathetab
8097  // see referenc in thesis of Luillo Esposito, page 109.
8098  shower_deltasigmathetab[diff_pid]=shower_deltasigmathetab[diff_pid]+(Power(shower_txb[ii]-shower_txb[0],2)+Power(shower_tyb[ii]-shower_tyb[0],2));
8099 
8100  // PUT HERE: calculation routine for shower_deltathetab, shower_deltarb
8101  // ExSetTreebranchNametrapolate the BT [ii] to the position [jj] and then calc the
8102  // position and slope differences;
8103  // For the backward extrapolation of the shower_deltathetab and shower_deltarb
8104  // calulation for BaseTrack(ii), Basetrack(jj)->Z() hast to be smaller.
8105  min_shower_deltathetab=99999; // Reset
8106  min_shower_deltar=99999; // Reset
8107 
8108  for (int jj=0; jj<shower_sizeb; jj++) {
8109  if (ii==jj) continue;
8110 
8111  // since we do not know if BTs are ordered by their Z positions:
8112  // and cannot cut directly on the number in the shower entry:
8113  // Entry jj has to have lower Z than ii:
8114  if (shower_zb[ii]<=shower_zb[jj]) continue;
8115 
8116  extrapo_diffz=shower_zb[ii]-shower_zb[jj];
8117  if (TMath::Abs(extrapo_diffz)>4*1300+1.0) continue;
8118 // if (TMath::Abs(extrapo_diffz)>6*1300+1.0) continue;
8119 // if (TMath::Abs(extrapo_diffz)>9*1300+1.0) continue;
8120  // if 4/6/9 gives only similar results...
8121  if (TMath::Abs(extrapo_diffz)<1.0) continue; // remove same positions.
8122 
8123  extrapol_x=shower_xb[ii]-shower_txb[ii]*extrapo_diffz; // minus, because its ii after jj.
8124  extrapol_y=shower_yb[ii]-shower_tyb[ii]*extrapo_diffz; // minus, because its ii after jj.
8125 
8126  // Delta radius we need to extrapolate.
8127 // test_shower_deltax=extrapol_x;//shower_txb[ii]*(shower_zb[ii]-shower_zb[jj])+shower_xb[ii];
8128 // test_shower_deltay=extrapol_y;//shower_tyb[ii]*(shower_zb[ii]-shower_zb[jj])+shower_yb[ii];
8129  test_shower_deltax=extrapol_x-shower_xb[jj];
8130  test_shower_deltay=extrapol_y-shower_yb[jj];
8131  test_shower_deltar=TMath::Sqrt(test_shower_deltax*test_shower_deltax+test_shower_deltay*test_shower_deltay);
8132 
8133  // Delta theta we do not need to extrapolate. (old version...)
8134  //test_shower_deltathetab=TMath::Sqrt(shower_txb[ii]*shower_txb[ii]+shower_tyb[ii]*shower_tyb[ii]);
8135  //test_shower_deltathetab=test_shower_deltathetab-TMath::Sqrt(shower_txb[jj]*shower_txb[jj]+shower_tyb[jj]*shower_tyb[jj]);
8136  //test_shower_deltathetab=TMath::Abs(test_shower_deltathetab);
8137  //----
8138  // As before in ShowRec this way of calculation is not equivalent as calculating
8139  // DeltaTheta domponentwise:
8140  // Code from libShower:
8141  // delta = sqrt((SX0-a->GetTXb(l2))*(SX0-a->GetTXb(l2))+((SY0-a->GetTYb(l2))*(SY0-a->GetTYb(l2))));
8142  test_shower_deltathetab=TMath::Sqrt(TMath::Power(shower_txb[ii]-shower_txb[jj],2)+TMath::Power(shower_tyb[ii]-shower_tyb[jj],2));
8143 
8144  // Check if both dr,dt match parameter criteria and then just take these values.....
8145  // Maybe a change is necessary because it is not exactly the same as in the off. algorithm.
8146 // if (test_shower_deltar<400 && test_shower_deltathetab<0.8 ) {
8147 // if (test_shower_deltar<150 && test_shower_deltathetab<0.15) {
8148  if (test_shower_deltar<1000 && test_shower_deltathetab<2.0 ) {
8155  if (test_shower_deltar<min_shower_deltar) {
8156  min_shower_deltathetab=test_shower_deltathetab;
8157  min_shower_deltar=test_shower_deltar;
8158  shower_deltathetab[ii]=min_shower_deltathetab;
8159  shower_deltarb[ii]=min_shower_deltar;
8160  //cout << ii << " " << jj << " " << test_shower_deltathetab << " " << test_shower_deltar << " " <<min_shower_deltathetab << " " << min_shower_deltar << endl;
8161 
8162  } // if (test_shower_deltar<min_shower_deltar)
8163  } // if (test_shower_deltar<150 && test_shower_deltathetab<0.15 )
8164  } // for (int jj=0;jj<shower_sizeb;jj++)
8165 
8166 
8167  //cout << "For ii= " << ii << "we found the best matcjgin dRtehta values: " << min_shower_deltathetab << " " << min_shower_deltar << endl;
8168  } // if (ii>0)
8169  //-------------------------------------
8170 
8171 
8172  shower_purb=shower_sizebMCNHELP/shower_sizebNHELP;
8173  } // for (int ii=0;ii<shower_sizeb;ii++) {
8174  if (gEDBDEBUGLEVEL>2) {
8175  cout << "ShowRec.cpp : --- void* TransferShowerObjectArrayIntoEntryOfTreebranchShowerTree() ---"<<endl;
8176  cout << "Loop over for (int ii=0;ii<shower_sizeb;ii++) done." << endl;
8177  }
8178 
8179  //-------------------------------------
8180  for (int i=1; i<59; ++i) {
8182  }
8183  shower_numberofilms=shower_nfilmb[shower_sizeb-1]; // there we assume (this is correct always?) when
8184  // the last shower BT is in the last film...(otherwise we would again have to loop on sizeb array);
8185  //cout << "TransferShowerObjectArrayIntoEntryOfTreebranchShowerTree shower_numberofilms= "<< shower_numberofilms <<endl;
8186 
8187  int eN0=0;
8188  for (int i=0; i<shower_nfilmb[shower_sizeb-1]; i++) if (shower_nfilmb[i]==0) ++eN0;
8190 
8191  int eN00int=0;
8192  int eN00=0;
8193  for (int i=1; i<shower_nfilmb[shower_sizeb-1]; i++) {
8194  //cout << i << "------------" << shower_nfilmb[i]-shower_nfilmb[i-1] << " -- " << eN00 << endl;
8195  if (shower_nfilmb[i]-shower_nfilmb[i-1]>1) {
8196  eN00=shower_nfilmb[i]-shower_nfilmb[i-1]-1;
8197  if (eN00>eN00int) eN00int=eN00;
8198  }
8199  if (shower_nfilmb[i]-shower_nfilmb[i-1]==1) eN00=0;
8200  }
8201  eN00=eN00int;
8203 
8204  //cout << "TransferShowerObjectArrayIntoEntryOfTreebranchShowerTree shower_numberofholesconseq= "<< shower_numberofholesconseq <<endl;
8205 
8206  // Also calculate now Shower axis and fill axis values into the treebranch:
8207 // EdbSegP* axis= new EdbSegP();
8208  EdbSegP* axis = BuildShowerAxis(segarray);
8209 // axis->PrintNice();
8210  //cout << "TransferShowerObjectArrayIntoEntryOfTreebranchShowerTree BuildShowerAxis done."<<endl;
8211  shower_axis_xb=axis->X();
8212  shower_axis_yb=axis->Y();
8213  shower_axis_zb=axis->Z();
8214  shower_axis_txb=axis->TX();
8215  shower_axis_tyb=axis->TY();
8216 // delete axis;
8217 
8218  // Fill Tree:
8219  treebranchtree->Fill();
8220 
8221  if (gEDBDEBUGLEVEL>2) cout << "Now we have treebranchtree Entries: " << treebranchtree->GetEntries() << endl;
8222  if (gEDBDEBUGLEVEL>3) treebranchtree->Show(treebranchtree->GetEntries()-1);
8223 
8224  return;
8225 }

◆ 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 .....


6300 {
6301  Log(3, "ShowRec.cpp", "--- void TransformEdbPVRec() ---");
6302 
6303  // local_halfpatternsize=11250;// debugTEST how long it takes more if we take a big area to reconstruct.
6304  Float_t halfpatternsize=local_halfpatternsize;
6305 
6306 
6307  // Informational Debug Output
6308  // DOWNSTREAM ORDER ASSUMED !!!
6311  Int_t npat = GLOBAL_gAli->Npatterns(); //number of plates
6312  Int_t firstplate= npat-cmd_FP;
6313  Int_t middleplate= npat-cmd_MP;
6314  Int_t actualplate= npat-cmd_FP;
6315  Int_t lastplate= TMath::Max(npat-cmd_LP-1,0);
6316  Int_t InBTplate= InitiatorBT->PID();
6317  Int_t InBTplateandNplate= InitiatorBT->PID()-cmd_NP+1;
6318  Int_t endlplatetopropagate=TMath::Max(InBTplateandNplate,lastplate);
6319  Float_t InBTZ= InitiatorBT->Z();
6320 
6321  if (gEDBDEBUGLEVEL>2) {
6322  cout << "--- TransformEdbPVRec --- DOWNSTREAM ORDER = " <<endl;
6323  cout << "--- TransformEdbPVRec --- npat = " << npat << endl;
6324  cout << "--- TransformEdbPVRec --- firstplate = " << firstplate << endl;
6325  cout << "--- TransformEdbPVRec --- middleplate = " << middleplate << endl;
6326  cout << "--- TransformEdbPVRec --- lastplate = " << lastplate << endl;
6327  cout << "--- TransformEdbPVRec --- InBTplate = " << InBTplate << endl;
6328  cout << "--- TransformEdbPVRec --- InBTplateandNplate = " << InBTplateandNplate << endl;
6329  cout << "--- TransformEdbPVRec --- endlplatetopropagate = " << endlplatetopropagate << endl;
6330  cout << "--- TransformEdbPVRec --- InBTZ = " << InBTZ << endl;
6331  cout << "--- TransformEdbPVRec --- InBTplate = " << InBTplate << endl;
6332  }
6333 
6334  // has to be deleted in some part of the script outside this function...
6335  // Dont forget , otherwise memory heap overflow!
6336  EdbPVRec* gAli_Sub = new EdbPVRec();
6337 
6338  // Create SubPattern objects
6339  EdbSegP* ExtrapolateInitiatorBT;
6340  ExtrapolateInitiatorBT = (EdbSegP*)InitiatorBT->Clone();
6341 
6342  // Create Variables For ExtractSubpattern boundaries
6343  Float_t mini[5];
6344  Float_t maxi[5];
6345  mini[0]=ExtrapolateInitiatorBT->X()-halfpatternsize;
6346  mini[1]=ExtrapolateInitiatorBT->Y()-halfpatternsize;
6347  maxi[0]=ExtrapolateInitiatorBT->X()+halfpatternsize;
6348  maxi[1]=ExtrapolateInitiatorBT->Y()+halfpatternsize;
6349  mini[2]=-0.5;
6350  mini[3]=-0.5;
6351  mini[4]=0.0;
6352  maxi[2]=0.5;
6353  maxi[3]=0.5;
6354  maxi[4]=100.0;
6355 
6356 
6360  if (cmd_EXTHETA==1) {
6361  mini[2]=ExtrapolateInitiatorBT->TX()-0.15;
6362  mini[3]=ExtrapolateInitiatorBT->TY()-0.15;
6363  maxi[2]=ExtrapolateInitiatorBT->TX()+0.15;
6364  maxi[3]=ExtrapolateInitiatorBT->TY()+0.15;
6365  }
6367 
6368  EdbPattern* singlePattern;
6369  Int_t MCMixFlag=-1;
6370  if (cmd_MCMIX==1) {
6371  MCMixFlag=-1;
6372  }
6373  else {
6374  MCMixFlag=InitiatorBT->MCEvt();
6375  }
6376 
6377  // Add the subpatterns in a loop for the plates:
6378  // in reverse ordering.due to donwstream behaviour (!):
6379  // (Only downstream is supported now...)
6380  for (Int_t ii=endlplatetopropagate; ii<=InBTplate; ++ii) {
6381 
6382  Float_t zpos=gAli->GetPattern(ii)->Z();
6383  if (gEDBDEBUGLEVEL>3) cout << "--- --- Loop: ii, zpos "<< ii << " " << zpos << "; Print InitiatorBT,ExtrapolateInitiatorBT"<<endl;
6384 
6385  ExtrapolateInitiatorBT->PropagateTo(zpos);
6386  if (gEDBDEBUGLEVEL>3) {
6387  InitiatorBT->PrintNice();
6388  ExtrapolateInitiatorBT->PrintNice();
6389  }
6390 
6391  mini[0]=ExtrapolateInitiatorBT->X()-halfpatternsize;
6392  mini[1]=ExtrapolateInitiatorBT->Y()-halfpatternsize;
6393  maxi[0]=ExtrapolateInitiatorBT->X()+halfpatternsize;
6394  maxi[1]=ExtrapolateInitiatorBT->Y()+halfpatternsize;
6395 
6396  singlePattern=(EdbPattern*)gAli->GetPattern(ii)->ExtractSubPattern(mini,maxi,MCMixFlag);
6397 // cout << "singlePattern with MCMixFlag= " << MCMixFlag << " nentries= " << singlePattern->N() << endl;
6398 
6399 
6400  singlePattern-> SetID(gAli->GetPattern(ii)->ID());
6401  singlePattern-> SetPID(gAli->GetPattern(ii)->PID());
6402  gAli_Sub->AddPattern(singlePattern);
6403  }
6404  if (gEDBDEBUGLEVEL>2) cout <<"--- gAli_Sub->Print():"<<endl;
6405  if (gEDBDEBUGLEVEL>2) gAli_Sub->Print();
6406  if (gEDBDEBUGLEVEL>2) cout <<"--- ----------------------------------"<<endl;
6407 
6408  return gAli_Sub;
6409 }
int ID() const
Definition: EdbPattern.h:328
EdbPattern * ExtractSubPattern(float min[5], float max[5], int MCevt=-1)
Definition: EdbPattern.cxx:1593
void AddPattern(EdbPattern *pat)
Definition: EdbPattern.cxx:1867

◆ 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!

6414 {
6415  Log(3, "ShowRec.cpp", "--- void TransformEdbPVRec_BackWard() ---");
6416 
6417  local_halfpatternsize=11250;// debugTEST how long it takes more if we take a big area to reconstruct.
6418  local_halfpatternsize=5000;// debugTEST how long it takes more if we take a big area to reconstruct.
6419  local_halfpatternsize=2000;// debugTEST how long it takes more if we take a big area to reconstruct.
6420  Float_t halfpatternsize=local_halfpatternsize;
6421 
6422  // Informational Debug Output
6423  // DOWNSTREAM ORDER ASSUMED !!!
6426  Int_t npat = GLOBAL_gAli->Npatterns(); //number of plates
6427  Int_t firstplate= npat-cmd_FP;
6428  Int_t middleplate= npat-cmd_MP;
6429  Int_t actualplate= npat-cmd_FP;
6430  Int_t lastplate= TMath::Max(npat-cmd_LP-1,0);
6431  Int_t InBTplate= InitiatorBT->PID();
6432  Int_t InBTplateandNplate= InitiatorBT->PID()-cmd_NP+1;
6433  Int_t endlplatetopropagate=TMath::Max(InBTplateandNplate,lastplate);
6434  Float_t InBTZ= InitiatorBT->Z();
6435 
6436  if (gEDBDEBUGLEVEL>3) {
6437  cout << "--- DOWNSTREAM ORDER = " <<endl;
6438  cout << "--- npat = " << npat << endl;
6439  cout << "--- firstplate = " << firstplate << endl;
6440  cout << "--- middleplate = " << middleplate << endl;
6441  cout << "--- lastplate = " << lastplate << endl;
6442  cout << "--- InBTplate = " << InBTplate << endl;
6443  cout << "--- InBTplateandNplate = " << InBTplateandNplate << endl;
6444  cout << "--- endlplatetopropagate = " << endlplatetopropagate << endl;
6445  cout << "--- InBTZ = " << InBTZ << endl;
6446  }
6447 
6448  // has to be deleted in some part of the script outside this function...
6449  // Dont forget , otherwise memory heap overflow!
6450  EdbPVRec* gAli_Sub = new EdbPVRec();
6451 
6452  // Create SubPattern objects
6453  EdbSegP* ExtrapolateInitiatorBT;
6454  ExtrapolateInitiatorBT = (EdbSegP*)InitiatorBT->Clone();
6455 
6456  // Create Variables For ExtractSubpattern boundaries
6457  Float_t mini[5];
6458  Float_t maxi[5];
6459  mini[0]=ExtrapolateInitiatorBT->X()-halfpatternsize;
6460  mini[1]=ExtrapolateInitiatorBT->Y()-halfpatternsize;
6461  maxi[0]=ExtrapolateInitiatorBT->X()+halfpatternsize;
6462  maxi[1]=ExtrapolateInitiatorBT->Y()+halfpatternsize;
6463  mini[2]=-0.5;
6464  mini[3]=-0.5;
6465  mini[4]=0.0;
6466  maxi[2]=0.5;
6467  maxi[3]=0.5;
6468  maxi[4]=100.0;
6469 
6470  EdbPattern* singlePattern;
6471 
6472  for (Int_t ii=0; ii<npat; ++ii) {
6473 
6474  Float_t zpos=gAli->GetPattern(ii)->Z();
6475  if (gEDBDEBUGLEVEL>3) cout << "--- --- Loop: ii, zpos "<< ii << " " << zpos << "; Print InitiatorBT,ExtrapolateInitiatorBT"<<endl;
6476 
6477  ExtrapolateInitiatorBT->PropagateTo(zpos);
6478  if (gEDBDEBUGLEVEL>3) {
6479  InitiatorBT->PrintNice();
6480  ExtrapolateInitiatorBT->PrintNice();
6481  }
6482 
6483  mini[0]=ExtrapolateInitiatorBT->X()-halfpatternsize;
6484  mini[1]=ExtrapolateInitiatorBT->Y()-halfpatternsize;
6485  maxi[0]=ExtrapolateInitiatorBT->X()+halfpatternsize;
6486  maxi[1]=ExtrapolateInitiatorBT->Y()+halfpatternsize;
6487 
6488  singlePattern=(EdbPattern*)gAli->GetPattern(ii)->ExtractSubPattern(mini,maxi,InitiatorBT->MCEvt());
6489  singlePattern-> SetID(gAli->GetPattern(ii)->ID());
6490  singlePattern-> SetPID(gAli->GetPattern(ii)->PID());
6491  gAli_Sub->AddPattern(singlePattern);
6492  }
6493  if (gEDBDEBUGLEVEL>3) cout <<"--- gAli_Sub->Print():"<<endl;
6494  if (gEDBDEBUGLEVEL>3) gAli_Sub->Print();
6495  if (gEDBDEBUGLEVEL>3) cout <<"--- ----------------------------------"<<endl;
6496 
6497  if (gEDBDEBUGLEVEL>2) cout <<"--- gAli_Sub with ():"<< gAli_Sub->Npatterns() << "patterns."<<endl;
6498 
6499  return gAli_Sub;
6500 }

◆ 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!

6507 {
6508  Log(3, "ShowRec.cpp", "--- void TransformEdbPVRec_SA() ---");
6509 
6510  // Informational Debug Output
6511  // DOWNSTREAM ORDER ASSUMED !!!
6514  Int_t npat = GLOBAL_gAli->Npatterns(); //number of plates
6515  Int_t firstplate= npat-cmd_FP;
6516  Int_t middleplate= npat-cmd_MP;
6517  Int_t actualplate= npat-cmd_FP;
6518  Int_t lastplate= TMath::Max(npat-cmd_LP-1,0);
6519  Int_t InBTplate= InitiatorBT->PID();
6520  Int_t InBTplateandNplate= InitiatorBT->PID()-cmd_NP+1;
6521  Int_t endlplatetopropagate=TMath::Max(InBTplateandNplate,lastplate);
6522  Float_t InBTZ= InitiatorBT->Z();
6523 
6524  if (gEDBDEBUGLEVEL>2) {
6525  cout << "--- DOWNSTREAM ORDER = " <<endl;
6526  cout << "--- npat = " << npat << endl;
6527  cout << "--- firstplate = " << firstplate << endl;
6528  cout << "--- middleplate = " << middleplate << endl;
6529  cout << "--- lastplate = " << lastplate << endl;
6530  cout << "--- InBTplate = " << InBTplate << endl;
6531  cout << "--- InBTplateandNplate = " << InBTplateandNplate << endl;
6532  cout << "--- endlplatetopropagate = " << endlplatetopropagate << endl;
6533  cout << "--- InBTZ = " << InBTZ << endl;
6534  }
6535 
6536  // has to be deleted in some part of the script outside this function...
6537  // Dont forget , otherwise memory heap overflow!
6538  EdbPVRec* gAli_Sub = new EdbPVRec();
6539 
6540  // Create SubPattern objects
6541  EdbSegP* ExtrapolateInitiatorBT;
6542  ExtrapolateInitiatorBT = (EdbSegP*)InitiatorBT->Clone();
6543 
6544  Float_t halfsize=CUT_PARAMETER[1];
6545 
6546  // Create Variables For ExtractSubpattern boundaries
6547  Float_t mini[5];
6548  Float_t maxi[5];
6549  mini[0]=ExtrapolateInitiatorBT->X()-halfsize;
6550  mini[1]=ExtrapolateInitiatorBT->Y()-halfsize;
6551  maxi[0]=ExtrapolateInitiatorBT->X()+halfsize;
6552  maxi[1]=ExtrapolateInitiatorBT->Y()+halfsize;
6553  mini[2]=-0.5;
6554  mini[3]=-0.5;
6555  mini[4]=0.0;
6556  maxi[2]=0.5;
6557  maxi[3]=0.5;
6558  maxi[4]=100.0;
6559 
6560  EdbPattern* singlePattern;
6561 
6562  // Add the subpatterns in a loop for the plates:
6563  // in reverse ordering.due to donwstream behaviour (!):
6564  // (Only downstream is supported now...)
6565  for (Int_t ii=endlplatetopropagate; ii<=InBTplate; ++ii) {
6566 
6567  Float_t zpos=gAli->GetPattern(ii)->Z();
6568  if (gEDBDEBUGLEVEL>3) cout << "--- --- Loop: ii, zpos "<< ii << " " << zpos << "; Print InitiatorBT,ExtrapolateInitiatorBT"<<endl;
6569 
6570  ExtrapolateInitiatorBT->PropagateTo(zpos);
6571  if (gEDBDEBUGLEVEL>3) {
6572  InitiatorBT->PrintNice();
6573  ExtrapolateInitiatorBT->PrintNice();
6574  }
6575 
6576  mini[0]=ExtrapolateInitiatorBT->X()-halfsize;
6577  mini[1]=ExtrapolateInitiatorBT->Y()-halfsize;
6578  maxi[0]=ExtrapolateInitiatorBT->X()+halfsize;
6579  maxi[1]=ExtrapolateInitiatorBT->Y()+halfsize;
6580 
6581  singlePattern=(EdbPattern*)gAli->GetPattern(ii)->ExtractSubPattern(mini,maxi,InitiatorBT->MCEvt());
6582  singlePattern-> SetID(gAli->GetPattern(ii)->ID());
6583  singlePattern-> SetPID(gAli->GetPattern(ii)->PID());
6584  gAli_Sub->AddPattern(singlePattern);
6585  }
6586  if (gEDBDEBUGLEVEL>2) cout <<"--- gAli_Sub->Print():"<<endl;
6587  if (gEDBDEBUGLEVEL>2) gAli_Sub->Print();
6588  if (gEDBDEBUGLEVEL>2) cout <<"--- ----------------------------------"<<endl;
6589 
6590  return gAli_Sub;
6591 }