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

Functions

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

Function Documentation

◆ AddBTToArrayWithCeck()

Bool_t AddBTToArrayWithCeck ( EdbSegP tryAttachedSegment,
TObjArray *  GLOBAL_ShowerSegArray 
)

void ReconstructShowers_CL() /// Still Missing in the Implementation !!! BUT it is there now in ReconstructShowers_CL() function. TO CHECK IF THE ALGORITHM IS WORKING (NO MATTER THE BAD EFFICIENCY)

1631 {
1632  // We add by comparison with X,Y,TX,TY values, since this seems to be more failsafe
1633  // than adding by adresses.
1634  // This function returns kTRUE if BT is already in the shower array
1635  // This function returns kFALSE if BT is not yet in the shower array
1636 
1637  int nent=GLOBAL_ShowerSegArray->GetEntries();
1638  EdbSegP* ComparingSegment;
1639 
1640 
1641  if (gEDBDEBUGLEVEL>3) cout << "AddBTToArrayWithCeck() Check: "<< tryAttachedSegment << " with all "<< nent << " entries of GLOBAL_ShowerSegArray "<< endl;
1642 
1643  Bool_t IsContained=kFALSE;
1644 
1645  for (int i=0; i<nent; ++i) {
1646  ComparingSegment=(EdbSegP*)GLOBAL_ShowerSegArray->At(i);
1647  if (TMath::Abs(tryAttachedSegment->X()-ComparingSegment->X())>0.1) continue;
1648  if (TMath::Abs(tryAttachedSegment->Y()-ComparingSegment->Y())>0.1) continue;
1649 
1650  if (TMath::Abs(tryAttachedSegment->TX()-ComparingSegment->TX())>0.01) continue;
1651  if (TMath::Abs(tryAttachedSegment->TY()-ComparingSegment->TY())>0.01) continue;
1652 
1653  IsContained=kTRUE;
1654  }
1655 
1656 
1657  if (gEDBDEBUGLEVEL>3) cout << "AddBTToArrayWithCeck DO WE ADD THIS BT ?? "<< !IsContained << endl;
1658 
1659  if (!IsContained) {
1660  GLOBAL_ShowerSegArray->Add(tryAttachedSegment);
1661  }
1662 
1663  return !IsContained;
1664 }
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)
3914  {
3915 
3916  Log(2, "ShowRec.cpp", "--- void BuildParametrizationsMCInfo_PGun() ---");
3917 
3918  // Monte-Carlo Information on the event, take from the
3919  // pre-prepared root-file MCInfoFilename
3920 
3921  //Declare Tree Variables
3922  Int_t MCEvt, PDGId;
3923  Float_t energy, tantheta,dirx,diry,dirz,vtxposx,vtxposy,vtxposz;
3924  Float_t TX,TY,Y,X,Z;
3925 
3926  // Assume
3928 
3929  // Read Tree with File:
3930  TTree* PGunTree = new TTree();
3931  Int_t ReadSuccess = PGunTree->ReadFile(MCInfoFilename,"MCEvt/I:energy/F:tantheta/F:dirx/F:diry/F:dirz/F:vtxposx/F:vtxposy/F:vtxposz/F:TX/F:TY/F:X/F:Y/F:Z/F:PDGId/I");
3932 
3933  // Check if File exists:
3934  cout << "BuildParametrizationsMCInfo_PGun ReadSuccess = PGunTree->ReadFile(MCInfoFilename) " << ReadSuccess << endl;
3935  cout << "BuildParametrizationsMCInfo_PGun 0: File / Tree Reading was not successful " << endl;
3936  cout << "BuildParametrizationsMCInfo_PGun 1: File / Tree Reading was successful " << endl;
3937 
3938  // If tree reading was not successful, we must return here.
3939  if (ReadSuccess==0) {
3940  cout << "BuildParametrizationsMCInfo_PGun() ReadSuccess==0. return. " << endl;
3941  return;
3942  }
3943 
3944  PGunTree->SetBranchAddress("MCEvt",&MCEvt);
3945  PGunTree->SetBranchAddress("PDGId",&PDGId);
3946  PGunTree->SetBranchAddress("energy",&energy);
3947  PGunTree->SetBranchAddress("tantheta",&tantheta);
3948  PGunTree->SetBranchAddress("dirx",&dirx);
3949  PGunTree->SetBranchAddress("diry",&diry);
3950  PGunTree->SetBranchAddress("dirz",&dirz);
3951  PGunTree->SetBranchAddress("vtxposx",&vtxposx);
3952  PGunTree->SetBranchAddress("vtxposy",&vtxposy);
3953  PGunTree->SetBranchAddress("vtxposz",&vtxposz);
3954  PGunTree->SetBranchAddress("TX",&TX);
3955  PGunTree->SetBranchAddress("TY",&TY);
3956  PGunTree->SetBranchAddress("X",&X);
3957  PGunTree->SetBranchAddress("Z",&Z);
3958  PGunTree->SetBranchAddress("Y",&Y);
3959 
3960  // If the PGunTree is not filled, this can be a hint that the
3961  // MCInfoFilename might not be there. This is important for alorithms that
3962  // rely on Vertex Informations, like the _GS() alg.
3963  if (PGunTree->GetEntries()==0) {
3964  cout << "BuildParametrizationsMCInfo_PGun ATTENTION! PGunTree->GetEntries()==0" << endl;
3965  cout << "BuildParametrizationsMCInfo_PGun Bool_t GLOBAL_IsBrickTreePGunInfo=kFALSE;" << endl;
3967  }
3968  else {
3970  }
3971 
3972  if (gEDBDEBUGLEVEL>2) PGunTree->Print();
3973  cout << "BuildParametrizationsMCInfo_PGun() PGunTree->GetEntries(); " << PGunTree->GetEntries() << endl;
3974 
3975  if (cmd_GBMC>0) {
3976  cout << " BuildParametrizationsMCInfo_PGun() cmd_GBMC>0 Show entry (cmd_GBMC):" << endl;
3977  PGunTree->Show(cmd_GBMC);
3978  }
3979 
3980  // --------------------------------
3981  // The number 69999 comes from my (frank) maximal number of mc Events
3982  // I have put in a simulation file.
3983  if (!GLOBAL_VtxArray) GLOBAL_VtxArray=new TObjArray(69999);
3984  GLOBAL_VtxArrayX[0]=0;
3985  GLOBAL_VtxArrayZ[0]=0;
3986  GLOBAL_VtxArrayY[0]=0;
3987 
3988  //------------------
3989  // PGunTreeEntry_MCEvt_Correspondance[0]=TreeEntry(0)->MC()
3990  Int_t PGunTreeEntry_MCEvt_Correspondance[69999];
3991  for (Int_t i=0; i<PGunTree->GetEntries(); ++i) {
3992  PGunTree->GetEntry(i);
3993  PGunTreeEntry_MCEvt_Correspondance[MCEvt]=i;
3994  EdbVertex* vtx=new EdbVertex();
3995  // Why are these numbers the way they are (2018_07_04) ???
3996  // I cannot remember anymore, unfortunately.
3997  vtx->SetXYZ(vtxposx*1000,vtxposy*1000,(vtxposz+40.0)*1000);
3998  vtx->SetMC(MCEvt);
3999  // vtx->Print(); // Gives Crash!
4000  GLOBAL_VtxArray->Add(vtx);
4001  GLOBAL_VtxArrayX[MCEvt]=vtxposx*1000;
4002  GLOBAL_VtxArrayY[MCEvt]=vtxposy*1000;
4003  GLOBAL_VtxArrayZ[MCEvt]=(vtxposz+40.0)*1000;
4004 // vtx->Print();
4005 // gSystem->Exit(1);
4006  GLOBAL_EvtBT_EArray[MCEvt]=energy;
4007  GLOBAL_EvtBT_TanThetaArray[MCEvt]=tantheta;
4008  GLOBAL_EvtBT_FlagArray[MCEvt]=0;
4009  GLOBAL_EvtBT_MCArray[MCEvt]=MCEvt;
4010  GLOBAL_EvtBT_ZArray[MCEvt]=(vtxposz+40.0)*1000;
4011  }
4012  //------------------
4013  cout << "BuildParametrizationsMCInfo_PGun.... done." << endl;
4014  return;
4015 }
bool Log(int level, const char *location, const char *fmt,...)
Definition: EdbLog.cxx:75
Float_t GLOBAL_VtxArrayY[99999]
Definition: ShowRec.h:56
Int_t GLOBAL_EvtBT_ZArray[99999]
Definition: ShowRec.h:51
Int_t GLOBAL_EvtBT_FlagArray[99999]
Definition: ShowRec.h:51
Float_t GLOBAL_VtxArrayX[99999]
Definition: ShowRec.h:55
TObjArray * GLOBAL_VtxArray
Definition: ShowRec.h:54
Double_t GLOBAL_EvtBT_EArray[99999]
Definition: ShowRec.h:52
Int_t GLOBAL_EvtBT_MCArray[99999]
Definition: ShowRec.h:51
Float_t GLOBAL_VtxArrayZ[99999]
Definition: ShowRec.h:57
Double_t GLOBAL_EvtBT_TanThetaArray[99999]
Definition: ShowRec.h:52
Bool_t GLOBAL_IsBrickTreePGunInfo
Definition: ShowRec.h:82
Int_t cmd_GBMC
Definition: ShowRec.h:28
Definition: EdbVertex.h: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 !!!!

3692 {
3693  Int_t eNBT= ShowerSegArray->GetEntries();
3694  if (eNBT==0) return NULL;
3695  if (eNBT==1) return (EdbSegP*)ShowerSegArray->At(0);
3696  Double_t eNBT_float=(Double_t)eNBT;
3697 // cout << "eNBT= " << eNBT << " eNBT_float= " << eNBT_float << endl;
3698 
3699  // Code taken from EdbMath::LFIT3 to fit line to a collection of points in spce!
3700  //int EdbMath::LFIT3( float *X, float *Y, float *Z, float *W, int L,
3701  //float &X0, float &Y0, float &Z0, float &TX, float &TY, float &EX, float &EY )
3702  // Linar fit in 3-d case (microtrack-like)
3703  // Input: X,Y,Z - coords, W -weight - arrays of the lengh >=L
3704  // Note that X,Y,Z modified by function
3705  // Output: X0,Y0,Z0 - center of gravity of segment
3706  // TX,TY : tangents in respect to Z axis
3707 
3708  Float_t X0,Y0,Z0;
3709  Float_t TX,TY;
3710  Float_t EX,EY;
3711  // Float_t x[eNBT]; Float_t z[eNBT]; Float_t y[eNBT]; Float_t W[eNBT];
3712  // Compiled with -pedantic -Wall -W -Wstrict-prototypes this gives error message: Fehler: ISO-C++ verbietet Feld »x« variabler Länge
3713  // So we take it as fixed length:
3714  // As before we take the global maximum of 5k BT /shower.
3715  Float_t x[5000];
3716  Float_t z[5000];
3717  Float_t y[5000];
3718  Float_t W[5000];
3719 
3720 
3721  // SUM UP TANGES VALUES OF ALL BTS SO FAR TO GET tx and TY of SHOWERCENTER ???
3722  Float_t sumX=0;
3723  Float_t sumY=0;
3724  Float_t sumTX=0;
3725  Float_t sumTY=0;
3726  Float_t sumW=0;
3727 //
3728  // The weighting of the segments is a crucial point here, since it influences
3729  // the fitting to the shower axis!
3730  int eNBTMAX=TMath::Min(5000,eNBT);
3731  for (int i=0; i<eNBTMAX; i++) {
3732  EdbSegP* TestBT = (EdbSegP*)ShowerSegArray->At(i);
3733  x[i]=TestBT->X();
3734  y[i]=TestBT->Y();
3735  z[i]=TestBT->Z();
3736  // Choose weighting to be one!
3737  W[i]=1;
3738  W[i]=1.0/(TMath::Abs(z[i]-z[0])/1300.0*TMath::Abs(z[i]-z[0])/1300.0+1);
3739  // W[i]=1.0/TMath::Sqrt((TMath::Abs(z[i]-z[0])/1300.0*TMath::Abs(z[i]-z[0])/1300.0+1));
3740  if (TMath::Abs(z[i]-z[0])/1300.0>4) W[i]=0;
3741  // chose this,....could be that this will lead to something different results....
3742  sumX+=W[i]*TestBT->X();
3743  sumY+=W[i]*TestBT->Y();
3744  sumTX+=W[i]*TestBT->TX();
3745  sumTY+=W[i]*TestBT->TY();
3746  sumW+=W[i];
3747  }
3748  //cout << " Set all others to zero...." << endl;
3749  if (eNBT<5000) {
3750  for (int i=eNBT; i<5000; i++) {
3751  W[i]=0;
3752  x[i]=0;
3753  y[i]=0;
3754  z[i]=0;
3755  }
3756  }
3757 
3758 
3759  //cout << "BuildShowerAxis Invoke fit function:" << endl;
3760  // Invoke fit function:
3761  EdbMath::LFIT3( x,y,z,W,eNBTMAX,X0,Y0,Z0,TX,TY,EX,EY);
3762 
3763  //cout <<"AfterLinefit: x=" << x << " y=" << y << " z=" << z << " W=" << W << " eNBTMAX=" << eNBTMAX << " X0=" << X0 << " Y0=" << Y0 << " Z0=" << Z0 << " TX=" << TX << " TY= " << TY << endl;
3764 
3765  sumTX=sumTX/sumW;
3766  sumTY=sumTY/sumW;
3767  sumX=sumTX/sumW;
3768  sumY=sumTY/sumW;
3771 
3772  //==C== In few cases "nan" can happen, then we put val to -1;
3773  if (TMath::IsNaN(X0)) {
3774  //cout << "EdbShowerP::BuildShowerAxis WARNING! FIT DID NOT CONVVERGE, RETURN FIRST SEGMENT! " << endl;
3775  EdbSegP* seg0=(EdbSegP*)ShowerSegArray->At(0);
3776  EdbSegP* eShowerAxisCenterGravityBT = new EdbSegP(0,seg0->X(),seg0->Y(),seg0->TX(),seg0->TY(),0,0);
3777  eShowerAxisCenterGravityBT -> SetZ(((EdbSegP*)ShowerSegArray->At(0))->Z());
3778  //eShowerAxisCenterGravityBT->PrintNice();
3779  return eShowerAxisCenterGravityBT;
3780  }
3781 
3782  //cout << "EdbShowerP::BuildShowerAxis Axis X0,Y0,Z0, TX, TY " << X0 << " " << Y0 << " " << Z0 << " " << TX << " " << TY << " " << endl;
3783  //cout << "sumTX= " << sumTX << " sumTY= " << sumTY << " sumW= " << sumW << endl;
3784 
3785  EdbSegP* eShowerAxisCenterGravityBT = 0;
3786  if (!eShowerAxisCenterGravityBT) eShowerAxisCenterGravityBT = new EdbSegP(-1,X0,Y0,sumTX,sumTY,0,0); // with linefit
3787 // if (!eShowerAxisCenterGravityBT) eShowerAxisCenterGravityBT = new EdbSegP(-1,sumX,sumY,sumTX,sumTY,0,0); // without linefit
3788  eShowerAxisCenterGravityBT -> SetZ(((EdbSegP*)ShowerSegArray->At(0))->Z());
3789 
3790 
3792  // Bool_t UseOnlyFirstBT=kTRUE;
3793  Bool_t UseOnlyFirstBT=kFALSE;
3794  if (UseOnlyFirstBT) {
3795  cout << "Attention: UseOnlyFirstBT"<< endl;
3796  eShowerAxisCenterGravityBT -> SetX(((EdbSegP*)ShowerSegArray->At(0))->X());
3797  eShowerAxisCenterGravityBT -> SetY(((EdbSegP*)ShowerSegArray->At(0))->Y());
3798  eShowerAxisCenterGravityBT -> SetZ(((EdbSegP*)ShowerSegArray->At(0))->Z());
3799  eShowerAxisCenterGravityBT -> SetTX(((EdbSegP*)ShowerSegArray->At(0))->TX());
3800  eShowerAxisCenterGravityBT -> SetTY(((EdbSegP*)ShowerSegArray->At(0))->TY());
3801  }
3802 
3803  //eShowerAxisCenterGravityBT->Print();
3804  return eShowerAxisCenterGravityBT;
3805 }
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

2495 {
2496  Log(4,"ShowRec.cpp", "--- Bool_t CalcConeOrTubeDistanceToInBT() ---");
2497 
2498  TVector3 x1(InBT->X(),InBT->Y(),InBT->Z());
2499  TVector3 x2(sa->X(),sa->Y(),sa->Z());
2500  TVector3 direction_x1(InBT->TX()*1300,InBT->TY()*1300,1300);
2501  TVector3 direction_x2(sa->TX()*1300,sa->TY()*1300,1300);
2502  TVector3 u1=x2-x1;
2503 
2504  Double_t direction_x1_norm= direction_x1.Mag();
2505  Double_t cosangle= (direction_x1*u1)/(u1.Mag()*direction_x1_norm);
2506  Double_t angle = TMath::ACos(cosangle);
2507  // NO THIS IS NOT THE CONE ANGLE!!
2508 
2509  TVector3 direction_1(InBT->TX()*1300,InBT->TY()*1300,1300);
2510  TVector3 direction_2(sa->TX()*1300,sa->TY()*1300,1300);
2511 
2512  angle=u1.Angle(direction_x1);
2513 
2514 
2515  // For the case where the two basetracks have same z position
2516  // the angle is about 90 degree so it makes no sense to calculate it...
2517  // therefore we set it artificially to zero:
2518  if (TMath::Abs(InBT->Z()-sa->Z())<5.0 ) {
2519  angle=0.0;
2520  //if (gEDBDEBUGLEVEL>3) //cout << "same z position, set angle artificially to zero" << endl;
2521  }
2522 
2523 
2524 
2525  // If this InBT is in z position AFTER the testBT, the cone goes in the other direction and therefore, we have
2526  // to mirror the angle by 180 degree:
2527  if (angle>TMath::Pi()/2.0) {
2528  angle=TMath::Abs(TMath::Pi()-angle);
2529  //cout << "reverse angle: " << angle << endl;
2530  }
2531 
2533  if (angle>ConeAngle) {
2534  return kFALSE;
2535  }
2536 
2538  Double_t TubeDistance = 1.0/direction_x1_norm * ( (x2-x1).Cross(direction_x1) ).Mag();
2539  // cout << "CylinderRadius= " << CylinderRadius << " TubeDistance= " << TubeDistance << endl;
2540  if (TubeDistance>CylinderRadius) {
2541  return kFALSE;
2542  }
2543 
2544 
2545 
2546  //cout << "--- Bool_t CalcConeOrTubeDistanceToInBT() ---"<<endl;
2547  //InBT->PrintNice();
2548  //sa->PrintNice();
2549  //cout << "angle= " << angle << " ConeAngle= " << ConeAngle << endl;
2550  //cout << "CylinderRadius= " << CylinderRadius << " TubeDistance= " << TubeDistance << endl;
2551 
2552  return kTRUE;
2553 }

◆ CalcEfficencyNumbers()

void CalcEfficencyNumbers ( EdbPattern pat_interim,
Int_t  MCCheck,
Int_t &  NBT_Neff,
Int_t &  NBTMC_Neff,
Int_t &  NBTMCe_Neff 
)
3834 {
3835  if (gEDBDEBUGLEVEL>3) cout << "-------------void CalcEfficencyNumbers()"<<endl;
3836  Int_t npat_int=pat_interim->GetN();
3837  if (npat_int<=0) return;
3838 
3839  for (int i=0; i<pat_interim->N(); ++i) {
3840  EdbSegP* seg=(EdbSegP* )pat_interim->GetSegment(i);
3841  if (seg->MCEvt()<0||seg->MCEvt()==MCCheck) ++NBT_Neff;
3842  if (seg->MCEvt()==MCCheck) ++NBTMC_Neff;
3843  if (seg->MCEvt()==MCCheck&&TMath::Abs(seg->Flag())==11) ++NBTMCe_Neff;
3844  }
3845  if (gEDBDEBUGLEVEL>3) {
3846  cout << "npat_int = " << npat_int << endl;
3847  cout << "NBT_Neff = " << NBT_Neff << endl;
3848  cout << "NBTMC_Neff = " << NBTMC_Neff << endl;
3849  cout << "NBTMCe_Neff = " << NBTMCe_Neff << endl;
3850  }
3851  return;
3852 }
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 
)
2900 {
2901  Log(3, "ShowRec.cpp", "--- void CalcEffPurOfShower() ---");
2902  EdbSegP* seg;
2903  for (int i=0; i<arr->GetEntries(); ++i) {
2904  seg=(EdbSegP*)arr->At(i);
2905  ++NBT;
2906  if (seg->MCEvt()>0) {
2907  ++NBTMC; //NBTMC is kept for backward compability
2908  ++NBTallMC;
2909  }
2910  if (seg->MCEvt()>0 && TMath::Abs(seg->Flag())==11) {
2911  ++NBTeMC;
2912  }
2913  }
2914 
2915  purall=-1;
2916  pure=-1;
2917  if (NBT!=0) purall=(Double_t)NBTallMC/(Double_t)NBT;
2918  if (NBT!=0) pure=(Double_t)NBTeMC/(Double_t)NBT;
2919 
2920  if (gEDBDEBUGLEVEL>2) {
2921  cout << "CalcEffPurOfShower---------------- NBT,NBTallMC,NBTeMC,purall,pure= "<< NBT <<" " << NBTallMC <<" " << NBTeMC <<" " << purall <<" " << pure <<" " <<endl;
2922  }
2923 
2924  GLOBAL_NBT=NBT;
2925  GLOBAL_NBTallMC=NBTallMC;
2926  GLOBAL_NBTMC=NBTallMC; // kept for backward compability
2927  GLOBAL_NBTeMC=NBTeMC;
2928  GLOBAL_purall=purall;
2929  GLOBAL_pure=pure;
2930  return;
2931 }
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 
)
2934 {
2935  Log(3, "ShowRec.cpp", "--- void CalcEffPurOfShower2() ---");
2936  EdbSegP* seg;
2937 
2938  for (int i=0; i<arr->GetEntries(); ++i) {
2939  seg=(EdbSegP*)arr->At(i);
2940  ++NBT;
2941  if (seg->MCEvt()>0) {
2942  ++NBTMC; //NBTMC is kept for backward compability
2943  ++NBTallMC;
2944  }
2945  if (seg->MCEvt()>0 && TMath::Abs(seg->Flag())==11) {
2946  ++NBTeMC;
2947  }
2948  }
2949 
2950  purall=-1;
2951  pure=-1;
2952  if (NBT!=0) purall=(Double_t)NBTallMC/(Double_t)NBT;
2953  if (NBT!=0) pure=(Double_t)NBTeMC/(Double_t)NBT;
2954 
2955  // eff_all = NBTMC_SHOWER/NBTMC_VOLUME
2956  // eff_e = NBTMCe_SHOWER/NBTMCe_VOLUME
2957 
2958  Double_t effall=0;
2959  if (NBTMC_Neff!=0) effall = (Double_t)NBTMC/(Double_t)NBTMC_Neff;
2960  Double_t effe=0;
2961  if (NBTMC_Neff!=0) effe = (Double_t)NBTeMC/(Double_t)NBTMCe_Neff;
2962 
2963  if (gEDBDEBUGLEVEL>2) {
2964  cout << "CalcEffPurOfShower2---------------- NBT,NBTallMC,NBTeMC,purall,pure, effall, effe= "<< NBT <<" " << NBTallMC;
2965  cout <<" " << NBTeMC <<" " << purall <<" " << pure <<" " << effall <<" " << effe <<" " << endl;
2966  }
2967 
2968  GLOBAL_NBT=NBT;
2969  GLOBAL_NBTallMC=NBTallMC;
2970  GLOBAL_NBTMC=NBTallMC; // kept for backward compability
2971  GLOBAL_NBTeMC=NBTeMC;
2972  GLOBAL_purall=purall;
2973  GLOBAL_pure=pure;
2974  GLOBAL_effall=effall;
2975  GLOBAL_effe=effe;
2976 
2977  Log(3, "ShowRec.cpp", "--- void CalcEffPurOfShower2() done.");
2978  return;
2979 }
Double_t GLOBAL_effall
Definition: ShowRec.h:38
Double_t GLOBAL_effe
Definition: ShowRec.h:38

◆ CalcTrackDensity()

void CalcTrackDensity ( EdbPattern pat_interim,
Float_t  pat_interim_halfsize,
Int_t &  npat_int,
Int_t &  npat_total,
Int_t &  npatN 
)
3812 {
3813  if (gEDBDEBUGLEVEL>3) cout << "-------------void CalcTrackDensity(&pat_interim,pat_interim_halfsize,&npat_int,&npat_total)"<<endl;
3814  npat_int=pat_interim->GetN();
3815  if (npat_int<=0) return;
3816  npat_total+=npat_int;
3817  ++npatN;
3818  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!
3819 
3820  if (gEDBDEBUGLEVEL>3) {
3821  cout << "pat_interim->Z() = " << pat_interim->Z() << endl;
3822  cout << "pat_interim->GetN() = " << pat_interim->GetN() << endl;
3823  cout << "npat_int = " << npat_int << endl;
3824  cout << "npat_total = " << npat_total << endl;
3825  cout << "npatN = " << npatN << endl;
3826  cout << "shower_trackdensb = " << shower_trackdensb << endl;
3827  }
3828  return;
3829 }
Float_t local_halfpatternsize
Definition: ShowRec.h:146
Float_t shower_trackdensb
Definition: ShowRec.h:395
Float_t Z() const
Definition: EdbPattern.h:87

◆ CreateOutPutStructures()

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

◆ CreateTreeBranchShowerTree()

TTree* CreateTreeBranchShowerTree ( Int_t  ParaSetNr)
3173 {
3174  Log(2, "ShowRec.cpp", "--- TTree* CreateTreeBranchShowerTree() ---");
3175 
3176 
3177  // ParasetNr == -1 (no paraset from the paradefinition.root file is given and the
3178  // standard built in parasets are used: "treebranch" instead of "treebranch_-1"
3179  // ParasetNr != -1 ( paraset from the paradefinition.root file is given)
3180 
3181  TString treenname;
3182  if (ParaSetNr==-1) {
3183  treenname="treebranch";
3184  }
3185  else {
3186  treenname=TString(Form("treebranch_%d",ParaSetNr));
3187  }
3188 
3189  TTree* eShowerTree = new TTree(treenname,treenname);
3190  eShowerTree->Branch("number_eventb",&shower_number_eventb,"number_eventb/I");
3191  eShowerTree->Branch("sizeb",&shower_sizeb,"sizeb/I");
3192  eShowerTree->Branch("sizeb15",&shower_sizeb15,"sizeb15/I");
3193  eShowerTree->Branch("sizeb20",&shower_sizeb20,"sizeb20/I");
3194  eShowerTree->Branch("sizeb30",&shower_sizeb30,"sizeb30/I");
3195  eShowerTree->Branch("isizeb",&shower_isizeb,"isizeb/I");
3196  eShowerTree->Branch("xb",shower_xb,"xb[sizeb]/F");
3197  eShowerTree->Branch("yb",shower_yb,"yb[sizeb]/F");
3198  eShowerTree->Branch("zb",shower_zb,"zb[sizeb]/F");
3199  eShowerTree->Branch("txb",shower_txb,"txb[sizeb]/F");
3200  eShowerTree->Branch("tyb",shower_tyb,"tyb[sizeb]/F");
3201  eShowerTree->Branch("nfilmb",shower_nfilmb,"nfilmb[sizeb]/I");
3202  eShowerTree->Branch("ntrace1simub",shower_ntrace1simub,"ntrace1simu[sizeb]/I",128000); // s.eMCEvt
3203  eShowerTree->Branch("ntrace2simub",shower_ntrace2simub,"ntrace2simu[sizeb]/I",128000); // s.eW
3204  eShowerTree->Branch("ntrace3simub",shower_ntrace3simub,"ntrace3simu[sizeb]/F",128000); // s.eP
3205  eShowerTree->Branch("ntrace4simub",shower_ntrace4simub,"ntrace4simu[sizeb]/I",128000); // s.eFlag
3206  eShowerTree->Branch("chi2btkb",shower_chi2btkb,"chi2btkb[sizeb]/F");
3207  eShowerTree->Branch("deltarb",shower_deltarb,"deltarb[sizeb]/F");
3208  eShowerTree->Branch("deltathetab",shower_deltathetab,"deltathetab[sizeb]/F");
3209  eShowerTree->Branch("deltaxb",shower_deltaxb,"deltaxb[sizeb]/F");
3210  eShowerTree->Branch("deltayb",shower_deltayb,"deltayb[sizeb]/F");
3211  eShowerTree->Branch("tagprimary",shower_tagprimary,"tagprimary[sizeb]/F");
3212  eShowerTree->Branch("energy_shot_particle",&shower_energy_shot_particle,"energy_shot_particle/F");
3213  eShowerTree->Branch("E_MC",&shower_energy_shot_particle,"E_MC/F");
3214  eShowerTree->Branch("showerID",&shower_showerID,"showerID/I");
3215  eShowerTree->Branch("idb",shower_idb,"idb/I");
3216  eShowerTree->Branch("plateb",shower_plateb,"plateb[sizeb]/I");
3217  eShowerTree->Branch("deltasigmathetab",shower_deltasigmathetab,"deltasigmathetab[59]/F");
3218  eShowerTree->Branch("lengthfilmb",&shower_numberofilms,"lengthfilmb/I",128000);
3219  eShowerTree->Branch("purityb",&shower_purb,"purityb/F",128000); // shower purity
3220  eShowerTree->Branch("trackdensb",&shower_trackdensb,"trackdensb/F",128000); // track density _around_ the shower (not _in_ shower)
3221  eShowerTree->Branch("nholesb",&shower_numberofholes,"nholesb/I",128000); // #of (single) empty plates
3222  eShowerTree->Branch("nholesmaxb",&shower_numberofholesconseq,"nholesmaxb/I",128000); // #of (consecutive) empty plates
3223 
3224  eShowerTree->Branch("axis_xb",&shower_axis_xb,"shower_axis_xb/F"); // Shower Axis Values...
3225  eShowerTree->Branch("axis_yb",&shower_axis_yb,"shower_axis_yb/F");
3226  eShowerTree->Branch("axis_zb",&shower_axis_zb,"shower_axis_zb/F");
3227  eShowerTree->Branch("axis_txb",&shower_axis_txb,"shower_axis_txb/F");
3228  eShowerTree->Branch("axis_tyb",&shower_axis_tyb,"shower_axis_tyb/F");
3229 
3230  // distuingish variable for more than one kind of showers merged into treebranch
3231  eShowerTree->Branch("filetype",&shower_filetype,"filetype/I");
3232 
3233  eShowerTree->SetDirectory(FILE_ShowShower);
3234 
3235  if (gEDBDEBUGLEVEL>2) {
3236  cout << "--- CreateTreeBranchShowerTree: eShowerTree: Name, Entries:"<<endl;
3237  cout << eShowerTree->GetName() << " " << eShowerTree->GetEntries() <<endl;
3238  cout << "------eShowerTree-----------------------------------------"<<endl;
3239  }
3240  return eShowerTree;
3241 }
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

◆ DoBGTargetCleaning()

void DoBGTargetCleaning ( )
4096  {
4097 
4098  // Clean the input data Objects if necessary:
4099  Float_t BGTargetDensity=0;
4100  // cout << "--- \t\t : -CLEAN InputData BG Cleaning: 0: No, 1:20BT/mm2 2: 40BT/mm2 3:10BT/mm2 4:60BT/mm2 \n";
4101  // cout << "--- \t\t : InputData BG Cleaning: 10: Remove DoubleBT and Passing, No dens cut, 11: &&10BT/mm2 12: &&20BT/mm2 13: &&30BT/mm2 ... \n";
4102  if (cmd_CLEAN==1) BGTargetDensity=20;
4103  if (cmd_CLEAN==2) BGTargetDensity=40;
4104  if (cmd_CLEAN==3) BGTargetDensity=10;
4105  if (cmd_CLEAN==4) BGTargetDensity=60;
4106  if (cmd_CLEAN==0) BGTargetDensity=1000;
4107  EdbPVRQuality* PVRQualCheck;
4108  EdbPVRec* new_GLOBAL_gAli;
4109  EdbPVRec* newnew_GLOBAL_gAli;
4110 
4111 
4112  // Just density cleaning, no double or passing removal.
4113  if (cmd_CLEAN!=0&&cmd_CLEAN<10) {
4114  cout << "Just density cleaning, no double or passing removal. " << endl;
4115  PVRQualCheck = new EdbPVRQuality(GLOBAL_gAli,BGTargetDensity);
4116  new_GLOBAL_gAli = PVRQualCheck->GetEdbPVRec(1);
4117  PVRQualCheck->Print();
4118  GLOBAL_gAli=new_GLOBAL_gAli;
4119  }
4120 
4121  // Density cleaning, with double and passing removal.
4122  // Additional BG cleaning, depending on the last number of the number switch:
4123  if (cmd_CLEAN>=10&&cmd_CLEAN<=20) {
4124  cout << "Density cleaning, with double and passing removal." << endl;
4125  cout << " THIS WILL BE THE PART WHERE REMOVE PASSING IS IMPLEMENTED !!! " << endl;
4126  cout << " THIS WILL BE THE PART WHERE REMOVE DOUBLE BT IS IMPLEMENTED !!! " << endl;
4127  Int_t rest=cmd_CLEAN-10;
4128  Float_t BGTargetDensity=rest*10;
4129  if (rest==0) BGTargetDensity=100000;
4130  //cout << "BGTargetDensity " << BGTargetDensity << endl;
4131  PVRQualCheck = new EdbPVRQuality(GLOBAL_gAli,BGTargetDensity);
4132  new_GLOBAL_gAli = PVRQualCheck->GetEdbPVRec(1);
4133  GLOBAL_gAli=new_GLOBAL_gAli;
4134  GLOBAL_gAli->Print();
4135  newnew_GLOBAL_gAli=PVRQualCheck->Remove_DoubleBT(GLOBAL_gAli);
4136  GLOBAL_gAli=newnew_GLOBAL_gAli;
4137  new_GLOBAL_gAli=PVRQualCheck->Remove_Passing(GLOBAL_gAli);
4138  GLOBAL_gAli=new_GLOBAL_gAli;
4139  }
4140 
4141  return;
4142 } // of void DoBGTargetCleaning()
EdbPVRec * GLOBAL_gAli
Definition: ShowRec.h:73
Int_t cmd_CLEAN
Definition: ShowRec.h:26
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

◆ Fill2GlobalInBTArray()

void Fill2GlobalInBTArray ( )
4019  {
4020 
4021  // if we have a vertex file we can cut for InBT tracks with a given vertex (to pure up the starting inbt sample)
4022  // (for now 100micron ip). (electrons,pi+-);
4023  // (for now 250micron ip). (photons.);
4024  // (for now 300micron ip). (other.);
4025 // if (cmd_vtx!=1) return;
4026  if (cmd_vtx==0) return;
4027 // if (cmd_MC!=1) return; // why did we say that we wanna have only starting mc inbts?
4028  // also it can be possible that we wanna seacrh all in bt from the volume to an given
4029  // vertex, for a mc event (but not necessarily for mc In BTs).
4030  // better comment it out?... ah, i know why because otherwise, we do not know which mc event vtx to take... so what to do???
4031 
4032  Float_t cutIPMax=100;
4033  if (cmd_vtx==2) cutIPMax=250;
4034  if (cmd_vtx==3) cutIPMax=500;
4035  if (cmd_vtx==4) cutIPMax=1000;
4036  if (cmd_vtx==5) cutIPMax=5000;
4037 
4038  Float_t cutZVtxDist=999999;
4039 
4040  TObjArray* GLOBAL_InBTArray2 = new TObjArray();
4041  cout << "Fill2GlobalInBTArray Calc IPs for the " << GLOBAL_InBTArray->GetEntries() << " entries" << endl;
4042 
4043  for (Int_t i=0; i<GLOBAL_InBTArray->GetEntries(); ++i) {
4044  if (i%1000==0) cout << "." << flush;
4045  EdbSegP* s1=(EdbSegP*)GLOBAL_InBTArray->At(i);
4046  // Calculate IP:
4047  // in case InBT is of BGType, we check for the GBMC variable set.
4048  Int_t MCEvt=s1->MCEvt();
4049  if (MCEvt<0 && cmd_GBMC>0) MCEvt=cmd_GBMC;
4050 
4051  Double_t ip=CalcIP(s1,Double_t(GLOBAL_VtxArrayX[MCEvt]),Double_t(GLOBAL_VtxArrayY[MCEvt]),Double_t(GLOBAL_VtxArrayZ[MCEvt]));
4052 
4053  if (ip>cutIPMax) continue;
4054 
4055  cutZVtxDist=s1->Z()-Double_t(GLOBAL_VtxArrayZ[MCEvt]);
4056  if (i==0||i==GLOBAL_InBTArray->GetEntries()-1) {
4057  cout << "INBT " << i << " :VTX:X:Y:Z: " << GLOBAL_VtxArrayX[MCEvt] << " " << GLOBAL_VtxArrayY[MCEvt] << " " << GLOBAL_VtxArrayZ[MCEvt] << " ip= " << ip << " ZdistVtx= " << cutZVtxDist << " MCEvt= " << MCEvt << endl;
4058  }
4059 
4060  if (ip<cutIPMax) GLOBAL_InBTArray2->Add(s1);
4061  }
4062 
4063  cout << endl;
4064  cout << "Fill2GlobalInBTArray::Before IP cut " << GLOBAL_InBTArray->GetEntries() << endl;
4065  cout << "Fill2GlobalInBTArray::After IP cut("<<cutIPMax<<") " << GLOBAL_InBTArray2->GetEntries() << endl;
4066  // Swap Arrays:
4067  GLOBAL_InBTArray= GLOBAL_InBTArray2;
4068  cout << GLOBAL_InBTArray->GetEntries() <<endl;
4069  return;
4070 }
Double_t CalcIP(EdbSegP *s, EdbVertex *v)
Definition: ShowRec.cpp:8872
Int_t cmd_vtx
Definition: ShowRec.h:25
TObjArray * GLOBAL_InBTArray
Definition: ShowRec.h:74
EdbSegP * s1
Definition: tlg2pattern.C:30

◆ FillOutPutStructures()

void FillOutPutStructures ( )
2985 {
2986  if (cmd_OUTPUTLEVEL==1) return;
2987 
2988  Log(2, "ShowRec.cpp", "--- void FillOutPutStructures() ---");
2989 
2990  STREAM_ShowRecEff.open(STREAM_ShowRecEffName,ios::app); // Fill Later, Open now :-)
2992 
2993  Int_t PARASETNR,INBTSHOWERNR;
2994  Double_t EvtBT_E,EvtBT_TanTheta;
2995  Int_t EvtBT_Flag,EvtBT_MC;
2996  Double_t InBT_E,InBT_TanTheta;
2997  Int_t InBT_Flag,InBT_MC;
2998  Int_t NBT,NBTMC,NBTallMC,NBTeMC;
2999  Double_t purall,pure;
3000  Double_t effall,effe;
3001  Double_t trckdens;
3002 
3003  TREE_ShowRecEff->SetBranchAddress("PARASETNR", &PARASETNR);
3004  TREE_ShowRecEff->SetBranchAddress("ShowerNr", &INBTSHOWERNR);
3005 
3006  TREE_ShowRecEff->SetBranchAddress("EvtBT_E", &EvtBT_E);
3007  TREE_ShowRecEff->SetBranchAddress("EvtBT_TanTheta", &EvtBT_TanTheta);
3008  TREE_ShowRecEff->SetBranchAddress("EvtBT_Flag", &EvtBT_Flag);
3009  TREE_ShowRecEff->SetBranchAddress("EvtBT_MC", &EvtBT_MC);
3010 
3011  TREE_ShowRecEff->SetBranchAddress("InBT_E", &InBT_E);
3012  TREE_ShowRecEff->SetBranchAddress("InBT_TanTheta", &InBT_TanTheta);
3013  TREE_ShowRecEff->SetBranchAddress("InBT_Flag", &InBT_Flag);
3014  TREE_ShowRecEff->SetBranchAddress("InBT_MC", &InBT_MC);
3015 
3016  TREE_ShowRecEff->SetBranchAddress("NBT", &NBT);
3017  TREE_ShowRecEff->SetBranchAddress("NBTMC", &NBTMC);
3018  TREE_ShowRecEff->SetBranchAddress("NBTallMC", &NBTallMC);
3019  TREE_ShowRecEff->SetBranchAddress("NBTeMC", &NBTeMC);
3020  TREE_ShowRecEff->SetBranchAddress("purall", &purall);
3021  TREE_ShowRecEff->SetBranchAddress("pure", &pure);
3022 
3023  TREE_ShowRecEff->SetBranchAddress("effall", &effall);
3024  TREE_ShowRecEff->SetBranchAddress("effe", &effe);
3025  TREE_ShowRecEff->SetBranchAddress("trckdens", &trckdens);
3026 
3027  for (int i=0; i<TREE_ShowRecEff->GetEntries(); ++i) {
3028 
3029  if (gEDBDEBUGLEVEL>3) TREE_ShowRecEff->Show(i);
3030  TREE_ShowRecEff->GetEntry(i);
3031 
3032  STREAM_ShowRecEff << setw(10) << cmd_PADI;
3033  STREAM_ShowRecEff << setw(10) << cmd_BTPA;
3034  STREAM_ShowRecEff << setw(10) << cmd_BGTP;
3035  STREAM_ShowRecEff << setw(10) << cmd_ALTP;
3036  STREAM_ShowRecEff << setw(10) << cmd_FP;
3037  STREAM_ShowRecEff << setw(10) << cmd_MP;
3038  STREAM_ShowRecEff << setw(10) << cmd_LP;
3039  STREAM_ShowRecEff << setw(10) << cmd_NP;
3040 
3041  STREAM_ShowRecEff << setw(10) << cmd_LT;
3042  STREAM_ShowRecEff << setw(10) << cmd_MC;
3043 
3044  STREAM_ShowRecEff << setw(14) << PARASETNR;
3045  STREAM_ShowRecEff << setw(14) << INBTSHOWERNR;
3046 
3047  STREAM_ShowRecEff << setw(10) << EvtBT_E;
3048  STREAM_ShowRecEff << setw(14) << EvtBT_TanTheta;
3049  STREAM_ShowRecEff << setw(14) << EvtBT_Flag;
3050  STREAM_ShowRecEff << setw(10) << EvtBT_MC;
3051 
3052  STREAM_ShowRecEff << setw(10) << InBT_E;
3053  STREAM_ShowRecEff << setw(14) << InBT_TanTheta;
3054  STREAM_ShowRecEff << setw(14) << InBT_Flag;
3055  STREAM_ShowRecEff << setw(10) << InBT_MC;
3056 
3057  STREAM_ShowRecEff << setw(10) << NBT;
3058  STREAM_ShowRecEff << setw(10) << NBTallMC;
3059  STREAM_ShowRecEff << setw(10) << NBTeMC;
3060  STREAM_ShowRecEff << setw(10) << purall;
3061  STREAM_ShowRecEff << setw(10) << pure;
3062  STREAM_ShowRecEff << setw(10) << effall;
3063  STREAM_ShowRecEff << setw(10) << effe;
3064  STREAM_ShowRecEff << setw(10) << trckdens;
3065  STREAM_ShowRecEff << endl;
3066 
3067  // ---------
3068  NBTeMC_pure->Fill(pure,NBTeMC);
3069  NBTallMC_purall->Fill(purall,NBTallMC);
3070 
3071  NBTeMC_NBTMC->Fill(NBTallMC,NBTeMC);
3072  NBTeMC_NBT->Fill(NBT,NBTeMC);
3073 
3074  NBT_InBTE->Fill(InBT_E/1000.0,NBT);
3075  NBTeMC_InBTE->Fill(InBT_E/1000.0,NBTeMC);
3076 
3077  pure_InBTE->Fill(InBT_E/1000.0,pure);
3078  purall_InBTE->Fill(InBT_E/1000.0,purall);
3079  // ---------
3080  Hist_NBTeMC_pure->Fill(pure,NBTeMC);
3081  Hist_NBTallMC_purall->Fill(purall,NBTallMC);
3082 
3083  Hist_NBTeMC_NBTMC->Fill(NBTallMC,NBTeMC);
3084  Hist_NBTeMC_NBT->Fill(NBT,NBTeMC);
3085 
3086  Hist_NBT_InBTE->Fill(InBT_E/1000.0,NBT);
3087  Hist_NBTeMC_InBTE->Fill(InBT_E/1000.0,NBTeMC);
3088 
3089  Hist_pure_InBTE->Fill(InBT_E/1000.0,pure);
3090  Hist_purall_InBTE->Fill(InBT_E/1000.0,purall);
3091 
3092  }
3093 
3094  FILE_ShowRecEff->cd();
3095  TREE_ShowRecEff->Write();
3096 
3097  FILE_ShowRecHistos->cd();
3098  TCanvas* ShowRecEffPlots= new TCanvas("ShowRecEffPlots","ShowRecEffPlots",1200,1200);
3099  ShowRecEffPlots->Divide(2,4);
3100  ShowRecEffPlots->cd(1);
3101  NBTeMC_pure->Draw();
3102  ShowRecEffPlots->cd(2);
3103  NBTallMC_purall->Draw();
3104  ShowRecEffPlots->cd(3);
3105  NBTeMC_NBTMC->Draw();
3106  ShowRecEffPlots->cd(4);
3107  NBTeMC_NBT->Draw();
3108  ShowRecEffPlots->cd(5);
3109  NBT_InBTE->Draw();
3110  ShowRecEffPlots->cd(6);
3111  NBTeMC_InBTE->Draw();
3112  ShowRecEffPlots->cd(7);
3113  pure_InBTE->Draw();
3114  ShowRecEffPlots->cd(7);
3115  purall_InBTE->Draw();
3116  TCanvas* ShowRecEffPlots2= new TCanvas("ShowRecEffPlots2","ShowRecEffPlots2",1200,1200);
3117  ShowRecEffPlots2->Divide(2,4);
3118  ShowRecEffPlots2->cd(1);
3119  Hist_NBTeMC_pure->Draw("colz");
3120  ShowRecEffPlots2->cd(2);
3121  Hist_NBTallMC_purall->Draw("colz");
3122  ShowRecEffPlots2->cd(3);
3123  Hist_NBTeMC_NBTMC->Draw("colz");
3124  ShowRecEffPlots2->cd(4);
3125  Hist_NBTeMC_NBT->Draw("colz");
3126  ShowRecEffPlots2->cd(5);
3127  Hist_NBT_InBTE->Draw("colz");
3128  ShowRecEffPlots2->cd(6);
3129  Hist_NBTeMC_InBTE->Draw("colz");
3130  ShowRecEffPlots2->cd(7);
3131  Hist_pure_InBTE->Draw("colz");
3132  ShowRecEffPlots2->cd(8);
3133  Hist_purall_InBTE->Draw("colz");
3134 
3135  NBTeMC_pure->Write();
3136  NBTallMC_purall->Write();
3137  NBTeMC_NBTMC->Write();
3138  NBTeMC_NBT->Write();
3139  NBT_InBTE->Write();
3140  NBTeMC_InBTE->Write();
3141  Hist_NBTeMC_pure->Write();
3142  Hist_NBTallMC_purall->Write();
3143  Hist_NBTeMC_NBTMC->Write();
3144  Hist_NBTeMC_NBT->Write();
3145  Hist_NBT_InBTE->Write();
3146  Hist_NBTeMC_InBTE->Write();
3147  Hist_pure_InBTE->Write();
3148  Hist_purall_InBTE->Write();
3149 
3150  ShowRecEffPlots->Write();
3151  ShowRecEffPlots2->Write();
3152 
3153  STREAM_ShowRecEff.close();
3154  FILE_ShowRecEff->Close();
3155 
3156  delete ShowRecEffPlots;
3157  delete ShowRecEffPlots2;
3158  return;
3159 }
void InitCutParameters()
Definition: ShowRec.cpp:7546
Int_t cmd_OUTPUTLEVEL
Definition: ShowRec.h:33
ofstream STREAM_ShowRecEff
Definition: ShowRec.h:59
new TCanvas()

◆ Finalize()

void Finalize ( )
513  {
514 
515  // Finalize function to cleanup histograms or any other stuff...
516  Log(2, "ShowRec.cpp", "--- void Finalize() ---");
517  if (cmd_ALTP==10) {
518  cout << "Do some rest of the GSNN Algorithm, to be packed in extrafunction" << endl;
519  cout << "for some later time...." << endl;
521  }
522 
523  // Close the open root files....
524  TREE_ShowRecEff->Write();
525  FILE_ShowRecEff->Close();
526 
527  Log(2, "ShowRec.cpp", "--- void Finalize() done. ---");
528  return;
529 }
void Write_Alg_GS_Histograms()
Definition: ShowRec.cpp:4075

◆ FindFollowingBTs()

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

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

1972 {
1973  Log(4, "ShowRec.cpp", "--- Bool_t FindFollowingBTs() ---");
1974  cout << "WARNING::WARNING Bool_t FindFollowingBTs() ... IS NOT SUPPORTED ANYMORE. RETURN kFALSE now !!!"<<endl;
1975  return kFALSE;
1976 
1977  // ATTENTION NEW CUT CONDITION ITRODUCED...
1978  // SIGMA OF DTHETA CUT IS DEPENDING AN DIFERNECE TO INBT PLATE....
1979  // CUT_dtheta=1.5,2.0,2.5*CUT_dtheta_original
1980  int diff_pid=0;
1981  Float_t CUTFACTOR=1.0;
1982  if (TMath::Abs(InBT->PID()-s->PID()) <3) CUTFACTOR=1.0;
1983  if (TMath::Abs(InBT->PID()-s->PID()) >2) CUTFACTOR=1.5;
1984  if (TMath::Abs(InBT->PID()-s->PID()) >5) CUTFACTOR=2.0;
1985  // cout << TMath::Abs(InBT->PID()-s->PID()) << " " << CUTFACTOR << endl;
1986  //NORMAL:
1987  CUTFACTOR=1.0;
1988 
1989  EdbSegP* s_TestBT;
1990  EdbSegP* seg;
1991  Int_t nentries=showersegarray->GetEntries();
1992  Double_t dZ;
1993 
1994  // For the very first Z position we do not test
1995  // if testBT has Preceeders, only if it it has a BT around (case for e+e- coming from gammma):
1996  // Take 50microns and 80mrad in (dR/dT) around.
1997  // This does not affect the normal results, but helps for
1998  // events which may have a second BT close to InBT (like in e+e-)
1999  if (s->Z()==InBT->Z()) {
2000  //cout << "Test here..."<<endl;
2001  //cout << "GetdeltaTheta(s, InBT)= " << GetdeltaTheta(s, InBT) << endl;
2002  //cout << "GetdeltaRWithPropagation(s, InBT)= " << GetdeltaRWithPropagation(s, InBT) << endl;
2003  if (GetdeltaTheta(s, InBT) < 0.08 && GetdeltaRWithPropagation(s, InBT) < 50.0) {
2004  return kTRUE;
2005  }
2006  //cout << "Test here...done. Not fullfilled condition."<<endl;
2007  }
2008 
2009 
2010  // it is true to use local_gAli since this is given over in the function head as local_gAli ...
2011  Int_t local_gAli_npat=local_gAli->Npatterns();
2012  //if (gEDBDEBUGLEVEL>2)
2013  // cout << "--- local_gAli_npat= " << local_gAli_npat << endl;
2014 
2015  // Loop over all plates of local_gAli, since this is already
2016  // extracted with the right numbers of plates...
2017  for (Int_t patterloop_cnt=local_gAli_npat-1; patterloop_cnt>=0; --patterloop_cnt) {
2018  if (gEDBDEBUGLEVEL>3) cout << "--- --- Doing patterloop_cnt= " << patterloop_cnt << endl;
2019 
2020  //cout << local_gAli->GetPattern(patterloop_cnt)->Z() << " " << InBT->Z() << endl;
2021  if (local_gAli->GetPattern(patterloop_cnt)->Z()<InBT->Z()) continue;
2022  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..
2023 
2024  for (Int_t btloop_cnt=0; btloop_cnt<local_gAli->GetPattern(patterloop_cnt)->GetN(); ++btloop_cnt) {
2025  s_TestBT = (EdbSegP*)local_gAli->GetPattern(patterloop_cnt)->GetSegment(btloop_cnt);
2026  if (gEDBDEBUGLEVEL>3) s_TestBT->PrintNice();
2027 
2028 
2029  dZ=TMath::Abs(s_TestBT->Z()-s->Z());
2031  if (dZ<0.1&&TMath::Abs(s_TestBT->X()-s->X())<1.0) continue; // Exclude the case of same Basetracks:
2032  if (dZ>(4*1300.0)+30.0) continue; // Exclude the case of more than 4 plates after...
2033 
2034 
2035  if (GetdeltaThetaSingleAngles(s, s_TestBT) > CUTFACTOR*CUT_PARAMETER[3] ) continue;
2036  if (GetdeltaRWithPropagation(s, s_TestBT) > CUT_PARAMETER[2]) continue;
2037  return kTRUE;
2038  }
2039 
2040  }
2041 
2042  //---------------------------------------------
2043  return kFALSE;
2044 }
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 Npatterns() const
Definition: EdbPattern.h:380
EdbPattern * GetPattern(int id) const
Definition: EdbPattern.cxx:1887
void PrintNice() const
Definition: EdbSegP.cxx:418
Int_t PID() const
Definition: EdbSegP.h:145
EdbSegP * s
Definition: tlg2pattern.C:32

◆ FindPrecedingBTs()

Bool_t FindPrecedingBTs ( EdbSegP s,
EdbSegP InBT,
EdbPVRec gAli,
TObjArray *  showersegarray 
)
2136 {
2137  Log(4, "ShowRec.cpp", "--- Bool_t FindPrecedingBTs() ---");
2138 
2139  int diff_pid=0;
2140  Float_t CUTFACTOR=1.0;
2141  if (TMath::Abs(InBT->PID()-s->PID()) <3) CUTFACTOR=1.0;
2142  if (TMath::Abs(InBT->PID()-s->PID()) >2) CUTFACTOR=1.0;
2143  if (TMath::Abs(InBT->PID()-s->PID()) >5) CUTFACTOR=2.0;
2144 
2145  EdbSegP* s_TestBT;
2146  Int_t nentries=showersegarray->GetEntries();
2147  Double_t dZ;
2148 
2149  // Dont check the BT before the InBT position:
2150  if (s->Z()<InBT->Z()) {
2151  return kFALSE;
2152  }
2153 
2154  // For the very first Z position we do not test
2155  // if testBT has Preceeders, only if it it has a BT around (case for e+e- coming from gammma):
2156  // Take 50microns and 80mrad in (dR/dT) around.
2157  // This does not affect the normal results, but helps for
2158  // events which may have a second BT close to InBT (like in e+e-)
2159  if (s->Z()==InBT->Z()) {
2160  //cout << "Test here..."<<endl;
2161  //cout << "GetdeltaTheta(s, InBT)= " << GetdeltaTheta(s, InBT) << endl;
2162  //cout << "GetdeltaRWithPropagation(s, InBT)= " << GetdeltaRWithPropagation(s, InBT) << endl;
2163  if (GetdeltaTheta(s, InBT) < 0.08 && GetdeltaRWithPropagation(s, InBT) < 50.0) {
2164  return kTRUE;
2165  }
2166  //cout << "Test here...done. Not fullfilled condition."<<endl;
2167  }
2168 
2169  for (Int_t i=nentries-1; i>=0; --i) {
2170  s_TestBT = (EdbSegP*)( showersegarray->At(i) );
2171 
2172  if (gEDBDEBUGLEVEL>3) cout << "--- --- Do "<< s_TestBT->ID() << " " << s_TestBT->PID() << " " << s_TestBT->MCEvt() <<" " << s_TestBT->Z() << endl;
2173 
2174  dZ=TMath::Abs(s_TestBT->Z()-s->Z());
2175  if (dZ<30) continue; // Exclude the case of same Zpositions...
2176  if (dZ>(3*1300.0)+30.0) continue; // Exclude the case of more than 4 plates before...
2177 
2178  if (gEDBDEBUGLEVEL>3) cout << "--- --- Checking dT,dR and dZ for i: " << i << " " << GetdeltaTheta(s, s_TestBT) << " " << GetdeltaRWithPropagation(s, s_TestBT) << " "<<dZ << endl;
2179 
2180  if (GetdeltaTheta(s, s_TestBT) > CUTFACTOR*CUT_PARAMETER[3] ) continue;
2181  if (GetdeltaRWithPropagation(s, s_TestBT) > CUT_PARAMETER[2]) continue;
2182 
2183  if (gEDBDEBUGLEVEL>3) cout << "--- --- Checking dT,dR and dZ for i: " << i << " " << GetdeltaTheta(s, s_TestBT) << " " << GetdeltaRWithPropagation(s, s_TestBT) << " "<<dZ << " ok!"<<endl;
2184  return kTRUE;
2185  }
2186  //---------------------------------------------
2187  return kFALSE;
2188 }
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 
)
2053 {
2054  Log(4, "ShowRec.cpp", "--- Bool_t FindPrecedingBTs_local_gAli() ---");
2055 
2056  int diff_pid=0;
2057  Float_t CUTFACTOR=1.0;
2058  if (TMath::Abs(InBT->PID()-s->PID()) <3) CUTFACTOR=1.0;
2059  if (TMath::Abs(InBT->PID()-s->PID()) >2) CUTFACTOR=1.0;
2060  if (TMath::Abs(InBT->PID()-s->PID()) >5) CUTFACTOR=2.0;
2061 
2062  EdbSegP* s_TestBT;
2063  EdbSegP* seg;
2064  Int_t nentries=showersegarray->GetEntries();
2065  Double_t dZ;
2066 
2067 
2068  // Dont check the BT before the InBT position:
2069  if (s->Z()<InBT->Z()) {
2070  return kFALSE;
2071  }
2072 
2073  // For the very first Z position we do not test
2074  // if testBT has Preceeders, only if it it has a BT around (case for e+e- coming from gammma):
2075  // Take 50microns and 80mrad in (dR/dT) around.
2076  // This does not affect the normal results, but helps for
2077  // events which may have a second BT close to InBT (like in e+e-)
2078  if (s->Z()==InBT->Z()) {
2079  //cout << "Test here..."<<endl;
2080  //cout << "GetdeltaThetaSingleAngles(s, InBT)= " << GetdeltaThetaSingleAngles(s, InBT) << endl;
2081  //cout << "GetdeltaRWithPropagation(s, InBT)= " << GetdeltaRWithPropagation(s, InBT) << endl;
2082  if (GetdeltaThetaSingleAngles(s, InBT) < 0.08 && GetdeltaRWithPropagation(s, InBT) < 50.0) {
2083  return kTRUE;
2084  }
2085  //cout << "Test here...done. Not fullfilled condition."<<endl;
2086  }
2087 
2088 
2089  // it is true to use local_gAli since this is given over in the function head as local_gAli ...
2090  Int_t local_gAli_npat=local_gAli->Npatterns();
2091  //if (gEDBDEBUGLEVEL>2)
2092  // cout << "--- local_gAli_npat= " << local_gAli_npat << endl;
2093 
2094  // Loop over all plates of local_gAli, since this is already
2095  // extracted with the right numbers of plates...
2096  for (Int_t patterloop_cnt=local_gAli_npat-1; patterloop_cnt>=0; --patterloop_cnt) {
2097  if (gEDBDEBUGLEVEL>3) cout << "--- --- Doing patterloop_cnt= " << patterloop_cnt << endl;
2098 
2099  //cout << local_gAli->GetPattern(patterloop_cnt)->Z() << " " << InBT->Z() << endl;
2100  if (local_gAli->GetPattern(patterloop_cnt)->Z()<InBT->Z()) continue;
2101  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..
2102 
2103  for (Int_t btloop_cnt=0; btloop_cnt<local_gAli->GetPattern(patterloop_cnt)->GetN(); ++btloop_cnt) {
2104  s_TestBT = (EdbSegP*)local_gAli->GetPattern(patterloop_cnt)->GetSegment(btloop_cnt);
2105 
2106  dZ=TMath::Abs(s_TestBT->Z()-s->Z());
2107 
2108  // test only BTs which have LOWER Z (so they are before)....
2109  if (s_TestBT->Z()-s->Z()>=0) continue;
2110 
2111  if (dZ<30) continue; // Exclude the case of same Zpositions...
2112  if (dZ<0.1&&TMath::Abs(s_TestBT->X()-s->X())<1.0) continue; // Exclude the case of same Basetracks:
2113 
2114  // but why not search in both directions foreward and afterward ???
2115  if (dZ>(3.0*1300.0+30.0)) continue; // Exclude the case of more than 4 plates after...
2116 
2117  if (GetdeltaThetaSingleAngles(s, s_TestBT) > CUTFACTOR*CUT_PARAMETER[3] ) continue;
2118  if (GetdeltaRWithPropagation(s, s_TestBT) > CUT_PARAMETER[2]) continue;
2119  return kTRUE;
2120  }
2121 
2122  }
2123 
2124  //---------------------------------------------
2125  return kFALSE;
2126 }

◆ FindPrecedingBTsSingleThetaAngle()

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

11.06.2010: New including case:

2197 {
2198  Log(4, "ShowRec.cpp", "--- Bool_t FindPrecedingBTsSingleThetaAngle() ---");
2199 
2200  int diff_pid=0;
2201  Float_t CUTFACTOR=1.0;
2202  if (TMath::Abs(InBT->PID()-s->PID()) <3) CUTFACTOR=1.0;
2203  if (TMath::Abs(InBT->PID()-s->PID()) >2) CUTFACTOR=1.0;
2204 
2205  EdbSegP* s_TestBT;
2206  Int_t nentries=showersegarray->GetEntries();
2207  Double_t dZ;
2208 
2209  // Dont check the BT before the InBT position:
2210  if (s->Z()<InBT->Z()) {
2211  return kFALSE;
2212  }
2213 
2214  // For the very first Z position we do not test
2215  // if testBT has Preceeders, only if it it has a BT around (case for e+e- coming from gammma):
2216  // Take 50microns and 80mrad in (dR/dT) around.
2217  // This does not affect the normal results, but helps for
2218  // events which may have a second BT close to InBT (like in e+e-)
2219  if (s->Z()==InBT->Z()) {
2220  /*
2221  cout << "Bool_t FindPrecedingBTsSingleThetaAngle(EdbSegP* s, EdbSegP* InBT, EdbPVRec *gAli, TObjArray* showersegarray)" << endl;
2222  cout << "Test here... for s ( " << s << " ) and InBT ( " << InBT << " ) :" << endl;
2223  s->PrintNice();
2224  InBT->PrintNice();
2225  cout << "GetdeltaThetaSingleAngles(s, InBT)= " << GetdeltaThetaSingleAngles(s, InBT) << endl;
2226  cout << "GetdeltaRWithPropagation(s, InBT)= " << GetdeltaRWithPropagation(s, InBT) << endl;
2227  */
2228  if (GetdeltaThetaSingleAngles(s, InBT) < 0.08 && GetdeltaRWithPropagation(s, InBT) < 50.0) {
2229  return kTRUE;
2230  }
2231  //cout << "Test here...done. Not fullfilled condition."<<endl;
2232  }
2233 
2234 
2236  Float_t nmaxholes=3.0;
2237  if (CUT_PARAMETER[4]==3) nmaxholes=3.0;
2238  if (CUT_PARAMETER[4]==5) nmaxholes=5.0;
2239  if (CUT_PARAMETER[4]==9) nmaxholes=9.0;
2240 // cout << "DEBUG CUT_PARAMETER[4] = " << CUT_PARAMETER[4] << endl;
2241 // cout << "DEBUG nmaxholes = " << nmaxholes << endl;
2242 
2243  for (Int_t i=nentries-1; i>=0; --i) {
2244  s_TestBT = (EdbSegP*)( showersegarray->At(i) );
2245 
2246  if (gEDBDEBUGLEVEL>3) cout << "--- --- Do "<< s_TestBT->ID() << " " << s_TestBT->PID() << " " << s_TestBT->MCEvt() <<" " << s_TestBT->Z() << endl;
2247 
2248  dZ=TMath::Abs(s_TestBT->Z()-s->Z());
2249  if (dZ<30) continue; // Exclude the case of same Zpositions...
2250  if (dZ>(nmaxholes*1300.0)+30.0) continue; // Exclude the case of more than 4 plates before...
2251 
2252  if (gEDBDEBUGLEVEL>3) cout << "--- --- Checking dT,dR and dZ for i: " << i << " " << GetdeltaThetaSingleAngles(s, s_TestBT) << " " << GetdeltaRWithPropagation(s, s_TestBT) << " "<<dZ << endl;
2253 
2254  if (GetdeltaThetaSingleAngles(s, s_TestBT) > CUTFACTOR*CUT_PARAMETER[3] ) continue;
2255  if (GetdeltaRWithPropagation(s, s_TestBT) > CUT_PARAMETER[2]) continue;
2256 
2257  if (gEDBDEBUGLEVEL>3) {
2258  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;
2259  s->PrintNice();
2260  s_TestBT->PrintNice();
2261  }
2262  return kTRUE;
2263  }
2264  //---------------------------------------------
2265 
2266  return kFALSE;
2267 }

◆ FindPrecedingBTsSingleThetaAngleTCDEBUG()

Bool_t FindPrecedingBTsSingleThetaAngleTCDEBUG ( EdbSegP s,
EdbSegP InBT,
EdbPVRec gAli,
TObjArray *  showersegarray 
)
2275 {
2276  Log(4, "ShowRec.cpp", "--- Bool_t FindPrecedingBTsSingleThetaAngleTCDEBUG() ---");
2277 
2278  Float_t CUTFACTOR=1.0;
2279 
2280  EdbSegP* s_TestBT;
2281  Int_t nentries=showersegarray->GetEntries();
2282  Double_t dZ;
2283 
2284  // Dont check the BT before the InBT position:
2285  if (s->Z()<InBT->Z()) {
2286  return kFALSE;
2287  }
2288 
2289 
2290 
2291  // For the very first Z position we do not test
2292  // if testBT has Preceeders, only if it it has a BT around (case for e+e- coming from gammma):
2293  // Take 50microns and 80mrad in (dR/dT) around.
2294  // This does not affect the normal results, but helps for
2295  // events which may have a second BT close to InBT (like in e+e-)
2296  if (TMath::Abs(s->Z()-InBT->Z())<5.0) {
2297  //cout << "Test here..."<<endl;
2298  //cout << "GetdeltaThetaSingleAngles(s, InBT)= " << GetdeltaThetaSingleAngles(s, InBT) << endl;
2299  //cout << "GetdeltaRWithPropagation(s, InBT)= " << GetdeltaRWithPropagation(s, InBT) << endl;
2300  if (GetdeltaThetaSingleAngles(s, InBT) < 0.08 && GetdeltaRWithPropagation(s, InBT) < 50.0) {
2301  return kTRUE;
2302  }
2303 
2304 
2305  //cout << "Test here...done. Not fullfilled condition."<<endl;
2306  }
2307 
2308 
2309  for (Int_t i=nentries-1; i>=0; --i) {
2310  s_TestBT = (EdbSegP*)( showersegarray->At(i) );
2311 
2312  // cout << "--- --- FindPrecedingBTsSingleThetaAngleTCDEBUG Do "<< s_TestBT->ID() << " " << s_TestBT->PID() << " " << s_TestBT->MCEvt() <<" " << s_TestBT->Z() << endl;
2313 
2314  dZ=TMath::Abs(s_TestBT->Z()-s->Z());
2315  if (dZ<30) continue; // Exclude the case of same Zpositions...
2316  if (dZ>(3*1300.0)+30.0) continue; // Exclude the case of more than 4 plates before...
2317 
2318  Float_t interim_dT=GetdeltaThetaSingleAngles(s, s_TestBT);
2319  Float_t interim_dRProp=GetdeltaRWithPropagation(s, s_TestBT);
2320 
2321  // cout << "--- --- FindPrecedingBTsSingleThetaAngleTCDEBUG Checking dT,dR and dZ for i: " << i << " " << interim_dT << " " << interim_dRProp << " "<<dZ << endl;
2322 
2323  if (GetdeltaThetaSingleAngles(s, s_TestBT) > CUTFACTOR*CUT_PARAMETER[3] ) continue;
2324  if (GetdeltaRWithPropagation(s, s_TestBT) > CUT_PARAMETER[2]) continue;
2325 
2326  // cout << "--- --- Checking dT,dR and dZ: ok!"<<endl;
2327  return kTRUE;
2328  }
2329  //---------------------------------------------
2330 
2331  return kFALSE;
2332 }

◆ GetConeOrTubeDistanceToBTOfShowerArray()

Bool_t GetConeOrTubeDistanceToBTOfShowerArray ( EdbSegP sa,
EdbSegP InBT,
TObjArray *  showersegarray,
Double_t  CylinderRadius,
Double_t  ConeAngle 
)
2423 {
2424 
2425  Bool_t isTrueForBT=kFALSE;
2426  Int_t lastI=0;
2427  Double_t factor=1.0;
2428 
2429  EdbSegP* s_TestBT;
2430  Int_t nentries=showersegarray->GetEntries();
2431  //cout << "nentries=showersegarray->GetEntries(); " << nentries << endl;
2432 
2433  // Now call GetConeOrTubeDistanceToInBT for every BT which was reconstructed up to now in the shower:
2434  for (Int_t i=0; i<nentries; i++) {
2435  s_TestBT = (EdbSegP*)( showersegarray->At(i) );
2436  // Dont check the BT which is before or same Z as the BaseTrack(i) position:
2437  // But ---not--- for the first Basetrack. There we allow it!
2438  //if (s_TestBT->Z()>=sa->Z() && i>0) continue;
2439  if (s_TestBT->Z()>sa->Z() ) continue;
2440 
2441  lastI=i;
2442 
2443  if (i==0) {
2444  factor=1.0;
2445  }
2446  else {
2447  factor=3.0;
2448  }
2449 
2450 
2451  if (GetConeOrTubeDistanceToInBT(sa, s_TestBT, factor*CylinderRadius, factor*ConeAngle)==kTRUE) {
2452  isTrueForBT=kTRUE;
2453  break;
2454  }
2455 
2456  //if (i>0) cout << "GetConeOrTubeDistanceToBTOfShowerArray:: i="<<i<<endl;
2457 
2458  }
2459 
2460 
2461  if (isTrueForBT) {
2462  //if (lastI>0) cout <<"for i= " << lastI<< " return true with factor "<< factor << endl;
2463  return kTRUE;
2464  }
2465 
2466  return kFALSE;
2467 }
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

2341 {
2342  Log(4,"ShowRec.cpp", "--- Bool_t GetConeOrTubeDistanceToInBT() ---");
2343 
2344  TVector3 x1(InBT->X(),InBT->Y(),InBT->Z());
2345  TVector3 x2(sa->X(),sa->Y(),sa->Z());
2346  TVector3 direction_x1(InBT->TX()*1300,InBT->TY()*1300,1300);
2347  TVector3 direction_x2(sa->TX()*1300,sa->TY()*1300,1300);
2348  TVector3 u1=x2-x1;
2349 
2350  Double_t direction_x1_norm= direction_x1.Mag();
2351  Double_t cosangle= (direction_x1*u1)/(u1.Mag()*direction_x1_norm);
2352  Double_t angle = TMath::ACos(cosangle);
2353  // NO THIS IS NOT THE CONE ANGLE!!
2354 
2355  TVector3 direction_1(InBT->TX()*1300,InBT->TY()*1300,1300);
2356  TVector3 direction_2(sa->TX()*1300,sa->TY()*1300,1300);
2357 
2358  /*
2359  cout <<"------"<<endl;
2360  cout << "angle = " << angle << endl;
2361  cout << "angle V2 = " << x1.Angle(x2) << endl;
2362  cout << "angle V3 = " << direction_x1.Angle(direction_x2) << endl;
2363  cout << "angle V4 = " << direction_1.Angle(direction_2) << " " << direction_1.Angle(direction_2)/3.14*180.0 << endl;
2364 
2365  cout << "angle V5 direction_x1.Angle(u1 = " << direction_x1.Angle(u1) << endl;
2366  cout << "angle V5 u1.Angle(direction_x1 = " << u1.Angle(direction_x1) << endl;
2367  */
2368  angle=u1.Angle(direction_x1);
2369 
2370 
2371  // For the case where the two basetracks have same z position
2372  // the angle is about 90 degree so it makes no sense to calculate it...
2373  // therefore we set it artificially to zero:
2374  if (TMath::Abs(InBT->Z()-sa->Z())<5.0 ) {
2375  angle=0.0;
2376  //if (gEDBDEBUGLEVEL>3) //cout << "same z position, set angle artificially to zero" << endl;
2377  }
2378 
2379  // cout << "--- Bool_t GetConeOrTubeDistanceToInBT() ---"<<endl;
2380  // InBT->PrintNice();
2381  // sa->PrintNice();
2382  // cout << "angle= " << angle << " ConeAngle= " << ConeAngle << endl;
2383 
2384 
2385  // If this InBT is in z position AFTER the testBT, the cone goes in the other direction and therefore, we have
2386  // to mirror the angle by 180 degree:
2387  if (angle>TMath::Pi()/2.0) {
2388  angle=TMath::Abs(TMath::Pi()-angle);
2389  //cout << "reverse angle: " << angle << endl;
2390  }
2391 
2393  if (angle>ConeAngle) {
2394  return kFALSE;
2395  }
2396 
2398  Double_t TubeDistance = 1.0/direction_x1_norm * ( (x2-x1).Cross(direction_x1) ).Mag();
2399  // cout << "CylinderRadius= " << CylinderRadius << " TubeDistance= " << TubeDistance << endl;
2400  if (TubeDistance>CylinderRadius) {
2401  return kFALSE;
2402  }
2403 
2404  return kTRUE;
2405 }

◆ GetdeltaRNoPropagation()

Double_t GetdeltaRNoPropagation ( EdbSegP s,
EdbSegP stest 
)
2580 {
2581  Log(4, "ShowRec.cpp", "--- Bool_t GetdeltaRNoPropagation() ---");
2582  return TMath::Sqrt((s->X()-stest->X())*(s->X()-stest->X())+(s->Y()-stest->Y())*(s->Y()-stest->Y()));
2583 }

◆ GetdeltaRWithPropagation()

Double_t GetdeltaRWithPropagation ( EdbSegP s,
EdbSegP stest 
)
2562 {
2563  Log(4, "ShowRec.cpp", "--- Bool_t GetdeltaRWithPropagation() ---");
2564  // Propagate s to z-position of stest:
2565  Double_t zorig;
2566  Double_t dR;
2567  zorig=s->Z();
2568  s->PropagateTo(stest->Z());
2569  dR=(s->X()-stest->X())*(s->X()-stest->X())+(s->Y()-stest->Y())*(s->Y()-stest->Y());
2570  dR=TMath::Sqrt(dR);
2571  s->PropagateTo(zorig);
2572  return dR;
2573 }
void PropagateTo(float z)
Definition: EdbSegP.cxx:292

◆ GetdeltaTheta()

Double_t GetdeltaTheta ( EdbSegP s1,
EdbSegP s2 
)
2590 {
2591  Log(4, "ShowRec.cpp", "--- Bool_t GetdeltaTheta() ---");
2592 
2593  Double_t tx1,tx2,ty1,ty2;
2594  tx1=s1->TX();
2595  tx2=s2->TX();
2596  ty1=s1->TY();
2597  ty2=s2->TY();
2598  // 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...
2599  //Double_t dt= TMath::Sqrt( (tx1-tx2)*(tx1-tx2) + (ty1-ty2)*(ty1-ty2) ); // new version to test... => implemented in GetdeltaThetaSingleAngles
2600  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()
2601  return dt;
2602 }
EdbSegP * s2
Definition: tlg2pattern.C:31

◆ GetdeltaThetaSingleAngles()

Double_t GetdeltaThetaSingleAngles ( EdbSegP s1,
EdbSegP s2 
)
2609 {
2610  Log(4, "ShowRec.cpp", "--- Bool_t GetdeltaThetaSingleAngles() ---");
2611 
2612  Double_t tx1,tx2,ty1,ty2;
2613  tx1=s1->TX();
2614  tx2=s2->TX();
2615  ty1=s1->TY();
2616  ty2=s2->TY();
2617  //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...
2618  Double_t dt= TMath::Sqrt( (tx1-tx2)*(tx1-tx2) + (ty1-ty2)*(ty1-ty2) ); // new version to test...
2619  return dt;
2620 }

◆ GetEvent_ParasetDefinitionTree()

void GetEvent_ParasetDefinitionTree ( Int_t  nr)
1150 {
1151  Log(2, "ShowRec.cpp", "--- void GetEvent_ParasetDefinitionTree( Int_t %d) ---", nr);
1152 
1153  // Get the Parameter set definition variables for all the possible algorithms.
1154  // We need to distinguish the parameter values from the TreeDefinition file
1155  // for each algorithm.
1156 
1157  // ALTP 1..9: diverse algorithm cut parameter values.
1158  Double_t dr_max,dt_max,coneangle,tubedist;
1159  Int_t nholes_max;
1160  Double_t ann_output;
1161  Int_t ann_inputneurons;
1162  Double_t distMin_max;
1163  Int_t tracksegs_max;
1164  Double_t distMin_dt_max;
1166 
1167  // ALTP 10: GS from libShowRec
1168  Double_t cut_gs_cut_dip=150;
1169  Double_t cut_gs_cut_dmin=40;
1170  Double_t cut_gs_cut_dr=60;
1171  Double_t cut_gs_cut_dz=19000;
1172  Double_t cut_gs_cut_dtheta=0.06;
1173  Double_t cut_gs_cut_piddiff=1;
1174  Int_t cut_gs_cut_oppositeflag=0;
1175 
1176  // ALTP 11: N3 Alg
1177  Double_t ANN_OUTPUT;
1178  Int_t ANN_INPUTLEVEL;
1179  Int_t ANN_PLATEN;
1180  Int_t ANN_PLATEDIRECTION;
1181  Int_t ANN_HIDDENLAYER;
1182  Int_t ANN_INPUTNEURONS;
1183 
1184 
1185  // Reset Cut Paramters, just for safety reasons,
1186  // not to leave them uninitialized!
1187  for (int i=0; i<10; i++ ) {
1188  CUT_PARAMETER[i]=0.0;
1189  }
1190 
1191  // If the "nr" equals -1, then there is no given TREE_ParaSetDefinitions
1192  // That means, the default set of values is taken, i.e. entry zero.
1193  // So nr is set to 0:
1194  if (nr==-1) {
1195  nr=0;
1196 // TREE_ParaSetDefinitions->GetEntry(nr);
1197  cout << "--- Got TREE_ParaSetDefinitions->GetEntry(0) instead of -1 due to no given PARAMETERSET_DEFINITIONFILE.root file."<<endl;
1198 // TREE_ParaSetDefinitions->Show(nr);
1199 
1200  }
1201 
1202  //TREE_ParaSetDefinitions->Print();
1203 
1204  // Switches Statements would be nicer, but anyway.
1205  if (cmd_ALTP==0) {
1206  TREE_ParaSetDefinitions->SetBranchAddress("CUT_ZYLINDER_R_MAX",&tubedist);
1207  TREE_ParaSetDefinitions->SetBranchAddress("CUT_ZYLINDER_ANGLE_MAX",&coneangle);
1208  TREE_ParaSetDefinitions->SetBranchAddress("CUT_SHOWERFOLLOWERBT_DR_MAX",&dr_max);
1209  TREE_ParaSetDefinitions->SetBranchAddress("CUT_SHOWERFOLLOWERBT_DTAN_MAX",&dt_max);
1210 
1211  TREE_ParaSetDefinitions->GetEntry(nr);
1212 
1213  CUT_PARAMETER[0]=tubedist;
1214  CUT_PARAMETER[1]=coneangle;
1215  CUT_PARAMETER[2]=dr_max;
1216  CUT_PARAMETER[3]=dt_max;
1217  }
1218  else if (cmd_ALTP==1) {
1219  cout << "cmd_ALTP==1 TODO"<<endl;
1220  }
1221  else if (cmd_ALTP==2) {
1222  TREE_ParaSetDefinitions->SetBranchAddress("CUT_ZYLINDER_R_MAX",&tubedist);
1223  TREE_ParaSetDefinitions->SetBranchAddress("CUT_ZYLINDER_ANGLE_MAX",&coneangle);
1224  TREE_ParaSetDefinitions->SetBranchAddress("CUT_SHOWERFOLLOWERBT_DR_MAX",&dr_max);
1225  TREE_ParaSetDefinitions->SetBranchAddress("CUT_SHOWERFOLLOWERBT_DTAN_MAX",&dt_max);
1226 
1227  TREE_ParaSetDefinitions->GetEntry(nr);
1228 
1229  CUT_PARAMETER[0]=tubedist;
1230  CUT_PARAMETER[1]=coneangle;
1231  CUT_PARAMETER[2]=dr_max;
1232  CUT_PARAMETER[3]=dt_max;
1233  }
1234  else if (cmd_ALTP==3) {
1235  TREE_ParaSetDefinitions->SetBranchAddress("CUT_ANN_OUTPUT",&ann_output);
1236  TREE_ParaSetDefinitions -> SetBranchAddress("CUT_ANN_INPUTNEURONS",&ann_inputneurons);
1237 
1238  TREE_ParaSetDefinitions->GetEntry(nr);
1239 
1240  CUT_PARAMETER[0]=ann_output;
1241  CUT_PARAMETER[1]=ann_inputneurons;
1242 
1243  cout << "TODO"<<endl;
1244  // I DONT KNOW WHY I HAVE THAT WRITTEN, BUT AT SOME POINT MUST HAVE MADE SOME SENSE .....
1245 
1246  }
1247  else if (cmd_ALTP==4) {
1248  TREE_ParaSetDefinitions->SetBranchAddress("CUT_ZYLINDER_R_MAX",&tubedist);
1249  TREE_ParaSetDefinitions->SetBranchAddress("CUT_ZYLINDER_ANGLE_MAX",&coneangle);
1250  TREE_ParaSetDefinitions->SetBranchAddress("CUT_SHOWERFOLLOWERBT_DR_MAX",&dr_max);
1251  TREE_ParaSetDefinitions->SetBranchAddress("CUT_SHOWERFOLLOWERBT_DTAN_MAX",&dt_max);
1252  TREE_ParaSetDefinitions->SetBranchAddress("CUT_NHOLES_MAX",&nholes_max);
1253 
1254  TREE_ParaSetDefinitions->GetEntry(nr);
1255 
1256  CUT_PARAMETER[0]=tubedist;
1257  CUT_PARAMETER[1]=coneangle;
1258  CUT_PARAMETER[2]=dr_max;
1259  CUT_PARAMETER[3]=dt_max;
1260  CUT_PARAMETER[4]=nholes_max;
1261 
1262  }
1263  else if (cmd_ALTP==5) {
1264  Double_t CUT_P; // s->P()
1265  Double_t CUT_ALISUBSIZE; // eAli_local_half_size
1266 
1267  TREE_ParaSetDefinitions->SetBranchAddress("CUT_P",&CUT_P);
1268  TREE_ParaSetDefinitions->SetBranchAddress("CUT_ALISUBSIZE",&CUT_ALISUBSIZE);
1269 
1270  TREE_ParaSetDefinitions->GetEntry(nr);
1271 
1272  CUT_PARAMETER[0]=CUT_P;
1274  }
1275  else if (cmd_ALTP==6) {
1276  TREE_ParaSetDefinitions->SetBranchAddress("CUT_ZYLINDER_R_MAX",&tubedist);
1277  TREE_ParaSetDefinitions->SetBranchAddress("CUT_ZYLINDER_ANGLE_MAX",&coneangle);
1278  TREE_ParaSetDefinitions->SetBranchAddress("CUT_SHOWERFOLLOWERBT_DR_MAX",&dr_max);
1279  TREE_ParaSetDefinitions->SetBranchAddress("CUT_SHOWERFOLLOWERBT_DTAN_MAX",&dt_max);
1280  TREE_ParaSetDefinitions->SetBranchAddress("CUT_TRACKATTACH_DISTMIN",&distMin_max);
1281  TREE_ParaSetDefinitions->SetBranchAddress("CUT_TRACKATTACH_DTAN_MAX",&distMin_dt_max);
1282  TREE_ParaSetDefinitions->SetBranchAddress("CUT_TRACKATTACH_NTRACKSEG",&tracksegs_max);
1283 
1284  TREE_ParaSetDefinitions->GetEntry(nr);
1285 
1286  CUT_PARAMETER[0]=tubedist;
1287  CUT_PARAMETER[1]=coneangle;
1288  CUT_PARAMETER[2]=dr_max;
1289  CUT_PARAMETER[3]=dt_max;
1290  CUT_PARAMETER[4]=distMin_max;
1291  CUT_PARAMETER[5]=distMin_dt_max;
1292  CUT_PARAMETER[6]=tracksegs_max;
1293  }
1294  else if (cmd_ALTP==7||cmd_ALTP==9) {
1295  TREE_ParaSetDefinitions->SetBranchAddress("CUT_ZYLINDER_R_MAX",&tubedist);
1296  TREE_ParaSetDefinitions->SetBranchAddress("CUT_ZYLINDER_ANGLE_MAX",&coneangle);
1297  TREE_ParaSetDefinitions->SetBranchAddress("CUT_SHOWERFOLLOWERBT_DR_MAX",&dr_max);
1298  TREE_ParaSetDefinitions->SetBranchAddress("CUT_SHOWERFOLLOWERBT_DTAN_MAX",&dt_max);
1299 
1300  TREE_ParaSetDefinitions->GetEntry(nr);
1301 
1302  CUT_PARAMETER[0]=tubedist;
1303  CUT_PARAMETER[1]=coneangle;
1304  CUT_PARAMETER[2]=dr_max;
1305  CUT_PARAMETER[3]=dt_max;
1306  }
1307  else if (cmd_ALTP==8) {
1308  TREE_ParaSetDefinitions->SetBranchAddress("CUT_BACK_DMIN",&cut_back_dmin);
1309  TREE_ParaSetDefinitions->SetBranchAddress("CUT_BACK_DTHETA",&cut_back_dtheta);
1310  TREE_ParaSetDefinitions->SetBranchAddress("CUT_BACK_DR",&cut_back_dr);
1311  TREE_ParaSetDefinitions->SetBranchAddress("CUT_BACK_DZ",&cut_back_dz);
1312  TREE_ParaSetDefinitions->SetBranchAddress("CUT_FOR_DMIN",&cut_for_dmin);
1313  TREE_ParaSetDefinitions->SetBranchAddress("CUT_FOR_DTHETA",&cut_for_dtheta);
1314  TREE_ParaSetDefinitions->SetBranchAddress("CUT_FOR_DR",&cut_for_dr);
1315  TREE_ParaSetDefinitions->SetBranchAddress("CUT_FOR_DZ",&cut_for_dz);
1316 
1317  TREE_ParaSetDefinitions->GetEntry(nr);
1318 
1327  }
1328  else if (cmd_ALTP==10) {
1335  TREE_ParaSetDefinitions -> SetBranchAddress("CUT_GS_CUT_OPPOSITEFLAG",&cut_gs_cut_oppositeflag);
1336 
1337  TREE_ParaSetDefinitions->GetEntry(nr);
1338 
1346  }
1347  else if (cmd_ALTP==11) {
1353 
1354  TREE_ParaSetDefinitions->GetEntry(nr);
1355 
1359  CUT_PARAMETER[3]=N3_ANN_INPUTNEURONS; // not used in input, but anywy set here.
1361  }
1362 
1363 
1365 
1366  cout << "--- CUT_PARAMETER 0 1 2 3: " << CUT_PARAMETER[0] <<" "<<CUT_PARAMETER[1]<<" "<< CUT_PARAMETER[2] <<" "<< CUT_PARAMETER[3] <<endl;
1367  cout << "--- CUT_PARAMETER 4 5 6 7: " << CUT_PARAMETER[4] <<" "<<CUT_PARAMETER[5]<<" "<< CUT_PARAMETER[6]<< " "<< CUT_PARAMETER[7]<<" "<<endl;
1368  return;
1369 }
Double_t cut_gs_cut_dtheta
Definition: CreateParaset_GS_Alg.C:17
Double_t cut_gs_cut_dip
Definition: CreateParaset_GS_Alg.C:13
Int_t cut_gs_cut_oppositeflag
Definition: CreateParaset_GS_Alg.C:19
Double_t cut_gs_cut_piddiff
Definition: CreateParaset_GS_Alg.C:18
Double_t cut_gs_cut_dr
Definition: CreateParaset_GS_Alg.C:15
Double_t cut_gs_cut_dmin
Definition: CreateParaset_GS_Alg.C:14
Double_t cut_gs_cut_dz
Definition: CreateParaset_GS_Alg.C:16
Int_t ANN_INPUTNEURONS
Definition: CreateParaset_N3_Alg.C:23
Double_t CUT_P
Definition: CreateParaset_SA_Alg.C:1
Double_t CUT_ALISUBSIZE
Definition: CreateParaset_SA_Alg.C:18
Int_t N3_ANN_NHIDDENLAYER
Definition: ShowRec_Alg_N3.h:23
Int_t N3_ANN_INPUTNEURONS
Definition: ShowRec_Alg_N3.h:29
Double_t N3_ANN_OUTPUTTHRESHOLD
Definition: ShowRec_Alg_N3.h:24
Int_t N3_ANN_PLATE_DELTANMAX
Definition: ShowRec_Alg_N3.h:20
Int_t N3_ANN_NTRAINEPOCHS
Definition: ShowRec_Alg_N3.h:22
TTree * TREE_ParaSetDefinitions
Definition: ShowRec.h:65
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 
)
2734 {
2735  // cout << "GetMeansBeforeAndAfter( XX, " << patterloop_cnt << " , Seg, " << n_patterns << ", " << BeforeOrAfter << endl;
2736  mean_dT=-1;
2737  mean_dR=-1;
2738 
2739  float Z_minus1=0;
2740  float Z_normal=local_gAli->GetPattern(patterloop_cnt)->Z();
2741  float Z_plus1=0;
2742 
2743  int npat=local_gAli->Npatterns();
2744  Bool_t edge_npat_upper=kFALSE;
2745  Bool_t edge_npat_lower=kFALSE;
2746  Int_t Factor=-1;
2747 
2748  if (patterloop_cnt==npat-1) {
2749  edge_npat_upper=kTRUE;
2750  }
2751  if (patterloop_cnt==0) {
2752  edge_npat_lower=kTRUE;
2753  }
2754 
2755  if (!edge_npat_lower) {
2756  Z_minus1=local_gAli->GetPattern(patterloop_cnt-1)->Z();
2757  if (Z_minus1<Z_normal) Factor=1;
2758  }
2759  if (!edge_npat_upper) {
2760  Z_plus1 =local_gAli->GetPattern(patterloop_cnt+1)->Z();
2761  if (Z_plus1>Z_normal) Factor=1;
2762  }
2763  // New PID we want to have:
2764  Int_t patterloop_test=patterloop_cnt+Factor*n_patterns*BeforeOrAfter;
2765 
2766  // Does this plate exist? If not, return 0 directly:
2767  if (patterloop_test>=npat || patterloop_test<0) {
2768  //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;
2769  return 0;
2770  }
2771 
2772  // Since we have checked now for bounds we can FindCompliments:
2773  Int_t n_return=0;
2774  TObjArray array;
2775  array.Clear();
2776  EdbPattern* TestPattern= (EdbPattern*)local_gAli->GetPattern(patterloop_test);
2777  TestPattern -> FillCell(20,20,0.01,0.01);
2778  n_return = TestPattern->FindCompliments(*seg,array,3,3);
2779  //cout << " Found " << n_return << " compliments in 2,2 sigma area:" << endl;
2780 
2781  if (n_return==0) return n_return;
2782 
2783  //seg->PrintNice();
2784  for (int i=0; i<n_return; i++) {
2785  EdbSegP* s_of_array=(EdbSegP*)array.At(i);
2786  if (i==0) {
2787  mean_dT=0;
2788  mean_dR=0;
2789  }
2790  //s_of_array->PrintNice();
2791  mean_dT+=GetdeltaThetaSingleAngles(seg,s_of_array);
2792  mean_dR+=GetdeltaRNoPropagation(seg,s_of_array);
2793  }
2794  if (n_return>0) mean_dT=mean_dT/(Double_t)n_return;
2795  if (n_return>0) mean_dR=mean_dR/(Double_t)n_return;
2796 
2797  // cout << " mean_dT = " << mean_dT << endl;
2798  // cout << " mean_dR = " << mean_dR << endl;
2799 
2800  // „Hab ich mich aus einfachsten Verhältnissen emporgequält, um dann zu bitten?“
2801  return n_return;
2802 }
Int_t npat
Definition: Xi2HatStartScript.C:33
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

◆ 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 
)
2646 {
2647  // cout << "GetMinsBeforeAndAfter( XX, " << patterloop_cnt << " , Seg, " << n_patterns << ", " << BeforeOrAfter << endl;
2648  min_dT=-1;
2649  min_dR=-1;
2650 
2651  float Z_minus1=0;
2652  float Z_normal=local_gAli->GetPattern(patterloop_cnt)->Z();
2653  float Z_plus1=0;
2654 
2655  int npat=local_gAli->Npatterns();
2656  Bool_t edge_npat_upper=kFALSE;
2657  Bool_t edge_npat_lower=kFALSE;
2658  Int_t Factor=-1;
2659 
2660  if (patterloop_cnt==npat-1) {
2661  edge_npat_upper=kTRUE;
2662  }
2663  if (patterloop_cnt==0) {
2664  edge_npat_lower=kTRUE;
2665  }
2666 
2667  if (!edge_npat_lower) {
2668  Z_minus1=local_gAli->GetPattern(patterloop_cnt-1)->Z();
2669  if (Z_minus1<Z_normal) Factor=1;
2670  }
2671  if (!edge_npat_upper) {
2672  Z_plus1 =local_gAli->GetPattern(patterloop_cnt+1)->Z();
2673  if (Z_plus1>Z_normal) Factor=1;
2674  }
2675  // New PID we want to have:
2676  Int_t patterloop_test=patterloop_cnt+Factor*n_patterns*BeforeOrAfter;
2677 
2678  // Does this plate exist? If not, return 0 directly:
2679  if (patterloop_test>=npat || patterloop_test<0) {
2680  //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;
2681  return 0;
2682  }
2683 
2684  // Since we have checked now for bounds we can FindCompliments:
2685  Int_t n_return=0;
2686  TObjArray array;
2687  array.Clear();
2688  EdbPattern* TestPattern= (EdbPattern*)local_gAli->GetPattern(patterloop_test);
2689  TestPattern -> FillCell(20,20,0.01,0.01);
2690  n_return = TestPattern->FindCompliments(*seg,array,3,3);
2691  //cout << " Found " << n_return << " compliments in 2,2 sigma area:" << endl;
2692 
2693  if (n_return==0) return n_return;
2694 
2695  if (n_return==1) {
2696  EdbSegP* s_of_array=(EdbSegP*)array.At(0);
2697  min_dT=GetdeltaThetaSingleAngles(seg,s_of_array);
2698  min_dR=GetdeltaRNoPropagation(seg,s_of_array);
2699  }
2700 
2701 
2702  Float_t tmp_min_dT=-1;
2703  Float_t tmp_min_dR=-1;
2704  Float_t tmp2_min_dT=-1;
2705  Float_t tmp2_min_dR=-1;
2706  Float_t angle;
2707  Float_t dist;
2708 
2709  if (n_return>1) {
2710  for (int i=0; i<n_return; i++) {
2711  EdbSegP* s_of_array=(EdbSegP*)array.At(i);
2712  if (i==0) {
2713  min_dT=999999;
2714  min_dR=9999999;
2715  }
2716  angle=(Float_t)GetdeltaThetaSingleAngles(seg,s_of_array);
2717  tmp_min_dT=min_dT;
2718  tmp2_min_dT=TMath::Min(angle, tmp_min_dT);
2719  min_dT=tmp2_min_dT;
2720 
2721  dist=(Float_t)GetdeltaRNoPropagation(seg,s_of_array);
2722  tmp_min_dR=min_dR;
2723  tmp2_min_dR=TMath::Min(dist, tmp_min_dR);
2724  min_dR=tmp2_min_dR;
2725  }
2726  }
2727  return n_return;
2728 }

◆ GetNSegBeforeAndAfter()

Int_t GetNSegBeforeAndAfter ( EdbPVRec local_gAli,
Int_t  patterloop_cnt,
EdbSegP seg,
Int_t  n_patterns,
Int_t  BeforeOrAfter 
)
2813 {
2814  // cout << "GetNSegBeforeAndAfter( XX, " << patterloop_cnt << " , Seg, " << n_patterns << ", " << BeforeOrAfter << endl;
2815 
2816  float Z_minus1=0;
2817  float Z_normal=local_gAli->GetPattern(patterloop_cnt)->Z();
2818  float Z_plus1=0;
2819 
2820  int npat=local_gAli->Npatterns();
2821  Bool_t edge_npat_upper=kFALSE;
2822  Bool_t edge_npat_lower=kFALSE;
2823  Int_t Factor=-1;
2824 
2825  if (patterloop_cnt==npat-1) {
2826  edge_npat_upper=kTRUE;
2827  }
2828  if (patterloop_cnt==0) {
2829  edge_npat_lower=kTRUE;
2830  }
2831 
2832  if (!edge_npat_lower) {
2833  Z_minus1=local_gAli->GetPattern(patterloop_cnt-1)->Z();
2834  // cout << "WHAT IS GREATER? Z_normal Z_minus1 " << Z_normal << " " << Z_minus1 << endl;
2835  //Factor=(Int_t)TMath::Sign(Z_normal,Z_minus1);
2836  if (Z_minus1<Z_normal) Factor=1;
2837  }
2838  if (!edge_npat_upper) {
2839  Z_plus1 =local_gAli->GetPattern(patterloop_cnt+1)->Z();
2840  // cout << "WHAT IS GREATER? Z_normal Z_plus1 " << Z_normal << " " << Z_plus1 << endl;
2841  if (Z_plus1>Z_normal) Factor=1;
2842  }
2843 
2844  // cout << Z_minus1 << endl;
2845  // cout << Z_normal << endl;
2846  // cout << Z_plus1 << endl;
2847  // cout << "Is edge_npat_lower = " << edge_npat_lower << endl;
2848  // cout << "Is edge_npat_upper = " << edge_npat_upper << endl;
2849  // cout << "Factor = " << Factor << endl;
2850 
2851  // New PID we want to have:
2852  Int_t patterloop_test=patterloop_cnt+Factor*n_patterns*BeforeOrAfter;
2853  // cout << "So NEW n_patterns would be " << patterloop_test << endl;
2854 
2855  // Does this plate exist? If not, return 0 directly:
2856  if (patterloop_test>=npat || patterloop_test<0) {
2857  //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;
2858  return 0;
2859  }
2860 
2861  // Since we have checked now for bounds we can FindCompliments:
2862  TObjArray array;
2863  array.Clear();
2864  EdbPattern* TestPattern= (EdbPattern*)local_gAli->GetPattern(patterloop_test);
2865  TestPattern -> FillCell(20,20,0.01,0.01);
2866  int n_return = TestPattern->FindCompliments(*seg,array,3,3);
2867  //cout << " Found " << n_return << " compliments in 2,2 sigma area:" << endl;
2868 
2869  return n_return;
2870 }

◆ GetSpatialDist()

Double_t GetSpatialDist ( EdbSegP s1,
EdbSegP s2 
)
2627 {
2628  Log(4, "ShowRec.cpp", "--- Bool_t GetSpatialDist() ---");
2629  // Mainly Z values should dominate... since the are at the order of 10k microns and x,y of 1k microns
2630  Double_t x1,x2,y1,y2,z1,z2;
2631  x1=s1->X();
2632  x2=s2->X();
2633  y1=s1->Y();
2634  y2=s2->Y();
2635  z1=s1->Z();
2636  z2=s2->Z();
2637  Double_t dist= TMath::Sqrt( (x1-x2)*(x1-x2) + (y1-y2)*(y1-y2) + (z1-z2)*(z1-z2) );
2638  //cout << "dist = " << dist << endl;
2639  return dist;
2640 }

◆ IsShowerSortedZ()

Bool_t IsShowerSortedZ ( TObjArray *  showerarray)
3857  {
3858  // Condition: z[0]<= z[1]<=....<=z[nseg]
3859  if (showerarray->GetEntries()<1) return kTRUE;
3860  EdbSegP* s0;
3861  EdbSegP* s1;
3862  for (int i=0; i<showerarray->GetEntries()-1; i++) {
3863  s0= (EdbSegP*)showerarray->At(i);
3864  s1= (EdbSegP*)showerarray->At(i+1);
3865  if (s0->Z()>s1->Z()) return kFALSE;
3866  }
3867  return kTRUE;
3868 }

◆ main()

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

◆ MakeTracksTree()

void MakeTracksTree ( TTree *  treebranch)
3545 {
3546  if (cmd_OUTPUTLEVEL<2) return;
3547 
3548  Log(2, "ShowRec.cpp", "--- void MakeTracksTree() ---");
3549  if (gEDBDEBUGLEVEL>3) cout <<"--- --- MakeTracksTree Part 2:"<<endl;
3550 
3551  // cout << treebranch->GetName() << " treebranch->GetName(); " << endl;
3552 
3553  EdbSegP *seg;
3554  EdbTrackP *track2;
3555  EdbPVRec *ali;
3556  ali = new EdbPVRec();
3557  EdbPattern *pat=0;
3558  char fname_e[128];
3559  float x,y,tx,ty,z;
3560  int w2;
3561 
3562  for (int i=0; i<treebranch->GetEntries(); ++i) {
3563  treebranch->GetEntry(i);
3564  track2 = new EdbTrackP();
3565 
3566  for (int j=0; j<shower_sizeb; ++j) {
3567 
3568  x=shower_xb[j];
3569  y=shower_yb[j];
3570  tx=shower_txb[j];
3571  ty=shower_tyb[j];
3572  z=shower_zb[j];
3573  w2=shower_ntrace2simub[j];
3574 
3575  seg = new EdbSegP();
3576  seg->Set(j, x, y, tx, ty, w2, 0);
3577  seg->SetZ(z);
3578  seg->SetDZ(300.);
3579  // DISPLAY PROBLEM IF RIGHT PID IS USED !!!!!!!!!!!!!!
3580  pat = ali->GetPattern( seg->PID() );
3581  if (!pat) {
3582  printf("WARNING: no pattern with pid %d: creating new one!\n",seg->PID());
3583  pat = new EdbPattern( 0., 0., seg->Z() );
3584  //pat->SetID(seg->PID());
3585  ali->AddPatternAt(pat,seg->PID());
3586  ali->AddPatternAt(pat,j);
3587  }
3588  pat->AddSegment(*seg);
3589  track2->AddSegment(seg);
3590  }
3591  track2->SetSegmentsTrack(i);
3592  track2->SetID(i);
3593  track2->SetNpl(shower_nfilmb[shower_sizeb-1]);
3594  track2->SetProb(1.);
3595  track2->SetFlag(10);
3596  track2->FitTrack();
3597  ali->AddTrack(track2);
3598 
3599  // cout << "i = delete track2"<< i << endl;
3600  // delete track2;track2=0;
3601  }
3602  if (gEDBDEBUGLEVEL>3) ali->Print();
3603 
3604  // if (gEDBDEBUGLEVEL>3)
3605  // cout <<"--- --- MakeTracksTree Part 2:"<<endl;
3606 
3607  if (!ali) return;
3608  TObjArray *trarr = ali->eTracks;
3609  if (!trarr) return;
3610  float xv;
3611  xv=ali->X();
3612  float yv;
3613  yv=ali->Y();
3614 
3615  // if (gEDBDEBUGLEVEL>2)
3616  // cout <<"--- Write tracks to file: " << FILE_ShowTracks->GetName() <<endl;
3617 
3618  TString tracksname="tracks"+TString(treebranch->GetName());
3619 
3620  FILE_ShowTracks->cd();
3621  // TFile::Open(FILE_ShowTracks->GetName(),"UPDATE");
3622  TTree *tracks= new TTree(tracksname,tracksname);
3623  tracks->SetDirectory(FILE_ShowTracks);
3624  if (gEDBDEBUGLEVEL>2) cout <<"--- tracks->SetDirectory(FILE_ShowTracks)"<<endl;
3625 
3626 
3627  EdbTrackP *track = new EdbTrackP(8);
3628  EdbSegP *tr = (EdbSegP*)track;
3629  TClonesArray *segments = new TClonesArray("EdbSegP");
3630  TClonesArray *segmentsf = new TClonesArray("EdbSegP");
3631 
3632  int nseg,trid,npl,n0;
3633  float w=0.;
3634 
3635  tracks->Branch("trid",&trid,"trid/I");
3636  tracks->Branch("nseg",&nseg,"nseg/I");
3637  tracks->Branch("npl",&npl,"npl/I");
3638  tracks->Branch("n0",&n0,"n0/I");
3639  tracks->Branch("xv",&xv,"xv/F");
3640  tracks->Branch("yv",&yv,"yv/F");
3641  tracks->Branch("w",&w,"w/F");
3642  tracks->Branch("t.","EdbSegP",&tr,32000,99);
3643  tracks->Branch("s", &segments);
3644  //fitted segments is kept for linked_track.root compability
3645  tracks->Branch("sf",&segmentsf);
3646 
3647  int ntr = trarr->GetEntriesFast();
3648 
3649  if (gEDBDEBUGLEVEL>2) cout <<"--- ntr = trarr->GetEntriesFast(); " << ntr << " " << trarr->GetEntries() << endl;
3650 
3651  for (int itr=0; itr<ntr; itr++) {
3652  track = (EdbTrackP*)(trarr->At(itr));
3653  trid = track->ID();
3654  nseg = track->N();
3655  npl = track->Npl();
3656  n0 = track->N0();
3657  tr = (EdbSegP*)track;
3658  segments->Clear("C");
3659  nseg = track->N();
3660  w = track->Wgrains();
3661  EdbSegP *s=0,*sf=0;
3662  for (int is=0; is<nseg; is++) {
3663  s = track->GetSegment(is);
3664  if (s) new((*segments)[is]) EdbSegP( *s );
3665  sf = track->GetSegment(is);
3666  if (sf) new((*segmentsf)[is]) EdbSegP( *sf );
3667  }
3668  track->SetVid( 0, tracks->GetEntries() ); // put track counter in t.eVid[1]
3669  tracks->Fill();
3670  track->Clear();
3671  }
3672  tracks->Write();
3673 
3674 
3675 
3676  return;
3677 }
TTree * tr
Definition: Shower_E_FromShowerRoot.C:5
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
Definition: EdbPattern.h:118
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
void w(int rid=2, int nviews=2)
Definition: test.C:27

◆ Open_ParasetDefinitionFile()

Int_t Open_ParasetDefinitionFile ( )
768 {
769  Log(2, "ShowRec.cpp", "--- Int_t Open_ParasetDefinitionFile() ---");
770 
771  FILE_ParaSetDefinitions = new TFile("PARAMETERSET_DEFINITIONFILE.root","READ");
773  TREE_ParaSetDefinitions = (TTree*)FILE_ParaSetDefinitions->Get("ParaSet_Variables");
774 
776 
777  if (TREE_ParaSetDefinitions==0) {
778  cout << "WARNING: In --- Open_ParasetDefinitionFile --- Empty TREE_ParaSetDefinitions." << endl;
779  cout << " Switching to default parametersets (algorithm specific)." << endl;
780  cout << " Set cmd_PASTART=-1 cmd_PAEND =-1 " << endl;
781  cmd_PASTART=-1;
782  cmd_PAEND=-1;
783  }
784  return 1;
785 }
TFile * FILE_ParaSetDefinitions
Definition: ShowRec.h:64

◆ Read_ParasetDefinitionTree()

void Read_ParasetDefinitionTree ( )
791 {
792  Log(2, "ShowRec.cpp", "--- Int_t Read_ParasetDefinitionTree() ---");
793 
794  // ALTP 0 CT, 2 CA, 4 OI and others ... (which ones??? TO BE CHECKED)
795  Double_t dr_max,dt_max,coneangle,tubedist;
796  Int_t nholes_max;
797 
798  Double_t distMin_max;
799  Int_t tracksegs_max;
800  Double_t distMin_dt_max;
801 
802  // ALTP 1 CL
803  // TO BE DONE HERE
804 
805  // ALTP 3 NN
806  Double_t ann_output;
807  Int_t ann_inputneurons;
808 
809  // ALTP 5 SA
810  Double_t CUT_P;
811  Double_t CUT_ALISUBSIZE;
812 
813  // ALTP 6 TC
814  // TO BE DONE HERE
815 
816  // ALTP 7 RC
817  // TO BE DONE HERE
818 
819  // ALTP 8 BW
821 
822  // ALTP 9 AG
823  // TO BE DONE HERE
824 
825  // ALTP 10: GS from libShowRec
826  Double_t cut_gs_cut_dip=150;
827  Double_t cut_gs_cut_dmin=40;
828  Double_t cut_gs_cut_dr=60;
829  Double_t cut_gs_cut_dz=19000;
830  Double_t cut_gs_cut_dtheta=0.06;
831  Double_t cut_gs_cut_piddiff=1;
832  Int_t cut_gs_cut_oppositeflag=0;
833 
834  // ALTP 11 N3_ALG
835  Double_t ANN_OUTPUT;
836  Int_t ANN_PLATEN;
837  Int_t ANN_PLATEDIRECTION;
838  Int_t ANN_HIDDENLAYER;
839  Int_t ANN_INPUTNEURONS;
840 
841 
842  // Create on Tree if its not there and fill it with one entry:
843  if (TREE_ParaSetDefinitions==0 && (cmd_ALTP==0 || cmd_ALTP==2 || cmd_ALTP==4)) {
844  if (TREE_ParaSetDefinitions==0) cout << "WARNING: In --- Read_ParasetDefinitionTree --- Empty TREE_ParaSetDefinitions. Using only one, standard parameterset (...) ."<<endl;
845  TREE_ParaSetDefinitions = new TTree("ParaSet_Variables","ParaSet_Variables");
846  TREE_ParaSetDefinitions -> Branch("CUT_ZYLINDER_R_MAX",&tubedist,"CUT_ZYLINDER_R_MAX/D");
847  TREE_ParaSetDefinitions -> Branch("CUT_ZYLINDER_ANGLE_MAX",&coneangle,"CUT_ZYLINDER_ANGLE_MAX/D");
848  TREE_ParaSetDefinitions -> Branch("CUT_SHOWERFOLLOWERBT_DR_MAX",&dr_max,"CUT_SHOWERFOLLOWERBT_DR_MAX/D");
849  TREE_ParaSetDefinitions -> Branch("CUT_SHOWERFOLLOWERBT_DTAN_MAX",&dt_max,"CUT_SHOWERFOLLOWERBT_DTAN_MAX/D");
850  TREE_ParaSetDefinitions -> Branch("CUT_NHOLES_MAX",&nholes_max,"CUT_NHOLES_MAX/I");
851  dr_max=100.0;
852  dt_max=0.1;
853  coneangle=0.1;
854  tubedist=800.0;
855  nholes_max=3;
856 
857  if (cmd_ALTP==0||cmd_ALTP==2) {
858  if (cmd_CUTTP==2) {
859  cout << "----- cmd_CUTTP==2 -----"<<endl;
860  dr_max=100.0;
861  dt_max=0.1;
862  coneangle=0.1;
863  tubedist=800.0;
864  }
865  else if (cmd_CUTTP==1) {
866  cout << "----- cmd_CUTTP==1 -----"<<endl;
867  dr_max=100.0;
868  dt_max=0.1;
869  coneangle=0.1;
870  tubedist=800.0;
871  }
872  else {
873  cout << "----- cmd_CUTTP==else -----"<<endl;
874  dr_max=100.0;
875  dt_max=0.1;
876  coneangle=0.1;
877  tubedist=800.0; // CA ALG, cmd_ALTP==2 , CT ALG, cmd_ALTP==0
878  }
879  }
880  if (cmd_ALTP==4) {
881  if (cmd_CUTTP==4) {
882  cout << "----- cmd_CUTTP==4 : FJ_Standard -----"<<endl;
883  dr_max=150.0;
884  dt_max=0.15;
885  coneangle=0.02;
886  tubedist=800.0; // cuttype. FJ_Standard // OI ALG, cmd_ALTP==4
887  }
888  if (cmd_CUTTP==3) {
889  cout << "----- cmd_CUTTP==3 : FJ_HighPur -----"<<endl;
890  dr_max=100.0;
891  dt_max=0.05;
892  coneangle=0.025;
893  tubedist=400.0; // cuttype. FJ_HighPur // OI ALG, cmd_ALTP==4
894  }
895  else if (cmd_CUTTP==2) {
896  cout << "----- cmd_CUTTP==2 -----"<<endl;
897  dr_max=200.0;
898  dt_max=0.15;
899  coneangle=0.03;
900  tubedist=800.0; // cuttype. high eff // OI ALG, cmd_ALTP==4
901  }
902  else if (cmd_CUTTP==1) {
903  cout << "----- cmd_CUTTP==1 -----"<<endl;
904  dr_max=120.0;
905  dt_max=0.11;
906  coneangle=0.02;
907  tubedist=600.0; // cuttype. high pur // OI ALG, cmd_ALTP==4
908  }
909  else {
910  cout << "----- cmd_CUTTP==else -----"<<endl;
911  dr_max=150.0;
912  dt_max=0.15;
913  coneangle=0.02;
914  tubedist=800.0; // cuttype. FJ_Standard // OI ALG, cmd_ALTP==4
915  }
916  }
917 
918  //cout << "----------- SAME VALUES AS IN EdbShowerRec FOR tESTING... REMOVE AFTER YOURE DONE HERE!!"<<endl;
919  //if (cmd_ALTP==4) dr_max=150.0;dt_max=0.15;coneangle=0.02;tubedist=800.0; // OI ALG, cmd_ALTP==4
920 
921  // ParaSetNr CUT_ZYLINDER_R_MAX CUT_ZYLINDER_ANGLE_MAX CUT_SHOWERFOLLOWERBT_DR_MAX CUT_SHOWERFOLLOWERBT_DTAN_MAX
922  // 7001 800 0.1 100 0.1 (high NBT, middle purity)
923  // 4401 500 0.5 100 0.1 (middle NBT, high purity) (comparable to off. Recoalg.);
924 
926  if (gEDBDEBUGLEVEL>2) cout << "--- TREE_ParaSetDefinitions -> GetEntries() " << TREE_ParaSetDefinitions -> GetEntries()<<endl;
928 
929  // Reset here then also command line arguments:
930  // cmd_PASTART=0; cmd_PAEND=0;
931  // Update CUT_PARAMETER[0,1,2,3,]
932  }
933 
934  if (TREE_ParaSetDefinitions==0 && cmd_ALTP==3) {
935  TREE_ParaSetDefinitions = new TTree("ParaSet_Variables","ParaSet_Variables");
936  TREE_ParaSetDefinitions -> Branch("CUT_ANN_INPUTNEURONS",&ann_inputneurons,"CUT_ANN_INPUTNEURONS/I");
937  TREE_ParaSetDefinitions -> Branch("CUT_ANN_OUTPUT",&ann_output,"CUT_ANN_OUTPUT/D");
938  ann_output=0.85;
939  ann_inputneurons=5;
942  TREE_ParaSetDefinitions->Print();
943  }
944 
945  if (TREE_ParaSetDefinitions==0 && cmd_ALTP==11) {
946  TREE_ParaSetDefinitions = new TTree("ParaSet_Variables","ParaSet_Variables");
947  TREE_ParaSetDefinitions->Branch("ANN_PLATE_DELTANMAX",&N3_ANN_PLATE_DELTANMAX,"ANN_PLATE_DELTANMAX/I");
948  TREE_ParaSetDefinitions->Branch("ANN_NTRAINEPOCHS",&N3_ANN_NTRAINEPOCHS,"ANN_NTRAINEPOCHS/I");
949  TREE_ParaSetDefinitions->Branch("ANN_NHIDDENLAYER",&N3_ANN_NHIDDENLAYER,"ANN_NHIDDENLAYER/I");
950  TREE_ParaSetDefinitions->Branch("ANN_OUTPUTTHRESHOLD",&N3_ANN_OUTPUTTHRESHOLD,"ANN_OUTPUTTHRESHOLD/D");
951  TREE_ParaSetDefinitions->Branch("ANN_INPUTNEURONS",&N3_ANN_INPUTNEURONS,"ANN_INPUTNEURONS/I");
952 
953  // Default, maximal settings. Same plate, Two plates up- downstream connections looking,
954  // that for 5 inputvariables there
955  // plus 4 fixed input varibles for BT(i) to InBT connections: 4+5*5 = 29
963  TREE_ParaSetDefinitions->Print();
964  }
965 
966  if (TREE_ParaSetDefinitions==0 && cmd_ALTP==5) {
967  TREE_ParaSetDefinitions = new TTree("ParaSet_Variables","ParaSet_Variables");
968  TREE_ParaSetDefinitions -> Branch("CUT_P",&CUT_P,"CUT_P/D");
969  TREE_ParaSetDefinitions -> Branch("CUT_ALISUBSIZE",&CUT_ALISUBSIZE,"CUT_ALISUBSIZE/D");
970  CUT_P=0;
971  CUT_ALISUBSIZE=1000;
974  TREE_ParaSetDefinitions->Print();
975  }
976 
977  if (TREE_ParaSetDefinitions==0 && cmd_ALTP==6) {
978  TREE_ParaSetDefinitions = new TTree("ParaSet_Variables","ParaSet_Variables");
979  TREE_ParaSetDefinitions -> Branch("CUT_ZYLINDER_R_MAX",&tubedist,"CUT_ZYLINDER_R_MAX/D");
980  TREE_ParaSetDefinitions -> Branch("CUT_ZYLINDER_ANGLE_MAX",&coneangle,"CUT_ZYLINDER_ANGLE_MAX/D");
981  TREE_ParaSetDefinitions -> Branch("CUT_SHOWERFOLLOWERBT_DR_MAX",&dr_max,"CUT_SHOWERFOLLOWERBT_DR_MAX/D");
982  TREE_ParaSetDefinitions -> Branch("CUT_SHOWERFOLLOWERBT_DTAN_MAX",&dt_max,"CUT_SHOWERFOLLOWERBT_DTAN_MAX/D");
983 
984  TREE_ParaSetDefinitions -> Branch("CUT_TRACKATTACH_DISTMIN",&distMin_max,"CUT_TRACKATTACH_DISTMIN/D");
985  TREE_ParaSetDefinitions -> Branch("CUT_TRACKATTACH_DTAN_MAX",&distMin_dt_max,"CUT_TRACKATTACH_DTAN_MAX/D");
986  TREE_ParaSetDefinitions -> Branch("CUT_TRACKATTACH_NTRACKSEG",&tracksegs_max,"CUT_TRACKATTACH_NTRACKSEG/I");
987 
988  dr_max=150.0;
989  dt_max=0.13;
990  coneangle=0.025;
991  tubedist=700.0;
992  distMin_max=500;
993  tracksegs_max=1;
994  distMin_dt_max=200;
997  TREE_ParaSetDefinitions->Print();
998  }
999 
1000 
1001  if (TREE_ParaSetDefinitions==0 && (cmd_ALTP==7 || cmd_ALTP==9)) {
1002  TREE_ParaSetDefinitions = new TTree("ParaSet_Variables","ParaSet_Variables");
1003  TREE_ParaSetDefinitions -> Branch("CUT_ZYLINDER_R_MAX",&tubedist,"CUT_ZYLINDER_R_MAX/D");
1004  TREE_ParaSetDefinitions -> Branch("CUT_ZYLINDER_ANGLE_MAX",&coneangle,"CUT_ZYLINDER_ANGLE_MAX/D");
1005  TREE_ParaSetDefinitions -> Branch("CUT_SHOWERFOLLOWERBT_DR_MAX",&dr_max,"CUT_SHOWERFOLLOWERBT_DR_MAX/D");
1006  TREE_ParaSetDefinitions -> Branch("CUT_SHOWERFOLLOWERBT_DTAN_MAX",&dt_max,"CUT_SHOWERFOLLOWERBT_DTAN_MAX/D");
1007  dr_max=150.0;
1008  dt_max=0.13;
1009  coneangle=0.025;
1010  tubedist=700.0;
1013  TREE_ParaSetDefinitions->Print();
1014  }
1015 
1016 
1017  if (TREE_ParaSetDefinitions==0 && cmd_ALTP==8) {
1018  TREE_ParaSetDefinitions = new TTree("ParaSet_Variables","ParaSet_Variables");
1019  TREE_ParaSetDefinitions -> Branch("CUT_BACK_DMIN",&cut_back_dmin,"CUT_BACK_DMIN/D");
1020  TREE_ParaSetDefinitions -> Branch("CUT_BACK_DTHETA",&cut_back_dtheta,"CUT_BACK_DTHETA/D");
1021  TREE_ParaSetDefinitions -> Branch("CUT_BACK_DR",&cut_back_dr,"CUT_BACK_DR/D");
1022  TREE_ParaSetDefinitions -> Branch("CUT_BACK_DZ",&cut_back_dz,"CUT_BACK_DZ/D");
1023  TREE_ParaSetDefinitions -> Branch("CUT_FOR_DMIN",&cut_for_dmin,"CUT_FOR_DMIN/D");
1024  TREE_ParaSetDefinitions -> Branch("CUT_FOR_DTHETA",&cut_for_dtheta,"CUT_FOR_DTHETA/D");
1025  TREE_ParaSetDefinitions -> Branch("CUT_FOR_DR",&cut_for_dr,"CUT_FOR_DR/D");
1026  TREE_ParaSetDefinitions -> Branch("CUT_FOR_DZ",&cut_for_dz,"CUT_FOR_DZ/D");
1029  cut_back_dr=cut_for_dr=120;
1030  cut_back_dz=cut_for_dz=5000;
1033  TREE_ParaSetDefinitions->Print();
1034  }
1035 
1036  if (TREE_ParaSetDefinitions==0 && cmd_ALTP==10) {
1037  TREE_ParaSetDefinitions = new TTree("ParaSet_Variables","ParaSet_Variables");
1038  TREE_ParaSetDefinitions -> Branch("CUT_GS_CUT_DIP",&cut_gs_cut_dip,"CUT_GS_CUT_DIP/D");
1039  TREE_ParaSetDefinitions -> Branch("CUT_GS_CUT_DMIN",&cut_gs_cut_dmin,"CUT_GS_CUT_DMIN/D");
1040  TREE_ParaSetDefinitions -> Branch("CUT_GS_CUT_DR",&cut_gs_cut_dr,"CUT_GS_CUT_DR/D");
1041  TREE_ParaSetDefinitions -> Branch("CUT_GS_CUT_DZ",&cut_gs_cut_dz,"CUT_GS_CUT_DZ/D");
1042  TREE_ParaSetDefinitions -> Branch("CUT_GS_CUT_DTHETA",&cut_gs_cut_dtheta,"CUT_GS_CUT_DTHETA/D");
1043  TREE_ParaSetDefinitions -> Branch("CUT_GS_CUT_PIDDIFF",&cut_gs_cut_piddiff,"CUT_GS_CUT_PIDDIFF/D");
1044  TREE_ParaSetDefinitions -> Branch("CUT_GS_CUT_OPPOSITEFLAG",&cut_gs_cut_oppositeflag,"CUT_GS_CUT_OPPOSITEFLAG/I");
1045  // PARAMETERSET_DEFINITIONFILE_LONG_GS_ALG.txt: 19642 393.212 35.5454 85.268 25062.6 0.117141 3 0
1046  cut_gs_cut_dip=393;
1047  cut_gs_cut_dmin=35.5;
1048  cut_gs_cut_dr=85.;
1049  cut_gs_cut_dz=25000;
1050  cut_gs_cut_dtheta=0.11;
1055  TREE_ParaSetDefinitions->Print();
1056  }
1057 
1058 
1059 
1060  if (cmd_ALTP==0) {
1061  TREE_ParaSetDefinitions->SetBranchAddress("CUT_ZYLINDER_R_MAX",&tubedist);
1062  TREE_ParaSetDefinitions->SetBranchAddress("CUT_ZYLINDER_ANGLE_MAX",&coneangle);
1063  TREE_ParaSetDefinitions->SetBranchAddress("CUT_SHOWERFOLLOWERBT_DR_MAX",&dr_max);
1064  TREE_ParaSetDefinitions->SetBranchAddress("CUT_SHOWERFOLLOWERBT_DTAN_MAX",&dt_max);
1065  }
1066  else if (cmd_ALTP==1) {
1067  cout << "TODO"<<endl;
1068  }
1069  else if (cmd_ALTP==2) {
1070  TREE_ParaSetDefinitions->SetBranchAddress("CUT_ZYLINDER_R_MAX",&tubedist);
1071  TREE_ParaSetDefinitions->SetBranchAddress("CUT_ZYLINDER_ANGLE_MAX",&coneangle);
1072  TREE_ParaSetDefinitions->SetBranchAddress("CUT_SHOWERFOLLOWERBT_DR_MAX",&dr_max);
1073  TREE_ParaSetDefinitions->SetBranchAddress("CUT_SHOWERFOLLOWERBT_DTAN_MAX",&dt_max);
1074  }
1075  else if (cmd_ALTP==4) {
1076  TREE_ParaSetDefinitions->SetBranchAddress("CUT_ZYLINDER_R_MAX",&tubedist);
1077  TREE_ParaSetDefinitions->SetBranchAddress("CUT_ZYLINDER_ANGLE_MAX",&coneangle);
1078  TREE_ParaSetDefinitions->SetBranchAddress("CUT_SHOWERFOLLOWERBT_DR_MAX",&dr_max);
1079  TREE_ParaSetDefinitions->SetBranchAddress("CUT_SHOWERFOLLOWERBT_DTAN_MAX",&dt_max);
1080  TREE_ParaSetDefinitions->SetBranchAddress("CUT_NHOLES_MAX",&nholes_max);
1081  }
1082  else if (cmd_ALTP==5) {
1083  TREE_ParaSetDefinitions->SetBranchAddress("CUT_P",&CUT_P);
1084  TREE_ParaSetDefinitions->SetBranchAddress("CUT_ALISUBSIZE",&CUT_ALISUBSIZE);
1085  }
1086  else if (cmd_ALTP==3) {
1087  TREE_ParaSetDefinitions->SetBranchAddress("CUT_ANN_OUTPUT",&ann_output);
1088  TREE_ParaSetDefinitions -> SetBranchAddress("CUT_ANN_INPUTNEURONS",&ann_inputneurons);
1089  }
1090 
1091  else if (cmd_ALTP==6) {
1092  TREE_ParaSetDefinitions->SetBranchAddress("CUT_ZYLINDER_R_MAX",&tubedist);
1093  TREE_ParaSetDefinitions->SetBranchAddress("CUT_ZYLINDER_ANGLE_MAX",&coneangle);
1094  TREE_ParaSetDefinitions->SetBranchAddress("CUT_SHOWERFOLLOWERBT_DR_MAX",&dr_max);
1095  TREE_ParaSetDefinitions->SetBranchAddress("CUT_SHOWERFOLLOWERBT_DTAN_MAX",&dt_max);
1096  TREE_ParaSetDefinitions->SetBranchAddress("CUT_TRACKATTACH_DISTMIN",&distMin_max);
1097  TREE_ParaSetDefinitions->SetBranchAddress("CUT_TRACKATTACH_DTAN_MAX",&distMin_dt_max);
1098  TREE_ParaSetDefinitions->SetBranchAddress("CUT_TRACKATTACH_NTRACKSEG",&tracksegs_max);
1099  }
1100  else if (cmd_ALTP==7) {
1101  TREE_ParaSetDefinitions->SetBranchAddress("CUT_ZYLINDER_R_MAX",&tubedist);
1102  TREE_ParaSetDefinitions->SetBranchAddress("CUT_ZYLINDER_ANGLE_MAX",&coneangle);
1103  TREE_ParaSetDefinitions->SetBranchAddress("CUT_SHOWERFOLLOWERBT_DR_MAX",&dr_max);
1104  TREE_ParaSetDefinitions->SetBranchAddress("CUT_SHOWERFOLLOWERBT_DTAN_MAX",&dt_max);
1105  }
1106  else if (cmd_ALTP==8) {
1107  TREE_ParaSetDefinitions->SetBranchAddress("CUT_BACK_DMIN",&cut_back_dmin);
1108  TREE_ParaSetDefinitions->SetBranchAddress("CUT_BACK_DTHETA",&cut_back_dtheta);
1109  TREE_ParaSetDefinitions->SetBranchAddress("CUT_BACK_DR",&cut_back_dr);
1110  TREE_ParaSetDefinitions->SetBranchAddress("CUT_BACK_DZ",&cut_back_dz);
1111  TREE_ParaSetDefinitions->SetBranchAddress("CUT_FOR_DMIN",&cut_for_dmin);
1112  TREE_ParaSetDefinitions->SetBranchAddress("CUT_FOR_DTHETA",&cut_for_dtheta);
1113  TREE_ParaSetDefinitions->SetBranchAddress("CUT_FOR_DR",&cut_for_dr);
1114  TREE_ParaSetDefinitions->SetBranchAddress("CUT_FOR_DZ",&cut_for_dz);
1115  }
1116  else if (cmd_ALTP==10) {
1123  TREE_ParaSetDefinitions -> SetBranchAddress("CUT_GS_CUT_OPPOSITEFLAG",&cut_gs_cut_oppositeflag);
1124  }
1125  else if (cmd_ALTP==11) {
1131  }
1132 
1133  // Check: if PASTART is given (a number), but PAEND is default, then set
1134  // PAEND to PASTART
1135  if (cmd_PASTART>=0 && cmd_PAEND==-1) cmd_PAEND=cmd_PASTART;
1136 
1137  if (gEDBDEBUGLEVEL>2) cout << "--- Updated commandline values: cmd_PASTART=" << cmd_PASTART << " and cmd_PAEND=" << cmd_PAEND << endl;
1138 
1139  Log(2, "ShowRec.cpp", "--- Int_t Read_ParasetDefinitionTree() done.");
1140  return;
1141 }
cout<< tr-> GetEntries()<< endl
ParaSet Fill()
ParaSet Branch("CUT_BACK_DMIN",&cut_back_dmin,"CUT_BACK_DMIN/D")

◆ ReadEdbPVRecObjectFromCurrentDirectory()

EdbPVRec* ReadEdbPVRecObjectFromCurrentDirectory ( )
690 {
691  Log(2, "ShowRec.cpp", "--- EdbPVRec* ReadEdbPVRecObjectFromCurrentDirectory() ---");
692 
693  // Create EdbPVRec on the heap:
694  EdbPVRec *gAli= new EdbPVRec();
695 
696 // cmd_ALI==0: read gAli from lnk.def Basetracks
697 // cmd_ALI==1: read gAli from linked.tracks.root
698 // cmd_ALI==2: read gAli from ScanVolume_Ali.root
699 // cmd_ALI==3: read gAli from ScanVolumeLinkedTracks_Ali.root
700 
701  if (cmd_ALI==3) {
702  Log(2, "ShowRec.cpp", "--- EdbPVRec* ReadEdbPVRecObjectFromCurrentDirectory() cmd_ALI==3: read gAli from ScanVolumeLinkedTracks_Ali.root");
703  TFile* f= new TFile("ScanVolumeLinkedTracks_Ali.root");
704  gAli= (EdbPVRec*) f->Get("EdbPVRec");
705  return gAli;
706  }
707  if (cmd_ALI==2) {
708  Log(2, "ShowRec.cpp", "--- EdbPVRec* ReadEdbPVRecObjectFromCurrentDirectory() cmd_ALI==2: read gAli from ScanVolume_Ali.root");
709  TFile* f= new TFile("ScanVolume_Ali.root");
710  f->ls();
711  gAli= (EdbPVRec*) f->Get("EdbPVRec");
712  return gAli;
713  }
714 
715  //-----------------------------------
716  // current dir has to contain:
717  // default.par, lnk_all.lst, lnk_all.def
718  // data, par directory
719  // the definition of filenames and structurs
720  // is given in the lnk.def file (cmd_lnkdef_name)
721  // Warning:
722  // CHECK IF THIS FILE EXISTS. IF NOT, STOP HERE
723  // BECAUSE ONE DOES NOT KNOW WHAT TO DO !!!
724  //-----------------------------------
725  Log(2, "ShowRec.cpp", "--- EdbPVRec* ReadEdbPVRecObjectFromCurrentDirectory() Read EdbDataProc object");
726  Log(2, "ShowRec.cpp", "--- EdbPVRec* ReadEdbPVRecObjectFromCurrentDirectory() from file: %s",cmd_lnkdef_name);
727 
728  string filename = cmd_lnkdef_name;
729  ifstream fin( filename.c_str() );
730  if ( !fin ) {
731  cout << "WARNING: Opening " << filename << " failed!!! SEVERE ERROR POSSIBLE." << endl;
732  }
733 
734  // DECLARE MAIN OBJECTS
735  // Data set initialization
736  // string handling from cmd_lnkdef_name file here.
737  EdbDataProc *dset;
739  //dset->Dump();
740 
741  // Volume initialization
742  // The differentiation LT or not is made when filling the array
743  // new: (4.2.2010) can distinguish between gAli from cp.root or from linked tracks
744 
745  if (cmd_ALI==1) {
746  Log(2, "ShowRec.cpp", "--- EdbPVRec* ReadEdbPVRecObjectFromCurrentDirectory() cmd_ALI==1: read gAli from linked.tracks.root");
747  dset->InitVolume(100, ""); // Read in (all) BT from linked_tracks.root
748  }
749  if (cmd_ALI==0) {
750  Log(2, "ShowRec.cpp", "--- EdbPVRec* ReadEdbPVRecObjectFromCurrentDirectory() cmd_ALI==0: read gAli from lnk.def Basetracks");
751  cout << "TODO HERE ... CHECK IF cp.root files exist !!!" << endl;
752  cout << "OTHERWISE CRASH IN THE EdbDataProc::InitVolume FUNCTION" << endl;
753  dset->InitVolume(0, ""); // Read in (all) BT from cp.root.
754  }
755 
756  // Finally: get Pattern Volume Reconstruction object
757  gAli = dset->PVR();
758  //-------------------------------------
759  if (gEDBDEBUGLEVEL>2) gAli->Print();
760  //-------------------------------------
761  return gAli;
762 }
EdbDataProc * dset
Definition: RecDispEX.C:9
FILE * f
Definition: RecDispMC.C:150
char * cmd_lnkdef_name
Definition: ShowRec.h:31
Definition: EdbDataSet.h:180
EdbPVRec * PVR() const
Definition: EdbDataSet.h:197
int InitVolume(int datatype=0, const char *rcut="1")
Definition: EdbDataSet.cxx:2071
string filename
Definition: emthickness.cpp:34
EdbPVRec gAli
Definition: emvertex.cpp:20

◆ ReconstructShowers()

void ReconstructShowers ( Int_t  nr)

MakeTracksTree(TREE_ShowShower);

1378 {
1379  Log(2, "ShowRec.cpp", "--- void ReconstructShowers() for parameterset %d---",nr);
1380 
1381  //-----------------------------------
1382  // Create the ShowerOutputtree:
1384  //-----------------------------------
1385 
1386  //-----------------------------------
1387  // Call main reconstruction function:
1388  //-----------------------------------
1389  if (cmd_ALTP==0) {
1390  cout << "ReconstructShowers:: cmd_ALTP==0 ReconstructShowers_CT() IS NOW THE SAME AS CA ALG! "<< endl;
1391  cout << "ReconstructShowers:: cmd_ALTP==0 ReconstructShowers_CTA() Reconstruction of ParameterSet: "<< nr <<endl;
1393  }
1394  else if (cmd_ALTP==1) {
1395  cout << "TODO... CL ...."<<endl;
1396  cout << "ReconstructShowers:: cmd_ALTP==1 ReconstructShowers_CL() Reconstruction of ParameterSet: "<< nr <<endl;
1398  }
1399  else if (cmd_ALTP==2) {
1400  cout << "ReconstructShowers:: cmd_ALTP==2 ReconstructShowers_CA() Reconstruction of ParameterSet: "<< nr <<endl;
1402  }
1403  else if (cmd_ALTP==3) {
1404  cout << "ReconstructShowers:: cmd_ALTP==3 ReconstructShowers_NN() Reconstruction of ParameterSet: "<< nr <<endl;
1406  }
1407  else if (cmd_ALTP==4) {
1408  cout << "ReconstructShowers:: cmd_ALTP==4 ReconstructShowers_OI() Reconstruction of ParameterSet: "<< nr <<endl;
1410  }
1411  else if (cmd_ALTP==5) {
1412  cout << "ReconstructShowers:: cmd_ALTP==5 ReconstructShowers_SA() Reconstruction of ParameterSet: "<< nr <<endl;
1414  }
1415  else if (cmd_ALTP==6) {
1416  cout << "ReconstructShowers:: cmd_ALTP==6 ReconstructShowers_TC() Reconstruction of ParameterSet: "<< nr <<endl;
1418  }
1419  else if (cmd_ALTP==7) {
1420  cout << "ReconstructShowers:: cmd_ALTP==7 ReconstructShowers_RC() Reconstruction of ParameterSet: "<< nr <<endl;
1422  }
1423  else if (cmd_ALTP==8) {
1424  cout << "ReconstructShowers:: cmd_ALTP==8 ReconstructShowers_BW() Reconstruction of ParameterSet: "<< nr <<endl;
1426  }
1427  else if (cmd_ALTP==9) {
1428  cout << "ReconstructShowers:: cmd_ALTP==9 ReconstructShowers_AG() Reconstruction of ParameterSet: "<< nr <<endl;
1430  }
1431  else if (cmd_ALTP==10) {
1432  cout << "ReconstructShowers:: cmd_ALTP==10 ReconstructShowers_GS() Reconstruction of ParameterSet: "<< nr <<endl;
1434  }
1435  else if (cmd_ALTP==11) {
1436  cout << "ReconstructShowers:: cmd_ALTP==11 ReconstructShowers_N3() Reconstruction of ParameterSet: "<< nr <<endl;
1438  }
1439  else {
1440  cout << "ReconstructShowers:: cmd_ALTP invalid. Exit here." << endl;
1441  exit;
1442  }
1443  //-----------------------------------
1444 
1445 
1446  //-----------------------------------
1447  if (TREE_ShowShower->GetEntries()<1) {
1448  cout << "//-----------------------------------------------------------------------------//"<<endl;
1449  cout << "TREE_ShowShower->GetEntries()<1. NO SHOWER HAS BEEN RECONSTRUCTED."<<endl;
1450  cout << "CHECK INPUT BTs, INPUT PARAMETERS, SOURCE FILES, etc.."<<endl;
1451  cout << "//-----------------------------------------------------------------------------//"<<endl;
1452  }
1453  cout << "TREE_ShowShower->GetEntries() = " << TREE_ShowShower->GetEntries()<< endl;
1454  //-----------------------------------
1455 
1456 
1457  //-----------------------------------
1458  // MakeShowerTree:
1459  // Writing showers in treebranch style
1460  // as done by FJ algorithm.
1461  //-----------------------------------
1462  FILE_ShowShower->cd();
1463  TREE_ShowShower->Write("",TObject::kOverwrite);
1464  //-----------------------------------
1465 
1466 
1467  //-----------------------------------
1468  // MakeTracksTree:
1469  // Writing showers in tracks style
1470  // copied almost verbatim from GL.
1471  //-----------------------------------
1473  cout << "Make Tracks Tree commented out!!!"<< endl;
1474  //-----------------------------------
1475 
1476 
1477  //-----------------------------------
1478  // Delete the ShowerOutputtree:
1479  delete TREE_ShowShower;
1480  TREE_ShowShower=0;
1481  //-----------------------------------
1482  return;
1483 }
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_CT()
Definition: ShowRec.cpp:2462
TTree * TREE_ShowShower
Definition: ShowRec.h:68
void ReconstructShowers_N3()
DEBUG OPENMP TEST!!!!!!!// DEPRECATED !!!!
Definition: ShowRec_Alg_N3.cpp:2

◆ SetDefaultValues_CommandLine()

void SetDefaultValues_CommandLine ( )
534  {
535 
536  Log(2, "ShowRec.cpp", "--- void SetDefaultValues_CommandLine() ---");
537 
538  //--- Set default Values:
539  cmd_FP=1; // This default setting (FP,MP,LP,NP) takes all BTs in the volume
540  cmd_LP=57; // for possible initiator basetracks and starts reconstruction
541  cmd_MP=57; // from them all.
542  cmd_NP=57; // Attention: this may take a very long time.
543  cmd_PADI=0;
544  cmd_BTPA=0;
545  cmd_BGTP=0;
546  cmd_ALTP=4;
547  cmd_PASTART=-1;
548  cmd_PAEND=-1;
549  cmd_LT=0;
550  cmd_MC=1;
551  cmd_MCFL=0;
552  cmd_HPLZ=1;
553  cmd_vtx=0;
555  cmd_OUTPUTLEVEL=1;
556  cmd_ALI=0;
557  cmd_MCMIX=0;
558  cmd_FILETP=0;
559  cmd_GBMC=0;
560  cmd_lnkdef_name = "lnk.def";
561  cmd_EXTHETA=0;
562  return;
563 }

◆ SetPresetParameters()

void SetPresetParameters ( Int_t  cmd_PRESET)
4145  {
4146 
4147  Log(2, "ShowRec.cpp", "--- SetPresetParameters() ---");
4148 
4149  cout << "ATTentION : Currently we set cmd_ALI=2 for all presets for testing purposes!!! " << endl;
4150  cmd_ALI=2;
4151 
4152  if (cmd_PRESET==0) {
4153  cmd_MC=0;
4154  cmd_HPLZ=0;
4155  cmd_CLEAN=0;
4156  }
4157  else if (cmd_PRESET==1) {
4158  cmd_MC=1;
4159  cmd_HPLZ=1;
4160  cmd_CLEAN=0;
4161  }
4162  else if (cmd_PRESET==2) {
4163  cmd_MC=0;
4164  cmd_HPLZ=0;
4165  cmd_LT=1;
4166  }
4167  else if (cmd_PRESET==3) {
4168  cmd_MC=0;
4169  cmd_HPLZ=0;
4170  cmd_vtx=1;
4171  }
4172  else {
4173  cout << "No Preset List for this parameter found. Using values for PRESET 0." << endl;
4174  cmd_MC=0;
4175  cmd_HPLZ=0;
4176  cmd_CLEAN=0;
4177  }
4178  Log(2, "ShowRec.cpp", "--- SetPresetParameters()...done. ---");
4179  return;
4180 }

◆ SortShowerZ()

void SortShowerZ ( TObjArray *  showerarray)
3872  {
3873 
3874  // A simple reverting sort: assuming that segments in shower are already sorted, but in
3875  // descending direction, so we just invert them!
3876  // CANNOT BE USED WHEN segments wer put in an arbitrary way!!!
3877 
3878  if (IsShowerSortedZ(showerarray)) {
3879  if (gEDBDEBUGLEVEL>2) cout << "Shower already sorted in ascending Z-direction. Do nothing." << endl;
3880  return;
3881  }
3882  Int_t nent_showerarray=showerarray->GetEntries();
3883  Int_t nent=showerarray->GetEntries();
3884  TObjArray* interimShower = new TObjArray(nent_showerarray);
3885  if (gEDBDEBUGLEVEL>2) cout << "interif (gEDBDEBUGLEVEL>2)imShower->GetEntries() " << interimShower->GetEntries() << endl;
3886  if (gEDBDEBUGLEVEL>2) cout << "showerarray->GetEntries() " << showerarray->GetEntries() << endl;
3887  EdbSegP* s0;
3888  EdbSegP* s1;
3889  for (Int_t k=0; k<nent; ++k) {
3890  EdbSegP* s0=(EdbSegP*)showerarray->At(nent-k-1);
3891  interimShower->AddAt(s0,k);
3892  }
3893  showerarray->Clear();
3894  for (Int_t k=0; k<nent; ++k) {
3895  EdbSegP* s0=(EdbSegP*)interimShower->At(k);
3896  showerarray->AddAt(s0,k);
3897  }
3898  if (gEDBDEBUGLEVEL>2) PrintShowerObjectArray(showerarray);
3899 
3900  if (IsShowerSortedZ(showerarray)) {
3901  if (gEDBDEBUGLEVEL>2) cout << "Shower now sorted in ascending Z-direction. Done." << endl;
3902  return;
3903  }
3904  if (!IsShowerSortedZ(showerarray)) {
3905  cout << "WARNING WARNING Shower is still NOT sorted in ascending Z-direction. YOU HAVE TO CHECK MANUALLY." << endl;
3906  return;
3907  }
3908  return;
3909 }
Bool_t IsShowerSortedZ(TObjArray *showerarray)
Definition: ShowRec.cpp:8801
void PrintShowerObjectArray(TObjArray *segarray)
Definition: ShowRec.cpp:6967
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.

3249 {
3250  Log(3, "ShowRec.cpp", "--- void* TransferShowerObjectArrayIntoEntryOfTreebranchShowerTree() ---");
3251 
3252  // SaveCheck if shower has at least one basetrack:
3253  if (segarray->GetEntries()<1) return;
3254 
3255  EdbSegP* seg;
3256  EdbSegP* Inseg;
3257  Int_t helper_nfilmb;
3258  Int_t diff_pid;
3259  Float_t min_shower_deltathetab=99999;
3260  Float_t min_shower_deltar=99999;
3261  Float_t test_shower_deltathetab=99999;
3262  Float_t test_shower_deltar=99999;
3263  Float_t test_shower_deltax,test_shower_deltay;
3264  Int_t max_diff_pid=0;
3265 
3266 
3267  Float_t shower_sizebNHELP=0;
3268  Float_t shower_sizebMCNHELP=0;
3269 
3270  Float_t extrapol_x,extrapol_y, extrapo_diffz;
3271 
3272  // Initialize arrays...
3273  shower_sizeb15=0;
3274  shower_sizeb20=0;
3275  shower_sizeb30=0;
3276  shower_sizeb=0;
3281  shower_filetype=0;
3282  for (int ii=0; ii<5000; ii++) {
3283  shower_xb[ii]=0;
3284  shower_yb[ii]=0;
3285  shower_zb[ii]=0;
3286  shower_txb[ii]=0;
3287  shower_tyb[ii]=0;
3288  shower_nfilmb[ii]=0;
3289  shower_tagprimary[ii]=0;
3290  shower_ntrace1simub[ii]=0;
3291  shower_ntrace2simub[ii]=0;
3292  shower_ntrace3simub[ii]=0;
3293  shower_ntrace4simub[ii]=0;
3294  shower_deltaxb[ii]=0;
3295  shower_deltayb[ii]=0;
3296  shower_chi2btkb[ii]=0;
3297  shower_idb[ii]=0;
3298  shower_plateb[ii]=0;
3299  }
3300  for (int i=1; i<58; ++i) {
3302  }
3303 
3304  // Part To calculate the TransfereedVariables....
3305  shower_sizeb=segarray->GetEntries();
3306  Inseg=(EdbSegP*)segarray->At(0);
3307  shower_energy_shot_particle=Inseg->P();
3308  shower_number_eventb=Inseg->MCEvt();
3310 
3311 
3312  if (gEDBDEBUGLEVEL>3) cout << "--- --- ---------------------"<<endl;
3313  //-------------------------------------
3314  for (int ii=0; ii<shower_sizeb; ii++) {
3315 
3316  if (ii>=5000) {
3317  cout << "WARNING: shower_sizeb ( " << shower_sizeb<< ") greater than SHOWERARRAY. Set sizeb to 4999 and Stop filling!."<<endl;
3318  shower_sizeb=4999;
3319  continue;
3320  }
3321  seg=(EdbSegP*)segarray->At(ii);
3322 
3323  //-------------------------------------
3324  shower_xb[ii]=seg->X();
3325  shower_yb[ii]=seg->Y();
3326  shower_txb[ii]=seg->TX();
3327  shower_tyb[ii]=seg->TY();
3328  shower_zb[ii]=seg->Z();
3329  shower_chi2btkb[ii]=seg->Chi2();
3330  shower_deltathetab[ii]=0.5;
3331  shower_deltarb[ii]=200;
3332  shower_tagprimary[ii]=0;
3333  if (ii==0) shower_tagprimary[ii]=1;
3334  shower_isizeb=1; // always 1, not needed anymore
3335  if (seg->MCEvt()>0) {
3336  shower_ntrace1simub[ii]=seg->MCEvt();
3337  shower_ntrace2simub[ii]=seg->W();
3338  shower_ntrace3simub[ii]=seg->P();
3339  shower_ntrace4simub[ii]=seg->Flag();
3340  }
3341  else {
3342  // keep the seg->BT settings for BG:
3343  // that come out of "normal" scanned data from fedra:
3344  // shower_ntrace1simub=-999
3345  // shower_ntrace2simub=seg->W();
3346  // shower_ntrace3simub=-999
3347  // shower_ntrace4simub=0
3348  shower_ntrace1simub[ii]=-999;
3349  shower_ntrace2simub[ii]=seg->W();
3350  shower_ntrace3simub[ii]=-999;
3351  shower_ntrace4simub[ii]=0;
3352  }
3353  shower_idb[ii]=seg->ID();
3354  shower_plateb[ii]=seg->PID();
3355 
3356 
3357  //-------------------------------------
3358  // PUT HERE: deltarb,deltarb, nflimb, sizeb15......
3359  diff_pid=TMath::Abs( Inseg->PID()-seg->PID() )+1;
3360  // (does this work for up/downsream listing??)
3361  // (yes, since InBT->PID is also changed.)
3362  // but works only if the gAli Object has no missing plates
3363  // otherwise f.e. PID(1) and PID(2) are not necessaryly abay by dZ=1300
3364  // (could be Z(1)=1300 and Z(2)=3900...)
3365 
3366  // Calc pur:
3367  // New: (16.02.2010) define purity w.r.t. MC of Initiabtor Basetrack
3368  // So if other MC-events (like in testbeam simulation case) had been taken, they
3369  // count as well as "background!"
3370  shower_sizebNHELP++;
3371  if (seg->MCEvt()==shower_number_eventb&&shower_number_eventb>0) shower_sizebMCNHELP++;
3372  // for example: InBT:MCEvt==4 and Basetrack has MCEvt==18 then
3373  // shower_sizebNHELP++, but not shower_sizebMCNHELP !!
3374  // But also: if shower_number_eventb==-999 i.e. we start from a BG basetrack
3375  // and all other shower collected BTs have MCEvt==-999 then we get also
3376  // a purity of 1.
3377  // That means shower consisting only of BG events are in that sense also "very pure".
3378  // How to deal with this?
3379  // if (shower_number_eventb=-999) then we do NOT increment
3380  // shower_sizebMCNHELP , this is by changing the statement from
3381  // if (seg->MCEvt()==shower_number_eventb) shower_sizebMCNHELP++;
3382  // to
3383  // if (seg->MCEvt()==shower_number_eventb&&shower_number_eventb>0) shower_sizebMCNHELP++;
3384 
3385  // InBT:
3386  if (ii==0) {
3387  shower_deltathetab[0]=0.5;
3388  shower_deltarb[0]=200;
3389  shower_nfilmb[0]=1;
3390  }
3391  // All other BTs:
3392  if (ii>0) {
3393  // its correct like this, since this is the way it is done in
3394  // the official FJ-Algorithm:
3395  shower_nfilmb[ii]=diff_pid;
3396  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;
3397 
3398  shower_numberofilms=TMath::Max(shower_numberofilms,diff_pid);
3399 
3400  if (diff_pid >= 15 ) shower_sizeb15++;
3401  if (diff_pid >= 20 ) shower_sizeb20++;
3402  if (diff_pid >= 30 ) shower_sizeb30++;
3403 
3404  // PUT HERE: calculation routine for shower_deltasigmathetab
3405  // see referenc in thesis of Luillo Esposito, page 109.
3406  shower_deltasigmathetab[diff_pid]=shower_deltasigmathetab[diff_pid]+(Power(shower_txb[ii]-shower_txb[0],2)+Power(shower_tyb[ii]-shower_tyb[0],2));
3407 
3408  // PUT HERE: calculation routine for shower_deltathetab, shower_deltarb
3409  // ExSetTreebranchNametrapolate the BT [ii] to the position [jj] and then calc the
3410  // position and slope differences;
3411  // For the backward extrapolation of the shower_deltathetab and shower_deltarb
3412  // calulation for BaseTrack(ii), Basetrack(jj)->Z() hast to be smaller.
3413  min_shower_deltathetab=99999; // Reset
3414  min_shower_deltar=99999; // Reset
3415 
3416  for (int jj=0; jj<shower_sizeb; jj++) {
3417  if (ii==jj) continue;
3418 
3419  // since we do not know if BTs are ordered by their Z positions:
3420  // and cannot cut directly on the number in the shower entry:
3421  // Entry jj has to have lower Z than ii:
3422  if (shower_zb[ii]<=shower_zb[jj]) continue;
3423 
3424  extrapo_diffz=shower_zb[ii]-shower_zb[jj];
3425  if (TMath::Abs(extrapo_diffz)>4*1300+1.0) continue;
3426 // if (TMath::Abs(extrapo_diffz)>6*1300+1.0) continue;
3427 // if (TMath::Abs(extrapo_diffz)>9*1300+1.0) continue;
3428  // if 4/6/9 gives only similar results...
3429  if (TMath::Abs(extrapo_diffz)<1.0) continue; // remove same positions.
3430 
3431  extrapol_x=shower_xb[ii]-shower_txb[ii]*extrapo_diffz; // minus, because its ii after jj.
3432  extrapol_y=shower_yb[ii]-shower_tyb[ii]*extrapo_diffz; // minus, because its ii after jj.
3433 
3434  // Delta radius we need to extrapolate.
3435 // test_shower_deltax=extrapol_x;//shower_txb[ii]*(shower_zb[ii]-shower_zb[jj])+shower_xb[ii];
3436 // test_shower_deltay=extrapol_y;//shower_tyb[ii]*(shower_zb[ii]-shower_zb[jj])+shower_yb[ii];
3437  test_shower_deltax=extrapol_x-shower_xb[jj];
3438  test_shower_deltay=extrapol_y-shower_yb[jj];
3439  test_shower_deltar=TMath::Sqrt(test_shower_deltax*test_shower_deltax+test_shower_deltay*test_shower_deltay);
3440 
3441  // Delta theta we do not need to extrapolate. (old version...)
3442  //test_shower_deltathetab=TMath::Sqrt(shower_txb[ii]*shower_txb[ii]+shower_tyb[ii]*shower_tyb[ii]);
3443  //test_shower_deltathetab=test_shower_deltathetab-TMath::Sqrt(shower_txb[jj]*shower_txb[jj]+shower_tyb[jj]*shower_tyb[jj]);
3444  //test_shower_deltathetab=TMath::Abs(test_shower_deltathetab);
3445  //----
3446  // As before in ShowRec this way of calculation is not equivalent as calculating
3447  // DeltaTheta domponentwise:
3448  // Code from libShower:
3449  // delta = sqrt((SX0-a->GetTXb(l2))*(SX0-a->GetTXb(l2))+((SY0-a->GetTYb(l2))*(SY0-a->GetTYb(l2))));
3450  test_shower_deltathetab=TMath::Sqrt(TMath::Power(shower_txb[ii]-shower_txb[jj],2)+TMath::Power(shower_tyb[ii]-shower_tyb[jj],2));
3451 
3452  // Check if both dr,dt match parameter criteria and then just take these values.....
3453  // Maybe a change is necessary because it is not exactly the same as in the off. algorithm.
3454 // if (test_shower_deltar<400 && test_shower_deltathetab<0.8 ) {
3455 // if (test_shower_deltar<150 && test_shower_deltathetab<0.15) {
3456  if (test_shower_deltar<1000 && test_shower_deltathetab<2.0 ) {
3463  if (test_shower_deltar<min_shower_deltar) {
3464  min_shower_deltathetab=test_shower_deltathetab;
3465  min_shower_deltar=test_shower_deltar;
3466  shower_deltathetab[ii]=min_shower_deltathetab;
3467  shower_deltarb[ii]=min_shower_deltar;
3468  //cout << ii << " " << jj << " " << test_shower_deltathetab << " " << test_shower_deltar << " " <<min_shower_deltathetab << " " << min_shower_deltar << endl;
3469 
3470  } // if (test_shower_deltar<min_shower_deltar)
3471  } // if (test_shower_deltar<150 && test_shower_deltathetab<0.15 )
3472  } // for (int jj=0;jj<shower_sizeb;jj++)
3473 
3474 
3475  //cout << "For ii= " << ii << "we found the best matcjgin dRtehta values: " << min_shower_deltathetab << " " << min_shower_deltar << endl;
3476  } // if (ii>0)
3477  //-------------------------------------
3478 
3479 
3480  shower_purb=shower_sizebMCNHELP/shower_sizebNHELP;
3481  } // for (int ii=0;ii<shower_sizeb;ii++) {
3482  if (gEDBDEBUGLEVEL>2) {
3483  cout << "ShowRec.cpp : --- void* TransferShowerObjectArrayIntoEntryOfTreebranchShowerTree() ---"<<endl;
3484  cout << "Loop over for (int ii=0;ii<shower_sizeb;ii++) done." << endl;
3485  }
3486 
3487  //-------------------------------------
3488  for (int i=1; i<58; ++i) {
3490  }
3491  shower_numberofilms=shower_nfilmb[shower_sizeb-1]; // there we assume (this is correct always?) when
3492  // the last shower BT is in the last film...(otherwise we would again have to loop on sizeb array);
3493  //cout << "TransferShowerObjectArrayIntoEntryOfTreebranchShowerTree shower_numberofilms= "<< shower_numberofilms <<endl;
3494 
3495  int eN0=0;
3496  for (int i=0; i<shower_nfilmb[shower_sizeb-1]; i++) if (shower_nfilmb[i]==0) ++eN0;
3498 
3499  int eN00int=0;
3500  int eN00=0;
3501  for (int i=1; i<shower_nfilmb[shower_sizeb-1]; i++) {
3502  //cout << i << "------------" << shower_nfilmb[i]-shower_nfilmb[i-1] << " -- " << eN00 << endl;
3503  if (shower_nfilmb[i]-shower_nfilmb[i-1]>1) {
3504  eN00=shower_nfilmb[i]-shower_nfilmb[i-1]-1;
3505  if (eN00>eN00int) eN00int=eN00;
3506  }
3507  if (shower_nfilmb[i]-shower_nfilmb[i-1]==1) eN00=0;
3508  }
3509  eN00=eN00int;
3511 
3512  //cout << "TransferShowerObjectArrayIntoEntryOfTreebranchShowerTree shower_numberofholesconseq= "<< shower_numberofholesconseq <<endl;
3513 
3514  // Also calculate now Shower axis and fill axis values into the treebranch:
3515 // EdbSegP* axis= new EdbSegP();
3516  EdbSegP* axis = BuildShowerAxis(segarray);
3517 // axis->PrintNice();
3518  //cout << "TransferShowerObjectArrayIntoEntryOfTreebranchShowerTree BuildShowerAxis done."<<endl;
3519  shower_axis_xb=axis->X();
3520  shower_axis_yb=axis->Y();
3521  shower_axis_zb=axis->Z();
3522  shower_axis_txb=axis->TX();
3523  shower_axis_tyb=axis->TY();
3524 // delete axis;
3525 
3526  // Fill Tree:
3527  treebranchtree->Fill();
3528 
3529  if (gEDBDEBUGLEVEL>2) cout << "Now we have treebranchtree Entries: " << treebranchtree->GetEntries() << endl;
3530  if (gEDBDEBUGLEVEL>3) treebranchtree->Show(treebranchtree->GetEntries()-1);
3531 
3532  return;
3533 }
EdbSegP * BuildShowerAxis(TObjArray *ShowerSegArray)
Definition: ShowRec.cpp:8629
Float_t Chi2() const
Definition: EdbSegP.h:154
Float_t P() const
Definition: EdbSegP.h:149
Float_t W() const
Definition: EdbSegP.h:148

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


1673 {
1674  Log(3, "ShowRec.cpp", "--- void TransformEdbPVRec() ---");
1675 
1676  // local_halfpatternsize=11250;// debugTEST how long it takes more if we take a big area to reconstruct.
1677  Float_t halfpatternsize=local_halfpatternsize;
1678 
1679 
1680  // Informational Debug Output
1681  // DOWNSTREAM ORDER ASSUMED !!!
1684  Int_t npat = GLOBAL_gAli->Npatterns(); //number of plates
1685  Int_t firstplate= npat-cmd_FP;
1686  Int_t middleplate= npat-cmd_MP;
1687  Int_t actualplate= npat-cmd_FP;
1688  Int_t lastplate= TMath::Max(npat-cmd_LP-1,0);
1689  Int_t InBTplate= InitiatorBT->PID();
1690  Int_t InBTplateandNplate= InitiatorBT->PID()-cmd_NP+1;
1691  Int_t endlplatetopropagate=TMath::Max(InBTplateandNplate,lastplate);
1692  Float_t InBTZ= InitiatorBT->Z();
1693 
1694  if (gEDBDEBUGLEVEL>2) {
1695  cout << "--- TransformEdbPVRec --- DOWNSTREAM ORDER = " <<endl;
1696  cout << "--- TransformEdbPVRec --- npat = " << npat << endl;
1697  cout << "--- TransformEdbPVRec --- firstplate = " << firstplate << endl;
1698  cout << "--- TransformEdbPVRec --- middleplate = " << middleplate << endl;
1699  cout << "--- TransformEdbPVRec --- lastplate = " << lastplate << endl;
1700  cout << "--- TransformEdbPVRec --- InBTplate = " << InBTplate << endl;
1701  cout << "--- TransformEdbPVRec --- InBTplateandNplate = " << InBTplateandNplate << endl;
1702  cout << "--- TransformEdbPVRec --- endlplatetopropagate = " << endlplatetopropagate << endl;
1703  cout << "--- TransformEdbPVRec --- InBTZ = " << InBTZ << endl;
1704  cout << "--- TransformEdbPVRec --- InBTplate = " << InBTplate << endl;
1705  }
1706 
1707  // has to be deleted in some part of the script outside this function...
1708  // Dont forget , otherwise memory heap overflow!
1709  EdbPVRec* gAli_Sub = new EdbPVRec();
1710 
1711  // Create SubPattern objects
1712  EdbSegP* ExtrapolateInitiatorBT;
1713  ExtrapolateInitiatorBT = (EdbSegP*)InitiatorBT->Clone();
1714 
1715  // Create Variables For ExtractSubpattern boundaries
1716  Float_t mini[5];
1717  Float_t maxi[5];
1718  mini[0]=ExtrapolateInitiatorBT->X()-halfpatternsize;
1719  mini[1]=ExtrapolateInitiatorBT->Y()-halfpatternsize;
1720  maxi[0]=ExtrapolateInitiatorBT->X()+halfpatternsize;
1721  maxi[1]=ExtrapolateInitiatorBT->Y()+halfpatternsize;
1722  mini[2]=-0.5;
1723  mini[3]=-0.5;
1724  mini[4]=0.0;
1725  maxi[2]=0.5;
1726  maxi[3]=0.5;
1727  maxi[4]=100.0;
1728 
1729 
1733  if (cmd_EXTHETA==1) {
1734  mini[2]=ExtrapolateInitiatorBT->TX()-0.15;
1735  mini[3]=ExtrapolateInitiatorBT->TY()-0.15;
1736  maxi[2]=ExtrapolateInitiatorBT->TX()+0.15;
1737  maxi[3]=ExtrapolateInitiatorBT->TY()+0.15;
1738  }
1740 
1741  EdbPattern* singlePattern;
1742  Int_t MCMixFlag=-1;
1743  if (cmd_MCMIX==1) {
1744  MCMixFlag=-1;
1745  }
1746  else {
1747  MCMixFlag=InitiatorBT->MCEvt();
1748  }
1749 
1750  // Add the subpatterns in a loop for the plates:
1751  // in reverse ordering.due to donwstream behaviour (!):
1752  // (Only downstream is supported now...)
1753  for (Int_t ii=endlplatetopropagate; ii<=InBTplate; ++ii) {
1754 
1755  Float_t zpos=gAli->GetPattern(ii)->Z();
1756  if (gEDBDEBUGLEVEL>3) cout << "--- --- Loop: ii, zpos "<< ii << " " << zpos << "; Print InitiatorBT,ExtrapolateInitiatorBT"<<endl;
1757 
1758  ExtrapolateInitiatorBT->PropagateTo(zpos);
1759  if (gEDBDEBUGLEVEL>3) {
1760  InitiatorBT->PrintNice();
1761  ExtrapolateInitiatorBT->PrintNice();
1762  }
1763 
1764  mini[0]=ExtrapolateInitiatorBT->X()-halfpatternsize;
1765  mini[1]=ExtrapolateInitiatorBT->Y()-halfpatternsize;
1766  maxi[0]=ExtrapolateInitiatorBT->X()+halfpatternsize;
1767  maxi[1]=ExtrapolateInitiatorBT->Y()+halfpatternsize;
1768 
1769  singlePattern=(EdbPattern*)gAli->GetPattern(ii)->ExtractSubPattern(mini,maxi,MCMixFlag);
1770 // cout << "singlePattern with MCMixFlag= " << MCMixFlag << " nentries= " << singlePattern->N() << endl;
1771 
1772 
1773  singlePattern-> SetID(gAli->GetPattern(ii)->ID());
1774  singlePattern-> SetPID(gAli->GetPattern(ii)->PID());
1775  gAli_Sub->AddPattern(singlePattern);
1776  }
1777  if (gEDBDEBUGLEVEL>2) cout <<"--- gAli_Sub->Print():"<<endl;
1778  if (gEDBDEBUGLEVEL>2) gAli_Sub->Print();
1779  if (gEDBDEBUGLEVEL>2) cout <<"--- ----------------------------------"<<endl;
1780 
1781  return gAli_Sub;
1782 }
int PID() const
Definition: EdbPattern.h:329
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!

1787 {
1788  Log(3, "ShowRec.cpp", "--- void TransformEdbPVRec_BackWard() ---");
1789 
1790  local_halfpatternsize=11250;// debugTEST how long it takes more if we take a big area to reconstruct.
1791  local_halfpatternsize=5000;// debugTEST how long it takes more if we take a big area to reconstruct.
1792  local_halfpatternsize=2000;// debugTEST how long it takes more if we take a big area to reconstruct.
1793  Float_t halfpatternsize=local_halfpatternsize;
1794 
1795  // Informational Debug Output
1796  // DOWNSTREAM ORDER ASSUMED !!!
1799  Int_t npat = GLOBAL_gAli->Npatterns(); //number of plates
1800  Int_t firstplate= npat-cmd_FP;
1801  Int_t middleplate= npat-cmd_MP;
1802  Int_t actualplate= npat-cmd_FP;
1803  Int_t lastplate= TMath::Max(npat-cmd_LP-1,0);
1804  Int_t InBTplate= InitiatorBT->PID();
1805  Int_t InBTplateandNplate= InitiatorBT->PID()-cmd_NP+1;
1806  Int_t endlplatetopropagate=TMath::Max(InBTplateandNplate,lastplate);
1807  Float_t InBTZ= InitiatorBT->Z();
1808 
1809  if (gEDBDEBUGLEVEL>3) {
1810  cout << "--- DOWNSTREAM ORDER = " <<endl;
1811  cout << "--- npat = " << npat << endl;
1812  cout << "--- firstplate = " << firstplate << endl;
1813  cout << "--- middleplate = " << middleplate << endl;
1814  cout << "--- lastplate = " << lastplate << endl;
1815  cout << "--- InBTplate = " << InBTplate << endl;
1816  cout << "--- InBTplateandNplate = " << InBTplateandNplate << endl;
1817  cout << "--- endlplatetopropagate = " << endlplatetopropagate << endl;
1818  cout << "--- InBTZ = " << InBTZ << endl;
1819  }
1820 
1821  // has to be deleted in some part of the script outside this function...
1822  // Dont forget , otherwise memory heap overflow!
1823  EdbPVRec* gAli_Sub = new EdbPVRec();
1824 
1825  // Create SubPattern objects
1826  EdbSegP* ExtrapolateInitiatorBT;
1827  ExtrapolateInitiatorBT = (EdbSegP*)InitiatorBT->Clone();
1828 
1829  // Create Variables For ExtractSubpattern boundaries
1830  Float_t mini[5];
1831  Float_t maxi[5];
1832  mini[0]=ExtrapolateInitiatorBT->X()-halfpatternsize;
1833  mini[1]=ExtrapolateInitiatorBT->Y()-halfpatternsize;
1834  maxi[0]=ExtrapolateInitiatorBT->X()+halfpatternsize;
1835  maxi[1]=ExtrapolateInitiatorBT->Y()+halfpatternsize;
1836  mini[2]=-0.5;
1837  mini[3]=-0.5;
1838  mini[4]=0.0;
1839  maxi[2]=0.5;
1840  maxi[3]=0.5;
1841  maxi[4]=100.0;
1842 
1843  EdbPattern* singlePattern;
1844 
1845  for (Int_t ii=0; ii<npat; ++ii) {
1846 
1847  Float_t zpos=gAli->GetPattern(ii)->Z();
1848  if (gEDBDEBUGLEVEL>3) cout << "--- --- Loop: ii, zpos "<< ii << " " << zpos << "; Print InitiatorBT,ExtrapolateInitiatorBT"<<endl;
1849 
1850  ExtrapolateInitiatorBT->PropagateTo(zpos);
1851  if (gEDBDEBUGLEVEL>3) {
1852  InitiatorBT->PrintNice();
1853  ExtrapolateInitiatorBT->PrintNice();
1854  }
1855 
1856  mini[0]=ExtrapolateInitiatorBT->X()-halfpatternsize;
1857  mini[1]=ExtrapolateInitiatorBT->Y()-halfpatternsize;
1858  maxi[0]=ExtrapolateInitiatorBT->X()+halfpatternsize;
1859  maxi[1]=ExtrapolateInitiatorBT->Y()+halfpatternsize;
1860 
1861  singlePattern=(EdbPattern*)gAli->GetPattern(ii)->ExtractSubPattern(mini,maxi,InitiatorBT->MCEvt());
1862  singlePattern-> SetID(gAli->GetPattern(ii)->ID());
1863  singlePattern-> SetPID(gAli->GetPattern(ii)->PID());
1864  gAli_Sub->AddPattern(singlePattern);
1865  }
1866  if (gEDBDEBUGLEVEL>3) cout <<"--- gAli_Sub->Print():"<<endl;
1867  if (gEDBDEBUGLEVEL>3) gAli_Sub->Print();
1868  if (gEDBDEBUGLEVEL>3) cout <<"--- ----------------------------------"<<endl;
1869 
1870  if (gEDBDEBUGLEVEL>2) cout <<"--- gAli_Sub with ():"<< gAli_Sub->Npatterns() << "patterns."<<endl;
1871 
1872  return gAli_Sub;
1873 }

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

1880 {
1881  Log(3, "ShowRec.cpp", "--- void TransformEdbPVRec_SA() ---");
1882 
1883  // Informational Debug Output
1884  // DOWNSTREAM ORDER ASSUMED !!!
1887  Int_t npat = GLOBAL_gAli->Npatterns(); //number of plates
1888  Int_t firstplate= npat-cmd_FP;
1889  Int_t middleplate= npat-cmd_MP;
1890  Int_t actualplate= npat-cmd_FP;
1891  Int_t lastplate= TMath::Max(npat-cmd_LP-1,0);
1892  Int_t InBTplate= InitiatorBT->PID();
1893  Int_t InBTplateandNplate= InitiatorBT->PID()-cmd_NP+1;
1894  Int_t endlplatetopropagate=TMath::Max(InBTplateandNplate,lastplate);
1895  Float_t InBTZ= InitiatorBT->Z();
1896 
1897  if (gEDBDEBUGLEVEL>2) {
1898  cout << "--- DOWNSTREAM ORDER = " <<endl;
1899  cout << "--- npat = " << npat << endl;
1900  cout << "--- firstplate = " << firstplate << endl;
1901  cout << "--- middleplate = " << middleplate << endl;
1902  cout << "--- lastplate = " << lastplate << endl;
1903  cout << "--- InBTplate = " << InBTplate << endl;
1904  cout << "--- InBTplateandNplate = " << InBTplateandNplate << endl;
1905  cout << "--- endlplatetopropagate = " << endlplatetopropagate << endl;
1906  cout << "--- InBTZ = " << InBTZ << endl;
1907  }
1908 
1909  // has to be deleted in some part of the script outside this function...
1910  // Dont forget , otherwise memory heap overflow!
1911  EdbPVRec* gAli_Sub = new EdbPVRec();
1912 
1913  // Create SubPattern objects
1914  EdbSegP* ExtrapolateInitiatorBT;
1915  ExtrapolateInitiatorBT = (EdbSegP*)InitiatorBT->Clone();
1916 
1917  Float_t halfsize=CUT_PARAMETER[1];
1918 
1919  // Create Variables For ExtractSubpattern boundaries
1920  Float_t mini[5];
1921  Float_t maxi[5];
1922  mini[0]=ExtrapolateInitiatorBT->X()-halfsize;
1923  mini[1]=ExtrapolateInitiatorBT->Y()-halfsize;
1924  maxi[0]=ExtrapolateInitiatorBT->X()+halfsize;
1925  maxi[1]=ExtrapolateInitiatorBT->Y()+halfsize;
1926  mini[2]=-0.5;
1927  mini[3]=-0.5;
1928  mini[4]=0.0;
1929  maxi[2]=0.5;
1930  maxi[3]=0.5;
1931  maxi[4]=100.0;
1932 
1933  EdbPattern* singlePattern;
1934 
1935  // Add the subpatterns in a loop for the plates:
1936  // in reverse ordering.due to donwstream behaviour (!):
1937  // (Only downstream is supported now...)
1938  for (Int_t ii=endlplatetopropagate; ii<=InBTplate; ++ii) {
1939 
1940  Float_t zpos=gAli->GetPattern(ii)->Z();
1941  if (gEDBDEBUGLEVEL>3) cout << "--- --- Loop: ii, zpos "<< ii << " " << zpos << "; Print InitiatorBT,ExtrapolateInitiatorBT"<<endl;
1942 
1943  ExtrapolateInitiatorBT->PropagateTo(zpos);
1944  if (gEDBDEBUGLEVEL>3) {
1945  InitiatorBT->PrintNice();
1946  ExtrapolateInitiatorBT->PrintNice();
1947  }
1948 
1949  mini[0]=ExtrapolateInitiatorBT->X()-halfsize;
1950  mini[1]=ExtrapolateInitiatorBT->Y()-halfsize;
1951  maxi[0]=ExtrapolateInitiatorBT->X()+halfsize;
1952  maxi[1]=ExtrapolateInitiatorBT->Y()+halfsize;
1953 
1954  singlePattern=(EdbPattern*)gAli->GetPattern(ii)->ExtractSubPattern(mini,maxi,InitiatorBT->MCEvt());
1955  singlePattern-> SetID(gAli->GetPattern(ii)->ID());
1956  singlePattern-> SetPID(gAli->GetPattern(ii)->PID());
1957  gAli_Sub->AddPattern(singlePattern);
1958  }
1959  if (gEDBDEBUGLEVEL>2) cout <<"--- gAli_Sub->Print():"<<endl;
1960  if (gEDBDEBUGLEVEL>2) gAli_Sub->Print();
1961  if (gEDBDEBUGLEVEL>2) cout <<"--- ----------------------------------"<<endl;
1962 
1963  return gAli_Sub;
1964 }

◆ Write_Alg_GS_Histograms()

void Write_Alg_GS_Histograms ( )
4075  {
4076 
4077  Log(2, "ShowRec.cpp", "--- void Write_Alg_GS_Histograms() ---");
4078  f_GSNN->cd();
4079  f_GSNN->ls();
4080  h_GSNN_var00->Write();
4081  h_GSNN_var01->Write();
4082  h_GSNN_var02->Write();
4083  h_GSNN_var03->Write();
4084  h_GSNN_var04->Write();
4085  h_GSNN_var05->Write();
4086  h_GSNN_var06->Write();
4087  t_GSNN->Write();
4088  f_GSNN->Close();
4089  Log(2, "ShowRec.cpp", "--- void Write_Alg_GS_Histograms()...done.");
4090  return;
4091 }