FEDRA emulsion software from the OPERA Collaboration
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
EdbShowerRec Class Reference

#include <EdbShowerRec.h>

Inheritance diagram for EdbShowerRec:
Collaboration diagram for EdbShowerRec:

Public Member Functions

int AddInitiatorBT (EdbSegP *seg)
 
void CalcTrackDensity (EdbPattern *pat_interim, Int_t pat_interim_halfsize, Int_t &npat_int, Int_t &npat_total, Int_t &npatN)
 
void CalculateEnergyValues ()
 
void CheckEdbPVRecSetUseAliSub ()
 
void ClearInBTArray ()
 
void ClearRecoShowerArray ()
 
Double_t DeltaR_WithoutPropagation (EdbSegP *s, EdbSegP *stest)
 
Double_t DeltaR_WithPropagation (EdbSegP *s, EdbSegP *stest)
 
Double_t DeltaThetaComponentwise (EdbSegP *s1, EdbSegP *s2)
 
 EdbShowerRec ()
 
 EdbShowerRec (EdbPVRec *pvr)
 
 EdbShowerRec (EdbPVRec *pvr, Int_t OptionType)
 
 EdbShowerRec (TObjArray *InBTArray, int num, int MAXPLATE, int DATA, int piece2, int piece2par, int DOWN, EdbPVRec *pvr)
 
Float_t Energy_CalcSigma (Float_t Energy, Int_t NPlatesNr)
 
Float_t Energy_CorrectEnergy (Float_t MeasuredEnergy, Int_t NPlatesNr)
 
void Energy_CreateANNTree ()
 
void Energy_CreateEnergyResolutionFitFunction ()
 
void Energy_ExtractShowerParametrisationProfile ()
 
void Execute ()
 
void Fill_eInBTArray_ByLinkTracks_eFilename_LinkedTracks ()
 
Bool_t FindPrecedingBTs (EdbSegP *s, EdbSegP *InBT, EdbPVRec *gAli, EdbTrackP *shower)
 
Double_t GetAlgoParameter (Int_t paranr)
 
Bool_t GetAliLoaded () const
 
Float_t GetChi20 () const
 
Float_t GetChi2b (int i) const
 
Float_t GetDeltarb (int i) const
 
Float_t GetDeltathetab (int i) const
 
Float_t GetDz () const
 
EdbPVRecGetEdbPVRec () const
 
Int_t GetEdbPVRecNpat () const
 
Int_t GetEdbPVRecNplateNumber () const
 
Float_t GetEdbPVRecNSeg (EdbPVRec *ali, Int_t mode)
 
EdbPVRecGetEdbPVRecSub () const
 
Float_t GetEnergy () const
 
Float_t GetEnergySigma () const
 
Float_t GetEnergyUn () const
 
Float_t GetEnergyUnSigma () const
 
Float_t * GetEnergyValues (Int_t TreeEntry)
 
Int_t GetFlag0 () const
 
Int_t GetFlagb (int i) const
 
TH1D * GetHistdeltaR_mean ()
 
TH1D * GetHistdeltaR_rms ()
 
TH1D * GetHistdeltaT_mean ()
 
TH1D * GetHistdeltaT_rms ()
 
TH1F * GetHistEnergyCorrectedb ()
 
TH1F * GetHistEnergyNominal ()
 
TH1F * GetHistEnergySigmaCorrectedb ()
 
TH1F * GetHistEnergySigmaUnCorrectedb ()
 
TH1F * GetHistEnergyUnCorrectedb ()
 
TH1D * GetHistLongProfile ()
 
TH1D * GetHistNBaseTracks ()
 
Int_t GetID () const
 
Int_t GetIDb (int i) const
 
EdbSegPGetInBT (Int_t i) const
 
TObjArray * GetInBTArray () const
 
Int_t GetInBTArrayN () const
 
Int_t GetL () const
 
Float_t GetmcDigitIndexBottom (int i) const
 
Float_t GetmcDigitIndexTop (int i) const
 
Int_t GetN () const
 
Int_t GetNFilmb (int i) const
 
Float_t GetOutput () const
 
Float_t GetOutput15 () const
 
Float_t GetOutput20 () const
 
Float_t GetOutput30 () const
 
Float_t GetP0 () const
 
Float_t GetPb (int i) const
 
Int_t GetPlateb (int i) const
 
TObjArray * GetRecoShowerArray () const
 
Int_t GetRecoShowerArrayN () const
 
Float_t * GetShowerValues (Int_t TreeEntry)
 
Int_t GetSize () const
 
Int_t GetSize15 () const
 
Int_t GetSize20 () const
 
Int_t GetSize30 () const
 
Int_t GetTagPrimaryb (int i) const
 
Int_t GetTreeBranchEntryNr (EdbSegP *seg)
 
Int_t GetTrID () const
 
Float_t GetTx () const
 
Float_t GetTXb (int i) const
 
Float_t GetTy () const
 
Float_t GetTYb (int i) const
 
Bool_t GetUseAliSub ()
 
Int_t GetW0 () const
 
Int_t GetWb (int i) const
 
Float_t GetX0 () const
 
Float_t GetXb (int i) const
 
Float_t GetY0 () const
 
Float_t GetYb (int i) const
 
Float_t GetZ0 () const
 
Float_t GetZb (int i) const
 
void Help ()
 
void Init ()
 
void InitPiece (EdbDataPiece &piece, const char *cpfile, const char *parfile)
 
void initproc (const char *def, int iopt, const char *rcut)
 
Double_t InvariantMass (EdbSegP *s1, EdbSegP *s2, Double_t Momentum1=-1, Double_t Momentum2=-1, Double_t ID1=22, Double_t ID2=22)
 
Bool_t IsInConeTube (EdbSegP *TestingSegment, EdbSegP *StartingSegment, Double_t CylinderRadius, Double_t ConeAngle)
 
void LoadEdbPVRec ()
 
void LoadShowerFile (TString ShowerFileName)
 
void NeuralNet ()
 
void Print ()
 
void PrintEdbPVRec () const
 
void PrintInitiatorBTs ()
 
void PrintParameters ()
 
void PrintRecoShowerArray ()
 
void ReadAffAndZ (char *fname, Float_t *pZoffs, Float_t *a11, Float_t *a12, Float_t *a21, Float_t *a22, Float_t *b1, Float_t *b2)
 
int ReadPiece (EdbDataPiece &piece, EdbPattern &pat)
 
void rec (int num, int MAXPLATE, int DATA, int Ncand, double *x0, double *y0, double *z0, double *tx0, double *ty0, double *chi20, int *W0, double *P0, int *Flag0, int *plate0, int *id0, int *TRid, double *Esim, int piece2, int piece2par, int DOWN, EdbPVRec *pvr)
 
void rec (int num, int MAXPLATE, int DATA, int Ncand, double *x0, double *y0, double *z0, double *tx0, double *ty0, int *plate0, int *id0, int *TRid, double *Esim, int *mcDigitIndexTop, int *mcDigitIndexBottom, int piece2, int piece2par, int DOWN, EdbPVRec *pvr)
 OLD — not used anymore.... More...
 
void rec (TObjArray *sarr, EdbPVRec *pvr)
 
void recdown (int num, int MAXPLATE, int DATA, int Ncand, double *x0, double *y0, double *z0, double *tx0, double *ty0, double *chi20, int *W0, double *P0, int *Flag0, int *plate0, int *id0, int *TRid, double *Esim, int *mcDigitIndexTop0, int *mcDigitIndexBottom0, int piece2, int piece2par, EdbPVRec *pvr)
 
void recup (int num, int MAXPLATE, int DATA, int Ncand, double *x0, double *y0, double *z0, double *tx0, double *ty0, double *chi20, int *W0, double *P0, int *Flag0, int *plate0, int *id0, int *TRid, double *Esim, int *mcDigitIndexTop0, int *mcDigitIndexBottom0, int piece2, int piece2par, EdbPVRec *pvr)
 
void remove (char *shfname, char *def, int MAXPLATE, int piece2par)
 
void ResetAlgoParameters ()
 
void ResetInBTArray ()
 
void ResetRecoShowerArray ()
 
int SaveLNK ()
 
void SaveResults ()
 
void Set0 ()
 
void SetAlgoParameter (Double_t paravalue, Int_t paranr)
 
void SetChi20 (float chi2)
 
void SetChi2b (float chi2b, int i)
 
void SetDeltarb (float deltarb, int i)
 
void SetDelthetab (float deltathetab, int i)
 
void SetDoEnergyCalculation (Bool_t DoEnergyCalculation)
 
void SetDz (float dz)
 
void SetEdbPVRec (EdbPVRec *Ali)
 
void SetFlag0 (int flag)
 
void SetFlagb (int flag, int i)
 
void SetID (int id)
 
void SetIDb (int idb2, int i)
 
void SetInBTArray (EdbPVRec *Ali, Int_t mode=0)
 
void SetInBTArray (EdbSegP *InBT)
 
void SetInBTArray (TObjArray *InBTArray)
 
void SetInBTArrayN (Int_t InBTArrayN)
 
void SetL (int L)
 
void SetmcDigitIndexBottom (int mcDb, int i)
 
void SetmcDigitIndexBottom0 (int mcDb)
 
void SetmcDigitIndexTop (int mcDt, int i)
 
void SetmcDigitIndexTop0 (int mcDt)
 
void SetNFilmb (int nfilmb, int i)
 
void SetOutput (float output)
 
void SetOutput15 (float output)
 
void SetOutput20 (float output)
 
void SetOutput30 (float output)
 
void SetP0 (float p)
 
void SetPb (float p, int i)
 
void SetPlateb (int plate2, int i)
 
void SetPrimary (int tagprimary, int i)
 
void SetQualityCutValues (Double_t p0, Double_t p1)
 
void SetRecoShowerArray (TObjArray *RecoShowerArray)
 
void SetRecoShowerArrayN (Int_t RecoShowerArrayN)
 
void SetSize (int size)
 
void SetSize15 (int size)
 
void SetSize20 (int size)
 
void SetSize30 (int size)
 
void SetTrID (int id)
 
void SetTx (float tx)
 
void SetTXb (float txb, int i)
 
void SetTy (float ty)
 
void SetTYb (float tyb, int i)
 
void SetUseAliSub (Bool_t UseAliSub)
 
void SetW0 (int w)
 
void SetWb (int w, int i)
 
void SetX0 (float x)
 
void SetXb (float xb, int i)
 
void SetY0 (float y)
 
void SetYb (float yb, int i)
 
void SetZ0 (float z)
 
void SetZb (float zb, int i)
 
TObjArray * ShowerToEdbSegPArray ()
 
void TransferShowerObjectArrayIntoEntryOfTreebranchShowerTree (TObjArray *segarray)
 
void TransferTreebranchShowerTreeIntoShowerObjectArray (TTree *treebranch)
 
void Transform_eAli (EdbSegP *InitiatorBT, Float_t ExtractSize)
 
void vert (const char *name2, const char *def, int MAXPLATE, int piece2par)
 
virtual ~EdbShowerRec ()
 

Public Attributes

EdbDataProca
 
Double_t bin1
 
Double_t bin10
 
Double_t bin11
 
Double_t bin12
 
Double_t bin13
 
Double_t bin14
 
Double_t bin15
 
Double_t bin16
 
Double_t bin17
 
Double_t bin18
 
Double_t bin19
 
Double_t bin2
 
Double_t bin20
 
Double_t bin21
 
Double_t bin22
 
Double_t bin23
 
Double_t bin24
 
Double_t bin25
 
Double_t bin26
 
Double_t bin27
 
Double_t bin28
 
Double_t bin29
 
Double_t bin3
 
Double_t bin30
 
Double_t bin31
 
Double_t bin32
 
Double_t bin33
 
Double_t bin34
 
Double_t bin35
 
Double_t bin4
 
Double_t bin41
 
Double_t bin42
 
Double_t bin43
 
Double_t bin44
 
Double_t bin45
 
Double_t bin46
 
Double_t bin47
 
Double_t bin48
 
Double_t bin49
 
Double_t bin5
 
Double_t bin50
 
Double_t bin51
 
Double_t bin52
 
Double_t bin53
 
Double_t bin54
 
Double_t bin55
 
Double_t bin56
 
Double_t bin57
 
Double_t bin58
 
Double_t bin59
 
Double_t bin6
 
Double_t bin60
 
Double_t bin7
 
Double_t bin8
 
Double_t bin9
 
Float_t chi2btkb [10000]
 
char cmd [500]
 
Float_t deltarb [10000]
 
Float_t deltathetab [10000]
 
Float_t deltaxb [10000]
 
Float_t deltayb [10000]
 
EdbDataProcdproc
 
Float_t E_MC
 energy of the first starting basetrack More...
 
Float_t EnergyCorrectedb
 
Float_t EnergySigmaCorrectedb
 
Float_t EnergySigmaUnCorrectedb
 
Float_t EnergyUnCorrectedb
 
Int_t eProb1
 
Int_t eProb90
 
TFile * file
 
TFile * fileout
 
TFile * fileout2
 
TFile * fileout3
 
TFile * FileReconstructedShowerTree
 
TFile * FileShowerParametrisationTree
 
EdbPVRecgAli
 
TH1D * histo_deltaR_mean
 
TH1D * histo_deltaR_rms
 
TH1D * histo_deltaT_mean
 
TH1D * histo_deltaT_rms
 
TH1D * histo_longprofile_av
 
TH1D * histo_nbtk_av
 
Int_t idb [10000]
 ??? forgot what it was ??? More...
 
Int_t isizeb
 ??? forgot what it was ??? More...
 
Int_t mcDigitIndexBottom [1000]
 
Int_t mcDigitIndexTop [1000]
 
TMultiLayerPerceptron * mlp1
 
TMultiLayerPerceptron * mlp2
 
TMultiLayerPerceptron * mlp3
 
TMultiLayerPerceptron * mlp4
 
Int_t nfilmb [10000]
 plate position of segment i w.r.t. starting segment. More...
 
Int_t ngrainb [10000]
 
Int_t ntrace1simub [10000]
 
Int_t ntrace2simub [10000]
 
Float_t ntrace3simub [10000]
 
Int_t ntrace4simub [10000]
 
Int_t number_eventb
 definition of treebranch More...
 
Float_t output15
 old neural net variables for e/pi separation More...
 
Float_t output20
 old neural net variables for e/pi separation More...
 
Float_t output30
 old neural net variables for e/pi separation More...
 
Float_t output50
 old neural net variables for e/pi separation More...
 
Int_t plateb [10000]
 plate id of segment i More...
 
Float_t purityb
 purity of the shower (MC info needed). More...
 
Int_t showerID
 ??? forgot what it was ??? More...
 
TTree * ShowerParametrisationTree
 
Int_t sizeb
 number of basetracks More...
 
Int_t sizeb15
 sizeb15: basetracks within the first 15 plates More...
 
Int_t sizeb20
 sizeb20: basetracks within the first 20 plates More...
 
Int_t sizeb30
 sizeb30: basetracks within the first 30 plates More...
 
Float_t tagprimary [10000]
 
Float_t trackdensb
 Track density around the shower (BT/mm2) (using eAli_Sub_halfsize). More...
 
TTree * treesaveb
 
TTree * treesaveb2
 
TTree * treesaveb3
 
Float_t txb [10000]
 position of segment i More...
 
Float_t tyb [10000]
 position of segment i More...
 
Int_t type
 
TTree * varia
 
Float_t xb [10000]
 position of segment i More...
 
Float_t yb [10000]
 position of segment i More...
 
Float_t zb [10000]
 position of segment i More...
 

Private Member Functions

TMultiLayerPerceptron * eEANN ()
 shower length ("nfilmb"); More...
 

Private Attributes

TTree * ANNInterimTreeInputvariables
 
Double_t eAlgoParameterConeAngle
 Opening angle of spanning cone from first BT. More...
 
Double_t eAlgoParameterConeRadius
 Radius of spanning cone from first BT. More...
 
Double_t eAlgoParameterConnectionDR
 Connection Criterium: delta R. More...
 
Double_t eAlgoParameterConnectionDT
 Connection Criterium: delta T. More...
 
Int_t eAlgoParameterNPropagation
 N plates backpropagating. More...
 
EdbPVReceAli
 
EdbPVReceAli_Sub
 
Float_t eAli_Sub_halfsize
 
Int_t eAli_SubNpat
 
Bool_t eAliLoaded
 
Int_t eAliNpat
 
Int_t eAliNpatM1
 
Float_t eChi20
 Chi2 of the first shower segment. More...
 
Float_t eChi2b [10000]
 Chi2 of basetrack. More...
 
Float_t eDeltarb [10000]
 Distance criteria of basetrack. More...
 
Float_t eDeltathetab [10000]
 Angular criteria of basetrack. More...
 
Bool_t eDoEnergyCalculation
 EnergyEstimation to do or not. More...
 
Float_t eDz
 length of the shower along Z More...
 
TObjArray * eEnergyANN
 Container for the ANNs trained on different. More...
 
Float_t eEnergyCorrectedb
 Neural Network output for Corrected Energy. More...
 
Bool_t eEnergyIsDone
 EnergyEstimation already done or not. More...
 
TF1 * eEnergyResolutionFitFunction_All
 
Float_t eEnergySigmaCorrectedb
 Neural Network output for Corrected Energy Sigma. More...
 
Float_t eEnergySigmaUnCorrectedb
 Neural Network output for UnCorrected Energy Sigma. More...
 
Float_t eEnergyUnCorrectedb
 Neural Network output for UnCorrected Energy. More...
 
TString * eEnergyWeightFileString [9]
 Container for the weightfiles trained on different. More...
 
TString eFilename_LinkedTracks
 
Int_t eFlag0
 Flag of the first shower segment. More...
 
Int_t eFlagb [10000]
 Flag of basetrack. More...
 
TH1F * eHistEnergyCorrectedb
 
TH1F * eHistEnergyNominal
 
TH1F * eHistEnergySigmaCorrectedb
 
TH1F * eHistEnergySigmaUnCorrectedb
 
TH1F * eHistEnergyUnCorrectedb
 
Int_t eID
 shower ID More...
 
Int_t eIDb [10000]
 ID of basetrack. More...
 
TObjArray * eInBTArray
 
Bool_t eInBTArrayIsFilled
 
Bool_t eInBTArrayLoaded
 
Int_t eInBTArrayMaxSize
 
Int_t eInBTArrayN
 
Bool_t eInitiatorBTIsCreated
 
Int_t eL
 length of the shower in number of film More...
 
Int_t emcDigitIndexBottom [1000]
 mc bottom digit index of basetrack More...
 
Int_t emcDigitIndexBottom0
 Bottom Digit index of the first shower segment. More...
 
Int_t emcDigitIndexTop [1000]
 mc top digit index of basetrack More...
 
Int_t emcDigitIndexTop0
 Top Digit index of the first shower segment. More...
 
Float_t energy_shot_particle
 
Int_t eNFilmb [10000]
 Plate number of basetrack in the shower reference. More...
 
Int_t eNumberPlate_eAliPID
 
Float_t eOutput
 Neural Network output for e/pi separation. More...
 
Float_t eOutput15
 Neural Network output for e/pi separation (for 15 films crossed) More...
 
Float_t eOutput20
 Neural Network output for e/pi separation (for 20 films crossed) More...
 
Float_t eOutput30
 Neural Network output for e/pi separation (for 30 films crossed) More...
 
Float_t eP0
 P of the first shower segment. More...
 
Float_t ePb [10000]
 P of basetrack. More...
 
Int_t ePlateb [10000]
 Plate ID of basetrack. More...
 
Double_t eQualityPar [2]
 
TObjArray * eRecoShowerArray
 
Int_t eRecoShowerArrayN
 
Int_t eShowersN
 Number how many showers have been reconstructed. More...
 
Bool_t eShowerTreeIsDone
 ShowerReconstruction already done or not. More...
 
Int_t eSize
 number of BT in the shower More...
 
Int_t eSize15
 number of BT in the shower (for 15 films crossed) More...
 
Int_t eSize20
 number of BT in the shower (for 20 films crossed) More...
 
Int_t eSize30
 number of BT in the shower (for 30 films crossed) More...
 
Int_t eTagPrimary [10000]
 1 for first Basetrack - 0 for the other More...
 
Int_t eTrID
 ID of the tracks of the first BT (in cp file if simulation!) More...
 
Float_t eTx
 tanX: deltaX/deltaZ for the first shower segment More...
 
Float_t eTXb [10000]
 Slope X position of basetrack. More...
 
Float_t eTy
 tanY: deltaY/deltaZ for the first shower segment More...
 
Float_t eTYb [10000]
 Slope Y position of basetrack. More...
 
Bool_t eUseAliSub
 
Bool_t eUseQualityPar
 
Int_t eW0
 W of the first shower segment. More...
 
Int_t eWb [10000]
 W of basetrack. More...
 
Float_t eX0
 |_coordinates of the first shower segment More...
 
Float_t eXb [10000]
 X position of basetrack. More...
 
Float_t eY0
 | in the SAME FOR ALL SEGMENTS aligned coordinate system More...
 
Float_t eYb [10000]
 Y position of basetrack. More...
 
Float_t eZ0
 | More...
 
Float_t eZb [10000]
 Z position of basetrack. More...
 
Double_t inANN [70]
 

Constructor & Destructor Documentation

◆ EdbShowerRec() [1/4]

EdbShowerRec::EdbShowerRec ( )

◆ EdbShowerRec() [2/4]

EdbShowerRec::EdbShowerRec ( TObjArray *  InBTArray,
int  num,
int  MAXPLATE,
int  DATA,
int  piece2,
int  piece2par,
int  DOWN,
EdbPVRec pvr 
)

Constructor giving a TObjArray of EdbSegments as Initiator Basetracks.
Old style constructor: Fill the array variables (arrays with 10000 indices..)
from the TObjArray of EdbSegP.
Though this is the "original" reconstruction function, it should not be used anymore
since it just does everything mixed together and the different steps are not to
clear for the user.

45{
52
53 Init();
54 Set0();
55
56 // Interim arrays, code structure is copied from shower_btr.C :
57 double x0[10000];
58 double y0[10000];
59 double z0[10000];
60 double tx0[10000];
61 double ty0[10000];
62 double chi20[10000];
63 double P0[10000];
64 int W0[10000];
65 int Flag0[10000];
66 int TRid[10000];
67 double Esim[10000];
68 int id[10000];
69 int Pid[10000];
70 int Ncand=0;
71 float Zoff;
72
73 int nentries = InBTArray->GetEntries();
74 EdbSegP *s = 0;
75 for (int i=0; i<nentries; i++) {
76 s=(EdbSegP*)InBTArray->At(i);
77 x0[Ncand] = s->X();
78 y0[Ncand] = s->Y();
79 Zoff = s->Z();
80 z0[Ncand] = Zoff;
81 tx0[Ncand] = s->TX();
82 ty0[Ncand] = s->TY();
83 chi20[Ncand] = s->Chi2();
84 W0[Ncand] = s->W();
85 P0[Ncand] = s->P();
86 Flag0[Ncand] = s->Flag();
87 TRid[Ncand] = s->MCEvt(); //this has to be a positive number
88 Esim[Ncand] = s->P();
89 id[Ncand] = s->ID();
90 Pid[Ncand] = Zoff/1273+1;
91 if (gEDBDEBUGLEVEL>2) cout << s->X() << " " << s->Y() << " " << s->Z() << " " << s->TX() << " " << s->TY() << " " << Pid[Ncand] << " " << Esim[Ncand] << " " << TRid[Ncand] << endl;
92 cout << chi20[Ncand] << " " << W0[Ncand] << " " << P0[Ncand] << " " << Flag0[Ncand] << endl;
93 Ncand++;
94 }
95
96 // Start the actual reconstruction function:
97 rec(num,MAXPLATE,DATA,Ncand,x0,y0,z0,tx0,ty0,chi20,W0,P0,Flag0,Pid,id,TRid,Esim,piece2,piece2par,UPDOWN,pvr);
98
99}
brick z0
Definition: RecDispMC.C:106
Definition: EdbSegP.h:21
void Set0()
Definition: EdbShowerRec.cxx:230
void Init()
Definition: EdbShowerRec.cxx:209
void rec(int num, int MAXPLATE, int DATA, int Ncand, double *x0, double *y0, double *z0, double *tx0, double *ty0, int *plate0, int *id0, int *TRid, double *Esim, int *mcDigitIndexTop, int *mcDigitIndexBottom, int piece2, int piece2par, int DOWN, EdbPVRec *pvr)
OLD — not used anymore....
Definition: EdbShowerRec.cxx:317
int nentries
Definition: check_shower.C:40
s
Definition: check_shower.C:55
gEDBDEBUGLEVEL
Definition: energy.C:7
int piece2par
Definition: shower_btr.C:22
int piece2
Definition: shower_btr.C:21
int DATA
Definition: shower_btr.C:24
int MAXPLATE
Definition: shower_btr.C:19

◆ EdbShowerRec() [3/4]

EdbShowerRec::EdbShowerRec ( EdbPVRec pvr)

Constructor giving a EdbPVRec object directly.
We try to do the reconstruction in the following way:
a) if EdbPVRec has tracking already done then take eTracks for
Inititator Basetracks
b) if EdbPVRec has vertexing already done then take eVertex for
additional cut of the Initiator Basetracks which are in
an IP of less than 250 microns.
c) Start BGEstimation, Reconstruction, Energy, ID directly
from this EdbPVRec object

After these steps showers are stored as an TObjarray of EdbTrackP
in this class and can be accessed.
Showers can also be written in the linked_tracks.root file, or
in the Shower.root file. But this file stores the showers just as
a tree with leafs and the object structure is lost.

104{
120
121 cout << "----------------------------------------------------------" << endl;
122 cout << "EdbShowerRec::EdbShowerRec(EdbPVRec *pvr) " << endl;
123 cout << " Constructor giving a EdbPVRec object directly. We try to do the reconstruction in the following way: " << endl;
124 cout << " a) if EdbPVRec has tracking already done then take eTracks for Inititator Basetracks."<< endl;
125 cout << " b) if EdbPVRec has vertexing already done then take eVertex for additional cut of the Initiator Basetracks which are in an IP of less than 250 microns." << endl;
126 cout << " c) Start BGEstimation, Reconstruction, Energy, ID directly from this EdbPVRec object" << endl;
127 cout <<"---------- (some of step c are still: ) T O D O -----------------------" << endl;
128 cout << endl;
129 cout << "After these steps showers are stored as an TObjarray of EdbTrackP "<< endl;
130 cout << "in this class and can be accessed. " << endl;
131 cout << "Showers can also be written in the linked_tracks.root file, or " << endl;
132 cout << "in the Shower.root file. But this file stores the showers just as " << endl;
133 cout << "a tree with leafs and the object structure is lost. " << endl;
134 cout << endl;
135 cout << "WARNING:: EdbShowerRec::EdbShowerRec(EdbPVRec* pvr) DO NOTHING YET !!!" << endl;
136 cout << "PLEASE DO THESE STEPS MANUALLY UNTIL SHOWER LIBRARY IS FULLY FUNCTIONAL" << endl;
137 cout << "By stopping here, we avoid misunderstandings when all in one is done but not yet fully tested." << endl;
138 cout << endl;
139 cout << "----------------------------------------------------------" << endl;
140
141 Init();
142 Set0();
143 SetEdbPVRec(pvr);
144
145}
void SetEdbPVRec(EdbPVRec *Ali)
Definition: EdbShowerRec.h:629

◆ EdbShowerRec() [4/4]

EdbShowerRec::EdbShowerRec ( EdbPVRec pvr,
Int_t  OptionType 
)

Constructor giving a EdbPVRec object directly and an option number:

150{
152 cout << "----------------------------------------------------------" << endl;
153 cout << "EdbShowerRec::EdbShowerRec(EdbPVRec *pvr, Int_t OptionType) " << endl;
154 cout << " Constructor giving a EdbPVRec object directly and an option number:" << endl;
155 cout << " OptionType = " << OptionType << endl;
156 cout << "----------------------------------------------------------" << endl;
157 cout << " 0: Set Initial Values, do nothing more." << endl;
158 cout << " 1: Check EdbPVRec object (presence, bg dens), do nothing more." << endl;
159 cout << " 2: Check other Input objects (linked_tracks.root, feedback file), do nothing more." << endl;
160 cout << " 3: Do normal (electron) reconstruction using Cone Tube algorithm (OI implementation)" << endl;
161 cout << " 4: Do pair search (gamma) reconstruction using GS algorithm." << endl;
162 cout << " 5: Do both Reco and ID+Energy estimations." << endl;
163 cout << " -1: Do everything possible!" << endl;
164 cout << "----------------------------------------------------------" << endl;
165
166
167 Init();
168 Set0();
169
170 if (OptionType==1) {
171 EdbPVRQuality* qual = new EdbPVRQuality(pvr);
172 EdbPVRec *pvr_new=qual->GetEdbPVRec();
173 SetEdbPVRec(pvr_new);
174 }
175 if (OptionType==2) {
176 // check here if original pvr has tracks and/or vertices
177 // check here if linked_tracks.root exists, if feedback file exits
178 cout << "if (OptionType==2) .." << endl;
179 }
180 if (OptionType==3) {
181 // start reco for OI algo here...
182 cout << "if (OptionType==3) .." << endl;
183 }
184 if (OptionType==4) {
185 // start reco for OI algo here...
186 cout << "if (OptionType==4) .." << endl;
187 }
188 if (OptionType==5) {
189 // Invoke ID and Energy estimation here...
190 cout << "if (OptionType==5) .." << endl;
191 }
192
193
194
195}
Root Class Definition for EdbPVRQuality.
Definition: EdbPVRQuality.h:38
EdbPVRec * GetEdbPVRec()
Definition: EdbPVRQuality.h:232
Definition: EdbPVRec.h:148

◆ ~EdbShowerRec()

EdbShowerRec::~EdbShowerRec ( )
virtual

Default Destructor.

199{
201 delete eInBTArray;
202 delete eRecoShowerArray;
203}
TObjArray * eInBTArray
Definition: EdbShowerRec.h:115
TObjArray * eRecoShowerArray
Definition: EdbShowerRec.h:121

Member Function Documentation

◆ AddInitiatorBT()

int EdbShowerRec::AddInitiatorBT ( EdbSegP seg)

Check if eInBTArray array exits, otherwise create.

2403{
2405 if (!eInitiatorBTIsCreated) {
2406 eInBTArray=new TObjArray(9999);
2408 }
2409 // Add the segment to the eInBTArray array
2410 eInBTArray->Add(seg);
2411
2412 if (gEDBDEBUGLEVEL>2) cout << "EdbShowerRec::AddInitiatorBT(seg) added. Now entries in eInBTArray: ";
2413 if (gEDBDEBUGLEVEL>2) cout << eInBTArray->GetEntries() << endl;
2414
2415 eInBTArrayIsFilled=kTRUE;
2416 return 1;
2417}
Bool_t eInBTArrayIsFilled
Definition: EdbShowerRec.h:91
Bool_t eInitiatorBTIsCreated
Definition: EdbShowerRec.h:90

◆ CalcTrackDensity()

void EdbShowerRec::CalcTrackDensity ( EdbPattern pat_interim,
Int_t  pat_interim_halfsize,
Int_t &  npat_int,
Int_t &  npat_total,
Int_t &  npatN 
)
4859{
4860 if (gEDBDEBUGLEVEL>3) cout << "-------------void EdbShowerRec::CalcTrackDensity(&pat_interim,pat_interim_halfsize,&npat_int,&npat_total)"<<endl;
4861 npat_int=pat_interim->GetN();
4862 if (npat_int<=0) return;
4863 npat_total+=npat_int;
4864 ++npatN;
4865 if (npatN>0) trackdensb=(Float_t)npat_total/(Float_t)npatN/pat_interim_halfsize/pat_interim_halfsize/4.0*1000.0*1000.0; // BT/mm2
4866 if (gEDBDEBUGLEVEL>3) {
4867 cout << "npat_int = " << npat_int << endl;
4868 cout << "npat_total = " << npat_total << endl;
4869 cout << "npatN = " << npatN << endl;
4870 cout << "shower_trackdensb = " << trackdensb << endl;
4871 }
4872 return;
4873}
Int_t GetN() const
Definition: EdbPattern.h:65
Float_t trackdensb
Track density around the shower (BT/mm2) (using eAli_Sub_halfsize).
Definition: EdbShowerRec.h:213

◆ CalculateEnergyValues()

void EdbShowerRec::CalculateEnergyValues ( )

=C= --------------—will be deprecated soon----------—


—CreateANNTree:



—CreateEnergyResolutionFitFunction:



—Extract the desired profile


2451{
2453
2454 if (gEDBDEBUGLEVEL>2) cout << "------------------------------------------------------"<<endl;
2455 if (gEDBDEBUGLEVEL>2) cout << "void EdbShowerRec::CalculateEnergyValues()"<<endl;
2456 if (gEDBDEBUGLEVEL>2) cout << "------------------------------------------------------"<<endl;
2457
2458// if (!gROOT->GetClass("TMultiLayerPerceptron")) {
2459// cout << "Need to load libMLP seperately"<<endl;
2460// gSystem->Load("libMLP");
2461// }
2462
2463 //gEDBDEBUGLEVEL=3;
2464
2465
2471
2477
2483
2484 return;
2485}
void Energy_CreateANNTree()
Definition: EdbShowerRec.cxx:3027
void Energy_ExtractShowerParametrisationProfile()
Definition: EdbShowerRec.cxx:2510
void Energy_CreateEnergyResolutionFitFunction()
Definition: EdbShowerRec.cxx:2987

◆ CheckEdbPVRecSetUseAliSub()

void EdbShowerRec::CheckEdbPVRecSetUseAliSub ( )

Small function that test the ratio of MC/Data basetracks in the volume.
If ratio is high (>20%), and number of InitiatorBTN is mediate (<1000),
then we will use the SetUseAliSub(1) option, which means:
-faster reconstruction, but higher memory consumption.
If not we switch to the standard reco method SetUseAliSub(0):
-lower reconstruction, but stable memory consumption.

3903{
3910
3911 cout << "void EdbShowerRec::CheckEdbPVRecSetUseAliSub()" << endl;
3912 cout << "void EdbShowerRec::CheckEdbPVRecSetUseAliSub() GetUseAliSub() = " << GetUseAliSub() << endl;
3913
3914 if (gEDBDEBUGLEVEL>2) {
3915 cout << "void EdbShowerRec::CheckEdbPVRecSetUseAliSub() " << eAli << endl;
3916 cout << "void EdbShowerRec::CheckEdbPVRecSetUseAliSub() " << GetEdbPVRecNSeg(eAli,3) << endl;
3917 cout << "void EdbShowerRec::CheckEdbPVRecSetUseAliSub() " << eInBTArrayN << endl;
3918 }
3919
3920 if (NULL==eAli) return;
3921 if (GetEdbPVRecNSeg(eAli,3)<0.20) return;
3922 if (eInBTArrayN>1000) return;
3923
3924 // If we arrived here, it might be time to switch to the fast reconstruction!
3925 SetUseAliSub(1);
3926
3927 cout << "EdbShowerRec::CheckEdbPVRecSetUseAliSub() We arrived here, so it might be time to switch to the fast reconstruction!" << endl;
3928 cout << "EdbShowerRec::CheckEdbPVRecSetUseAliSub() GetUseAliSub() = " << GetUseAliSub() << endl;
3929
3930 return;
3931}
Float_t GetEdbPVRecNSeg(EdbPVRec *ali, Int_t mode)
Definition: EdbShowerRec.cxx:3862
Bool_t GetUseAliSub()
Definition: EdbShowerRec.h:678
void SetUseAliSub(Bool_t UseAliSub)
Definition: EdbShowerRec.h:625
Int_t eInBTArrayN
Definition: EdbShowerRec.h:116
EdbPVRec * eAli
Definition: EdbShowerRec.h:100
#define NULL
Definition: nidaqmx.h:84

◆ ClearInBTArray()

void EdbShowerRec::ClearInBTArray ( )
4270 {
4271 if (eInBTArrayN>0) eInBTArray->Clear();
4272 eInBTArrayN=0;
4273 return;
4274}

◆ ClearRecoShowerArray()

void EdbShowerRec::ClearRecoShowerArray ( )
4275 {
4276 if (eRecoShowerArrayN>0) eRecoShowerArray->Clear();
4278 return;
4279}
Int_t eRecoShowerArrayN
Definition: EdbShowerRec.h:122

◆ DeltaR_WithoutPropagation()

Double_t EdbShowerRec::DeltaR_WithoutPropagation ( EdbSegP s,
EdbSegP stest 
)

Calculate Delta R of two segments using no z propagation.

3529{
3531 return TMath::Sqrt((s->X()-stest->X())*(s->X()-stest->X())+(s->Y()-stest->Y())*(s->Y()-stest->Y()));
3532}
Float_t X() const
Definition: EdbSegP.h:173
Float_t Y() const
Definition: EdbSegP.h:174

◆ DeltaR_WithPropagation()

Double_t EdbShowerRec::DeltaR_WithPropagation ( EdbSegP s,
EdbSegP stest 
)

Calculate Delta R of two segments.
If they have different Z positions, then first segment in the argument of the bracket
is propagated to the position of the second segment.

3512{
3516 if (s->Z()==stest->Z()) return TMath::Sqrt((s->X()-stest->X())*(s->X()-stest->X())+(s->Y()-stest->Y())*(s->Y()-stest->Y()));
3517 Double_t zorig;
3518 Double_t dR;
3519 zorig=s->Z();
3520 s->PropagateTo(stest->Z());
3521 dR=TMath::Sqrt( (s->X()-stest->X())*(s->X()-stest->X())+(s->Y()-stest->Y())*(s->Y()-stest->Y()) );
3522 s->PropagateTo(zorig);
3523 return dR;
3524}
Float_t Z() const
Definition: EdbSegP.h:153

◆ DeltaThetaComponentwise()

Double_t EdbShowerRec::DeltaThetaComponentwise ( EdbSegP s1,
EdbSegP s2 
)

Calculate Delta Theta of two segments.
Be aware that this DeltaTheta function returns the difference between the component values of dTheta!!!
Acutally this function should be the normal way to calculate dTheta correctly...

3495{
3500 Double_t tx1,tx2,ty1,ty2;
3501 tx1=s1->TX();
3502 tx2=s2->TX();
3503 ty1=s1->TY();
3504 ty2=s2->TY();
3505 Double_t dt= TMath::Sqrt( (tx1-tx2)*(tx1-tx2) + (ty1-ty2)*(ty1-ty2) );
3506 return dt;
3507}
Float_t TX() const
tangens = deltaX/deltaZ
Definition: EdbSegP.h:175
Float_t TY() const
tangens = deltaY/deltaZ
Definition: EdbSegP.h:176
EdbSegP * s1
Definition: tlg2couples.C:29
EdbSegP * s2
Definition: tlg2couples.C:30

◆ eEANN()

TMultiLayerPerceptron * EdbShowerRec::eEANN ( )
private

shower length ("nfilmb");

◆ Energy_CalcSigma()

Float_t EdbShowerRec::Energy_CalcSigma ( Float_t  Energy,
Int_t  NPlatesNr 
)

=C= --------------—will be deprecated soon----------—
To understand where these values come from, please look in
the note of energy measurement by FWM. to be found on the opera doc server.
=C= --------------------------------------------------—

3008{
3013 Float_t SigmaParametrizationArray[8][3]= { { 1.27,0.0,0.28}, {0.79,0.0,0.26}, {0.48,0.0,0.23}, {0.50,0.0,0.15} ,{0.49,0.0,0.10} ,{0.50,0.17,0.04}, {0.49,0.24,0.00},{0.45,0.37,0.03} };
3014
3015 eEnergyResolutionFitFunction_All->SetParameter(0,SigmaParametrizationArray[type][0]);
3016 eEnergyResolutionFitFunction_All->SetParameter(1,SigmaParametrizationArray[type][1]);
3017 eEnergyResolutionFitFunction_All->SetParameter(2,SigmaParametrizationArray[type][2]);
3018
3019 Float_t CalcSigma = eEnergyResolutionFitFunction_All->Eval(Energy);
3020 return CalcSigma;
3021}
TF1 * eEnergyResolutionFitFunction_All
Definition: EdbShowerRec.h:156
Int_t type
Definition: EdbShowerRec.h:244

◆ Energy_CorrectEnergy()

Float_t EdbShowerRec::Energy_CorrectEnergy ( Float_t  MeasuredEnergy,
Int_t  NPlatesNr 
)

=C= --------------—will be deprecated soon----------—
=C= Correct the given ANN Energy linear according
=C= to the formula
=C= E_corr = 1/p1 * ( E_meas -p0 )
=C= p1,p0 are different for the plate numbers.
=C= --------------------------------------------------—

2949{
2956 Float_t p0[8];
2957 Float_t p1[8];
2958 Float_t CorrEnergy;
2959 // New Values
2960 p0[0]=1.01;
2961 p1[0]=2.83; // 11 Plates
2962 p0[1]=1.07;
2963 p1[1]=1.48; // 16 Plates
2964 p0[2]=0.97;
2965 p1[2]=1.03; // 21 Plates
2966 p0[3]=0.98;
2967 p1[3]=0.89; // 26 Plates
2968 p0[4]=0.92;
2969 p1[4]=1.05; // 31 Plates
2970 p0[5]=0.90;
2971 p1[5]=1.03; // 36 Plates
2972 p0[6]=0.88;
2973 p1[6]=1.07; // 41 Plates
2974 p0[7]=0.87;
2975 p1[7]=1.10; // 46 Plates
2976 if (gEDBDEBUGLEVEL>2) cout << "void EdbShowerRec::Energy_CorrectEnergy() === NPlatesNr p0[NPlatesNr] " << NPlatesNr << " " << p0[NPlatesNr] << endl;
2977 CorrEnergy= 1.0/p1[NPlatesNr] * ( MeasuredEnergy-p0[NPlatesNr] );
2978
2979 return CorrEnergy;
2980}

◆ Energy_CreateANNTree()

void EdbShowerRec::Energy_CreateANNTree ( )

=C= --------------—will be deprecated soon----------—

DEBUG // inANN = new Double_t[70];

3028{
3030
3031 if (gEDBDEBUGLEVEL>2) cout << "------------------------------------------"<<endl;
3032 if (gEDBDEBUGLEVEL>2) cout << "void EdbShowerRec::Energy_CreateANNTree()"<<endl;
3033 if (gEDBDEBUGLEVEL>2) cout << "------------------------------------------"<<endl;
3034
3035 //=C= Load MLP Root Class:
3036// if (!gROOT->GetClass("TMultiLayerPerceptron")) {
3037// gSystem->Load("libMLP");
3038// }
3039 if (gEDBDEBUGLEVEL>2) cout << "EdbShowerRec::Energy_CreateANNTree() === Load(libMLP) done." << endl;
3040
3041 //=C= -----------------------------------------------------
3042 //=C=
3043 //=C= -----------------------------------------------------
3044 //=C= Explanation: ReconstructedPlatesArray[ReconstructedPlatesNr]:
3045 //=C= for BTs per each EmulsionNr (11,16,21..56)
3046 //=C= Explanation: 4: dR, dT: mean and rms.
3047 //=C= Explanation: 1: number of Basetracks
3048 //=C= Explanation: [0]: type=energy of the Shower
3049 //=C= For the FJ Profile we have 1+4+(11,16,21=NumberOfPlates)... InputNeurons:
3050 //=C= -----------------------------------------------------
3051 //=C= We Create different instances of ANNs for different shower lengths:
3052 //=C= -----------------------------------------------------
3054 ANNInterimTreeInputvariables = new TTree("ANNInterimTreeInputvariables","ANNInterimTreeInputvariables");
3055 ANNInterimTreeInputvariables -> Branch("inANN", inANN, "inANN[70]/D");
3056 //=C= -----------------------------------------------------
3057
3058 if (gEDBDEBUGLEVEL>2) cout << "EdbShowerRec::Energy_CreateANNTree() === CreateANNTree() is done."<<endl;
3059 //gEDBDEBUGLEVEL=3;
3060
3061 Int_t ReconstructedPlatesArray[] = {11,16,21,26,31,36,41,46};
3062 Int_t NrOfANNInputNeurons[] = {11,16,21,26,31,36,41,46};
3063 eEnergyANN = new TObjArray(9);
3064
3065 //=C= -----------------------------------------------------
3066 //=C= This ANN Layout has the following form:
3067 //=C= inputNeurons : hiddenLayer1 : hiddenLayer2 : type
3068 //=C= inANN[1],...,inANN[x] : NrOfANNInputNeurons+1 : NrOfANNInputNeurons : inANN[0]
3069 //=C= -----------------------------------------------------
3070
3071 for (Int_t i=0; i<8; ++i) {
3072 NrOfANNInputNeurons[i]=NrOfANNInputNeurons[i]+1+4;
3073 TString layout="";
3074 //=C= -----------------------------------------------------
3075 for (Int_t j=1; j<NrOfANNInputNeurons[i]; ++j) layout += "@inANN["+TString(Form("%d",j))+"],";
3076 layout += "@inANN["+TString(Form("%d",NrOfANNInputNeurons[i]))+"]:"+TString(Form("%d",NrOfANNInputNeurons[i]+1))+":"+TString(Form("%d",NrOfANNInputNeurons[i]));
3077 layout+=":inANN[0]/1000"; //if (Geant4) ([E]=MeV) //else layout+=":inANN[0]"; (Geant3) ([E]=GeV)
3078 //=C= -----------------------------------------------------
3079// eEnergyANN[i]
3080 TMultiLayerPerceptron* eEANN = new TMultiLayerPerceptron(layout,ANNInterimTreeInputvariables,"","(Entry$)%2");
3081
3082 //=C= -----------------------------------------------------
3083 if (gEDBDEBUGLEVEL>2) cout << "EdbShowerRec::Energy_CreateANNTree() === ANN_MLP->GetStructure() : " << eEANN->GetStructure().Data() << endl ;
3084 if (gEDBDEBUGLEVEL>2) cout << "EdbShowerRec::Energy_CreateANNTree() === LoadANNWeightFile():"<<endl;
3085
3086 TString weightfilestring=TString(gSystem->ExpandPathName("$FEDRA_ROOT"))+TString("/src/libShower/")+TString(Form("EnergyMeasurement_WeightFile_%d_Plates.txt",ReconstructedPlatesArray[i]));
3087
3088 if (gEDBDEBUGLEVEL>2) cout << "EdbShowerRec::Energy_CreateANNTree() === weightfilestring= " << weightfilestring.Data() << endl;
3089
3090
3091 eEANN->LoadWeights(weightfilestring);
3092 eEnergyANN->Add(eEANN);
3093 }
3094 //=C= -----------------------------------------------------
3095
3096 if (gEDBDEBUGLEVEL>2) cout << "EdbShowerRec::Energy_CreateANNTree() === is done."<<endl;
3097 return;
3098}
ParaSet Branch("CUT_BACK_DMIN",&cut_back_dmin,"CUT_BACK_DMIN/D")
TMultiLayerPerceptron * eEANN()
shower length ("nfilmb");
Double_t inANN[70]
Definition: EdbShowerRec.h:155
TTree * ANNInterimTreeInputvariables
Definition: EdbShowerRec.h:154
TObjArray * eEnergyANN
Container for the ANNs trained on different.
Definition: EdbShowerRec.h:148

◆ Energy_CreateEnergyResolutionFitFunction()

void EdbShowerRec::Energy_CreateEnergyResolutionFitFunction ( )
2988{
2989 //=C= -----------------will be deprecated soon-------------
2990 eEnergyResolutionFitFunction_All = new TF1("EnergyResolutionFitFunction_All","TMath::Sqrt([0]*[0]/sqrt(x)/sqrt(x)+[2]*[2]+[1]*[1]/x/x)",0.9,48.0);
2991 eEnergyResolutionFitFunction_All->SetParameter(0,0.5); //Initialize with A=50%
2992 eEnergyResolutionFitFunction_All->SetParameter(1,0.2); //Initialize with B=20%
2993 eEnergyResolutionFitFunction_All->SetParameter(2,0.1); //Initialize with C=10%
2994 eEnergyResolutionFitFunction_All->SetParName(0,"ResolutionFactor A");
2995 eEnergyResolutionFitFunction_All->SetParName(1,"ResolutionFactor B");
2996 eEnergyResolutionFitFunction_All->SetParName(2,"ResolutionFactor C");
2997 eEnergyResolutionFitFunction_All->SetLineColor(2);
2998 eEnergyResolutionFitFunction_All->SetParLimits(0,0,2);
2999 eEnergyResolutionFitFunction_All->SetParLimits(1,0,2);
3000 eEnergyResolutionFitFunction_All->SetParLimits(2,0,2);
3001
3002 return;
3003}

◆ Energy_ExtractShowerParametrisationProfile()

void EdbShowerRec::Energy_ExtractShowerParametrisationProfile ( )

DEBUG --------------------------------—

DEBUG --------------------------------—

DEBUG OPTION

DEBUG OPTION

DEBUG OPTION

DEBUG OPTION

DEBUG OPTION

2511{
2512 if (gEDBDEBUGLEVEL>2) cout << "------------------------------------------------------"<<endl;
2513 if (gEDBDEBUGLEVEL>2) cout << "void EdbShowerRec::Energy_ExtractShowerParametrisationProfile()"<<endl;
2514 if (gEDBDEBUGLEVEL>2) cout << "------------------------------------------------------"<<endl;
2515 //ouput file
2516 fileout3 = new TFile("Shower.root","RECREATE");
2517 treesaveb3 = new TTree("treebranch","tree of branchtrack");
2518 treesaveb3->Branch("number_eventb",&number_eventb,"number_eventb/I");
2519 treesaveb3->Branch("sizeb",&sizeb,"sizeb/I");
2520 treesaveb3->Branch("sizeb15",&sizeb15,"sizeb15/I");
2521 treesaveb3->Branch("sizeb20",&sizeb20,"sizeb20/I");
2522 treesaveb3->Branch("sizeb30",&sizeb30,"sizeb30/I");
2523 treesaveb3->Branch("output15",&output15,"output15/F");
2524 treesaveb3->Branch("output20",&output20,"output20/F");
2525 treesaveb3->Branch("output30",&output30,"output30/F");
2526 treesaveb3->Branch("output50",&output50,"output50/F");
2527 treesaveb3->Branch("eProb90",&eProb90,"eProb90/I");
2528 treesaveb3->Branch("eProb1",&eProb1,"eProb1/I");
2529 treesaveb3->Branch("E_MC",&E_MC,"E_MC/F");
2530 treesaveb3->Branch("idb",idb,"idb[sizeb]/I");
2531 treesaveb3->Branch("plateb",plateb,"plateb[sizeb]/I");
2532 treesaveb3->Branch("showerID",&showerID,"showerID/I");
2533 treesaveb3->Branch("isizeb",&isizeb,"isizeb/I");
2534 treesaveb3->Branch("xb",xb,"xb[sizeb]/F");
2535 treesaveb3->Branch("yb",yb,"yb[sizeb]/F");
2536 treesaveb3->Branch("zb",zb,"zb[sizeb]/F");
2537 treesaveb3->Branch("txb",txb,"txb[sizeb]/F");
2538 treesaveb3->Branch("tyb",tyb,"tyb[sizeb]/F");
2539 treesaveb3->Branch("nfilmb",nfilmb,"nfilmb[sizeb]/I");
2540 treesaveb3->Branch("ntrace1simub",ntrace1simub,"ntrace1simu[sizeb]/I");
2541 treesaveb3->Branch("ntrace2simub",ntrace2simub,"ntrace2simu[sizeb]/I");
2542 treesaveb3->Branch("ntrace3simub",ntrace3simub,"ntrace3simu[sizeb]/F");
2543 treesaveb3->Branch("ntrace4simub",ntrace4simub,"ntrace4simu[sizeb]/I");
2544 treesaveb3->Branch("chi2btkb",chi2btkb,"chi2btkb[sizeb]/F");
2545 treesaveb3->Branch("deltarb",deltarb,"deltarb[sizeb]/F");
2546 treesaveb3->Branch("deltathetab",deltathetab,"deltathetab[sizeb]/F");
2547 treesaveb3->Branch("deltaxb",deltaxb,"deltaxb[sizeb]/F");
2548 treesaveb3->Branch("deltayb",deltayb,"deltayb[sizeb]/F");
2549 treesaveb3->Branch("purityb",&purityb,"purityb/F");
2550 treesaveb3->Branch("trackdensb",&trackdensb,"trackdensb/F");
2551 treesaveb3->Branch("tagprimary",tagprimary,"tagprimary[sizeb]/F");
2552
2553 treesaveb3->Branch("mcDigitIndexTop",mcDigitIndexTop,"mcDigitIndexTop[sizeb]/I");
2554 treesaveb3->Branch("mcDigitIndexBottom",mcDigitIndexBottom,"mcDigitIndexBottom[sizeb]/I");
2555
2556 treesaveb3->Branch("Energy",&EnergyCorrectedb,"EnergyCorrectedb/F");
2557 treesaveb3->Branch("EnergyUnCorrected",&EnergyUnCorrectedb,"EnergyUnCorrectedb/F");
2558 treesaveb3->Branch("EnergySigma",&EnergySigmaCorrectedb,"EnergySigmaCorrectedb/F");
2559 treesaveb3->Branch("EnergySigmaUnCorrected",&EnergySigmaUnCorrectedb,"EnergySigmaUnCorrectedb/F");
2560
2561 // -------------------------------------------------------------
2562 // If no showerTree was created we have to load the ShowerTree
2563 // most probably from an already reconstructed file.
2564 // Float_t energy_shot_particle;
2566 // Get Treebranch:
2567 // Either from shower file (then it has to be casted) or from the
2568 // reconstruction, then its automatically there.
2569 if (!eShowerTreeIsDone) {
2570 treesaveb = (TTree*)(FileReconstructedShowerTree->Get("treebranch"));
2571 treesaveb->SetBranchAddress("nfilmb", nfilmb);
2572 treesaveb->SetBranchAddress("sizeb", &sizeb);
2573 treesaveb->SetBranchAddress("sizeb15", &sizeb15);
2574 treesaveb->SetBranchAddress("sizeb20", &sizeb20);
2575 treesaveb->SetBranchAddress("sizeb30", &sizeb30);
2576 treesaveb->SetBranchAddress("output15", &output15);
2577 treesaveb->SetBranchAddress("output20", &output20);
2578 treesaveb->SetBranchAddress("output30", &output30);
2579 treesaveb->SetBranchAddress("output50", &output50);
2580 treesaveb->SetBranchAddress("eProb1", &eProb1);
2581 treesaveb->SetBranchAddress("eProb90", &eProb90);
2582 treesaveb->SetBranchAddress("isizeb", &isizeb);
2583 treesaveb->SetBranchAddress("chi2btkb", &chi2btkb);
2584 treesaveb->SetBranchAddress("tagprimary", tagprimary);
2585 treesaveb->SetBranchAddress("txb", txb);
2586 treesaveb->SetBranchAddress("tyb", tyb);
2587 treesaveb->SetBranchAddress("xb", xb);
2588 treesaveb->SetBranchAddress("yb", yb);
2589 treesaveb->SetBranchAddress("zb", zb);
2590 treesaveb->SetBranchAddress("showerID", &showerID);
2591 treesaveb->SetBranchAddress("plateb", plateb);
2592 treesaveb->SetBranchAddress("idb", idb);
2593 treesaveb->SetBranchAddress("deltarb", deltarb);
2594 treesaveb->SetBranchAddress("deltathetab", deltathetab);
2595 treesaveb->SetBranchAddress("number_eventb", &number_eventb);
2596 treesaveb->SetBranchAddress("ntrace1simub", &ntrace1simub);
2597 treesaveb->SetBranchAddress("ntrace2simub", &ntrace2simub);
2598 treesaveb->SetBranchAddress("ntrace3simub", &ntrace3simub);
2599 treesaveb->SetBranchAddress("ntrace4simub", &ntrace4simub);
2600 treesaveb->SetBranchAddress("purityb", &purityb);
2601 treesaveb->SetBranchAddress("trackdensb", &trackdensb);
2602 treesaveb->SetBranchAddress("E_MC", &E_MC);
2603 treesaveb->SetBranchAddress("Energy", &EnergyCorrectedb);
2604 treesaveb->SetBranchAddress("EnergyUnCorrected", &EnergyUnCorrectedb);
2605 treesaveb->SetBranchAddress("EnergySigma", &EnergySigmaCorrectedb);
2606 treesaveb->SetBranchAddress("EnergySigmaUnCorrected", &EnergySigmaUnCorrectedb);
2607 }
2608 else {
2609 ; /* treesaveb already declared and filled. */
2610 }
2611 // -------------------------------------------------------------
2612
2613
2614 // Just local variables which are neeeded once for the shower parametrisation...
2615 Float_t Dr[57];
2616 Float_t X0[57];
2617 Float_t Y0[57];
2618 Float_t TX0=0. ,TY0=0.;
2619 Float_t theta[57];
2620 Float_t dist;
2621 Int_t nentries_e;
2622 Int_t nentries_withisizeb=0;
2623 Int_t NumberOfPlates;
2624 Int_t sizeb_for_plates;
2625 Float_t BT_deltaR_mean;
2626 Float_t BT_deltaR_rms;
2627 Float_t BT_deltaT_mean;
2628 Float_t BT_deltaT_rms;
2629 Int_t longprofile[57]; // Depens on how much sheets;
2630 Int_t numberofilms;
2631 Float_t EnergyMC;
2632 TString histname;
2633 TH1D *histo_nbtk;
2634 TH1D *histo_longprofile;
2635 TH1D* histo_deltaR;
2636 TH1D* histo_deltaT;
2637 // Just local variables which are neeeded once for the shower parametrisation...END
2638
2639 //gEDBDEBUGLEVEL=3;
2640
2641 // Create ShowerProfileTree ...
2642
2643 if (gEDBDEBUGLEVEL>2) cout << "void EdbShowerRec::Energy_ExtractShowerParametrisationProfile(): Create ShowerProfileTree ..."<<endl;
2644 fileout3->cd();
2645 ShowerParametrisationTree = new TTree("ShowerProfileTree","ShowerProfileTree");
2646
2647 ShowerParametrisationTree->Branch("sizeb_for_plates",&sizeb_for_plates,"sizeb_for_plates/I");
2648 ShowerParametrisationTree->Branch("BT_deltaR_mean",&BT_deltaR_mean,"BT_deltaR_mean/F");
2649 ShowerParametrisationTree->Branch("BT_deltaR_rms",&BT_deltaR_rms,"BT_deltaR_rms/F");
2650 ShowerParametrisationTree->Branch("BT_deltaT_mean",&BT_deltaT_mean,"BT_deltaT_mean/F");
2651 ShowerParametrisationTree->Branch("BT_deltaT_rms",&BT_deltaT_rms,"BT_deltaT_rms/F");
2652 ShowerParametrisationTree->Branch("longprofile",longprofile,"longprofile[58]/I");
2653 ShowerParametrisationTree->Branch("numberofilms",&numberofilms,"numberofilms/I");
2654 ShowerParametrisationTree->Branch("EnergyMC",&E_MC,"EnergyMC/F");
2655
2656 ShowerParametrisationTree->Branch("Energy",&EnergyCorrectedb,"EnergyCorrectedb/F");
2657 ShowerParametrisationTree->Branch("EnergyUnCorrected",&EnergyUnCorrectedb,"EnergyUnCorrectedb/F");
2658 ShowerParametrisationTree->Branch("EnergySigma",&EnergySigmaCorrectedb,"EnergySigmaCorrectedb/F");
2659 ShowerParametrisationTree->Branch("EnergySigmaUnCorrected",&EnergySigmaUnCorrectedb,"EnergySigmaUnCorrectedb/F");
2660
2661 //=C= -----------------------------------------------------
2662 histname="histo_nbtk_av";
2663 histo_nbtk_av = new TH1D(histname,"Avergage basetrack numbers",21,0.0,210.0);
2664 histname="histo_longprofile_av";
2665 histo_longprofile_av = new TH1D(histname,"Basetracks per emulsion number",56,0.0,56.0);
2666 histname="histo_deltaR_mean";
2667 histo_deltaR_mean = new TH1D(histname,"Mean #deltar of all BTs in one shower",61,0.0,61.0);
2668 histname="histo_deltaT_mean";
2669 histo_deltaT_mean = new TH1D(histname,"Mean #delta#theta of all BTs in one shower",50,0.0,0.05);
2670 histname="histo_deltaR_rms";
2671 histo_deltaR_rms = new TH1D(histname,"RMS #deltar of all BTs in one shower",61,0.0,61.0);
2672 histname="histo_deltaT_rms";
2673 histo_deltaT_rms = new TH1D(histname,"RMS #delta#theta of all BTs in one shower",50,0.0,0.025);
2674 //=C= These Histos are for each Shower Entrie filled new
2675 histname="histo_nbtk";
2676 histo_nbtk = new TH1D(histname,"Basetracks in the shower",250,0.0,250.0);
2677 histname="histo_longprofile";
2678 histo_longprofile = new TH1D(histname,"Basetracks per emulsion number",56,0.0,56.0);
2679 histname="histo_deltaR";
2680 histo_deltaR = new TH1D(histname,"Mean #deltar of all BTs in Shower",100,0.0,100.0);
2681 histname="histo_deltaT";
2682 histo_deltaT = new TH1D(histname,"Mean #delta#theta of all BTs in Shower",100,0.0,0.05);
2683 //=C= -----------------------------------------------------
2684 eHistEnergyNominal = new TH1F("eHistEnergyNominal","eHistEnergyNominal",100,0,20);
2685 eHistEnergyCorrectedb = new TH1F("eHistEnergyCorrectedb","eHistEnergyCorrectedb",100,0,20);
2686 eHistEnergyUnCorrectedb = new TH1F("eHistEnergyUnCorrectedb","eHistEnergyUnCorrectedb",100,0,20);
2687 //=C= -----------------------------------------------------
2688 histo_nbtk_av->Reset();
2689 histo_nbtk->Reset();
2690 histo_longprofile_av->Reset();
2691 histo_deltaR_mean->Reset();
2692 histo_deltaT_mean->Reset();
2693 histo_deltaR_rms->Reset();
2694 histo_deltaT_rms->Reset();
2695 //=C= -----------------------------------------------------
2696
2697 //=C= Again Define some Variables used for calculating:
2698 nentries_e = (Int_t) treesaveb -> GetEntries();
2699 for (Int_t j = 0; j<57; ++j) {
2700 Dr[j] = 0.03*j*1273. +20.0;
2701 }
2702 Float_t zmax=0;
2703 Float_t zmin=0;
2704
2705 //=C= -----------------------------------------------------
2706 Double_t params[70];
2707 Double_t val;
2708 Double_t val_corr;
2709 Double_t sigma_val_corr;
2710 Double_t sigma_val;
2711
2712 Int_t NrOfANNInputNeurons[]= {11,16,21,26,31,36,41,46};
2713 for (Int_t i=0; i<8; ++i) NrOfANNInputNeurons[i]=NrOfANNInputNeurons[i]+1+4;
2714 //=C= -----------------------------------------------------
2715
2716 cout << "void EdbShowerRec::Energy_ExtractShowerParametrisationProfile(): Loop over reconstructed showers (=" << nentries_e << " total)."<< endl;
2717 //=C= -----------------------------------------------------
2718 //=C= Loop over reconstructed Showers (Entries):
2719 for (Int_t ige = 0; ige < nentries_e; ++ige) {
2720
2722 // if (ige>5&&ige<nentries_e-5) continue;
2723 // if (ige>900) continue;
2724 // if (ige<nentries_e-900) continue;
2726
2727 if (ige%50==0) cout<<"=== Doing Entry "<< ige << endl;
2728 treesaveb->GetEntry(ige);
2729 if (gEDBDEBUGLEVEL>3) treesaveb->Show(ige);
2730
2731 // GetEnergyMC:
2732 EnergyMC=E_MC;
2733 if (gEDBDEBUGLEVEL>2) cout << "void EdbShowerRec::Energy_ExtractShowerParametrisationProfile() === EnergyMC= "<< EnergyMC << endl;
2734
2735 // Search for local zmax and zmin in the whole shower event to
2736 // guess from that the number of plates...
2737 zmax=0;
2738 zmin=0; // Reinit zmax, min;
2739 for (Int_t j=0; j<sizeb; ++j) {
2740 if (zb[j]>zmax) zmax=zb[j];
2741 if (zb[j]<zmin) zmin=zb[j];
2742 }
2743 if (gEDBDEBUGLEVEL>2) cout << "void EdbShowerRec::Energy_ExtractShowerParametrisationProfile() === zmax= "<< zmax << endl;
2744 if (gEDBDEBUGLEVEL>2) cout << "void EdbShowerRec::Energy_ExtractShowerParametrisationProfile() === zmin= "<< zmin << endl;
2745
2746 // Calculate the plates.
2747 Int_t pl=int(zmax-zmin)/1273+1;
2748 NumberOfPlates=pl;
2749 if (gEDBDEBUGLEVEL>2) cout << "void EdbShowerRec::Energy_ExtractShowerParametrisationProfile() === pl= "<< pl << endl;
2750
2751 // Make sure that its at least 1 or more...
2752 NumberOfPlates=max(NumberOfPlates,1);
2753 NumberOfPlates=min(NumberOfPlates,57);
2754 if (gEDBDEBUGLEVEL>2) cout << "void EdbShowerRec::Energy_ExtractShowerParametrisationProfile() === NumberOfPlates= "<< NumberOfPlates << endl;
2755
2756
2757 histo_longprofile ->Reset();
2758 histo_deltaR ->Reset();
2759 histo_deltaT ->Reset();
2760 for (int id=0; id<57; id++) {
2761 theta[id]= 0;
2762 X0[id] = id*1273.*txb[0] + xb[0];
2763 Y0[id] = id*1273.*tyb[0] + yb[0];
2764 longprofile[id]=-1;
2765 }
2766 if (tagprimary[0]==1) {
2767 TX0 = txb[0];
2768 TY0 = tyb[0];
2769 }
2770 ++nentries_withisizeb;
2771
2772 sizeb_for_plates=0;
2773 numberofilms=NumberOfPlates;
2774 if (gEDBDEBUGLEVEL>2) cout << "void EdbShowerRec::Energy_ExtractShowerParametrisationProfile() === numberofilms= " << numberofilms <<endl;
2775
2776 //=C= -----------------------------------------------------
2777 //=C= loop over the basetracks in the shower (boucle sur les btk)
2778 for (Int_t ibtke = 0; ibtke < sizeb; ibtke++) {
2779 dist = sqrt((xb[ibtke]- X0[nfilmb[ibtke]-1])*(xb[ibtke]- X0[nfilmb[ibtke]-1])+(yb[ibtke]- Y0[nfilmb[ibtke]-1])*(yb[ibtke]- Y0[nfilmb[ibtke]-1]));
2780 // inside the cone
2781 if (dist<Dr[nfilmb[ibtke]-1]&&nfilmb[ibtke]<=numberofilms) {
2782
2783 histo_longprofile ->Fill(nfilmb[ibtke]);
2784 histo_longprofile_av ->Fill(nfilmb[ibtke]);
2785 theta[nfilmb[ibtke]]+= (TX0-txb[ibtke])*(TX0-txb[ibtke])+(TY0-tyb[ibtke])*(TY0-tyb[ibtke]);
2786
2787 if (nfilmb[ibtke]<=numberofilms) {
2788 ++sizeb_for_plates;
2789 }
2790 if (ibtke>0&&nfilmb[ibtke]<=numberofilms) {
2791 histo_deltaR ->Fill(deltarb[ibtke]);
2792 histo_deltaT ->Fill(deltathetab[ibtke]);
2793 }
2794 }
2795 }//=C= END OF loop over the basetracks in the shower
2796 //=C= -----------------------------------------------------
2797
2798 if (gEDBDEBUGLEVEL>2) cout << "void EdbShowerRec::Energy_ExtractShowerParametrisationProfile() === ige sizeb_for_plates sizeb" << ige << " " << sizeb_for_plates <<" " << sizeb << endl;
2799 if (gEDBDEBUGLEVEL>2) cout << "void EdbShowerRec::Energy_ExtractShowerParametrisationProfile() === histo_deltaR->GetMean() histo_deltaT->GetMean()" << histo_deltaR->GetMean() << " " << histo_deltaT->GetMean() <<" " << endl;
2800 if (gEDBDEBUGLEVEL>2) cout << "void EdbShowerRec::Energy_ExtractShowerParametrisationProfile() === histo_deltaR->GetRMS() histo_deltaT->GetRMS()" << histo_deltaR->GetRMS() << " " << histo_deltaT->GetRMS() <<" " << endl;
2801
2802 //=C= Fill NumberBT Hist----Just temporary....for all showers:
2803 histo_nbtk ->Fill(sizeb_for_plates);
2804 histo_nbtk_av ->Fill(sizeb_for_plates);
2805 //=C= Fill dR,dT Mean and RMS Histos for all showers:
2806 histo_deltaR_mean ->Fill(histo_deltaR->GetMean());
2807 histo_deltaT_mean ->Fill(histo_deltaT->GetMean());
2808 histo_deltaR_rms ->Fill(histo_deltaR->GetRMS());
2809 histo_deltaT_rms ->Fill(histo_deltaT->GetRMS());
2810
2811 //=C= -----------------------------------------------------
2812 // "Variable" 0 describes the (MonteCarlo) energy of the particle
2813 // energy_shot_particle; (if there)
2814 // Variable 1 corresponds to number of Basetracks in the Shower.
2815 // sizeb;
2816 // Variable 2,3,4,5 corresponds to dR, mean,rms; dT, mean,rms;
2817 BT_deltaR_mean=histo_deltaR->GetMean();
2818 BT_deltaR_rms=histo_deltaR->GetRMS();
2819 BT_deltaT_mean=histo_deltaT->GetMean();
2820 BT_deltaT_rms=histo_deltaT->GetRMS();
2821 // Variables longprofile[...] corresponds to BinEntries Of the longitudialProfile (averaged):
2822 // Take Care!! BinContent(0) is the UnderflowBin! so it has to go from 0 (plate1) to nbfilm+1 (f.e.plate11->nbfilm+1=12) !
2823 for (Int_t i=1; i<=numberofilms+1; ++i) {
2824 longprofile[i-1] = int(histo_longprofile->GetBinContent(i));
2825 }
2826 //=C= -----------------------------------------------------
2827
2828
2829 //=C= -----------------------------------------------------
2830 //=C= --- Here we differentiate which Platetype we have.
2831 //=C= --- Can be for each Shower different!
2832 Int_t type=0;
2833 if (gEDBDEBUGLEVEL>2) cout << "void EdbShowerRec::Energy_ExtractShowerParametrisationProfile() === NumberOfPlates " << NumberOfPlates << endl;
2834 if (NumberOfPlates<16) {
2835 type=0;
2836 }
2837 if (NumberOfPlates>=16 && NumberOfPlates<21) {
2838 type=1;
2839 }
2840 if (NumberOfPlates>=21 && NumberOfPlates<26) {
2841 type=2;
2842 }
2843 if (NumberOfPlates>=26 && NumberOfPlates<31) {
2844 type=3;
2845 }
2846 if (NumberOfPlates>=31 && NumberOfPlates<36) {
2847 type=4;
2848 }
2849 if (NumberOfPlates>=36 && NumberOfPlates<41) {
2850 type=5;
2851 }
2852 if (NumberOfPlates>=41 && NumberOfPlates<46) {
2853 type=6;
2854 }
2855 if (NumberOfPlates>=46) {
2856 type=7;
2857 }
2858 if (gEDBDEBUGLEVEL>2) cout << "void EdbShowerRec::Energy_ExtractShowerParametrisationProfile() === Type " << type << endl;
2859 //=C= -----------------------------------------------------
2860
2861
2862 //=C= -----------------------------------------------------
2863 //=C= Fill the ANN Inputvariables
2864 //=C= For the specific Sample
2865 //=C= -----------------------------------------------------
2866 if (gEDBDEBUGLEVEL>2) cout << "void EdbShowerRec::Energy_ExtractShowerParametrisationProfile() === " << ige;
2867 if (gEDBDEBUGLEVEL>2) cout << " type= " << type << endl;
2868 // Reset All inANN Values to Zero:
2869 for (Int_t j=0; j<70; j++) {
2870 inANN[j]=0;
2871 }
2872
2873 // Variable 0 corresponds to the "type" i.e. to the Energy of the Shower.
2874 inANN[0]= EnergyMC;
2875 // Variable 1 corresponds to number of Basetracks in the Shower.
2876 inANN[1]= sizeb_for_plates;
2877 // Variable 2,3,4,5 corresponds to dR, mean,rms; dT, mean,rms;
2878 inANN[2]= BT_deltaR_mean;
2879 inANN[3]= BT_deltaR_rms;
2880 inANN[4]= BT_deltaT_mean;
2881 inANN[5]= BT_deltaT_rms;
2882 // Variable 6... (end) to the longitudinale profile...
2883 for (Int_t j=0; j<numberofilms; j++) inANN[6+j]=longprofile[j+1];
2884 //=C= -----------------------------------------------------
2885
2886
2887 //---------------Parameters as param array suited for ANN to evaluate: ---------------
2888 // Reset All Values to Zero:
2889 for (Int_t j=0; j<70; j++) {
2890 params[j]=0;
2891 }
2892 //=C= NeuralNetworkLayout: check to which layout this specific shower belongs:
2893 for (Int_t j=1; j<=NrOfANNInputNeurons[type]; ++j) {
2894 params[j-1]=inANN[j];
2895 if (gEDBDEBUGLEVEL>3) cout << "void EdbShowerRec::Energy_ExtractShowerParametrisationProfile() === j params[j-1]=inANN[j] " << j<< " " << params[j-1] << " " << inANN[j] << endl;
2896 }
2897
2898
2899 //--- Main Core Part: Evaluate function of Neural Network, specific to the
2900 //--- ANN which is usefull for the shower length!
2901 //------------------------------------------
2902 TMultiLayerPerceptron* mlp= (TMultiLayerPerceptron*)eEnergyANN->At(type);
2903 val=mlp->Evaluate(0,params);
2904 val_corr=Energy_CorrectEnergy(val, type);
2905 //------------------------------------------
2906 sigma_val=Energy_CalcSigma(val, type);
2907 sigma_val_corr=Energy_CalcSigma(val_corr, type);
2908 //------------------------------------------
2909
2910 //------------------------------------------
2911 EnergyCorrectedb=val_corr;
2913 EnergySigmaCorrectedb=sigma_val_corr;
2914 EnergySigmaUnCorrectedb=sigma_val;
2915 EnergyMC=E_MC;
2916 //------------------------------------------
2917
2918 if (gEDBDEBUGLEVEL>3) cout << "void EdbShowerRec::Energy_ExtractShowerParametrisationProfile() === " << mlp->GetStructure().Data() <<endl;
2919 if (gEDBDEBUGLEVEL>2) cout << "void EdbShowerRec::Energy_ExtractShowerParametrisationProfile() === EnergyUnCorrectedb, EnergyCorrectedb,EnergyMC: " << EnergyUnCorrectedb << " == " << EnergyCorrectedb << " " << EnergyMC << endl;
2920 if (gEDBDEBUGLEVEL>2) cout << "void EdbShowerRec::Energy_ExtractShowerParametrisationProfile() === EnergySigmaCorrectedb, EnergySigmaUnCorrectedb: " << EnergySigmaUnCorrectedb << " == " << EnergySigmaCorrectedb << " " << endl;
2921
2922 eHistEnergyUnCorrectedb->Fill(val);
2923 eHistEnergyCorrectedb->Fill(val_corr);
2924 eHistEnergyNominal->Fill( inANN[0]/1000. );
2925
2927 treesaveb3->Fill();
2928 //--------------------------------------------------------------------
2929 } //=C= END of Loop over reconstructed Showers (Entries):
2930 cout << "Loop over reconstructed Showers finished."<< endl;
2931
2932 // Scale histo_longprofile_av to number of entries:
2933 histo_longprofile_av->Scale(1.0/nentries_withisizeb);
2934
2935 // Write to File:
2936 fileout3->cd();
2937 treesaveb3->Write();
2938 fileout3->Close();
2939
2940 eEnergyIsDone=kTRUE;
2941 return;
2942}
brick X0
Definition: RecDispMC.C:112
cout<< tr-> GetEntries()<< endl
float min(TClonesArray *t)
Definition: bitview.cxx:275
Int_t ntrace2simub[10000]
Definition: EdbShowerRec.h:195
Float_t tagprimary[10000]
Definition: EdbShowerRec.h:203
Float_t ntrace3simub[10000]
Definition: EdbShowerRec.h:196
Int_t sizeb30
sizeb30: basetracks within the first 30 plates
Definition: EdbShowerRec.h:174
Int_t ntrace4simub[10000]
Definition: EdbShowerRec.h:197
Float_t yb[10000]
position of segment i
Definition: EdbShowerRec.h:188
Float_t output30
old neural net variables for e/pi separation
Definition: EdbShowerRec.h:177
Int_t sizeb15
sizeb15: basetracks within the first 15 plates
Definition: EdbShowerRec.h:172
Float_t Energy_CalcSigma(Float_t Energy, Int_t NPlatesNr)
Definition: EdbShowerRec.cxx:3007
TH1D * histo_nbtk_av
Definition: EdbShowerRec.h:583
Int_t showerID
??? forgot what it was ???
Definition: EdbShowerRec.h:184
Float_t xb[10000]
position of segment i
Definition: EdbShowerRec.h:187
TH1D * histo_deltaT_rms
Definition: EdbShowerRec.h:588
Float_t output50
old neural net variables for e/pi separation
Definition: EdbShowerRec.h:178
Int_t eProb1
Definition: EdbShowerRec.h:216
Float_t chi2btkb[10000]
Definition: EdbShowerRec.h:198
Bool_t eShowerTreeIsDone
ShowerReconstruction already done or not.
Definition: EdbShowerRec.h:143
Int_t eProb90
Definition: EdbShowerRec.h:215
Int_t mcDigitIndexBottom[1000]
Definition: EdbShowerRec.h:205
Int_t number_eventb
definition of treebranch
Definition: EdbShowerRec.h:171
Float_t purityb
purity of the shower (MC info needed).
Definition: EdbShowerRec.h:212
void LoadShowerFile(TString ShowerFileName)
Definition: EdbShowerRec.cxx:2491
TFile * fileout3
Definition: EdbShowerRec.h:225
Int_t sizeb20
sizeb20: basetracks within the first 20 plates
Definition: EdbShowerRec.h:173
TH1F * eHistEnergyCorrectedb
Definition: EdbShowerRec.h:138
Float_t output15
old neural net variables for e/pi separation
Definition: EdbShowerRec.h:175
Int_t isizeb
??? forgot what it was ???
Definition: EdbShowerRec.h:183
TH1D * histo_longprofile_av
Definition: EdbShowerRec.h:584
Float_t Energy_CorrectEnergy(Float_t MeasuredEnergy, Int_t NPlatesNr)
Definition: EdbShowerRec.cxx:2948
Int_t mcDigitIndexTop[1000]
Definition: EdbShowerRec.h:204
Float_t output20
old neural net variables for e/pi separation
Definition: EdbShowerRec.h:176
Float_t deltathetab[10000]
Definition: EdbShowerRec.h:200
Bool_t eEnergyIsDone
EnergyEstimation already done or not.
Definition: EdbShowerRec.h:145
TTree * treesaveb3
Definition: EdbShowerRec.h:226
Float_t EnergyUnCorrectedb
Definition: EdbShowerRec.h:208
Float_t deltarb[10000]
Definition: EdbShowerRec.h:199
Int_t ntrace1simub[10000]
Definition: EdbShowerRec.h:194
Int_t idb[10000]
??? forgot what it was ???
Definition: EdbShowerRec.h:185
TH1F * eHistEnergyNominal
Definition: EdbShowerRec.h:137
Int_t nfilmb[10000]
plate position of segment i w.r.t. starting segment.
Definition: EdbShowerRec.h:192
Float_t EnergySigmaCorrectedb
Definition: EdbShowerRec.h:209
Int_t sizeb
number of basetracks
Definition: EdbShowerRec.h:182
Float_t txb[10000]
position of segment i
Definition: EdbShowerRec.h:190
Float_t deltayb[10000]
Definition: EdbShowerRec.h:202
Float_t zb[10000]
position of segment i
Definition: EdbShowerRec.h:189
Float_t EnergySigmaUnCorrectedb
Definition: EdbShowerRec.h:210
TH1D * histo_deltaR_mean
Definition: EdbShowerRec.h:585
Float_t E_MC
energy of the first starting basetrack
Definition: EdbShowerRec.h:179
TFile * FileReconstructedShowerTree
Definition: EdbShowerRec.h:229
TH1D * histo_deltaT_mean
Definition: EdbShowerRec.h:586
Float_t EnergyCorrectedb
Definition: EdbShowerRec.h:207
TTree * ShowerParametrisationTree
Definition: EdbShowerRec.h:231
TTree * treesaveb
Definition: EdbShowerRec.h:219
TH1D * histo_deltaR_rms
Definition: EdbShowerRec.h:587
Float_t tyb[10000]
position of segment i
Definition: EdbShowerRec.h:191
Float_t deltaxb[10000]
Definition: EdbShowerRec.h:201
TH1F * eHistEnergyUnCorrectedb
Definition: EdbShowerRec.h:139
Int_t plateb[10000]
plate id of segment i
Definition: EdbShowerRec.h:186
int max
Definition: check_shower.C:41
UInt_t id
Definition: tlg2couples.C:117
TMultiLayerPerceptron * mlp
Definition: testBGReduction_By_ANN.C:61
Double_t params[3]
Definition: testBGReduction_By_ANN.C:84

◆ Execute()

void EdbShowerRec::Execute ( )

CALCULATE NEWACTUALPID NUMBER BY GETPATTERNSUCCEDING:

======================== WRITE TO FILE..... ====================================================== ======================== TEMPORARY SOLUTION TO ACCES FUNCTION NEURALNET AND ENERGY .....========== ======================== Transfer ..... ======================================================

3938{
3939 cout << "EdbShowerRec::Execute()" << endl;
3940 cout << "EdbShowerRec::Execute DOING MAIN SHOWER RECONSTRUCTION HERE" << endl;
3941 cout << "EdbShowerRec::Execute USE Standard CONETUBE ALGO with Standard Parameters." << endl;
3942
3943 // Check if the eRecoShowerArray exists, if not create it;
3944 if (!eRecoShowerArray) eRecoShowerArray=new TObjArray();
3945 //cout << "eRecoShowerArray->GetEntries() " << eRecoShowerArray->GetEntries() << endl;
3946
3947 // Check the use of eAliSub or not:
3949
3950
3951 EdbSegP* InBT;
3952 EdbSegP* Segment;
3953 EdbTrackP* RecoShower;
3954
3955 Bool_t StillToLoop=kTRUE;
3956 Int_t ActualPID;
3957 Int_t newActualPID;
3958 Int_t STEP=-1;
3959 Int_t NLoopedPattern=0;
3960
3961 Int_t eLastPlate_eAliPID=0;
3962 Int_t eFirstPlate_eAliPID=0;
3963 Float_t eLastPlate_eAliPIDZ=0;
3964 Float_t eFirstPlate_eAliPIDZ=0;
3965
3966 // Already defined as private variable:
3969 if (gEDBDEBUGLEVEL>2) {
3970 cout << " eAliNpat = " << eAliNpat << endl;
3971 }
3972
3973
3974 // "First Plate" means always the one most upstream, i.e. the lowest Z position
3975 // "Last Plate" means always the one most downstream, i.e. the highest Z position
3976 if (eAli->GetPattern(0)->Z() > eAli->GetPattern(eAliNpatM1)->Z()) {
3977 eLastPlate_eAliPID=eAli->GetPattern(0)->PID();
3978 eFirstPlate_eAliPID=eAli->GetPattern(eAliNpatM1)->PID();
3979 eLastPlate_eAliPIDZ=eAli->GetPattern(0)->Z();
3980 eFirstPlate_eAliPIDZ=eAli->GetPattern(eAliNpatM1)->Z();
3981 }
3982 else {
3983 eLastPlate_eAliPID=eAli->GetPattern(eAliNpatM1)->PID();
3984 eFirstPlate_eAliPID=eAli->GetPattern(0)->PID();
3985 eLastPlate_eAliPIDZ=eAli->GetPattern(eAliNpatM1)->Z();
3986 eFirstPlate_eAliPIDZ=eAli->GetPattern(0)->Z();
3987 }
3988
3989 if (gEDBDEBUGLEVEL>1) {
3990 cout << "EdbShowerRec::Execute() eAli->GetPattern(0)->Z() > eAli->GetPattern(eAliNpatM1)->Z() " << eAli->GetPattern(0)->Z()<< " " << eAli->GetPattern(eAliNpatM1)->Z() << endl;
3991 cout << "EdbShowerRec::Execute() eLastPlate_eAliPID = " << eLastPlate_eAliPID << endl;
3992 cout << "EdbShowerRec::Execute() eFirstPlate_eAliPID = " << eFirstPlate_eAliPID << endl;
3993 cout << "EdbShowerRec::Execute() eLastPlate_eAliPIDZ = " << eLastPlate_eAliPIDZ << endl;
3994 cout << "EdbShowerRec::Execute() eFirstPlate_eAliPIDZ = " << eFirstPlate_eAliPIDZ << endl;
3995 cout << endl;
3996 }
3997// DEBUG!!!!
3998
3999 if (eFirstPlate_eAliPID<eLastPlate_eAliPID) STEP=-1;
4000 if (eFirstPlate_eAliPID>eLastPlate_eAliPID) STEP=1;
4001 if (gEDBDEBUGLEVEL>1) cout << "EdbShowerRec::Execute STEP for patternloop direction = " << STEP << endl;
4002
4003 //--- Loop over InBTs:
4004 if (gEDBDEBUGLEVEL>1) {
4005 cout << "EdbShowerRec::Execute Loop over InBTs:" << endl;
4006 cout << "EdbShowerRec::Execute ("<< eInBTArrayN << "):" << endl;
4007 }
4008
4009
4010
4011 // Since eInBTArray is usually filled in ascending ordering by zpositon
4012 // We use the descending loop to begin with BT with lowest z first.
4013 for (Int_t i=eInBTArrayN-1; i>=0; --i) {
4014// for (Int_t i=eInBTArrayN-1; i==eInBTArrayN-1; --i) {
4015
4016 // CounterOutPut
4017 if (gEDBDEBUGLEVEL==2) if ((i%1)==0) cout << eInBTArrayN <<" InBT in total, still to do:"<<Form("%4d",i)<< "\r\r\r\r"<<flush;
4018 if (gEDBDEBUGLEVEL==3) cout << eInBTArrayN <<" InBT in total, still to do:"<< i << endl;
4019
4020 //-----------------------------------
4021 // 1) Make local_gAli with cut parameters:
4022 //-----------------------------------
4023
4024 // Create new Shower Object for storage;
4025 // For the moment this is treated as an "EdbTrackP" object...
4026 RecoShower = new EdbTrackP(*(EdbSegP*)eInBTArray->At(i));
4027
4028 // Get InitiatorBT from eInBTArray
4029 InBT=(EdbSegP*)eInBTArray->At(i);
4030 if (gEDBDEBUGLEVEL>2) {
4031 cout << " " << endl;
4032 cout << "EdbShowerRec::Execute() Start reconstruction for Initiator BaseTrack:" << endl;
4033 InBT->PrintNice();
4034 }
4035
4036 // Add InBT to RecoShower:
4037 // This has to be done, since by definition the first BT in the RecoShower is the InBT.
4038 // Otherwise, also the definition of shower axis and transversal profiles is wrong!
4039 RecoShower -> AddSegment(InBT);
4040 // Attention: If you have a EdbTrackP object and you add a segment, then
4041 // you have to manually set Counters for N(), NPl(). It is not done auto.
4042 RecoShower -> SetCounters();
4043 //cout << "Segment (InBT) " << Segment << " was added to RecoShower." << endl;
4044
4045 // Transform (make size smaller, extract only events having same MC) the eAli object:
4046 Transform_eAli(InBT);
4047 if (gEDBDEBUGLEVEL>3) eAli_Sub->Print();
4048 Int_t npat_int=0;
4049 Int_t npat_total=0;
4050 Int_t npatN=0;
4051 // Get greatest Z Value:
4052 Double_t greatestZValueofeAliSub=TMath::Max(eAli_Sub->GetPattern(0)->Z(),eAli_Sub->GetPattern(eAli_Sub->Npatterns()-1)->Z());
4053 if (gEDBDEBUGLEVEL>2) cout << "EdbShowerRec::Execute--- --- greatest Z value of eAliSub= " << greatestZValueofeAliSub << endl;
4054
4055
4056 //-----------------------------------
4057 // 2) Loop over (whole) eAli, check BT for Cuts
4058 // eAli_Sub
4059 // We have to sort the Initiator PID and pattern PID,
4060 // since the sample of Bari has shown that these two PIDs maybe
4061 // not necessaryly be the same!!!
4062 //-----------------------------------
4063
4064
4065 EdbPattern* patternActualPID = eAli_Sub->GetPatternByZ(InBT->Z());
4066 ActualPID = patternActualPID->PID();
4067 newActualPID = ActualPID ;
4068 //InBT->PrintNice();
4069 //cout << endl;
4070
4071 while (StillToLoop) {
4072 if (gEDBDEBUGLEVEL>2) cout << "EdbShowerRec::Execute--- --- Doing patterloop for PID: " << ActualPID << ", for patterns Z position: " << eAli_Sub->GetPatternByPID(ActualPID)->Z() << endl;
4073
4074 patternActualPID = eAli_Sub->GetPatternByPID(ActualPID);
4075
4076 // This reco Alg we take only BTs that come downstream the InBT:
4077 // (should now never hapen anymore).
4078 if (patternActualPID->Z() < InBT->Z() ) {
4079 cout << "WARNING : patternActualPID->Z() < InBT->Z() " << endl;
4080 continue;
4081 }
4082
4083 for (Int_t btloop_cnt=0; btloop_cnt<patternActualPID->GetN(); ++btloop_cnt) {
4084
4085 Segment = (EdbSegP*)patternActualPID->GetSegment(btloop_cnt);
4086
4087 if (gEDBDEBUGLEVEL>4) {
4088 cout << "Checking Segment " << btloop_cnt << endl;
4089 Segment->PrintNice();
4090 }
4091
4092
4093 // Now apply cut conditions: Cut for Quality: --------------------
4094 if ( (eUseQualityPar==kTRUE) && (Segment->Chi2()>Segment->W()*eQualityPar[0]-eQualityPar[1]) ) {
4095 continue;
4096 }
4097
4098
4099 // Now apply cut conditions: OI OfficialImplementation Alg --------------------
4100 if ( !IsInConeTube(Segment, InBT, eAlgoParameterConeRadius , eAlgoParameterConeAngle) ) continue;
4101 //cout << "Segment " << Segment << " passed IsInConeTube"<<endl;
4102 if ( !FindPrecedingBTs(Segment, InBT, eAli_Sub, RecoShower)) continue;
4103 if (gEDBDEBUGLEVEL>4) cout << "Segment " << Segment << " passed FindPrecedingBTs"<<endl;
4104 // end of cut conditions: OI OfficialImplementation Alg --------------------
4105
4106 // If we arrive here, Basetrack Segment has passed criteria
4107 // and is then added to the RecoShower:
4108 // Check if its not the InBT which is already added:
4109 if (Segment->X()==InBT->X()&&Segment->Y()==InBT->Y()) {
4110 ; // is InBT, do nothing;
4111 }
4112 else {
4113 RecoShower -> AddSegment(Segment);
4114 // Attention: If you have a EdbTrackP object and you add a segment, then
4115 // you have to manually set Counters for N(), NPl(). It is not done auto.
4116 RecoShower -> SetCounters();
4117 }
4118 if (gEDBDEBUGLEVEL>4) cout << "Segment " << Segment << " was added at &Segment : " << &Segment << endl;
4119
4120 } // of btloop_cnt
4121
4122
4123 if (gEDBDEBUGLEVEL>2) {
4124 cout << "EdbShowerRec::Execute--- --- ActualPID= " << ActualPID << " done. Reconstructed shower has up to now: " << RecoShower->N() << " Segments." << endl;
4125 cout << "EdbShowerRec::Execute--- --- NLoopedPattern = " << NLoopedPattern << " until now. " << endl;
4126 }
4127
4128
4129 // Calc BT density around shower:
4130 EdbPattern* pat_interim = patternActualPID;
4131 CalcTrackDensity(pat_interim,eAli_Sub_halfsize,npat_int,npat_total,npatN);
4132
4133 //------------
4135 EdbPattern* pat_ActualSucceeding;
4136 pat_ActualSucceeding = eAli_Sub->GetPatternSucceding( patternActualPID ) ;
4137
4138
4139 if (pat_ActualSucceeding!=NULL) {
4140
4141 // Set New Values:
4142 newActualPID = pat_ActualSucceeding->PID();
4143 ++NLoopedPattern;
4144
4145 //cout <<"patternActualPID : at,PID,Z " << patternActualPID << " " << patternActualPID->PID() << " " << patternActualPID->Z() << endl;
4146 //cout <<"pat_ActualSucceeding: at,PID,Z " << pat_ActualSucceeding << " " << pat_ActualSucceeding->PID() << " " << pat_ActualSucceeding->Z() << endl;
4147 }
4148
4149
4150 // DAU user solution for stopping the loop:
4151 if (pat_ActualSucceeding==NULL) {
4152 StillToLoop=kFALSE;
4153 if (gEDBDEBUGLEVEL>2) cout << "EdbShowerRec::Execute--- ---Stopp Loop since: pat_ActualSucceeding==NULL"<<endl;
4154 }
4155
4156 if (gEDBDEBUGLEVEL>3) {
4157 cout << "EdbShowerRec::Execute--- --- StillToLoop= " << StillToLoop << endl;
4158 cout << "EdbShowerRec::Execute--- ---ActualPID= " << ActualPID <<" Finished. Take newActualPID = " << newActualPID << " now. (this is end of while (StillToLoop) ) " << endl;
4159 }
4160
4161 ActualPID=newActualPID;
4162 //cout << endl << endl;
4163 } // of // while (StillToLoop)
4164
4165
4166 if (gEDBDEBUGLEVEL>2) cout << "Finshed __while (StillToLoop)__ . Now Adding reconstructed shower to the array (only in case it has two or more Basetracks) of reconstructed showers ..." << endl;
4167 if (gEDBDEBUGLEVEL>2) cout << "Shower Has ..." << RecoShower->N() << " basetracks in it." << endl;
4168
4169 // Add Shower Object to Shower Reco Array.
4170 // Not, if its empty or containing only one BT:
4171 if (RecoShower->N()>1) eRecoShowerArray->Add(RecoShower);
4172 // cout << "DEBUG_TEST eRecoShowerArray->Add(RecoShower);" << endl;
4173 // cout << "is eRecoShowerArray existing anyway??? " << eRecoShowerArray << endl;
4174
4175 // Set back loop values:
4176 StillToLoop=kTRUE;
4177 NLoopedPattern=0;
4178
4179 } // of // for (Int_t i=eInBTArrayN-1; i>=0; --i) {
4180
4181
4182 // Set new value for eRecoShowerArrayN (may now be < eInBTArrayN).
4184
4185 if (gEDBDEBUGLEVEL>2) cout << "EdbShowerRec::eRecoShowerArray() Entries: " << eRecoShowerArray->GetEntries() << endl;
4186 if (gEDBDEBUGLEVEL>2) cout << "EdbShowerRec::Execute()...done." << endl;
4187
4189
4190
4195 NeuralNet();
4197
4198
4199
4200 cout << "======================== " << eQualityPar[0] << endl;
4201 cout << "======================== " << eQualityPar[1] << endl;
4202 return;
4203}
EdbPattern * GetPatternByPID(int pid)
Definition: EdbPVRec.cxx:2902
Definition: EdbPattern.h:273
int PID() const
Definition: EdbPattern.h:320
Int_t Npatterns() const
Definition: EdbPattern.h:366
EdbPattern * GetPatternByZ(float z, float tolerance=5) const
EdbPattern* GetPatternByZ(float z) const;.
Definition: EdbPattern.cxx:1899
void Print() const
Definition: EdbPattern.cxx:1693
EdbPattern * GetPattern(int id) const
Definition: EdbPattern.cxx:1721
EdbPattern * GetPatternSucceding(EdbPattern *pat) const
Definition: EdbPattern.cxx:1845
Float_t Chi2() const
Definition: EdbSegP.h:157
void PrintNice() const
Definition: EdbSegP.cxx:392
Float_t W() const
Definition: EdbSegP.h:151
Float_t Z() const
Definition: EdbPattern.h:84
EdbSegP * GetSegment(int i) const
Definition: EdbPattern.h:66
Double_t eQualityPar[2]
Definition: EdbShowerRec.h:38
void CalculateEnergyValues()
Definition: EdbShowerRec.cxx:2450
Double_t eAlgoParameterConeRadius
Radius of spanning cone from first BT.
Definition: EdbShowerRec.h:29
void Transform_eAli(EdbSegP *InitiatorBT, Float_t ExtractSize)
Definition: EdbShowerRec.cxx:3724
Float_t eAli_Sub_halfsize
Definition: EdbShowerRec.h:102
void CalcTrackDensity(EdbPattern *pat_interim, Int_t pat_interim_halfsize, Int_t &npat_int, Int_t &npat_total, Int_t &npatN)
Definition: EdbShowerRec.cxx:4858
EdbPVRec * eAli_Sub
Definition: EdbShowerRec.h:101
Bool_t IsInConeTube(EdbSegP *TestingSegment, EdbSegP *StartingSegment, Double_t CylinderRadius, Double_t ConeAngle)
Definition: EdbShowerRec.cxx:3536
void PrintRecoShowerArray()
Definition: EdbShowerRec.cxx:3477
Double_t eAlgoParameterConeAngle
Opening angle of spanning cone from first BT.
Definition: EdbShowerRec.h:30
Bool_t eUseQualityPar
Definition: EdbShowerRec.h:39
void SetRecoShowerArrayN(Int_t RecoShowerArrayN)
Definition: EdbShowerRec.h:661
void NeuralNet()
Definition: EdbShowerRec.cxx:1920
void CheckEdbPVRecSetUseAliSub()
Definition: EdbShowerRec.cxx:3902
Int_t eAliNpat
Definition: EdbShowerRec.h:103
Bool_t FindPrecedingBTs(EdbSegP *s, EdbSegP *InBT, EdbPVRec *gAli, EdbTrackP *shower)
Definition: EdbShowerRec.cxx:4212
void TransferShowerObjectArrayIntoEntryOfTreebranchShowerTree(TObjArray *segarray)
Definition: EdbShowerRec.cxx:4285
Int_t eNumberPlate_eAliPID
Definition: EdbShowerRec.h:106
Int_t eAliNpatM1
Definition: EdbShowerRec.h:105
Definition: EdbPattern.h:113
Int_t N() const
Definition: EdbPattern.h:177

◆ Fill_eInBTArray_ByLinkTracks_eFilename_LinkedTracks()

void EdbShowerRec::Fill_eInBTArray_ByLinkTracks_eFilename_LinkedTracks ( )

Fill the Initiator Basetrack Array by the linked_tracks file,
that is given in the eFilename_LinkedTracks String.
We check, if the file exists, and if there are tracks inside.
If so, we fill Initiator Basetrack Array with (a copy of ) these tracks.


3604{
3610
3611 Log(2,"EdbShowerRec::Fill_eInBTArray_ByLinkTracks_eFilename_LinkedTracks","EdbShowerRec::Fill_eInBTArray_ByLinkTracks_eFilename_LinkedTracks.");
3612
3613 // -----------------
3614 // Check if file eFilename_LinkedTracks exits and if it has tracks inside....
3615 // ----------------- tODO
3616 cout << "EdbShowerRec::Fill_eInBTArray_ByLinkTracks_eFilename_LinkedTracks() TODO::CHECK IF " << eFilename_LinkedTracks <<" exists and if it has tracks inside!!!!" << endl;
3618
3619 EdbSegP* segment=0;
3620 EdbSegP* s2=0;
3621 EdbTrackP* t=0;
3622
3623 TFile * fil = new TFile(eFilename_LinkedTracks);
3624 fil->ls();
3625 TTree* tr= (TTree*)fil->Get("tracks");
3626 int nentr = 0;
3627 nentr =int(tr->GetEntries());
3628
3629 // check if tracks has entries: if so then ok, otherwise return directly:
3630 if (nentr>0) {
3631 ;
3632 }
3633 else {
3634 cout << "EdbShowerRec::Fill_eInBTArray_ByLinkTracks_eFilename_LinkedTracks() tracks file has NO entries...Return." << endl;
3635 return;
3636 }
3637
3638 TClonesArray *seg= new TClonesArray("EdbSegP",60);
3639
3640 // check if eInBTArray was created, if not do it now.:
3641 if (!eInBTArray) eInBTArray=new TObjArray(nentr);
3642
3643 int nseg,n0,npl;
3644 cout << nentr << " entries Total"<<endl;
3645 tr->SetBranchAddress("t." , &t );
3646 tr->SetBranchAddress("s" , &seg );
3647 tr->SetBranchAddress("nseg" , &nseg );
3648 tr->SetBranchAddress("n0" , &n0 );
3649 tr->SetBranchAddress("npl" , &npl );
3650
3651 for (int i=0; i<nentr; i++ ) {
3652 tr->GetEntry(i);
3653
3654 // Take first BT of the tracks:
3655 s2=(EdbSegP*) seg->At(0);
3656 // Clone it (otherwise it will be overtaken by the next one...)
3657 segment=(EdbSegP*)s2->Clone();
3658 // Add it to array
3659 eInBTArray->Add(segment);
3660 }
3661 delete tr;
3662 delete fil;
3663
3664 // Update Entry numbers.
3665 SetInBTArrayN(eInBTArray->GetEntries());
3666
3667 if (gEDBDEBUGLEVEL>2) cout << "EdbShowerRec::Fill_eInBTArray_ByLinkTracks_eFilename_LinkedTracks Printing InBTs" << endl;
3668 EdbSegP* testseg=0;
3669 for (int i=0; i<eInBTArrayN; i++ ) {
3670 if (gEDBDEBUGLEVEL>2) {
3671 testseg=(EdbSegP*)eInBTArray->At(i);
3672 testseg->PrintNice();
3673 }
3674 }
3675
3676 eInBTArrayIsFilled=kTRUE;
3677
3678 Log(2,"EdbShowerRec::Fill_eInBTArray_ByBaseTracksOf_eAli","EdbShowerRec::Fill_eInBTArray_ByBaseTracksOf_eAli. After TCut: InBT N=%d", eInBTArrayN );
3679 Log(2,"EdbShowerRec::Fill_eInBTArray_ByLinkTracks_eFilename_LinkedTracks","EdbShowerRec::Fill_eInBTArray_ByLinkTracks_eFilename_LinkedTracks...done.");
3680 return;
3681}
bool Log(int level, const char *location, const char *fmt,...)
Definition: EdbLog.cxx:75
TTree * tr
Definition: Shower_E_FromShowerRoot.C:5
void SetInBTArrayN(Int_t InBTArrayN)
Definition: EdbShowerRec.h:644
TString eFilename_LinkedTracks
Definition: EdbShowerRec.h:96
TTree * t
Definition: check_shower.C:4

◆ FindPrecedingBTs()

Bool_t EdbShowerRec::FindPrecedingBTs ( EdbSegP s,
EdbSegP InBT,
EdbPVRec gAli,
EdbTrackP shower 
)
4213{
4214 //cout << "EdbShowerRec::FindPrecedingBTs Find BTs to be connected with the Test BT:" << endl;
4215
4216 EdbSegP* s_TestBT;
4217 Int_t nentries=shower->N();
4218 Double_t dZ;
4219
4220 // In case the shower is empty we do not have to search for a preceeding BT:
4221 if (nentries==0) return kTRUE;
4222
4223 // We do not test BaseTracks which are before the initiator BaseTrack!
4224 if (s->Z()<InBT->Z()) {
4225 cout << "--- --- EdbShowerRec::FindPrecedingBTs(): s->Z()<InBT->Z()..: We do not test BaseTracks which are before the initiator BaseTrack! return kFALSE;" << endl;
4226 return kFALSE;
4227 }
4228
4229 // For the very first Z position we do not test
4230 // if testBT has Preceeders, only if it it has a BT around (case for e+e- coming from gammma):
4231 // Take 50microns and 80mrad in (dR/dT) around.
4232 // This does not affect the normal results, but helps for
4233 // events which may have a second BT close to InBT (like in e+e-)
4234 if (TMath::Abs(s->Z()-InBT->Z())<2.0) {
4235 //cout << "--- --- EdbShowerRec::FindPrecedingBTs(): s->Z()~InBT->Z()..: DeltaThetaComponentwise(s, InBT)= " << DeltaThetaComponentwise(s, InBT) << " << DeltaR_WithoutPropagation(s, InBT) = " << DeltaR_WithoutPropagation(s, InBT) << endl;
4236 if (DeltaThetaComponentwise(s, InBT) < 0.08 && DeltaR_WithoutPropagation(s, InBT) < 50.0 ) return kTRUE;
4237 }
4238
4239 if (gEDBDEBUGLEVEL>3) cout << "--- --- EdbShowerRec::FindPrecedingBTs(): Testing " << nentries << " entries of the shower." << endl;
4240
4241 for (Int_t i=nentries-1; i>=0; --i) {
4242 s_TestBT = (EdbSegP*)( shower->GetSegment(i) );
4243
4244 if (gEDBDEBUGLEVEL>3) cout << "--- --- EdbShowerRec::FindPrecedingBTs(): Do s_TestBT->ID() s->ID() s_TestBT->MCEvt() s_TestBT->Z() s->Z() "<< s_TestBT->ID() << " " << s->ID() << " " << s_TestBT->MCEvt() <<" " << s_TestBT->Z() << " " << s->Z() <<endl;
4245 if (gEDBDEBUGLEVEL>3) s_TestBT->PrintNice();
4246 if (gEDBDEBUGLEVEL>3) s->PrintNice();
4247
4248
4249 dZ=TMath::Abs(s_TestBT->Z()-s->Z());
4250 if (dZ<30) continue; // Exclude the case of same Zpositions...
4251 if (dZ>(eAlgoParameterNPropagation*1273.0)+650.0) continue; // Exclude the case of more than eAlgoParameterNPropagation plates before...
4252
4253 if (gEDBDEBUGLEVEL>3) cout << "--- --- EdbShowerRec::FindPrecedingBTs(): Checking dT,dR and dZ for i: " << i << " " << DeltaThetaComponentwise(s, s_TestBT) << " " << DeltaR_WithPropagation(s, s_TestBT) << " "<<dZ << endl;
4254
4255 if (DeltaThetaComponentwise(s, s_TestBT) > eAlgoParameterConnectionDT ) continue;
4256 if (DeltaR_WithPropagation(s, s_TestBT) > eAlgoParameterConnectionDR ) continue;
4257
4258 if (gEDBDEBUGLEVEL>3) cout << "--- --- EdbShowerRec::FindPrecedingBTs(): Checking dT,dR and dZ for i: " << i << " " << DeltaThetaComponentwise(s, s_TestBT) << " " << DeltaR_WithPropagation(s, s_TestBT) << " "<<dZ << " ok!"<<endl;
4259 return kTRUE;
4260 }
4261 //---------------------------------------------
4262 return kFALSE;
4263}
Int_t ID() const
Definition: EdbSegP.h:147
Int_t MCEvt() const
Definition: EdbSegP.h:145
Double_t DeltaR_WithPropagation(EdbSegP *s, EdbSegP *stest)
Definition: EdbShowerRec.cxx:3511
Int_t eAlgoParameterNPropagation
N plates backpropagating.
Definition: EdbShowerRec.h:35
Double_t eAlgoParameterConnectionDR
Connection Criterium: delta R.
Definition: EdbShowerRec.h:32
Double_t eAlgoParameterConnectionDT
Connection Criterium: delta T.
Definition: EdbShowerRec.h:33
Double_t DeltaR_WithoutPropagation(EdbSegP *s, EdbSegP *stest)
Definition: EdbShowerRec.cxx:3528
Double_t DeltaThetaComponentwise(EdbSegP *s1, EdbSegP *s2)
Definition: EdbShowerRec.cxx:3494
EdbSegP * GetSegment(int i) const
Definition: EdbPattern.h:195

◆ GetAlgoParameter()

Double_t EdbShowerRec::GetAlgoParameter ( Int_t  paranr)
4833{
4834 if (paranr==0) return eAlgoParameterConeRadius;
4835 else if (paranr==1) return eAlgoParameterConeAngle;
4836 else if (paranr==2) return eAlgoParameterConnectionDR;
4837 else if (paranr==3) return eAlgoParameterConnectionDT;
4838 else if (paranr==4) return eAlgoParameterNPropagation;
4839 else {
4840 return 0;
4841 }
4842}

◆ GetAliLoaded()

Bool_t EdbShowerRec::GetAliLoaded ( ) const
inline
690 {
691 return eAliLoaded;
692 }
Bool_t eAliLoaded
Definition: EdbShowerRec.h:108

◆ GetChi20()

Float_t EdbShowerRec::GetChi20 ( ) const
inline
269 {
270 return eChi20;
271 }
Float_t eChi20
Chi2 of the first shower segment.
Definition: EdbShowerRec.h:50

◆ GetChi2b()

Float_t EdbShowerRec::GetChi2b ( int  i) const
inline
331 {
332 return eChi2b[i];
333 }
Float_t eChi2b[10000]
Chi2 of basetrack.
Definition: EdbShowerRec.h:67

◆ GetDeltarb()

Float_t EdbShowerRec::GetDeltarb ( int  i) const
inline
346 {
347 return eDeltarb[i];
348 }
Float_t eDeltarb[10000]
Distance criteria of basetrack.
Definition: EdbShowerRec.h:72

◆ GetDeltathetab()

Float_t EdbShowerRec::GetDeltathetab ( int  i) const
inline
349 {
350 return eDeltathetab[i];
351 }
Float_t eDeltathetab[10000]
Angular criteria of basetrack.
Definition: EdbShowerRec.h:73

◆ GetDz()

Float_t EdbShowerRec::GetDz ( ) const
inline
287 {
288 return eDz;
289 }
Float_t eDz
length of the shower along Z
Definition: EdbShowerRec.h:57

◆ GetEdbPVRec()

EdbPVRec * EdbShowerRec::GetEdbPVRec ( ) const
inline
681 {
682 return eAli;
683 }

◆ GetEdbPVRecNpat()

Int_t EdbShowerRec::GetEdbPVRecNpat ( ) const
inline
684 {
685 return eAliNpat;
686 }

◆ GetEdbPVRecNplateNumber()

Int_t EdbShowerRec::GetEdbPVRecNplateNumber ( ) const
inline
687 {
689 }

◆ GetEdbPVRecNSeg()

Float_t EdbShowerRec::GetEdbPVRecNSeg ( EdbPVRec ali,
Int_t  mode 
)

Return Number of Segments (=BTs) in the EdbPVRec volume.
The mode number is used as following:
mode = 0 : return ALL BTs.
mode = 1 : return BTs with s->MCEvt() > 0 (MC)
mode = 2 : return BTs with s->MCEvt() < 0 (DATA)
mode = 3 : return fraction nTotalMC/(nTotal);

3863{
3870
3871 if (NULL==ali) return 0;
3872 Int_t nTotal=0;
3873 Int_t nTotalMC=0;
3874 Int_t nTotalDATA=0;
3875 Int_t npat=ali->Npatterns();
3876 for (Int_t ii=0; ii<npat; ++ii) {
3877 Int_t nseg=ali->GetPattern(ii)->N();
3878 nTotal+=nseg;
3879 for (Int_t jj=0; jj<nseg; ++jj) {
3880 EdbSegP* seg=ali->GetPattern(ii)->GetSegment(jj);
3881 if (seg->MCEvt()>0) ++nTotalMC;
3882 if (seg->MCEvt()<0) ++nTotalDATA;
3883 }
3884 }
3885 Float_t ratio=(Float_t)(nTotalMC)/(Float_t)(nTotal);
3886// cout << "nTotalDATA basetracks in volume: " << nTotalDATA << endl;
3887// cout << "nTotalMC basetracks in volume: " << nTotalMC << endl;
3888// cout << "nTotal basetracks in volume: " << nTotal << endl;
3889// cout << "ratio basetracks in volume: " << ratio << endl;
3890
3891 if (mode == 1) return (Float_t)nTotalMC;
3892 if (mode == 2) return (Float_t)nTotalDATA;
3893 if (mode == 3) return ratio;
3894 return (Float_t)nTotal;
3895
3896}
Int_t npat
Definition: Xi2HatStartScript.C:33
Int_t N() const
Definition: EdbPattern.h:86
EdbPVRec * ali
Definition: test_oracle.C:9

◆ GetEdbPVRecSub()

EdbPVRec * EdbShowerRec::GetEdbPVRecSub ( ) const
inline
693 {
694 return eAli_Sub;
695 }

◆ GetEnergy()

Float_t EdbShowerRec::GetEnergy ( ) const
inline
370 {
371 return eEnergyCorrectedb;
372 }
Float_t eEnergyCorrectedb
Neural Network output for Corrected Energy.
Definition: EdbShowerRec.h:131

◆ GetEnergySigma()

Float_t EdbShowerRec::GetEnergySigma ( ) const
inline
376 {
378 }
Float_t eEnergySigmaCorrectedb
Neural Network output for Corrected Energy Sigma.
Definition: EdbShowerRec.h:133

◆ GetEnergyUn()

Float_t EdbShowerRec::GetEnergyUn ( ) const
inline
373 {
374 return eEnergyUnCorrectedb;
375 }
Float_t eEnergyUnCorrectedb
Neural Network output for UnCorrected Energy.
Definition: EdbShowerRec.h:132

◆ GetEnergyUnSigma()

Float_t EdbShowerRec::GetEnergyUnSigma ( ) const
inline
379 {
381 }
Float_t eEnergySigmaUnCorrectedb
Neural Network output for UnCorrected Energy Sigma.
Definition: EdbShowerRec.h:134

◆ GetEnergyValues()

Float_t * EdbShowerRec::GetEnergyValues ( Int_t  TreeEntry)
3361{
3362 Float_t* dummy = new Float_t[5];
3363 dummy[0]=-999.;
3364 dummy[1]=-999.;
3365 dummy[2]=-999.;
3366 dummy[3]=-999.;
3367 dummy[4]=-999.;
3368
3369 cout << "eShowerTreeIsDone = " << eShowerTreeIsDone << endl;
3370
3371 if (!eShowerTreeIsDone) {
3372 cout << "EdbShowerRec::GetEnergyValues !eShowerTreeIsDone" << endl;
3373 LoadShowerFile("Shower.root");
3374 }
3375 // Get Treebranch:
3376 // Either from shower file (then it has to be casted) or from the
3377 // reconstruction, then its automatically there.
3378 if (!eShowerTreeIsDone) {
3379 LoadShowerFile("Shower.root");
3380 treesaveb = (TTree*)(FileReconstructedShowerTree->Get("treebranch"));
3381 treesaveb->SetBranchAddress("sizeb", &sizeb);
3382 treesaveb->SetBranchAddress("E_MC", &E_MC);
3383 treesaveb->SetBranchAddress("Energy", &EnergyCorrectedb);
3384 treesaveb->SetBranchAddress("EnergyUnCorrected", &EnergyUnCorrectedb);
3385 treesaveb->SetBranchAddress("EnergySigma", &EnergySigmaCorrectedb);
3386 treesaveb->SetBranchAddress("EnergySigmaUnCorrected", &EnergySigmaUnCorrectedb);
3387 }
3388 else {
3389 cout << "EdbShowerRec::GetEnergyValues treesaveb already declared and filled"<<endl;
3390 /* treesaveb already declared and filled. */
3391 }
3392 cout << "EdbShowerRec::GetEnergyValues LoadShowerFile SetBranchAddress done" << endl;
3393
3394 treesaveb->GetEntry(TreeEntry);
3395 if (gEDBDEBUGLEVEL>2) treesaveb->Show(TreeEntry);
3396
3397 dummy[0]=E_MC;
3402
3403 cout << "E_MC EnergyCorrectedb EnergyUnCorrectedb EnergySigmaCorrectedb EnergySigmaUnCorrectedb:" << endl;
3404 cout << " " << dummy[0] << " " << dummy[1] << " " << dummy[2] << " " << dummy[3] << " " << dummy[4] << " " << endl;
3405
3406 return dummy;
3407}
Int_t dummy
Definition: merge_Energy_SytematicSources_Electron.C:7

◆ GetFlag0()

Int_t EdbShowerRec::GetFlag0 ( ) const
inline
278 {
279 return eFlag0;
280 }
Int_t eFlag0
Flag of the first shower segment.
Definition: EdbShowerRec.h:53

◆ GetFlagb()

Int_t EdbShowerRec::GetFlagb ( int  i) const
inline
340 {
341 return eFlagb[i];
342 }
Int_t eFlagb[10000]
Flag of basetrack.
Definition: EdbShowerRec.h:70

◆ GetHistdeltaR_mean()

TH1D * EdbShowerRec::GetHistdeltaR_mean ( )
inline
597 {
598 return histo_deltaR_mean;
599 }

◆ GetHistdeltaR_rms()

TH1D * EdbShowerRec::GetHistdeltaR_rms ( )
inline
603 {
604 return histo_deltaR_rms;
605 }

◆ GetHistdeltaT_mean()

TH1D * EdbShowerRec::GetHistdeltaT_mean ( )
inline
600 {
601 return histo_deltaT_mean;
602 }

◆ GetHistdeltaT_rms()

TH1D * EdbShowerRec::GetHistdeltaT_rms ( )
inline
606 {
607 return histo_deltaT_rms;
608 }

◆ GetHistEnergyCorrectedb()

TH1F * EdbShowerRec::GetHistEnergyCorrectedb ( )
inline
569 {
571 }

◆ GetHistEnergyNominal()

TH1F * EdbShowerRec::GetHistEnergyNominal ( )
inline
566 {
567 return eHistEnergyNominal;
568 }

◆ GetHistEnergySigmaCorrectedb()

TH1F * EdbShowerRec::GetHistEnergySigmaCorrectedb ( )
inline
575 {
577 }
TH1F * eHistEnergySigmaCorrectedb
Definition: EdbShowerRec.h:140

◆ GetHistEnergySigmaUnCorrectedb()

TH1F * EdbShowerRec::GetHistEnergySigmaUnCorrectedb ( )
inline
578 {
580 }
TH1F * eHistEnergySigmaUnCorrectedb
Definition: EdbShowerRec.h:141

◆ GetHistEnergyUnCorrectedb()

TH1F * EdbShowerRec::GetHistEnergyUnCorrectedb ( )
inline
572 {
574 }

◆ GetHistLongProfile()

TH1D * EdbShowerRec::GetHistLongProfile ( )
inline
591 {
593 }

◆ GetHistNBaseTracks()

TH1D * EdbShowerRec::GetHistNBaseTracks ( )
inline
594 {
595 return histo_nbtk_av;
596 }

◆ GetID()

Int_t EdbShowerRec::GetID ( ) const
inline
257 {
258 return eID;
259 }
Int_t eID
shower ID
Definition: EdbShowerRec.h:43

◆ GetIDb()

Int_t EdbShowerRec::GetIDb ( int  i) const
inline
312 {
313 return eIDb[i];
314 }
Int_t eIDb[10000]
ID of basetrack.
Definition: EdbShowerRec.h:60

◆ GetInBT()

EdbSegP * EdbShowerRec::GetInBT ( Int_t  i) const
inline
701 {
702 return (EdbSegP*)eInBTArray->At(i);
703 }

◆ GetInBTArray()

TObjArray * EdbShowerRec::GetInBTArray ( ) const
inline
698 {
699 return eInBTArray;
700 }

◆ GetInBTArrayN()

Int_t EdbShowerRec::GetInBTArrayN ( ) const
inline
708 {
709 return eInBTArrayN;
710 }

◆ GetL()

Int_t EdbShowerRec::GetL ( ) const
inline
290 {
291 return eL;
292 }
Int_t eL
length of the shower in number of film
Definition: EdbShowerRec.h:58

◆ GetmcDigitIndexBottom()

Float_t EdbShowerRec::GetmcDigitIndexBottom ( int  i) const
inline
385 {
386 return emcDigitIndexBottom[i];
387 }
Int_t emcDigitIndexBottom[1000]
mc bottom digit index of basetrack
Definition: EdbShowerRec.h:76

◆ GetmcDigitIndexTop()

Float_t EdbShowerRec::GetmcDigitIndexTop ( int  i) const
inline
382 {
383 return emcDigitIndexTop[i];
384 }
Int_t emcDigitIndexTop[1000]
mc top digit index of basetrack
Definition: EdbShowerRec.h:75

◆ GetN()

Int_t EdbShowerRec::GetN ( ) const
inline
253 {
254 return eShowersN;
255 }
Int_t eShowersN
Number how many showers have been reconstructed.
Definition: EdbShowerRec.h:158

◆ GetNFilmb()

Int_t EdbShowerRec::GetNFilmb ( int  i) const
inline
343 {
344 return eNFilmb[i];
345 }
Int_t eNFilmb[10000]
Plate number of basetrack in the shower reference.
Definition: EdbShowerRec.h:71

◆ GetOutput()

Float_t EdbShowerRec::GetOutput ( ) const
inline
357 {
358 return eOutput;
359 }
Float_t eOutput
Neural Network output for e/pi separation.
Definition: EdbShowerRec.h:83

◆ GetOutput15()

Float_t EdbShowerRec::GetOutput15 ( ) const
inline
360 {
361 return eOutput15;
362 }
Float_t eOutput15
Neural Network output for e/pi separation (for 15 films crossed)
Definition: EdbShowerRec.h:84

◆ GetOutput20()

Float_t EdbShowerRec::GetOutput20 ( ) const
inline
363 {
364 return eOutput20;
365 }
Float_t eOutput20
Neural Network output for e/pi separation (for 20 films crossed)
Definition: EdbShowerRec.h:85

◆ GetOutput30()

Float_t EdbShowerRec::GetOutput30 ( ) const
inline
366 {
367 return eOutput30;
368 }
Float_t eOutput30
Neural Network output for e/pi separation (for 30 films crossed)
Definition: EdbShowerRec.h:86

◆ GetP0()

Float_t EdbShowerRec::GetP0 ( ) const
inline
275 {
276 return eP0;
277 }
Float_t eP0
P of the first shower segment.
Definition: EdbShowerRec.h:52

◆ GetPb()

Float_t EdbShowerRec::GetPb ( int  i) const
inline
337 {
338 return ePb[i];
339 }
Float_t ePb[10000]
P of basetrack.
Definition: EdbShowerRec.h:68

◆ GetPlateb()

Int_t EdbShowerRec::GetPlateb ( int  i) const
inline
309 {
310 return ePlateb[i];
311 }
Int_t ePlateb[10000]
Plate ID of basetrack.
Definition: EdbShowerRec.h:61

◆ GetRecoShowerArray()

TObjArray * EdbShowerRec::GetRecoShowerArray ( ) const
inline
704 {
705 return eRecoShowerArray;
706 }

◆ GetRecoShowerArrayN()

Int_t EdbShowerRec::GetRecoShowerArrayN ( ) const
inline
711 {
712 return eRecoShowerArrayN;
713 }

◆ GetShowerValues()

Float_t * EdbShowerRec::GetShowerValues ( Int_t  TreeEntry)
3416{
3417 Float_t* dummy = new Float_t[10];
3418 dummy[0]=-999.;
3419 dummy[1]=-999.;
3420 dummy[2]=-999.;
3421 dummy[3]=-999.;
3422 dummy[4]=-999.;
3423 dummy[5]=-999.;
3424 dummy[6]=-999.;
3425 dummy[7]=-999.;
3426
3427 if (!eShowerTreeIsDone) {
3428 cout << "EdbShowerRec::GetEnergyValues !eShowerTreeIsDone" << endl;
3429 LoadShowerFile("Shower.root");
3430 }
3431 // Get Treebranch:
3432 // Either from shower file (then it has to be casted) or from the
3433 // reconstruction, then its automatically there.
3434 if (!eShowerTreeIsDone) {
3435 LoadShowerFile("Shower.root");
3436 treesaveb = (TTree*)(FileReconstructedShowerTree->Get("treebranch"));
3437 treesaveb->SetBranchAddress("sizeb", &sizeb);
3438 treesaveb->SetBranchAddress("txb", txb);
3439 treesaveb->SetBranchAddress("tyb", tyb);
3440 treesaveb->SetBranchAddress("xb", xb);
3441 treesaveb->SetBranchAddress("yb", yb);
3442 treesaveb->SetBranchAddress("zb", zb);
3443 treesaveb->SetBranchAddress("eProb90", &eProb90);
3444 treesaveb->SetBranchAddress("eProb1", &eProb1);
3445 treesaveb->SetBranchAddress("nfilmb", nfilmb);
3446
3447 }
3448 else {
3449 ; /* treesaveb already declared and filled. */
3450 }
3451 cout << "EdbShowerRec::GetEnergyValues LoadShowerFile SetBranchAddress done" << endl;
3452
3453 treesaveb->GetEntry(TreeEntry);
3454 if (gEDBDEBUGLEVEL>2) treesaveb->Show(TreeEntry);
3455
3456 dummy[0]=sizeb;
3457 dummy[1]=xb[0];
3458 dummy[2]=yb[0];
3459 dummy[3]=zb[0];
3460 dummy[4]=txb[0];
3461 dummy[5]=tyb[0];
3462 dummy[6]=nfilmb[sizeb-1]-nfilmb[0]+1; // number of passed plates [Firstplate..Lastplate]
3463 dummy[7]=eProb90;
3464 dummy[8]=eProb1;
3465 /*
3466 cout << "sizeb xb[0] yb[0] zb[0] txb[0] tyb[0] nplates eProb90 eProb1:" << endl;
3467 cout << " " << dummy[0] << " " << dummy[1] << " " << dummy[2] << " " << dummy[3] << " " << dummy[4] << " ";
3468 cout << " " << dummy[5] << " " << dummy[6] << " " << dummy[7] << " " << dummy[8] << " " << dummy[9] << " "<<endl;;
3469 */
3470 return dummy;
3471}

◆ GetSize()

Int_t EdbShowerRec::GetSize ( ) const
inline
297 {
298 return eSize;
299 }
Int_t eSize
number of BT in the shower
Definition: EdbShowerRec.h:78

◆ GetSize15()

Int_t EdbShowerRec::GetSize15 ( ) const
inline
300 {
301 return eSize15;
302 }
Int_t eSize15
number of BT in the shower (for 15 films crossed)
Definition: EdbShowerRec.h:79

◆ GetSize20()

Int_t EdbShowerRec::GetSize20 ( ) const
inline
303 {
304 return eSize20;
305 }
Int_t eSize20
number of BT in the shower (for 20 films crossed)
Definition: EdbShowerRec.h:80

◆ GetSize30()

Int_t EdbShowerRec::GetSize30 ( ) const
inline
306 {
307 return eSize30;
308 }
Int_t eSize30
number of BT in the shower (for 30 films crossed)
Definition: EdbShowerRec.h:81

◆ GetTagPrimaryb()

Int_t EdbShowerRec::GetTagPrimaryb ( int  i) const
inline
352 {
353 return eTagPrimary[i];
354 }
Int_t eTagPrimary[10000]
1 for first Basetrack - 0 for the other
Definition: EdbShowerRec.h:74

◆ GetTreeBranchEntryNr()

Int_t EdbShowerRec::GetTreeBranchEntryNr ( EdbSegP seg)

Returns the number of the treebranch entry for which the segment is starting point of a shower!
if the segment is not starting point at all, return -1;

3319{
3322
3323 cout << "EdbShowerRec::GetTreeBranchEntryNr()"<< endl;
3324
3325 if (!eShowerTreeIsDone) {
3326 LoadShowerFile("Shower.root");
3327 treesaveb = (TTree*)(FileReconstructedShowerTree->Get("treebranch"));
3328 treesaveb->SetBranchAddress("txb", txb);
3329 treesaveb->SetBranchAddress("tyb", tyb);
3330 treesaveb->SetBranchAddress("xb", xb);
3331 treesaveb->SetBranchAddress("yb", yb);
3332 treesaveb->SetBranchAddress("zb", zb);
3333 }
3334 else {
3335 cout << "EdbShowerRec::GetTreeBranchEntryNr treesaveb already declared and filled"<<endl;
3336 /* treesaveb already declared and filled. */
3337 }
3338
3339 cout << "EdbShowerRec::GetTreeBranchEntryNr Looping over treesaveb now..."<<endl;
3340
3341 for (int i=0; i<treesaveb->GetEntries(); i++) {
3342 treesaveb->GetEntry(i);
3343 if (TMath::Abs(seg->X()-xb[0])>1.0) continue;
3344 if (TMath::Abs(seg->Y()-yb[0])>1.0) continue;
3345 if (TMath::Abs(seg->Z()-zb[0])>1.0) continue;
3346 if (TMath::Abs(seg->TX()-txb[0])>0.01) continue;
3347 if (TMath::Abs(seg->TY()-tyb[0])>0.01) continue;
3348 treesaveb->Show(i);
3349 return i;
3350 }
3351 return -1;
3352}

◆ GetTrID()

Int_t EdbShowerRec::GetTrID ( ) const
inline
293 {
294 return eTrID;
295 }
Int_t eTrID
ID of the tracks of the first BT (in cp file if simulation!)
Definition: EdbShowerRec.h:49

◆ GetTx()

Float_t EdbShowerRec::GetTx ( ) const
inline
281 {
282 return eTx;
283 }
Float_t eTx
tanX: deltaX/deltaZ for the first shower segment
Definition: EdbShowerRec.h:47

◆ GetTXb()

Float_t EdbShowerRec::GetTXb ( int  i) const
inline
325 {
326 return eTXb[i];
327 }
Float_t eTXb[10000]
Slope X position of basetrack.
Definition: EdbShowerRec.h:65

◆ GetTy()

Float_t EdbShowerRec::GetTy ( ) const
inline
284 {
285 return eTy;
286 }
Float_t eTy
tanY: deltaY/deltaZ for the first shower segment
Definition: EdbShowerRec.h:48

◆ GetTYb()

Float_t EdbShowerRec::GetTYb ( int  i) const
inline
328 {
329 return eTYb[i];
330 }
Float_t eTYb[10000]
Slope Y position of basetrack.
Definition: EdbShowerRec.h:66

◆ GetUseAliSub()

Bool_t EdbShowerRec::GetUseAliSub ( )
inline
678 {
679 return eUseAliSub;
680 }
Bool_t eUseAliSub
Definition: EdbShowerRec.h:109

◆ GetW0()

Int_t EdbShowerRec::GetW0 ( ) const
inline
272 {
273 return eW0;
274 }
Int_t eW0
W of the first shower segment.
Definition: EdbShowerRec.h:51

◆ GetWb()

Int_t EdbShowerRec::GetWb ( int  i) const
inline
334 {
335 return eWb[i];
336 }
Int_t eWb[10000]
W of basetrack.
Definition: EdbShowerRec.h:69

◆ GetX0()

Float_t EdbShowerRec::GetX0 ( ) const
inline
260 {
261 return eX0;
262 }
Float_t eX0
|_coordinates of the first shower segment
Definition: EdbShowerRec.h:44

◆ GetXb()

Float_t EdbShowerRec::GetXb ( int  i) const
inline
316 {
317 return eXb[i];
318 }
Float_t eXb[10000]
X position of basetrack.
Definition: EdbShowerRec.h:62

◆ GetY0()

Float_t EdbShowerRec::GetY0 ( ) const
inline
263 {
264 return eY0;
265 }
Float_t eY0
| in the SAME FOR ALL SEGMENTS aligned coordinate system
Definition: EdbShowerRec.h:45

◆ GetYb()

Float_t EdbShowerRec::GetYb ( int  i) const
inline
319 {
320 return eYb[i];
321 }
Float_t eYb[10000]
Y position of basetrack.
Definition: EdbShowerRec.h:63

◆ GetZ0()

Float_t EdbShowerRec::GetZ0 ( ) const
inline
266 {
267 return eZ0;
268 }
Float_t eZ0
|
Definition: EdbShowerRec.h:46

◆ GetZb()

Float_t EdbShowerRec::GetZb ( int  i) const
inline
322 {
323 return eZb[i];
324 }
Float_t eZb[10000]
Z position of basetrack.
Definition: EdbShowerRec.h:64

◆ Help()

void EdbShowerRec::Help ( )

Help Function

4910{
4912 cout << "--------------------------------------------------------------------------" << endl;
4913 cout << "-- --" << endl;
4914 cout << "-- EdbShowerRec --" << endl;
4915 cout << "-- --" << endl;
4916 cout << "-- Base Class for the shower reconstruction in OPERA brick. --" << endl;
4917 cout << "-- This class has been initially developed by F. Juget, G. Lutter --" << endl;
4918 cout << "-- and is ongoingly modified and developed by Frank Meisel, which is --" << endl;
4919 cout << "-- currently the corresponding author: frank.meisel@gmx.de --" << endl;
4920 cout << "-- --" << endl;
4921 cout << "-- The main goal of this library is to make the shower search in the --" << endl;
4922 cout << "-- scanned emulsion data as easy as possible, and as most automatically.--" << endl;
4923 cout << "-- There exist also two manuals, to be found under 'documentation'. In --" << endl;
4924 cout << "-- these some general handling of the package is explained. --" << endl;
4925 cout << "-- --" << endl;
4926 cout << "-- The EdbShowerRec class makes following things: --" << endl;
4927 cout << "-- Starting from the emulsion scanned data (represented as an EdbPVRec --" << endl;
4928 cout << "-- object in FEDRA), it does search and reconstruction of showers, --" << endl;
4929 cout << "-- based on different algorithms, which the user can set indivially --" << endl;
4930 cout << "-- (normaly not necessary). After that, we try to identify --" << endl;
4931 cout << "-- characteristics of the shower, as it is: energy and particle ID. --" << endl;
4932 cout << "-- --" << endl;
4933 cout << "--------------------------------------------------------------------------" << endl;
4934 return;
4935}

◆ Init()

void EdbShowerRec::Init ( void  )

Create (one time) needed internal objects

210{
212
213 // Check if eInBTArray array exits, otherwise create.
215 eInBTArray=new TObjArray();
217 eInBTArrayN=0;
218 }
219
220 // Create Array For storing the reconstructed showers.
221 eRecoShowerArray=new TObjArray();
223
224 return;
225}

◆ InitPiece()

void EdbShowerRec::InitPiece ( EdbDataPiece piece,
const char *  cpfile,
const char *  parfile 
)
264{
265 piece.eFileNameCP = cpfile;
266 piece.eFileNamePar = parfile;
267 piece.TakePiecePar();
268 //piece.Print();
269}
TString eFileNameCP
root-style text cuts
Definition: EdbDataSet.h:50
int TakePiecePar()
Definition: EdbDataSet.cxx:276
TString eFileNamePar
name of the parameters file
Definition: EdbDataSet.h:51

◆ initproc()

void EdbShowerRec::initproc ( const char *  def,
int  iopt,
const char *  rcut = "1" 
)
272{
273 dproc = new EdbDataProc(def);
274 dproc->InitVolume(iopt, rcut);
275 gAli = dproc->PVR();
276}
emulsion data processing
Definition: EdbDataSet.h:181
int InitVolume(int datatype=0, const char *rcut="1")
Definition: EdbDataSet.cxx:2066
EdbPVRec * PVR() const
Definition: EdbDataSet.h:198
EdbPVRec * gAli
Definition: EdbShowerRec.h:227
EdbDataProc * dproc
Definition: EdbShowerRec.h:235
const char * def
Definition: shower_tr.C:24

◆ InvariantMass()

Double_t EdbShowerRec::InvariantMass ( EdbSegP s1,
EdbSegP s2,
Double_t  Momentum1 = -1,
Double_t  Momentum2 = -1,
Double_t  ID1 = 22,
Double_t  ID2 = 22 
)
4879{
4880 cout << "EdbShowerRec::InvariantMass()" << endl;
4881 cout << "s1->P() " << s1->P() << endl;
4882 cout << "s2->P() " << s2->P() << endl;
4883
4884 // If no momentum is specified, then it will be taken from segments momentum:
4885 if (Momentum1<0) Momentum1=s1->P();
4886 if (Momentum2<0) Momentum2=s2->P();
4887
4888 //mass reconstruction for Pi0 using 2 tracks
4889 //you have to know the momentum of the 2 tracks and their slopes (Tx,Ty)
4890 //first implementation: frederic juget
4891 TLorentzVector v1;
4892 TLorentzVector v2;
4893 Double_t energy1=0;
4894 Double_t energy2=0;
4895 v1.SetPxPyPzE(s1->TX(),s1->TY(),1,Momentum1);
4896 v2.SetPxPyPzE(s2->TX(),s2->TY(),1,Momentum2);
4897 TLorentzVector vsum=v1+v1;
4898 Double_t invM=vsum.Mag2();
4899 cout << v1.Mag() << endl;
4900 cout << v2.Mag() << endl;
4901 cout << vsum.Mag() << endl;
4902 return invM;
4903}
Float_t P() const
Definition: EdbSegP.h:152

◆ IsInConeTube()

Bool_t EdbShowerRec::IsInConeTube ( EdbSegP TestingSegment,
EdbSegP StartingSegment,
Double_t  CylinderRadius,
Double_t  ConeAngle 
)

General Function which returns kTRUE if the Testing BaeTrack is in a cone defined by the StartingBaseTrack. In case of same starting Z position, a max distance cut ( in Delta R) of 20microns is assumed (i.e. the cone is not totally closed at the start).
In case of TestingSegment==StartingSegment this function should also correctly return kTRUE.

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

3537{
3542
3543 if (gEDBDEBUGLEVEL>3) cout << "Bool_t EdbShowerAlg::IsInConeTube("<<TestingSegment<< ","<< StartingSegment <<","<< CylinderRadius << "," << ConeAngle << endl;
3544 if (gEDBDEBUGLEVEL>3) cout << "Bool_t EdbShowerAlg::IsInConeTube() Test Segment " << TestingSegment << " vs. Starting Segment " << StartingSegment << endl;
3545
3546 // if (TestingSegment->Z()-StartingSegment->Z()<2.0) return kFALSE; //wrong...
3547 if (StartingSegment->Z()>TestingSegment->Z() ) return kFALSE;
3548
3549 TVector3 x1(StartingSegment->X(),StartingSegment->Y(),StartingSegment->Z());
3550 TVector3 x2(TestingSegment->X(),TestingSegment->Y(),TestingSegment->Z());
3551 TVector3 direction_x1(StartingSegment->TX()*1273,StartingSegment->TY()*1273,1273);
3552
3553 // u1 is the difference vector of the position!
3554 TVector3 u1=x2-x1;
3555
3556 Double_t direction_x1_norm= direction_x1.Mag();
3557 Double_t cosangle= (direction_x1*u1)/(u1.Mag()*direction_x1_norm);
3558 Double_t angle = TMath::ACos(cosangle);
3559 // This is the old version of angle calculation. It does not give the same results as in ROOT
3560 // when use TVector3.Angle(&TVector3). // For this IsInConeTube() we use therefore the ROOT calculation.
3561 angle=u1.Angle(direction_x1);
3562
3563 // For the case where the two basetracks have same z position
3564 // the angle is about 90 degree so it makes no sense to calculate it...
3565 // therefore we set it artificially to zero:
3566 // if (TMath::Abs(StartingSegment->Z()-TestingSegment->Z())<2.0) {
3567 if (StartingSegment->Z()==TestingSegment->Z() ) {
3568 if (gEDBDEBUGLEVEL>3) cout << "Bool_t EdbShowerAlg::IsInConeTube() Same Z position of TestingSegment and StartingSegment, Set angle artificially to zero" << endl;
3569 angle=0.0;
3570
3571 // Check for position distance for 20microns if
3572 // Testing Segment is in same Z as StartingSegment
3573 if (gEDBDEBUGLEVEL>3) cout << "Bool_t EdbShowerAlg::IsInConeTube() Check for position distance for 20microns if Testing Segment is in same Z as StartingSegment" << endl;
3574 if (gEDBDEBUGLEVEL>3) cout << "Bool_t EdbShowerAlg::IsInConeTube() DeltaR_WithoutPropagation(StartingSegment,TestingSegment) = "<< DeltaR_WithoutPropagation(StartingSegment,TestingSegment) << endl;
3575 if (DeltaR_WithoutPropagation(StartingSegment,TestingSegment)<20) return kTRUE;
3576 if (DeltaR_WithoutPropagation(StartingSegment,TestingSegment)>=20) return kFALSE;
3577 }
3578
3579
3581 if (gEDBDEBUGLEVEL>3) cout << "Bool_t EdbShowerAlg::IsInConeTube() Check if AngleVector now within the ConeAngleVector (<"<< ConeAngle<<"): " << angle << endl;
3582 if (angle>ConeAngle) {
3583 return kFALSE;
3584 }
3585
3586
3588 Double_t TubeDistance = 1.0/direction_x1_norm * ( (x2-x1).Cross(direction_x1) ).Mag();
3589
3590 if (gEDBDEBUGLEVEL>3) cout << "Bool_t EdbShowerAlg::IsInConeTube() Check if TestingSegment is now within the Tube (<"<< CylinderRadius<<"): " << TubeDistance << endl;
3591
3592 if (TubeDistance>CylinderRadius) {
3593 return kFALSE;
3594 }
3595
3596 return kTRUE;
3597}

◆ LoadEdbPVRec()

void EdbShowerRec::LoadEdbPVRec ( )

Function to load the EdbPatterVolumeReconstruction object into memory.
Shower reco needs to have full basetrack data to improve performance.
Because full basetrack data (corresponds to cp.root files) is memory extensive,
standard operations rely on linked tracks only.
Warning: some hardcoded strings are inside herebject for analysis use!

3690{
3696
3697 Log(2,"EdbShowerRec::LoadEdbPVRec","Loads the full cp Basetracks into the eAli object.");
3698 // Loads the full cp Basetracks into the eAli object:
3699 if (!eAli) eAli=new EdbPVRec();
3700
3701 // **** Data set initialization
3702 EdbDataProc* dset = new EdbDataProc("lnk.def");
3703 // **** Volume initialization
3704 dset->InitVolume(0);
3705 // **** Get Pattern Volume Reconstruction object
3706 eAli = dset->PVR();
3707
3708 if (gEDBDEBUGLEVEL>2) eAli->Print();
3709
3710 // Set private variables for the EdbPVrec Object now:
3714
3715 eAliLoaded=kTRUE;
3716 Log(2,"EdbShowerRec::LoadEdbPVRec","Loads the full cp Basetracks into the eAli object.Done.");
3717}
EdbDataProc * dset
Definition: RecDispEX.C:9

◆ LoadShowerFile()

void EdbShowerRec::LoadShowerFile ( TString  ShowerFileName = "Shower2.root")
2492{
2493 if (gEDBDEBUGLEVEL>2) cout << "------------------------------------------------------"<<endl;
2494 if (gEDBDEBUGLEVEL>2) cout << "void EdbShowerRec::LoadShowerFile()"<<endl;
2495 if (gEDBDEBUGLEVEL>2) cout << "------------------------------------------------------"<<endl;
2496
2497 FileReconstructedShowerTree = new TFile(ShowerFileName,"READ");
2499 cout << "ERROR: FileReconstructedShowerTree==NULL. ABORTING."<<endl;
2500 return;
2501 }
2502
2503 // if (gEDBDEBUGLEVEL>2) FileReconstructedShowerTree->ls();
2504 if (gEDBDEBUGLEVEL>2) cout << "void EdbShowerRec::LoadShowerFile() done."<<endl;
2505 return;
2506}

◆ NeuralNet()

void EdbShowerRec::NeuralNet ( )
1920 {
1921
1922 float offset; // Z position of last (first) plate in the data set (usually = 0.)
1923 offset = 0.;
1924
1925
1926 //output file
1927 fileout3 = new TFile("Shower2.root","RECREATE");
1928 //definition of treebranch
1929 treesaveb3 = new TTree("treebranch","tree of branchtrack");
1930 treesaveb3->Branch("number_eventb",&number_eventb,"number_eventb/I");
1931 treesaveb3->Branch("sizeb",&sizeb,"sizeb/I");
1932 treesaveb3->Branch("sizeb15",&sizeb15,"sizeb15/I");
1933 treesaveb3->Branch("sizeb20",&sizeb20,"sizeb20/I");
1934 treesaveb3->Branch("sizeb30",&sizeb30,"sizeb30/I");
1935 treesaveb3->Branch("output15",&output15,"output15/F");
1936 treesaveb3->Branch("output20",&output20,"output20/F");
1937 treesaveb3->Branch("output30",&output30,"output30/F");
1938 treesaveb3->Branch("output50",&output50,"output50/F");
1939 treesaveb3->Branch("eProb90",&eProb90,"eProb90/I");
1940 treesaveb3->Branch("eProb1",&eProb1,"eProb1/I");
1941 treesaveb3->Branch("E_MC",&E_MC,"E_MC/F");
1942 treesaveb3->Branch("idb",idb,"idb[sizeb]/I");
1943 treesaveb3->Branch("plateb",plateb,"plateb[sizeb]/I");
1944 treesaveb3->Branch("showerID",&showerID,"showerID/I");
1945 treesaveb3->Branch("isizeb",&isizeb,"isizeb/I");
1946 treesaveb3->Branch("xb",xb,"xb[sizeb]/F");
1947 treesaveb3->Branch("yb",yb,"yb[sizeb]/F");
1948 treesaveb3->Branch("zb",zb,"zb[sizeb]/F");
1949 treesaveb3->Branch("txb",txb,"txb[sizeb]/F");
1950 treesaveb3->Branch("tyb",tyb,"tyb[sizeb]/F");
1951 treesaveb3->Branch("nfilmb",nfilmb,"nfilmb[sizeb]/I");
1952 treesaveb3->Branch("ntrace1simub",ntrace1simub,"ntrace1simu[sizeb]/I");
1953 treesaveb3->Branch("ntrace2simub",ntrace2simub,"ntrace2simu[sizeb]/I");
1954 treesaveb3->Branch("ntrace4simub",ntrace4simub,"ntrace4simu[sizeb]/I");
1955 treesaveb3->Branch("ntrace3simub",ntrace3simub,"ntrace3simu[sizeb]/F");
1956 treesaveb3->Branch("chi2btkb",chi2btkb,"chi2btkb[sizeb]/F");
1957 treesaveb3->Branch("deltarb",deltarb,"deltarb[sizeb]/F");
1958 treesaveb3->Branch("deltathetab",deltathetab,"deltathetab[sizeb]/F");
1959 treesaveb3->Branch("deltaxb",deltaxb,"deltaxb[sizeb]/F");
1960 treesaveb3->Branch("deltayb",deltayb,"deltayb[sizeb]/F");
1961 treesaveb3->Branch("tagprimary",tagprimary,"tagprimary[sizeb]/F");
1962 treesaveb3->Branch("purityb",&purityb,"purityb/F");
1963 treesaveb3->Branch("trackdensb",&trackdensb,"trackdensb/F");
1964 treesaveb3->Branch("mcDigitIndexTop",mcDigitIndexTop,"mcDigitIndexTop[sizeb]/I");
1965 treesaveb3->Branch("mcDigitIndexBottom",mcDigitIndexBottom,"mcDigitIndexBottom[sizeb]/I");
1966
1967 treesaveb3->Branch("Energy",&EnergyCorrectedb,"EnergyCorrectedb/F");
1968 treesaveb3->Branch("EnergyUnCorrected",&EnergyUnCorrectedb,"EnergyUnCorrectedb/F");
1969 treesaveb3->Branch("EnergySigma",&EnergySigmaCorrectedb,"EnergySigmaCorrectedb/F");
1970 treesaveb3->Branch("EnergySigmaUnCorrected",&EnergySigmaUnCorrectedb,"EnergySigmaUnCorrectedb/F");
1971
1972
1973
1974 char fname_e[128];
1975 Float_t Rcut30, Tcut30;
1976 Float_t Rcut20, Tcut20;
1977 Float_t Rcut15, Tcut15;
1978 Float_t Rcut50, Tcut50;
1979
1980 int flag15;
1981 int flag20;
1982 int flag30;
1983 int flag50;
1984
1985 Double_t params[53];
1986
1987 Float_t ntrke50;
1988 Float_t ntrke30;
1989 Float_t ntrke20;
1990 Float_t ntrke15;
1991
1992 TTree *varia = new TTree("MonteCarlo", "Filtered Monte Carlo Events");
1993 varia->Branch("bin3", &bin3, "bin3/F");
1994 varia->Branch("bin4", &bin4, "bin4/F");
1995 varia->Branch("bin5", &bin5, "bin5/F");
1996 varia->Branch("bin6", &bin6, "bin6/F");
1997 varia->Branch("bin7", &bin7, "bin7/F");
1998 varia->Branch("bin8", &bin8, "bin8/F");
1999 varia->Branch("bin9", &bin9, "bin9/F");
2000 varia->Branch("bin10", &bin10, "bin10/F");
2001 varia->Branch("bin11", &bin11, "bin11/F");
2002 varia->Branch("bin12", &bin12, "bin12/F");
2003 varia->Branch("bin13", &bin13, "bin13/F");
2004 varia->Branch("bin14", &bin14, "bin14/F");
2005 varia->Branch("bin15", &bin15, "bin15/F");
2006 varia->Branch("bin16", &bin16, "bin16/F");
2007 varia->Branch("bin17", &bin17, "bin17/F");
2008 varia->Branch("bin18", &bin18, "bin18/F");
2009 varia->Branch("bin19", &bin19, "bin19/F");
2010 varia->Branch("bin20", &bin20, "bin20/F");
2011 varia->Branch("bin21", &bin21, "bin21/F");
2012 varia->Branch("bin22", &bin22, "bin22/F");
2013 varia->Branch("bin23", &bin23, "bin23/F");
2014 varia->Branch("bin24", &bin24, "bin24/F");
2015 varia->Branch("bin25", &bin25, "bin25/F");
2016 varia->Branch("bin26", &bin26, "bin26/F");
2017 varia->Branch("bin27", &bin27, "bin27/F");
2018 varia->Branch("bin28", &bin28, "bin28/F");
2019 varia->Branch("bin29", &bin29, "bin29/F");
2020 varia->Branch("bin30", &bin30, "bin30/F");
2021 varia->Branch("bin31", &bin31, "bin31/F");
2022 varia->Branch("bin32", &bin32, "bin32/F");
2023 varia->Branch("bin33", &bin33, "bin33/F");
2024 varia->Branch("bin34", &bin34, "bin34/F");
2025 varia->Branch("bin35", &bin35, "bin35/F");
2026 varia->Branch("bin41", &bin41, "bin41/F");
2027 varia->Branch("bin42", &bin42, "bin42/F");
2028 varia->Branch("bin43", &bin43, "bin43/F");
2029 varia->Branch("bin44", &bin44, "bin44/F");
2030 varia->Branch("bin45", &bin45, "bin45/F");
2031 varia->Branch("bin46", &bin46, "bin46/F");
2032 varia->Branch("bin47", &bin47, "bin47/F");
2033 varia->Branch("bin48", &bin48, "bin48/F");
2034 varia->Branch("bin49", &bin49, "bin49/F");
2035 varia->Branch("bin50", &bin50, "bin50/F");
2036 varia->Branch("bin51", &bin51, "bin51/F");
2037 varia->Branch("bin52", &bin52, "bin52/F");
2038 varia->Branch("bin53", &bin53, "bin53/F");
2039 varia->Branch("bin54", &bin54, "bin54/F");
2040 varia->Branch("bin55", &bin55, "bin55/F");
2041 varia->Branch("bin56", &bin56, "bin56/F");
2042 varia->Branch("bin57", &bin57, "bin57/F");
2043 varia->Branch("bin58", &bin58, "bin58/F");
2044 varia->Branch("bin59", &bin59, "bin59/F");
2045 varia->Branch("bin60", &bin60, "bin60/F");
2046 varia->Branch("type", &type, "type/I");
2047
2048
2049 // Weightfiles using Expanded Path Name, hopefully it does work for both windows and linux
2050 TString weightpath_20=TString(gSystem->ExpandPathName("$FEDRA_ROOT"))+TString("/src/libShower/weights_20.txt");
2051 TString weightpath_15=TString(gSystem->ExpandPathName("$FEDRA_ROOT"))+TString("/src/libShower/weights_15.txt");
2052 TString weightpath_30=TString(gSystem->ExpandPathName("$FEDRA_ROOT"))+TString("/src/libShower/weights_30.txt");
2053 TString weightpath_50=TString(gSystem->ExpandPathName("$FEDRA_ROOT"))+TString("/src/libShower/weights_50.txt");
2054
2055 TMultiLayerPerceptron *mlp1 = new TMultiLayerPerceptron("@bin3,@bin4,@bin5,@bin6,@bin7,@bin8,@bin9,@bin10,@bin11,@bin12,@bin13,@bin14,@bin15,@bin16,@bin17,@bin18,@bin19,@bin20,@bin31,@bin32,@bin33,@bin34,@bin35:63:21:type",varia,"bin31>0","bin31>0");
2056 mlp1->LoadWeights(weightpath_20);
2057
2058 TMultiLayerPerceptron *mlp2 = new TMultiLayerPerceptron("@bin3,@bin4,@bin5,@bin6,@bin7,@bin8,@bin9,@bin10,@bin11,@bin12,@bin13,@bin14,@bin15,@bin31,@bin32,@bin33,@bin34,@bin35:63:21:type",varia,"bin31>0","bin31>0");
2059 mlp2->LoadWeights(weightpath_15);
2060
2061 TMultiLayerPerceptron *mlp3 = new TMultiLayerPerceptron("@bin3,@bin4,@bin5,@bin6,@bin7,@bin8,@bin9,@bin10,@bin11,@bin12,@bin13,@bin14,@bin15,@bin16,@bin17,@bin18,@bin19,@bin20,@bin21,@bin22,@bin23,@bin24,@bin25,@bin26,@bin27,@bin28,@bin29,@bin30,@bin31,@bin32,@bin33,@bin34,@bin35:63:21:type",varia,"bin31>0","bin31>0");
2062 mlp3->LoadWeights(weightpath_30);
2063
2064 TMultiLayerPerceptron *mlp4 = new TMultiLayerPerceptron("@bin3,@bin4,@bin5,@bin6,@bin7,@bin8,@bin9,@bin10,@bin11,@bin12,@bin13,@bin14,@bin15,@bin16,@bin17,@bin18,@bin19,@bin20,@bin21,@bin22,@bin23,@bin24,@bin25,@bin26,@bin27,@bin28,@bin29,@bin30,@bin41,@bin42,@bin43,@bin44,@bin45,@bin46,@bin47,@bin48,@bin49,@bin50,@bin51,@bin52,@bin53,@bin54,@bin55,@bin56,@bin57,@bin58,@bin59,@bin60,@bin31,@bin32,@bin33,@bin34,@bin35:63:21:type",varia,"bin31>0","bin31>0");
2065 mlp4->LoadWeights(weightpath_50);
2066
2067 TH1F *histogl_e = new TH1F("longitudinal profile","longitudinal profile",50,0,50);
2068
2069 TH1F *historcut30 = new TH1F("Delta r 30"," ",50,0,200);
2070 TH1F *histotcut30 = new TH1F("Delta theta 30"," ",50,0,0.2);
2071 TH1F *historcut50 = new TH1F("Delta r 50"," ",50,0,200);
2072 TH1F *histotcut50 = new TH1F("Delta theta 50"," ",50,0,0.2);
2073
2074 TH1F *historcut20 = new TH1F("Delta r 20 "," ",50,0,200);
2075 TH1F *histotcut20 = new TH1F("Delta theta 20"," ",50,0,0.2);
2076 TH1F *historcut15 = new TH1F("Delta r 15"," ",50,0,200);
2077 TH1F *histotcut15 = new TH1F("Delta theta 15"," ",50,0,0.2);
2078
2079 float val30,val20,val15,val50;
2080
2081 sprintf(fname_e,"shower1.root"); //input shower tree file
2082
2083 TFile *file_e2 = new TFile(fname_e ,"READ");
2084 TTree *treebranch_e = (TTree *) file_e2->Get("treebranch");
2085 treebranch_e->SetBranchAddress("nfilmb", nfilmb);
2086 treebranch_e->SetBranchAddress("sizeb", &sizeb);
2087 treebranch_e->SetBranchAddress("sizeb15", &sizeb15);
2088 treebranch_e->SetBranchAddress("sizeb20", &sizeb20);
2089 treebranch_e->SetBranchAddress("sizeb30", &sizeb30);
2090 treebranch_e->SetBranchAddress("isizeb", &isizeb);
2091 treebranch_e->SetBranchAddress("chi2btkb", &chi2btkb);
2092 treebranch_e->SetBranchAddress("tagprimary", tagprimary);
2093 treebranch_e->SetBranchAddress("txb", txb);
2094 treebranch_e->SetBranchAddress("tyb", tyb);
2095 treebranch_e->SetBranchAddress("xb", xb);
2096 treebranch_e->SetBranchAddress("yb", yb);
2097 treebranch_e->SetBranchAddress("zb", zb);
2098 treebranch_e->SetBranchAddress("showerID", &showerID);
2099 treebranch_e->SetBranchAddress("plateb", plateb);
2100 treebranch_e->SetBranchAddress("idb", idb);
2101 treebranch_e->SetBranchAddress("deltarb", deltarb);
2102 treebranch_e->SetBranchAddress("deltathetab", deltathetab);
2103 treebranch_e->SetBranchAddress("number_eventb", &number_eventb);
2104 treebranch_e->SetBranchAddress("ntrace1simub", &ntrace1simub);
2105 treebranch_e->SetBranchAddress("ntrace2simub", &ntrace2simub);
2106 treebranch_e->SetBranchAddress("ntrace3simub", &ntrace3simub);
2107 treebranch_e->SetBranchAddress("ntrace4simub", &ntrace4simub);
2108 treebranch_e->SetBranchAddress("purityb", &purityb);
2109 treebranch_e->SetBranchAddress("E_MC", &E_MC);
2110 treebranch_e->SetBranchAddress("mcDigitIndexTop",mcDigitIndexTop);
2111 treebranch_e->SetBranchAddress("mcDigitIndexBottom",mcDigitIndexBottom);
2112
2113
2114 for (Int_t ik = 0; ik < treebranch_e->GetEntries(); ik++)
2115 {
2116 treebranch_e->GetEntry(ik);
2117 histogl_e->Reset();
2118 historcut15->Reset();
2119 histotcut15->Reset();
2120 historcut20->Reset();
2121 histotcut20->Reset();
2122 historcut30->Reset();
2123 histotcut30->Reset();
2124 historcut50->Reset();
2125 histotcut50->Reset();
2126
2127 output50 = -10;
2128 output30 = -10;
2129 output20 = -10;
2130 output15 = -10;
2131
2132 if (isizeb>0) {
2133 ntrke50 = 0;
2134 Rcut50 = 0.;
2135 Tcut50 = 0.;
2136 ntrke30 = 0;
2137 Rcut30 = 0.;
2138 Tcut30 = 0.;
2139 ntrke20 = 0;
2140 Rcut20 = 0.;
2141 Tcut20 = 0.;
2142 ntrke15 = 0;
2143 Rcut15 = 0.;
2144 Tcut15 = 0.;
2145 flag15 = 0;
2146 flag20 = 0;
2147 flag30 = 0;
2148 flag50 = 0;
2149
2150 if (isizeb==15)flag15=1;
2151 if (isizeb==20)flag20=1;
2152 if (isizeb==30)flag30=1;
2153 if (isizeb==50)flag50=1;
2154
2155
2156 for (Int_t ibtke = 0; ibtke < sizeb; ibtke++) { // loop on btk
2157
2158 histogl_e->Fill(nfilmb[ibtke]);
2159 if (nfilmb[ibtke]<51)ntrke50++;
2160 if (nfilmb[ibtke]<31)ntrke30++;
2161 if (nfilmb[ibtke]<21)ntrke20++;
2162 if (nfilmb[ibtke]<16)ntrke15++;
2163
2164 if (ibtke>0&&nfilmb[ibtke]<51)
2165 {
2166 Rcut50 += deltarb[ibtke];
2167 Tcut50 += deltathetab[ibtke];
2168 historcut50->Fill(deltarb[ibtke]);
2169 histotcut50->Fill(deltathetab[ibtke]);
2170 }
2171 if (ibtke>0&&nfilmb[ibtke]<31)
2172 {
2173 Rcut30 += deltarb[ibtke];
2174 Tcut30 += deltathetab[ibtke];
2175 historcut30->Fill(deltarb[ibtke]);
2176 histotcut30->Fill(deltathetab[ibtke]);
2177 }
2178 if (ibtke>0&&nfilmb[ibtke]<21)
2179 {
2180 Rcut20 += deltarb[ibtke];
2181 Tcut20 += deltathetab[ibtke];
2182 historcut20->Fill(deltarb[ibtke]);
2183 histotcut20->Fill(deltathetab[ibtke]);
2184 }
2185 if (ibtke>0&&nfilmb[ibtke]<16)
2186 {
2187 Rcut15 += deltarb[ibtke];
2188 Tcut15 += deltathetab[ibtke];
2189 historcut15->Fill(deltarb[ibtke]);
2190 histotcut15->Fill(deltathetab[ibtke]);
2191 }
2192 }
2193
2194 bin1 = histogl_e->GetBinContent(1);
2195 bin2 = histogl_e->GetBinContent(2);
2196 bin3 = histogl_e->GetBinContent(3);
2197 bin4 = histogl_e->GetBinContent(4);
2198 bin5 = histogl_e->GetBinContent(5);
2199 bin6 = histogl_e->GetBinContent(6);
2200 bin7 = histogl_e->GetBinContent(7);
2201 bin8 = histogl_e->GetBinContent(8);
2202 bin9 = histogl_e->GetBinContent(9);
2203 bin10 = histogl_e->GetBinContent(10);
2204 bin11 = histogl_e->GetBinContent(11);
2205 bin12 = histogl_e->GetBinContent(12);
2206 bin13 = histogl_e->GetBinContent(13);
2207 bin14 = histogl_e->GetBinContent(14);
2208 bin15 = histogl_e->GetBinContent(15);
2209 bin16 = histogl_e->GetBinContent(16);
2210 bin17 = histogl_e->GetBinContent(17);
2211 bin18 = histogl_e->GetBinContent(18);
2212 bin19 = histogl_e->GetBinContent(19);
2213 bin20 = histogl_e->GetBinContent(20);
2214 bin21 = histogl_e->GetBinContent(21);
2215 bin22 = histogl_e->GetBinContent(22);
2216 bin23 = histogl_e->GetBinContent(23);
2217 bin24 = histogl_e->GetBinContent(24);
2218 bin25 = histogl_e->GetBinContent(25);
2219 bin26 = histogl_e->GetBinContent(26);
2220 bin27 = histogl_e->GetBinContent(27);
2221 bin28 = histogl_e->GetBinContent(28);
2222 bin29 = histogl_e->GetBinContent(29);
2223 bin30 = histogl_e->GetBinContent(30);
2224 bin41 = histogl_e->GetBinContent(31);
2225 bin42 = histogl_e->GetBinContent(32);
2226 bin43 = histogl_e->GetBinContent(33);
2227 bin44 = histogl_e->GetBinContent(34);
2228 bin45 = histogl_e->GetBinContent(35);
2229 bin46 = histogl_e->GetBinContent(36);
2230 bin47 = histogl_e->GetBinContent(37);
2231 bin48 = histogl_e->GetBinContent(38);
2232 bin49 = histogl_e->GetBinContent(39);
2233 bin50 = histogl_e->GetBinContent(40);
2234 bin51 = histogl_e->GetBinContent(41);
2235 bin52 = histogl_e->GetBinContent(42);
2236 bin53 = histogl_e->GetBinContent(43);
2237 bin54 = histogl_e->GetBinContent(44);
2238 bin55 = histogl_e->GetBinContent(45);
2239 bin56 = histogl_e->GetBinContent(46);
2240 bin57 = histogl_e->GetBinContent(47);
2241 bin58 = histogl_e->GetBinContent(48);
2242 bin59 = histogl_e->GetBinContent(49);
2243 bin60 = histogl_e->GetBinContent(50);
2244// input variables for 20 sheets
2245 bin31 = ntrke20;
2246 bin32 = Rcut20/ntrke20;
2247 bin33 = Tcut20/ntrke20;
2248 bin34 = historcut20->GetRMS();
2249 bin35 = histotcut20->GetRMS();
2250
2251 params[0] = bin3;
2252 params[1] = bin4;
2253 params[2] = bin5;
2254 params[3] = bin6;
2255 params[4] = bin7;
2256 params[5] = bin8;
2257 params[6] = bin9;
2258 params[7] = bin10;
2259 params[8] = bin11;
2260 params[9] = bin12;
2261 params[10] = bin13;
2262 params[11] = bin14;
2263 params[12] = bin15;
2264 params[13] = bin16;
2265 params[14] = bin17;
2266 params[15] = bin18;
2267 params[16] = bin19;
2268 params[17] = bin20;
2269 params[18] = bin31;
2270 params[19] = bin32;
2271 params[20] = bin33;
2272 params[21] = bin34;
2273 params[22] = bin35;
2274
2275 val20=mlp1->Evaluate(0, params);
2276
2277// input variables for 30 sheets
2278 bin31 = ntrke30;
2279 bin32 = Rcut30/ntrke30;
2280 bin33 = Tcut30/ntrke30;
2281 bin34 = historcut30->GetRMS();
2282 bin35 = histotcut30->GetRMS();
2283
2284 params[18] = bin21;
2285 params[19] = bin22;
2286 params[20] = bin23;
2287 params[21] = bin24;
2288 params[22] = bin25;
2289 params[23] = bin26;
2290 params[24] = bin27;
2291 params[25] = bin28;
2292 params[26] = bin29;
2293 params[27] = bin30;
2294 params[28] = bin31;
2295 params[29] = bin32;
2296 params[30] = bin33;
2297 params[31] = bin34;
2298 params[32] = bin35;
2299 val30 = mlp3->Evaluate(0, params);
2300
2301// input variables for 50 sheets
2302 bin31 = ntrke50;
2303 bin32 = Rcut50/ntrke50;
2304 bin33 = Tcut50/ntrke50;
2305 bin34 = historcut50->GetRMS();
2306 bin35 = histotcut50->GetRMS();
2307
2308 params[28] = bin41;
2309 params[29] = bin42;
2310 params[30] = bin43;
2311 params[31] = bin44;
2312 params[32] = bin45;
2313 params[33] = bin46;
2314 params[34] = bin47;
2315 params[35] = bin48;
2316 params[36] = bin49;
2317 params[37] = bin50;
2318 params[38] = bin51;
2319 params[39] = bin52;
2320 params[40] = bin53;
2321 params[41] = bin54;
2322 params[42] = bin55;
2323 params[43] = bin56;
2324 params[44] = bin57;
2325 params[45] = bin58;
2326 params[46] = bin59;
2327 params[47] = bin60;
2328
2329 params[48] = bin31;
2330 params[49] = bin32;
2331 params[50] = bin33;
2332 params[51] = bin34;
2333 params[52] = bin35;
2334 val50 = mlp4->Evaluate(0, params);
2335
2336// input variables for 15 sheets
2337
2338 bin31 = ntrke15;
2339 bin32 = Rcut15/ntrke15;
2340 bin33 = Tcut15/ntrke15;
2341 bin34 = historcut15->GetRMS();
2342 bin35 = histotcut15->GetRMS();
2343 params[13] = bin31;
2344 params[14] = bin32;
2345 params[15] = bin33;
2346 params[16] = bin34;
2347 params[17] = bin35;
2348
2349 val15=mlp2->Evaluate(0, params);
2350
2351// save final output values
2352
2353 output50= val50;
2354 output30= val30;
2355 output20= val20;
2356 output15= val15;
2357 eProb90=0;
2358 eProb1=0;
2359
2360 if (output15>0.38&&isizeb==1) eProb90=1;
2361 if (flag15==1&&output15>0.38) eProb90=1;
2362 if (flag20==1&&output20>0.37) eProb90=1;
2363 if (flag30==1&&output30>0.36) eProb90=1;
2364 if (flag50==1&&output50>0.34) eProb90=1;
2365
2366 if (output15>0.78&&isizeb==1) eProb1=1;
2367 if (flag15==1&&output15>0.78) eProb1=1;
2368 if (flag20==1&&output20>0.73) eProb1=1;
2369 if (flag30==1&&output30>0.7) eProb1=1;
2370 if (flag50==1&&output50>0.73) eProb1=1;
2371 /*
2372 if (output15>0.345) eProb90=1;
2373 if (output15>0.345&&output20>0.355) eProb90=1;
2374 if (output15>0.345&&output20>0.355&&output30>0.385) eProb90=1;
2375 if (output15>0.345&&output20>0.355&&output30>0.385&&output50>0.37) eProb90=1;
2376
2377 if (output15>0.64) eProb1=1;
2378 if (output15>0.64&&output20>0.65) eProb1=1;
2379 if (output15>0.64&&output20>0.65&&output30>0.64) eProb1=1;
2380 if (output15>0.64&&output20>0.65&&output30>0.64&output50>0.645) eProb1=1;
2381 */
2382 if (eProb90==1&&flag50==1)
2383 {
2384 cout<< " output50: " << val50 << " output20: " << val20 << " output15: " << val15 << endl;
2385 }
2386 treesaveb3->Fill();
2387 //cout << "Do treesaveb3->Fill();"<<endl;
2388 }
2389 }
2390
2391 eShowersN=treesaveb3->GetEntries();
2392
2393 file_e2->Close();
2394
2395 fileout3->cd();
2396 treesaveb3->Write();
2397 fileout3->Close();
2398}
Double_t bin57
Definition: EdbShowerRec.h:243
TTree * varia
Definition: EdbShowerRec.h:233
Double_t bin60
Definition: EdbShowerRec.h:243
Double_t bin23
Definition: EdbShowerRec.h:240
Double_t bin5
Definition: EdbShowerRec.h:238
Double_t bin59
Definition: EdbShowerRec.h:243
Double_t bin22
Definition: EdbShowerRec.h:240
Double_t bin52
Definition: EdbShowerRec.h:243
Double_t bin35
Definition: EdbShowerRec.h:241
Double_t bin49
Definition: EdbShowerRec.h:242
Double_t bin32
Definition: EdbShowerRec.h:241
Double_t bin12
Definition: EdbShowerRec.h:239
Double_t bin2
Definition: EdbShowerRec.h:238
Double_t bin44
Definition: EdbShowerRec.h:242
Double_t bin4
Definition: EdbShowerRec.h:238
Double_t bin45
Definition: EdbShowerRec.h:242
TMultiLayerPerceptron * mlp1
Definition: EdbShowerRec.h:246
Double_t bin54
Definition: EdbShowerRec.h:243
Double_t bin41
Definition: EdbShowerRec.h:242
Double_t bin50
Definition: EdbShowerRec.h:242
Double_t bin28
Definition: EdbShowerRec.h:240
TMultiLayerPerceptron * mlp4
Definition: EdbShowerRec.h:249
Double_t bin29
Definition: EdbShowerRec.h:240
TMultiLayerPerceptron * mlp3
Definition: EdbShowerRec.h:248
Double_t bin20
Definition: EdbShowerRec.h:239
Double_t bin25
Definition: EdbShowerRec.h:240
Double_t bin58
Definition: EdbShowerRec.h:243
Double_t bin30
Definition: EdbShowerRec.h:240
Double_t bin47
Definition: EdbShowerRec.h:242
Double_t bin26
Definition: EdbShowerRec.h:240
Double_t bin53
Definition: EdbShowerRec.h:243
Double_t bin21
Definition: EdbShowerRec.h:240
Double_t bin46
Definition: EdbShowerRec.h:242
Double_t bin13
Definition: EdbShowerRec.h:239
TMultiLayerPerceptron * mlp2
Definition: EdbShowerRec.h:247
Double_t bin14
Definition: EdbShowerRec.h:239
Double_t bin42
Definition: EdbShowerRec.h:242
Double_t bin55
Definition: EdbShowerRec.h:243
Double_t bin11
Definition: EdbShowerRec.h:239
Double_t bin51
Definition: EdbShowerRec.h:243
Double_t bin24
Definition: EdbShowerRec.h:240
Double_t bin6
Definition: EdbShowerRec.h:238
Double_t bin34
Definition: EdbShowerRec.h:241
Double_t bin19
Definition: EdbShowerRec.h:239
Double_t bin48
Definition: EdbShowerRec.h:242
Double_t bin1
Definition: EdbShowerRec.h:238
Double_t bin27
Definition: EdbShowerRec.h:240
Double_t bin43
Definition: EdbShowerRec.h:242
Double_t bin56
Definition: EdbShowerRec.h:243
Double_t bin31
Definition: EdbShowerRec.h:241
Double_t bin9
Definition: EdbShowerRec.h:238
Double_t bin18
Definition: EdbShowerRec.h:239
Double_t bin15
Definition: EdbShowerRec.h:239
Double_t bin8
Definition: EdbShowerRec.h:238
Double_t bin17
Definition: EdbShowerRec.h:239
Double_t bin7
Definition: EdbShowerRec.h:238
Double_t bin10
Definition: EdbShowerRec.h:238
Double_t bin3
Definition: EdbShowerRec.h:238
Double_t bin16
Definition: EdbShowerRec.h:239
Double_t bin33
Definition: EdbShowerRec.h:241

◆ Print()

void EdbShowerRec::Print ( )

Print Function

4941 {
4943 cout << "-- EdbShowerRec Print --" << endl;
4944}

◆ PrintEdbPVRec()

void EdbShowerRec::PrintEdbPVRec ( ) const
inline
745 {
746 eAli->Print();
747 };

◆ PrintInitiatorBTs()

void EdbShowerRec::PrintInitiatorBTs ( )

Print the eInBTArray nice...

2425{
2427 if (!eInBTArrayIsFilled) {
2428 cout << "void EdbShowerRec::PrintInitiatorBTs() WARNING: eInBTArrayIsFilled="<<eInBTArrayIsFilled<<" . RETURN. "<< endl;
2429 return;
2430 }
2431
2432 cout << "void EdbShowerRec::PrintInitiatorBTs() eInBTArray->GetEntries()=" << eInBTArray->GetEntries() << endl;
2433
2434 EdbSegP* seg;
2435 for (int i=0; i< eInBTArray->GetEntries(); ++i) {
2436 seg=(EdbSegP*) eInBTArray->At(i);
2437 seg->PrintNice();
2438 }
2439 return;
2440}

◆ PrintParameters()

void EdbShowerRec::PrintParameters ( )
4846 {
4847 cout << "void EdbShowerRec::PrintParameters() " << endl;
4848 cout << "eAlgoParameterConeRadius = " << eAlgoParameterConeRadius << endl;
4849 cout << "eAlgoParameterConeAngle = " << eAlgoParameterConeAngle << endl;
4850 cout << "eAlgoParameterConnectionDR = " << eAlgoParameterConnectionDR << endl;
4851 cout << "eAlgoParameterConnectionDT = " << eAlgoParameterConnectionDT << endl;
4852 cout << "eAlgoParameterNPropagation = " << eAlgoParameterNPropagation << endl;
4853 return;
4854}

◆ PrintRecoShowerArray()

void EdbShowerRec::PrintRecoShowerArray ( )

Print the array for the Reconstructed Showers.

3478{
3480 Log(2,"EdbShowerRec::PrintRecoShowerArray","EdbShowerRec::PrintRecoShowerArray");
3481 EdbTrackP* show=0;
3482 for (int i=0; i<GetRecoShowerArrayN(); ++i) {
3483 show=(EdbTrackP*)eRecoShowerArray->At(i);
3484 show->PrintNice();
3485 }
3486 cout << "Printed all " << GetRecoShowerArrayN() << " showers of the eRecoShowerArray" << endl;
3487 Log(2,"EdbShowerRec::PrintRecoShowerArray","EdbShowerRec::PrintRecoShowerArray...done.");
3488 return;
3489}
Int_t GetRecoShowerArrayN() const
Definition: EdbShowerRec.h:711
void PrintNice()
Definition: EdbPattern.cxx:1169

◆ ReadAffAndZ()

void EdbShowerRec::ReadAffAndZ ( char *  fname,
Float_t *  pZoffs,
Float_t *  a11,
Float_t *  a12,
Float_t *  a21,
Float_t *  a22,
Float_t *  b1,
Float_t *  b2 
)
1861{
1862 char buf[256];
1863 char key[256];
1864 Int_t id;
1865 Float_t fTranslateX,fTranslateY;
1866
1867 FILE *fp=fopen(fname,"r");
1868 if (fp==NULL) {
1869 printf("ERROR open file: %s n", fname);
1870 return;
1871 } else
1872 // printf( "Read affine transformation from file: %s\n", fname );
1873 while ( fgets(buf,256,fp)!=NULL ) {
1874
1875 for ( int i=0; i<(int)strlen(buf); i++ )
1876 if ( buf[i]=='#' ) {
1877 buf[i]='0'; // cut out comments starting from #
1878 break;
1879 }
1880
1881 if ( sscanf(buf,"%s",key)!=1 ) continue;
1882 if ( !strcmp(key,"INCLUDE") )
1883 {
1884 // sscanf(buf+strlen(key),"%s",name);
1885 //ReadAffAndZ(name,pZoffs);
1886 }
1887 else if ( !strcmp(key,"AFFXY") )
1888 {
1889 sscanf(buf+strlen(key),"%d %f %f %f %f %f %f",&id,a11,a12,a21,a22,b1,b2);
1890 }
1891 else if ( !strcmp(key,"ZLAYER") )
1892 {
1893 sscanf(buf+strlen(key),"%d %f",&id,pZoffs);
1894 }
1895 else if ( !strcmp(key,"VOLUME0") )
1896 {
1897 sscanf(buf+strlen(key),"%f %f",&fTranslateX,&fTranslateY);
1898 }
1899 }
1900 fclose(fp);
1901}
const char * fname
Definition: mc2raw.cxx:41
fclose(pFile)

◆ ReadPiece()

int EdbShowerRec::ReadPiece ( EdbDataPiece piece,
EdbPattern pat 
)

assuming that piece was initialised correctly

1906{
1908
1909 if (!piece.InitCouplesTree("READ")) return 0;
1910 piece.GetCPData_new( &pat,0,0,0 );
1911 pat.SetSegmentsZ();
1912 pat.Transform( piece.GetLayer(0)->GetAffineXY() );
1913 pat.TransformA( piece.GetLayer(0)->GetAffineTXTY() );
1914 pat.TransformShr( piece.GetLayer(0)->Shr() );
1915 return 1;
1916}
EdbLayer * GetLayer(int id)
Definition: EdbDataSet.h:87
int InitCouplesTree(const char *mode="READ")
Definition: EdbDataSet.cxx:1239
int GetCPData_new(EdbPattern *pat, EdbPattern *p1=0, EdbPattern *p2=0, TIndex2 *trseg=0)
Definition: EdbDataSet.cxx:792
float Shr() const
Definition: EdbLayer.h:89
EdbAffine2D * GetAffineTXTY()
Definition: EdbLayer.h:120
EdbAffine2D * GetAffineXY()
Definition: EdbLayer.h:119
virtual void Transform(const EdbAffine2D *a)
Definition: EdbVirtual.cxx:155
void TransformA(const EdbAffine2D *affA)
Definition: EdbPattern.cxx:324
void TransformShr(const float shr)
Definition: EdbPattern.cxx:341
void SetSegmentsZ()
Definition: EdbPattern.cxx:250

◆ rec() [1/3]

void EdbShowerRec::rec ( int  num,
int  MAXPLATE,
int  DATA,
int  Ncand,
double *  x0,
double *  y0,
double *  z0,
double *  tx0,
double *  ty0,
double *  chi20,
int *  W0,
double *  P0,
int *  Flag0,
int *  plate0,
int *  id0,
int *  TRid,
double *  Esim,
int  piece2,
int  piece2par,
int  DOWN,
EdbPVRec pvr 
)
300{
301 // General reconstruction intermediate function to differentiate between upstream
302 // or downstream reco.
303 // This function contains also arrays for Chi2,W,P,Flag of the first BT...
304
305// if (DOWN == 1) {
306// recdown(num,MAXPLATE,DATA,Ncand,x0,y0,z0,tx0,ty0,chi20,W0,P0,Flag0,plate0,id0,TRid,Esim,mcDigitIndexTop0,mcDigitIndexBottom0,piece2, piece2par,pvr);
307// }
308// if (DOWN == 0) {
309// recup(num,MAXPLATE,DATA,Ncand,x0,y0,z0,tx0,ty0,chi20,W0,P0,Flag0,plate0,id0,TRid,Esim,mcDigitIndexTop0,mcDigitIndexBottom0,piece2, piece2par,pvr);
310// }
311 return;
312}

◆ rec() [2/3]

void EdbShowerRec::rec ( int  num,
int  MAXPLATE,
int  DATA,
int  Ncand,
double *  x0,
double *  y0,
double *  z0,
double *  tx0,
double *  ty0,
int *  plate0,
int *  id0,
int *  TRid,
double *  Esim,
int *  mcDigitIndexTop,
int *  mcDigitIndexBottom,
int  piece2,
int  piece2par,
int  DOWN,
EdbPVRec pvr 
)

OLD — not used anymore....

NEW — to be used from now on .... (svn. Revision 889)

Another reconstruction function ...

318{
320 double chi20[10000];
321 double P0[10000];
322 int W0[10000];
323 int Flag0[10000];
324 chi20[0]=-9999999;
325 W0[0]=-9999999;
326 P0[0]=-9999999;
327 Flag0[0]=-9999999;
328 if (DOWN == 1) {
329 recdown(num,MAXPLATE,DATA,Ncand,x0,y0,z0,tx0,ty0,chi20,W0,P0,Flag0,plate0,id0,TRid,Esim,mcDigitIndexTop0,mcDigitIndexBottom0,piece2, piece2par,pvr);
330 }
331 if (DOWN == 0) {
332 recup(num,MAXPLATE,DATA,Ncand,x0,y0,z0,tx0,ty0,chi20,W0,P0,Flag0,plate0,id0,TRid,Esim,mcDigitIndexTop0,mcDigitIndexBottom0,piece2, piece2par,pvr);
333 }
334 return;
335}
void recup(int num, int MAXPLATE, int DATA, int Ncand, double *x0, double *y0, double *z0, double *tx0, double *ty0, double *chi20, int *W0, double *P0, int *Flag0, int *plate0, int *id0, int *TRid, double *Esim, int *mcDigitIndexTop0, int *mcDigitIndexBottom0, int piece2, int piece2par, EdbPVRec *pvr)
Definition: EdbShowerRec.cxx:942
void recdown(int num, int MAXPLATE, int DATA, int Ncand, double *x0, double *y0, double *z0, double *tx0, double *ty0, double *chi20, int *W0, double *P0, int *Flag0, int *plate0, int *id0, int *TRid, double *Esim, int *mcDigitIndexTop0, int *mcDigitIndexBottom0, int piece2, int piece2par, EdbPVRec *pvr)
Definition: EdbShowerRec.cxx:391
int DOWN
Definition: shower_btr.C:16

◆ rec() [3/3]

void EdbShowerRec::rec ( TObjArray *  sarr,
EdbPVRec pvr 
)

Another reconstruction function ...

340{
342 int Ncand = 0;
343 double x0[10000];
344 double y0[10000];
345 double z0[10000];
346 double tx0[10000];
347 double ty0[10000];
348 double chi20[10000];
349 double P0[10000];
350 int W0[10000];
351 int Flag0[10000];
352 int TRid[10000];
353 double Esim[10000];
354 int id[10000];
355 int Pid[10000];
356 float Zoff;
357 int nentries = sarr->GetEntries();
358 EdbSegP *s = 0;
359 for (int i=0; i<nentries; i++) {
360
361 s= (EdbSegP*)sarr->At(i);
362 x0[Ncand] = s->X();
363 y0[Ncand] = s->Y();
364 Zoff = s->Z();
365 z0[Ncand] = Zoff;
366 tx0[Ncand] = s->TX();
367 ty0[Ncand] = s->TY();
368 chi20[Ncand] = s->Chi2();
369 W0[Ncand] = s->W();
370 P0[Ncand] = s->P();
371 Flag0[Ncand] = s->Flag();
372 TRid[Ncand] = s->MCEvt(); //this has to be a positive number
373 Esim[Ncand] = s->P();
374 id[Ncand] = s->ID();
375 Pid[Ncand] = Zoff/1273+1;
376 //cout << s->X() << " " << s->Y() << " " << s->Z() << " " << s->TX() << " " << s->TY() << " " << Pid[Ncand] << " " << Esim[Ncand] << " " << TRid[Ncand] << endl;
377 //cout << chi20[Ncand] << " " << W0[Ncand] << " " << P0[Ncand] << " " << Flag0[Ncand] << endl;
378 Ncand++;
379 }
380 rec(0,57,0,Ncand,x0,y0,z0,tx0,ty0,chi20,W0,P0,Flag0,Pid,id,TRid,Esim,1,1,1,pvr);
381
382}

◆ recdown()

void EdbShowerRec::recdown ( int  num,
int  MAXPLATE,
int  DATA,
int  Ncand,
double *  x0,
double *  y0,
double *  z0,
double *  tx0,
double *  ty0,
double *  chi20,
int *  W0,
double *  P0,
int *  Flag0,
int *  plate0,
int *  id0,
int *  TRid,
double *  Esim,
int *  mcDigitIndexTop0,
int *  mcDigitIndexBottom0,
int  piece2,
int  piece2par,
EdbPVRec pvr 
)

Old style implementation of downstream reconstruction.
Starts with arrays that contain Initiator Basetracks,
and uses the EdbPVRec object for source data.
Reconstruction algorithm is the standard "ConeTube" basetrack
connection algorithm.
Reconstructed Showers are first saved as Float_t data in a
Tree, afterwards they will be converted into an EdbTrackP array.

392{
400 //
401
402 // shower tree definition
403 treesaveb = new TTree("treebranch","tree of branchtrack");
404 treesaveb->Branch("number_eventb",&number_eventb,"number_eventb/I");
405 treesaveb->Branch("sizeb",&sizeb,"sizeb/I");
406 treesaveb->Branch("sizeb15",&sizeb15,"sizeb15/I");
407 treesaveb->Branch("sizeb20",&sizeb20,"sizeb20/I");
408 treesaveb->Branch("sizeb30",&sizeb30,"sizeb30/I");
409 treesaveb->Branch("E_MC",&E_MC,"E_MC/F");
410
411 treesaveb->Branch("isizeb",&isizeb,"isizeb/I");
412 treesaveb->Branch("showerID",&showerID,"showerID/I");
413 treesaveb->Branch("idb",idb,"idb[sizeb]/I");
414 treesaveb->Branch("plateb",plateb,"plateb[sizeb]/I");
415 treesaveb->Branch("xb",xb,"xb[sizeb]/F");
416 treesaveb->Branch("yb",yb,"yb[sizeb]/F");
417 treesaveb->Branch("zb",zb,"zb[sizeb]/F");
418 treesaveb->Branch("txb",txb,"txb[sizeb]/F");
419 treesaveb->Branch("tyb",tyb,"tyb[sizeb]/F");
420 treesaveb->Branch("nfilmb",nfilmb,"nfilmb[sizeb]/I");
421 treesaveb->Branch("ntrace1simub",ntrace1simub,"ntrace1simu[sizeb]/I");
422 treesaveb->Branch("ntrace2simub",ntrace2simub,"ntrace2simu[sizeb]/I"); // s->W()
423 treesaveb->Branch("ntrace3simub",ntrace3simub,"ntrace3simu[sizeb]/F"); // s->P()
424 treesaveb->Branch("ntrace4simub",ntrace4simub,"ntrace4simu[sizeb]/I"); // s->Flag()
425 treesaveb->Branch("chi2btkb",chi2btkb,"chi2btkb[sizeb]/F");
426 treesaveb->Branch("deltarb",deltarb,"deltarb[sizeb]/F");
427 treesaveb->Branch("deltathetab",deltathetab,"deltathetab[sizeb]/F");
428 treesaveb->Branch("deltaxb",deltaxb,"deltaxb[sizeb]/F");
429 treesaveb->Branch("deltayb",deltayb,"deltayb[sizeb]/F");
430 treesaveb->Branch("tagprimary",tagprimary,"tagprimary[sizeb]/F");
431 treesaveb->Branch("purityb",&purityb,"purityb/F");
432 treesaveb->Branch("mcDigitIndexTop",mcDigitIndexTop,"mcDigitIndexTop[sizeb]/I");
433 treesaveb->Branch("mcDigitIndexBottom",mcDigitIndexBottom,"mcDigitIndexBottom[sizeb]/I");
434
435 fileout = new TFile("shower1.root","RECREATE");
436
437 //additionally needed, if not given by constructor.
438 // this is only a temporary solution. When giving over the constructor with
439 // segments of EdbSegP class, they will contain the needed information then.
440 cout << " void EdbShowerRec::recdown() Additionally needed, if not given by constructor: " << endl;
441 cout << " void EdbShowerRec::recdown() this is only a temporary solution. When giving over the constructor with " << endl;
442 cout << " void EdbShowerRec::recdown() segments of EdbSegP class, they will contain the needed information then." << endl;
443 cout << " void EdbShowerRec::recdown() For the momemt, if Chi2, W,P,Flag of the starting BT is not given..." << endl;
444 cout << " void EdbShowerRec::recdown() It is assumed to be ... -9999999 ..." << endl;
445// float chi20[10000];
446// float P0[10000];
447// int W0[10000];
448// int Flag0[10000];
449// chi20[0]=-9999999;
450// W0[0]=-9999999;
451// P0[0]=-9999999;
452// Flag0[0]=-9999999;
453
454 float Z0, SX0,SY0;
455 float X0, Y0, Xss,Yss;
456 float Delta, rayon,rayon2, diff, delta;
457 float Xe[4], Ye[4];
458 char fname2[128];
459
460 char nme[64];
461 float a11, a12, a21, a22, bb1, bb2;
462 a11=1;
463 a12=0;
464 a21=0;
465 a22=1;
466 bb1=0;
467 bb2=0;
468 float Zoff;
469 double ZZ0[60];
470 int ind;
471 const Int_t eNSM = 10000;
472 const Int_t eNTM = 1000;
473
474 TArrayF xbb(eNTM*eNSM);
475 TArrayF ybb(eNTM*eNSM);
476 TArrayF zbb(eNTM*eNSM);
477 TArrayF txbb(eNTM*eNSM);
478 TArrayF tybb(eNTM*eNSM);
479 TArrayF chi2bb(eNTM*eNSM);
480 TArrayI sigbb(eNTM*eNSM);
481 TArrayI wbb(eNTM*eNSM);
482 TArrayI add(eNTM*eNSM);
483 TArrayF Pbb(eNTM*eNSM);
484 TArrayI Flagbb(eNTM*eNSM);
485
486 for (int i=0; i<eNSM; i++)
487 {
488 for (int j=0; j<eNTM; j++)
489 {
490 ind = i*eNTM+j;
491 xbb[ind];
492 ybb[ind];
493 zbb[ind];
494 txbb[ind];
495 tybb[ind];
496 chi2bb[ind];
497 wbb[ind];
498 sigbb[ind];
499 Pbb[ind];
500 Flagbb[ind];
501 }
502 }
503
504 TList *eS = new TList;
505 for (int ii=0; ii<Ncand; ii++)
506 {
507 EdbShowerRec* shower = new EdbShowerRec();
508
509 shower->SetID(ii);
510 shower->SetX0(x0[ii]);
511 shower->SetY0(y0[ii]);
512 shower->SetZ0(z0[ii]);
513 shower->SetTx(tx0[ii]);
514 shower->SetTy(ty0[ii]);
515 shower->SetTrID(TRid[ii]);
516 shower->SetChi20(chi20[ii]);
517 shower->SetW0(W0[ii]);
518 shower->SetP0(P0[ii]);
519 shower->SetFlag0(Flag0[ii]);
520
521
522 shower->SetDeltarb(200.,0);
523 shower->SetDelthetab(0.5,0);
524 shower->SetPrimary(0,0);
525 shower->SetNFilmb(1,0);
526 shower->SetIDb(id0[ii],0);
527 shower->SetPlateb(plate0[ii],0);
528 shower->SetXb(x0[ii],0);
529 shower->SetYb(y0[ii],0);
530 shower->SetZb(z0[ii],0);
531 shower->SetTXb(tx0[ii],0);
532 shower->SetTYb(ty0[ii],0);
533 shower->SetChi2b(chi20[ii],0);
534 shower->SetWb(W0[ii],0);
535 shower->SetPb(P0[ii],0);
536 shower->SetFlagb(Flag0[ii],0);
537 shower->SetmcDigitIndexTop(mcDigitIndexTop0[ii],0);
538 shower->SetmcDigitIndexBottom(mcDigitIndexBottom0[ii],0);
539
540
541 ind = 0 + ii*eNTM;
542
543 xbb[ind] = x0[ii];
544 ybb[ind] = y0[ii];
545 zbb[ind] = z0[ii];
546 txbb[ind] = tx0[ii];
547 tybb[ind] = ty0[ii];
548 chi2bb[ind] = chi20[ii];
549 wbb[ind] = W0[ii];
550 Pbb[ind] = P0[ii];
551 Flagbb[ind] = Flag0[ii];
552
553 add[ii] = 1;
554 eS->Add(shower);
555 }
556
557 EdbShowerRec* a=0;
558// save the Z position of the first sheet
559 /*
560 if (num<10)
561 {
562 if (piece2par<10)
563 {
564 sprintf(nme,"%s/0%d_00%d.par","par",num,piece2par);
565 }
566 else
567 {
568 sprintf(nme,"%s/0%d_0%d.par","par",num,piece2par);
569 }
570 }
571 else
572 {
573 if (piece2par<10)
574 {
575 sprintf(nme,"%s/%d_00%d.par","par",num,piece2par);
576 }
577 else
578 {
579 sprintf(nme,"%s/%d_0%d.par","par",num,piece2par);
580 }
581 }
582 ReadAffAndZ(nme,&Zoff,&a11,&a12,&a21,&a22,&bb1,&bb2 );
583 // ZZ0[0]= z0[0];
584 ZZ0[0]= Zoff;
585 */
586 int nntr;
587 int ok;
588 int max=0 ;
589 int index = 0;
590 double rr;
591
592// float Rcut = 180.;
593// float Tcut = 0.18;
594// float Rcut = 150.;
595// float Tcut = 0.15;
596 float Rcut = eAlgoParameterConnectionDR;
597 float Tcut = eAlgoParameterConnectionDT;
598
599 float mini[5] = {-20000.,-20000.,-1,-1,0};
600 float maxi[5] = {20000.,20000.,1,1,100};
601 /*
602 for (int d=num+1; d<MAXPLATE+1; d++) {
603 index++;
604 printf( "Process plate nr (w.r.t.first BT) : %d\n",d);
605
606 if (d<10)
607 {
608 if (piece2par<10)
609 {
610 sprintf(nme,"%s/0%d_00%d.par","par",d,piece2par);
611 sprintf(fname2,"%s/0%d_00%d.cp.root","data",d,piece2);
612 }
613 else
614 {
615 sprintf(nme,"%s/0%d_0%d.par","par",d,piece2par);
616 sprintf(fname2,"%s/0%d_0%d.cp.root","data",d,piece2);
617 }
618 }
619 else
620 {
621 if (piece2par<10)
622 {
623 sprintf(nme,"%s/%d_00%d.par","par",d,piece2par);
624 sprintf(fname2,"%s/%d_00%d.cp.root","data",d,piece2);
625 }
626 else
627 {
628 sprintf(nme,"%s/%d_0%d.par","par",d,piece2par);
629 sprintf(fname2,"%s/%d_0%d.cp.root","data",d,piece2);
630 }
631 }
632 */
634 EdbPattern *pat=0;
635 EdbPattern *pat2=0;
636 EdbDataPiece Piece;
637 /*
638 InitPiece(Piece,fname2,nme);
639 pat2 = new EdbPattern(0.,0., Piece.GetLayer(0)->Z(),100 );
640 Z0 = Piece.GetLayer(0)->Z();
641 ReadPiece(Piece, *pat2);
642
643 ReadAffAndZ(nme,&Zoff,&a11,&a12,&a21,&a22,&bb1,&bb2 );
644
645
646 Z0 = Zoff;
647 ZZ0[index] = Zoff;
648 */
649// EdbPVRec *pvr;
650// LoadEdbPVRec();
651// pvr= GetEdbPVRec();
652
653
654
655 for (int d=0; d<pvr->Npatterns(); d++) {
656 index++;
657 printf( "Process plate nr (w.r.t.first BT) : %d\r",d+1);
658 if (d==pvr->Npatterns()-1) printf("\n");
659 pat2 = pvr->GetPattern(d);
660
661 Z0 = pat2->Z();
662 ZZ0[index] = pat2->Z();
663
664 int ii =0;
665
666 TIter next(eS);
667 while ((a=(EdbShowerRec*)next()))
668 {
669
670 //cout << " DEBUG:: a->GetZ0() = " << a->GetZ0() << " Z0= " << Z0 << endl;
671
672 if (a->GetZ0()>Z0) ii++;
673 if (a->GetZ0()>Z0) continue;
674 Xss = a->GetX0() + fabs(Z0-a->GetZ0())*a->GetTx();
675 Yss = a->GetY0() + fabs(Z0-a->GetZ0())*a->GetTy();
676
677
678 mini[0] = Xss-1250.;
679 mini[1] = Yss-1250.;
680 mini[2] = -0.5;
681 mini[3] = -0.5;
682 mini[4] = 0.;
683 maxi[0] = Xss+1250.;
684 maxi[1] = Yss+1250.;
685 maxi[2] = 0.5;
686 maxi[3] = 0.5;
687 maxi[4] = 100;
688
689 pat = pat2->ExtractSubPattern(mini,maxi);
690 ali.AddPattern(pat);
691 //ali.Print(); cout << "This was ali.Print(); "<< endl;
692
693 EdbSegP *ss=0;
694
695 int incr=-1;
696
697 for (int ip=0; ip<ali.Npatterns(); ip++) {
698 incr++;
699 };
700
701 for (int i=0; i<ali.GetPattern(incr)->N(); i++)
702 {
703 ss = ali.GetPattern(incr)->GetSegment(i);
704// ss->PrintNice();
705 ok = 0;
706 if (DATA ==1) {
707 X0 = a11*ss->X() + a12*ss->Y() + bb1;
708 Y0 = a21*ss->X() + a22*ss->Y() + bb2;
709
710 SX0 = a11*ss->TX()+ a12*ss->TY() ;
711 SY0 = a21*ss->TX()+a22*ss->TY();
712 }
713 else
714 {
715 X0 = ss->X() ;
716 Y0 = ss->Y() ;
717 SX0 = ss->TX();
718 SY0 = ss->TY();
719 }
720
721 if (fabs(SX0)>0.4) continue;
722 if (fabs(SY0)>0.4) continue;
723
724 //if ( a->GetTrID() == ss->MCEvt()|| ss->MCEvt()<0)
725 //{
726 //Delta = 20.+ fabs(0.02*fabs(Z0-a->GetZ0())); // cone with 20 mrad
727 //rayon = 800.; // cylinder with 800 microns radius
728 Delta = 20.+ fabs(eAlgoParameterConeAngle*fabs(Z0-a->GetZ0())); // cone with eAlgoParameterConeAngle mrad
729 rayon = eAlgoParameterConeRadius; // cylinder with eAlgoParameterConeRadius microns radius
730
731 diff = sqrt((X0-Xss)*(X0-Xss)+(Y0-Yss)*(Y0-Yss));
732
733// cout << "diff = " << diff << endl;
734// ss->PrintNice();
735
736 if ( diff<rayon&&diff<Delta )
737 {
738 if (index==1) max = 1;
739 if (index==2) max = 2;
740 if (index>2) max = 3;
741
742 for (int el=0; el<max; el++)
743 {
744 //extrapolation in previous plate
745 Xe[el] = X0 - fabs(Z0-ZZ0[index-el-1])*SX0;
746 Ye[el] = Y0 - fabs(Z0-ZZ0[index-el-1])*SY0;
747 nntr = add[ii];
748
749 for (int l2=0; l2<nntr; l2++)
750 {
751 ind = l2 + ii*eNTM;
752
753 if (fabs(a->GetZb(l2)-(Z0-(el+1)*1273))<500)
754 {
755// ss->PrintNice();
756
757 rayon2 = sqrt((Xe[el]-a->GetXb(l2))*(Xe[el]-a->GetXb(l2))+((Ye[el]-a->GetYb(l2))*(Ye[el]-a->GetYb(l2))));
758 delta = sqrt((SX0-a->GetTXb(l2))*(SX0-a->GetTXb(l2))+((SY0-a->GetTYb(l2))*(SY0-a->GetTYb(l2))));
759 if (rayon2<Rcut&&delta<Tcut)
760 {
761
762 if (ok==0)
763 {
764 ind = add[ii] + ii*eNTM;
765
766 xbb[ind] = X0 ;
767 ybb[ind] = Y0 ;
768 zbb[ind] = Z0 ;
769 txbb[ind] = SX0 ;
770 tybb[ind] = SY0 ;
771 a->SetIDb(ss->ID(),add[ii]);
772 a->SetPlateb(d,add[ii]);
773 a->SetXb(X0,add[ii]);
774 a->SetYb(Y0,add[ii]);
775 a->SetZb(Z0,add[ii]);
776 a->SetTXb(SX0,add[ii]);
777 a->SetTYb(SY0,add[ii]);
778 a->SetDeltarb(rayon2,add[ii]);
779 a->SetDelthetab(delta,add[ii]);
780 //a->SetNFilmb( index+1,add[ii]);
781 rr = (Z0-a->GetZ0())/1273;
782 a->SetNFilmb(int(round(rr)+1),add[ii]);
783 if (ss->MCEvt()==a->GetTrID()) sigbb[ind] = 1;
784 if (ss->MCEvt()<0) sigbb[ind] = 0;
785 chi2bb[ind] = ss->Chi2();
786 wbb[ind] = int(ss->W());
787 Pbb[ind] = ss->P();
788 Flagbb[ind] = ss->Flag();
789
790 a->SetmcDigitIndexTop(ss->MCEvt(),add[ii]);
791 a->SetmcDigitIndexBottom(ss->MCTrack(),add[ii]);
792 ok =1;
793
794// ss->PrintNice();
795
796 add[ii]++;
797 }
798 else if (ok==1&&rayon2<a->GetDeltarb(add[ii]-1))
799 {
800 a->SetDeltarb(rayon2,add[ii]-1);
801 a->SetDelthetab(delta,add[ii]-1);
802
803 }
804 }
805 }
806 }
807 }
808 }
809 //}
810 }
811 ii++;
812 }
813 }
814
815
816 int i = 0;
817 int loopcount=0;
818 int evtid = 0;
819 int nMC=0;
820 TIter next(eS);
821 while ((a=(EdbShowerRec*)next()))
822 {
823// cout << "while ((a=(EdbShowerRec*)next())) loopcount= " << loopcount << endl;
824
825 number_eventb = a->GetTrID();
826 sizeb = add[i];
827 a->SetSize(add[i]);
828 sizeb15 = 0;
829 sizeb20 = 0;
830 sizeb30 = 0;
831 isizeb = 0;
832 purityb = 0;
833 nMC=0;
834 E_MC = Esim[i];
835
836 for (int j=0; j<add[i]; j++)
837 {
838 if ((a->GetZb(j)>a->GetZ0()+5000)&&isizeb==0) isizeb = 1; //cross at least 4 plates
839 if (a->GetNFilmb(j)<16) sizeb15++;
840 if (a->GetNFilmb(j)<21) sizeb20++;
841 if (a->GetNFilmb(j)<31) sizeb30++;
842 if (a->GetNFilmb(j)==15) isizeb=15;
843 if (a->GetNFilmb(j)==20) isizeb=20;
844 if (a->GetNFilmb(j)==30) isizeb=30;
845 if (a->GetNFilmb(j)==50) isizeb=50;
846 }
847 a->SetSize15(sizeb15);
848 a->SetSize20(sizeb20);
849 a->SetSize30(sizeb30);
850
851 for (int j=0; j<add[i]; j++)
852 {
853 idb[j] = a->GetIDb(j);
854 //plateb[j] = a->GetPlateb(j);
855 plateb[j] = floor(a->GetZb(j)/1273)+31;// F. Brunet : ePlate setters and getters obsolet with new plate thickness
856 xb[j] = a->GetXb(j);
857 yb[j] = a->GetYb(j);
858 zb[j] = a->GetZb(j);
859 txb[j] = a->GetTXb(j);
860 tyb[j] = a->GetTYb(j);
861 deltarb[j] = a->GetDeltarb(j);
862 deltathetab[j] = a->GetDeltathetab(j);
863 nfilmb[j] = a->GetNFilmb(j);
864 tagprimary[j] = 0;
865
866 mcDigitIndexTop[j] = a->GetmcDigitIndexTop(j);
867 mcDigitIndexBottom[j] = a->GetmcDigitIndexBottom(j);
868
869 //gEDBDEBUGLEVEL=3;
870 if (gEDBDEBUGLEVEL>2) cout << xb[j] << " " << yb[j] << " " << zb[j] << " " << txb[j] << " " << tyb[j] << " " << sizeb << endl;
871
872 if (j==0) tagprimary[j] = 1;
873 if (j==0) chi2btkb[j] = chi2bb[j+i*eNTM];
874 if (j>0) chi2btkb[j] = chi2bb[j+i*eNTM];
875 // if (j==0) ntrace1simub[j]= 1;
876 if (j==0&&a->GetTrID()>=0) ntrace1simub[j]= 1;
877 if (j==0&&a->GetTrID()<0) ntrace1simub[j]= 0;
878
879 if (j>0) ntrace1simub[j] = sigbb[j+i*eNTM];
880 if (j==0) ntrace2simub[j]= wbb[j+i*eNTM];
881 if (j>0) ntrace2simub[j] = wbb[j+i*eNTM];
882 ntrace3simub[j]= Pbb[j+i*eNTM];
883 ntrace4simub[j]= Flagbb[j+i*eNTM];
884
885 //cout << " j= " << j << " i= " << i << " eNTM= " << eNTM <<endl;
886 //cout << " j+i*eNTM= " << j+i*eNTM << " chi2bb[j+i*eNTM]; = " << chi2bb[j+i*eNTM] << " eNTM= " << eNTM <<endl;
887
888 if (ntrace1simub[j]>=1) ++nMC;
889 }
890 if (sizeb>0) purityb=float(nMC)/float(sizeb);
891 if (isizeb > 0)//cross at least 4 plates
892 {
893 showerID = evtid;
894 treesaveb->Fill();
895 evtid++;
896 }
897 i++;
898 }
899
900 eShowersN=treesaveb->GetEntries();
901 treesaveb->Show(0);
902 SaveResults();
903 NeuralNet();
904
905
906 //CalculateEnergyValues();
907 // deprecated since were going to have the transition to EdbShowerAlg, which does energy...
908 // New... still to check:
909 //TransferTreebranchShowerTreeIntoShowerObjectArray
910
911
912 // Open File. Get Tree.
913 TFile *_file0 = new TFile("Shower2.root");
914 TTree *tr = (TTree*)_file0->Get("treebranch");
916 TObjArray* RecoShowerArray = GetRecoShowerArray() ;
917 // Check the number of entries:
918 cout << tr->GetEntries() << endl;
919 cout << GetRecoShowerArrayN() << endl;
920 // Instantate ShowerAlgorithmEnergy Class
922 // Run Shower Energy Algorith on all shower/tracks
924 // Write the values then into "Shower.root" (old Shower.root will be replaced(and backuped)!");
925 ShowerAlgEnergyInstance->WriteNewRootFile("Shower2.root","treebranch");
926
927#ifndef WIN32
928 strcpy(cmd,"rm shower1.root");
929 gSystem->Exec(cmd);
930 strcpy(cmd,"rm Shower2.root");
931 gSystem->Exec(cmd);
932#else
933 gSystem->Exec("del shower1.root");
934 gSystem->Exec("del Shower2.root");
935#endif
936
937 return;
938}
int round(const T &x)
Definition: Functions.hh:83
void d()
Definition: RecDispEX.C:381
EdbShowerAlgESimple * ShowerAlgEnergyInstance
Definition: Shower_E_FromEdbTrackP.C:6
TObjArray * RecoShowerArray
Definition: Shower_E_FromShowerRoot.C:12
Expr< UnaryOp< Fabs< T >, Expr< A, T, D >, T >, T, D > fabs(const Expr< A, T, D > &rhs)
Definition: UnaryOperators.hh:96
Edb raw data unit (scanned plate) associated with run file.
Definition: EdbDataSet.h:26
EdbPattern * ExtractSubPattern(float min[5], float max[5], int MCevt=-1)
Definition: EdbPattern.cxx:1470
void AddPattern(EdbPattern *pat)
Definition: EdbPattern.cxx:1707
Definition: EdbShowerAlg.h:323
void WriteNewRootFile()
Definition: EdbShowerAlg.h:576
void DoRun()
Definition: EdbShowerAlg.cxx:2730
Definition: EdbShowerRec.h:25
void SetIDb(int idb2, int i)
Definition: EdbShowerRec.h:465
void SetZ0(float z)
Definition: EdbShowerRec.h:398
void SetmcDigitIndexTop(int mcDt, int i)
Definition: EdbShowerRec.h:507
void SetXb(float xb, int i)
Definition: EdbShowerRec.h:462
void SetPlateb(int plate2, int i)
Definition: EdbShowerRec.h:468
void SetChi20(float chi2)
Definition: EdbShowerRec.h:401
void SetFlag0(int flag)
Definition: EdbShowerRec.h:410
Float_t GetDeltarb(int i) const
Definition: EdbShowerRec.h:346
void SetTx(float tx)
Definition: EdbShowerRec.h:419
void SetY0(float y)
Definition: EdbShowerRec.h:395
void SetPrimary(int tagprimary, int i)
Definition: EdbShowerRec.h:504
void SetYb(float yb, int i)
Definition: EdbShowerRec.h:471
char cmd[500]
Definition: EdbShowerRec.h:251
void SetX0(float x)
Definition: EdbShowerRec.h:392
void SetZb(float zb, int i)
Definition: EdbShowerRec.h:474
void SetmcDigitIndexBottom(int mcDb, int i)
Definition: EdbShowerRec.h:510
void SetDelthetab(float deltathetab, int i)
Definition: EdbShowerRec.h:501
void SetW0(int w)
Definition: EdbShowerRec.h:404
void SetTy(float ty)
Definition: EdbShowerRec.h:422
void SetFlagb(int flag, int i)
Definition: EdbShowerRec.h:492
void SetTYb(float tyb, int i)
Definition: EdbShowerRec.h:480
void SetID(int id)
Definition: EdbShowerRec.h:388
void SetChi2b(float chi2b, int i)
Definition: EdbShowerRec.h:483
void TransferTreebranchShowerTreeIntoShowerObjectArray(TTree *treebranch)
Definition: EdbShowerRec.cxx:4599
void SetNFilmb(int nfilmb, int i)
Definition: EdbShowerRec.h:495
void SetWb(int w, int i)
Definition: EdbShowerRec.h:486
TFile * fileout
Definition: EdbShowerRec.h:218
EdbDataProc * a
Definition: EdbShowerRec.h:236
void SetP0(float p)
Definition: EdbShowerRec.h:407
TObjArray * GetRecoShowerArray() const
Definition: EdbShowerRec.h:704
void SaveResults()
Definition: EdbShowerRec.cxx:278
void SetPb(float p, int i)
Definition: EdbShowerRec.h:489
void SetTXb(float txb, int i)
Definition: EdbShowerRec.h:477
void SetDeltarb(float deltarb, int i)
Definition: EdbShowerRec.h:498
void SetTrID(int id)
Definition: EdbShowerRec.h:425
float Z0
Definition: hwinit.C:67
ss
Definition: energy.C:62
strcpy(cmd,"cp Shower.root Shower2.root")

◆ recup()

void EdbShowerRec::recup ( int  num,
int  MAXPLATE,
int  DATA,
int  Ncand,
double *  x0,
double *  y0,
double *  z0,
double *  tx0,
double *  ty0,
double *  chi20,
int *  W0,
double *  P0,
int *  Flag0,
int *  plate0,
int *  id0,
int *  TRid,
double *  Esim,
int *  mcDigitIndexTop0,
int *  mcDigitIndexBottom0,
int  piece2,
int  piece2par,
EdbPVRec pvr 
)
943{
944
945// shower tree definition
946
947 treesaveb = new TTree("treebranch","tree of branchtrack");
948 treesaveb->Branch("number_eventb",&number_eventb,"number_eventb/I");
949 treesaveb->Branch("sizeb",&sizeb,"sizeb/I");
950 treesaveb->Branch("sizeb15",&sizeb15,"sizeb15/I");
951 treesaveb->Branch("sizeb20",&sizeb20,"sizeb20/I");
952 treesaveb->Branch("sizeb30",&sizeb30,"sizeb30/I");
953 treesaveb->Branch("E_MC",&E_MC,"E_MC/F");
954 treesaveb->Branch("idb",idb,"idb[sizeb]/I");
955 treesaveb->Branch("plateb",plateb,"plateb[sizeb]/I");
956 treesaveb->Branch("showerID",&showerID,"showerID/I");
957 treesaveb->Branch("isizeb",&isizeb,"isizeb/I");
958 treesaveb->Branch("xb",xb,"xb[sizeb]/F");
959 treesaveb->Branch("yb",yb,"yb[sizeb]/F");
960 treesaveb->Branch("zb",zb,"zb[sizeb]/F");
961 treesaveb->Branch("txb",txb,"txb[sizeb]/F");
962 treesaveb->Branch("tyb",tyb,"tyb[sizeb]/F");
963 treesaveb->Branch("nfilmb",nfilmb,"nfilmb[sizeb]/I");
964 treesaveb->Branch("ntrace1simub",ntrace1simub,"ntrace1simu[sizeb]/I");
965 treesaveb->Branch("ntrace2simub",ntrace2simub,"ntrace2simu[sizeb]/I");
966 treesaveb->Branch("ntrace3simub",ntrace3simub,"ntrace3simu[sizeb]/F");
967 treesaveb->Branch("ntrace4simub",ntrace4simub,"ntrace4simu[sizeb]/I");
968 treesaveb->Branch("chi2btkb",chi2btkb,"chi2btkb[sizeb]/F");
969 treesaveb->Branch("deltarb",deltarb,"deltarb[sizeb]/F");
970 treesaveb->Branch("deltathetab",deltathetab,"deltathetab[sizeb]/F");
971 treesaveb->Branch("deltaxb",deltaxb,"deltaxb[sizeb]/F");
972 treesaveb->Branch("deltayb",deltayb,"deltayb[sizeb]/F");
973 treesaveb->Branch("tagprimary",tagprimary,"tagprimary[sizeb]/F");
974 treesaveb->Branch("purityb",&purityb,"purityb/F");
975 treesaveb->Branch("mcDigitIndexTop",mcDigitIndexTop,"mcDigitIndexTop[sizeb]/I");
976 treesaveb->Branch("mcDigitIndexBottom",mcDigitIndexBottom,"mcDigitIndexBottom[sizeb]/I");
977
978 fileout = new TFile("shower1.root","RECREATE");
979
980 //additionally needed, if not given by constructor.
981 // this is only a temporary solution. When giving over the constructor with
982 // segments of EdbSegP class, they will contain the needed information then.
983 cout << " void EdbShowerRec::recdown() Additionally needed, if not given by constructor: " << endl;
984 cout << " void EdbShowerRec::recdown() this is only a temporary solution. When giving over the constructor with " << endl;
985 cout << " void EdbShowerRec::recdown() segments of EdbSegP class, they will contain the needed information then." << endl;
986 cout << " void EdbShowerRec::recdown() For the momemt, if Chi2, W,P,Flag of the starting BT is not given..." << endl;
987 cout << " void EdbShowerRec::recdown() It is assumed to be ... -9999999 ..." << endl;
988// float chi20[10000];
989// float P0[10000];
990// int W0[10000];
991// int Flag0[10000];
992// chi20[0]=-9999999;
993// W0[0]=-9999999;
994// P0[0]=-9999999;
995// Flag0[0]=-9999999;
996
997 float Z0, SX0,SY0;
998 float X0, Y0, Xss,Yss;
999 float Delta, rayon,rayon2, diff, delta;
1000 float Xe[4], Ye[4];
1001 char fname2[128];
1002
1003 char nme[64];
1004 float a11, a12, a21, a22, bb1, bb2;
1005 a11=1;
1006 a12=0;
1007 a21=0;
1008 a22=1;
1009 bb1=0;
1010 bb2=0;
1011 float Zoff;
1012 double ZZ0[57];
1013 int ind;
1014 const Int_t eNSM = 10000;
1015 const Int_t eNTM = 1000;
1016
1017 TArrayF xbb(eNTM*eNSM);
1018 TArrayF ybb(eNTM*eNSM);
1019 TArrayF zbb(eNTM*eNSM);
1020 TArrayF txbb(eNTM*eNSM);
1021 TArrayF tybb(eNTM*eNSM);
1022 TArrayI sigbb(eNTM*eNSM);
1023 TArrayF chi2bb(eNTM*eNSM);
1024 TArrayI wbb(eNTM*eNSM);
1025 TArrayI add(eNTM*eNSM);
1026 TArrayF Pbb(eNTM*eNSM);
1027 TArrayI Flagbb(eNTM*eNSM);
1028
1029 for (int i=0; i<eNSM; i++)
1030 {
1031 for (int j=0; j<eNTM; j++)
1032 {
1033 ind = i*eNTM+j;
1034 xbb[ind];
1035 ybb[ind];
1036 zbb[ind];
1037 txbb[ind];
1038 tybb[ind];
1039 sigbb[ind];
1040 wbb[ind];
1041 chi2bb[ind];
1042 Pbb[ind];
1043 Flagbb[ind];
1044 }
1045 }
1046
1047 TList *eS = new TList;
1048
1049 for (int ii=0; ii<Ncand; ii++)
1050 {
1051 EdbShowerRec* shower = new EdbShowerRec();
1052
1053 shower->SetID(ii);
1054 shower->SetX0(x0[ii]);
1055 shower->SetY0(y0[ii]);
1056 shower->SetZ0(z0[ii]);
1057 shower->SetTx(tx0[ii]);
1058 shower->SetTy(ty0[ii]);
1059 shower->SetTrID(TRid[ii]);
1060 shower->SetChi20(chi20[ii]);
1061 shower->SetW0(W0[ii]);
1062 shower->SetP0(P0[ii]);
1063 shower->SetFlag0(Flag0[ii]);
1064
1065 shower->SetDeltarb(200.,0);
1066 shower->SetDelthetab(0.5,0);
1067 shower->SetPrimary(0,0);
1068 shower->SetNFilmb(1,0);
1069 shower->SetIDb(id0[ii],0);
1070 shower->SetPlateb(plate0[ii],0);
1071 shower->SetXb(x0[ii],0);
1072 shower->SetYb(y0[ii],0);
1073 shower->SetZb(z0[ii],0);
1074 shower->SetTXb(tx0[ii],0);
1075 shower->SetTYb(ty0[ii],0);
1076 shower->SetChi2b(chi20[ii],0);
1077 shower->SetWb(W0[ii],0);
1078 shower->SetPb(P0[ii],0);
1079 shower->SetFlagb(Flag0[ii],0);
1080 shower->SetmcDigitIndexTop(mcDigitIndexTop0[ii],0);
1081 shower->SetmcDigitIndexBottom(mcDigitIndexBottom0[ii],0);
1082
1083 ind = 0 + ii*eNTM;
1084
1085 xbb[ind] = x0[ii];
1086 ybb[ind] = y0[ii];
1087 zbb[ind] = z0[ii];
1088 txbb[ind] = tx0[ii];
1089 tybb[ind] = ty0[ii];
1090 chi2bb[ind] = chi20[ii];
1091 wbb[ind] = W0[ii];
1092 Pbb[ind] = P0[ii];
1093 Flagbb[ind] = Flag0[ii];
1094
1095 add[ii] = 1;
1096 eS->Add(shower);
1097
1098
1099 }
1100
1101 EdbShowerRec* a=0;
1102// save the Z position of the first sheet
1103 if (num<10)
1104 {
1105 if (piece2par<10)
1106 {
1107 sprintf(nme,"%s/0%d_00%d.par","par",num,piece2par);
1108 }
1109 else
1110 {
1111 sprintf(nme,"%s/0%d_0%d.par","par",num,piece2par);
1112 }
1113 }
1114 else
1115 {
1116 if (piece2par<10)
1117 {
1118 sprintf(nme,"%s/%d_00%d.par","par",num,piece2par);
1119 }
1120 else
1121 {
1122 sprintf(nme,"%s/%d_0%d.par","par",num,piece2par);
1123 }
1124 }
1125
1126 ReadAffAndZ(nme,&Zoff,&a11,&a12,&a21,&a22,&bb1,&bb2 );
1127 // ZZ0[0]= z0[0];
1128 ZZ0[0]= Zoff;
1129
1130 int nntr;
1131 int ok;
1132 int max=0 ;
1133 int index = 0;
1134 double rr;
1135
1136 float Rcut = 150.;
1137 float Tcut = 0.15;
1138
1139 float mini[5] = {-20000.,-20000.,-1,-1,0};
1140 float maxi[5] = {20000.,20000.,1,1,100};
1141
1142// for (int d=num+1; d<MAXPLATE+1; d++){
1143// if (DOWN==0) break;
1144 for (int d=num-1; d>num-MAXPLATE; d--) {
1145 index++;
1146 //sprintf( "Process plate number: %d/%d\n",index+1,MAXPLATE-PLATE);
1147
1148 //if(d<10) {sprintf(nme,"%s/0%d_00%d.par","par",d,piece2par);}
1149 //else {sprintf(nme,"%s/%d_00%d.par","par",d,piece2par);}
1150
1151 if (d<10) {
1152 sprintf(fname2,"%s/0%d_00%d.cp.root","data",d,piece2);
1153 }
1154 else {
1155 sprintf(fname2,"%s/%d_00%d.cp.root","data",d,piece2);
1156 }
1157
1158 if (d<10)
1159 {
1160 if (piece2par<10)
1161 {
1162 sprintf(nme,"%s/0%d_00%d.par","par",d,piece2par);
1163 sprintf(fname2,"%s/0%d_00%d.cp.root","data",d,piece2);
1164 }
1165 else
1166 {
1167 sprintf(nme,"%s/0%d_0%d.par","par",d,piece2par);
1168 sprintf(fname2,"%s/0%d_0%d.cp.root","data",d,piece2);
1169 }
1170 }
1171 else
1172 {
1173 if (piece2par<10)
1174 {
1175 sprintf(nme,"%s/%d_00%d.par","par",d,piece2par);
1176 sprintf(fname2,"%s/%d_00%d.cp.root","data",d,piece2);
1177 }
1178 else
1179 {
1180 sprintf(nme,"%s/%d_0%d.par","par",d,piece2par);
1181 sprintf(fname2,"%s/%d_0%d.cp.root","data",d,piece2);
1182 }
1183 }
1184
1185 EdbPVRec ali;
1186 EdbPattern *pat=0;
1187 EdbPattern *pat2=0;
1188 EdbDataPiece Piece;
1189
1190 InitPiece(Piece,fname2,nme);
1191 pat2 = new EdbPattern(0.,0., Piece.GetLayer(0)->Z(),100 );
1192 Z0 = Piece.GetLayer(0)->Z();
1193 ReadPiece(Piece, *pat2);
1194
1195 ReadAffAndZ(nme,&Zoff,&a11,&a12,&a21,&a22,&bb1,&bb2 );
1196 Z0 = Zoff;
1197 ZZ0[index] = Zoff;
1198
1199 int ii =0;
1200 TIter next(eS);
1201 while ((a=(EdbShowerRec*)next()))
1202 {
1203 if (a->GetZ0()>Z0) ii++;
1204 if (a->GetZ0()>Z0) continue;
1205 Xss = a->GetX0() + fabs(Z0-a->GetZ0())*a->GetTx();
1206 Yss = a->GetY0() + fabs(Z0-a->GetZ0())*a->GetTy();
1207
1208 mini[0] = Xss-1250.;
1209 mini[1] = Yss-1250.;
1210 mini[2] = -0.5;
1211 mini[3] = -0.5;
1212 mini[4] = 0.;
1213 maxi[0] = Xss+1250.;
1214 maxi[1] = Yss+1250.;
1215 maxi[2] = 0.5;
1216 maxi[3] = 0.5;
1217 maxi[4] = 100.;
1218
1219 pat = pat2->ExtractSubPattern(mini,maxi);
1220 ali.AddPattern(pat);
1221
1222 EdbSegP *ss=0;
1223
1224 int incr=-1;
1225
1226 for (int ip=0; ip<ali.Npatterns(); ip++) {
1227 incr++;
1228 };
1229
1230 for (int i=0; i<ali.GetPattern(incr)->N(); i++)
1231 {
1232 ss = ali.GetPattern(incr)->GetSegment(i);
1233 ok = 0;
1234 if (DATA ==1) {
1235 X0 = a11*ss->X() + a12*ss->Y() + bb1;
1236 Y0 = a21*ss->X() + a22*ss->Y() + bb2;
1237
1238 SX0 = a11*ss->TX()+ a12*ss->TY() ;
1239 SY0 = a21*ss->TX()+a22*ss->TY();
1240 }
1241 else
1242 {
1243 X0 = ss->X() ;
1244 Y0 = ss->Y() ;
1245 SX0 = ss->TX();
1246 SY0 = ss->TY();
1247 }
1248
1249 if (fabs(SX0)>0.4) continue;
1250 if (fabs(SY0)>0.4) continue;
1251
1252 //if ( a->GetTrID() == ss->MCEvt()|| ss->MCEvt()<0)
1253 //{
1254 Delta = 20.+ fabs(0.02*fabs(Z0-a->GetZ0())); // cone with 20 mrad
1255 rayon = 800.; // cylinder with 800 microns radius
1256 diff = sqrt((X0-Xss)*(X0-Xss)+(Y0-Yss)*(Y0-Yss));
1257
1258 if ( diff<rayon&&diff<Delta )
1259 {
1260 if (index==1) max = 1;
1261 if (index==2) max = 2;
1262 if (index>2) max = 3;
1263
1264 for (int el=0; el<max; el++)
1265 {
1266 //extrapolation in previous plate
1267 Xe[el] = X0 - fabs(Z0-ZZ0[index-el-1])*SX0;
1268 Ye[el] = Y0 - fabs(Z0-ZZ0[index-el-1])*SY0;
1269 nntr = add[ii];
1270
1271 for (int l2=0; l2<nntr; l2++)
1272 {
1273 ind = l2 + ii*eNTM;
1274 if (fabs(zbb[ind]-(Z0-(el+1)*1273))<500)
1275 {
1276 rayon2 = sqrt((Xe[el]-xbb[ind])*(Xe[el]-xbb[ind])+((Ye[el]-ybb[ind])*(Ye[el]-ybb[ind])));
1277 delta = sqrt((SX0-txbb[ind])*(SX0-txbb[ind])+((SY0-tybb[ind])*(SY0-tybb[ind])));
1278 if (rayon2<Rcut&&delta<Tcut)
1279 {
1280 if (ok==0)
1281 {
1282 ind = add[ii] + ii*eNTM;
1283
1284 xbb[ind] = X0 ;
1285 ybb[ind] = Y0 ;
1286 zbb[ind] = Z0 ;
1287 txbb[ind] = SX0 ;
1288 tybb[ind] = SY0 ;
1289
1290 a->SetIDb(ss->ID(),add[ii]);
1291 a->SetPlateb(d,add[ii]);
1292 a->SetXb(X0,add[ii]);
1293 a->SetYb(Y0,add[ii]);
1294 a->SetZb(Z0,add[ii]);
1295 a->SetTXb(SX0,add[ii]);
1296 a->SetTYb(SY0,add[ii]);
1297 a->SetDeltarb(rayon2,add[ii]);
1298 a->SetDelthetab(delta,add[ii]);
1299 //a->SetNFilmb( index+1,add[ii]);
1300 rr = (Z0-a->GetZ0())/1273;
1301 a->SetNFilmb(int(round(rr)+1),add[ii]);
1302
1303 if (ss->MCEvt()==a->GetTrID()) sigbb[ind] = 1;
1304 if (ss->MCEvt()<0) sigbb[ind] = 0;
1305 chi2bb[ind] = ss->Chi2();
1306 wbb[ind] = int(ss->W());
1307 Pbb[ind] = ss->P();
1308 Flagbb[ind] = ss->Flag();
1309
1310 a->SetmcDigitIndexTop(ss->MCEvt(),add[ii]);
1311 a->SetmcDigitIndexBottom(ss->MCTrack(),add[ii]);
1312 ok =1;
1313 add[ii]++;
1314 }
1315 else if (ok==1&&rayon2<a->GetDeltarb(add[ii]-1))
1316 {
1317 a->SetDeltarb(rayon2,add[ii]-1);
1318 a->SetDelthetab(delta,add[ii]-1);
1319 }
1320 }
1321 }
1322 }
1323 }
1324 }
1325 //}
1326 }
1327 ii++;
1328 }
1329 }
1330
1331 int i = 0;
1332 int evtid = 0;
1333 int nMC=0;
1334 TIter next(eS);
1335 while ((a=(EdbShowerRec*)next()))
1336 {
1337 number_eventb = a->GetID();
1338 sizeb = add[i];
1339 a->SetSize(add[i]);
1340 sizeb15 = 0;
1341 sizeb20 = 0;
1342 sizeb30 = 0;
1343 isizeb = 0;
1344 purityb = 0;
1345 nMC=0;
1346 E_MC = Esim[i];
1347
1348 for (int j=0; j<add[i]; j++)
1349 {
1350 if ((a->GetZb(j)>a->GetZ0()+5000)&&isizeb==0) isizeb = 1; //cross at least 4 plates
1351 if (a->GetNFilmb(j)<16) sizeb15++;
1352 if (a->GetNFilmb(j)<21) sizeb20++;
1353 if (a->GetNFilmb(j)<31) sizeb30++;
1354 if (a->GetNFilmb(j)==15) isizeb=15;
1355 if (a->GetNFilmb(j)==20) isizeb=20;
1356 if (a->GetNFilmb(j)==30) isizeb=30;
1357 if (a->GetNFilmb(j)==50) isizeb=50;
1358 }
1359 a->SetSize15(sizeb15);
1360 a->SetSize20(sizeb20);
1361 a->SetSize30(sizeb30);
1362
1363 for (int j=0; j<add[i]; j++)
1364 {
1365 idb[j] = a->GetIDb(j);
1366 plateb[j] = a->GetPlateb(j);
1367 xb[j] = a->GetXb(j);
1368 yb[j] = a->GetYb(j);
1369 zb[j] = a->GetZb(j);
1370 txb[j] = a->GetTXb(j);
1371 tyb[j] = a->GetTYb(j);
1372 deltarb[j] = a->GetDeltarb(j);
1373 deltathetab[j] = a->GetDeltathetab(j);
1374 nfilmb[j] = a->GetNFilmb(j);
1375 tagprimary[j] = 0;
1376
1377 mcDigitIndexTop[j] = a->GetmcDigitIndexTop(j);
1378 mcDigitIndexBottom[j] = a->GetmcDigitIndexBottom(j);
1379
1380// printf("txb[j] %f\n", a->GetTXb(j));
1381
1382 if (gEDBDEBUGLEVEL>2) cout << xb[j] << " " << yb[j] << " " << zb[j] << " " << txb[j] << " " << tyb[j] << " " << sizeb << endl;
1383
1384 if (j==0) tagprimary[j] = 1;
1385 if (j==0) chi2btkb[j] = chi2bb[j+i*eNTM];
1386 if (j>0) chi2btkb[j] = chi2bb[j+i*eNTM];
1387 // if (j==0) ntrace1simub[j]= 1;
1388 if (j==0&&a->GetTrID()>=0) ntrace1simub[j]= 1;
1389 if (j==0&&a->GetTrID()<0) ntrace1simub[j]= 0;
1390
1391 if (j>0) ntrace1simub[j] = sigbb[j+i*eNTM];
1392 if (j==0) ntrace2simub[j]= wbb[j+i*eNTM];
1393 if (j>0) ntrace2simub[j] = wbb[j+i*eNTM];
1394 ntrace3simub[j]= Pbb[j+i*eNTM];
1395 ntrace4simub[j]= Flagbb[j+i*eNTM];
1396
1397 //cout << " j= " << j << " i= " << i << " eNTM= " << eNTM <<endl;
1398 //cout << " j+i*eNTM= " << j+i*eNTM << " chi2bb[j+i*eNTM]; = " << chi2bb[j+i*eNTM] << " eNTM= " << eNTM <<endl;
1399
1400 if (ntrace1simub[j]>=1) ++nMC;
1401 }
1402 if (sizeb>0) purityb=float(nMC)/float(sizeb);
1403 if (isizeb >0) //cross at least 4 plates
1404 {
1405 // number_eventb = evtid;
1406 showerID = evtid;
1407 treesaveb->Fill();
1408 evtid++;
1409 }
1410 i++;
1411 }
1412
1413 eShowersN=treesaveb->GetEntries();
1414 //treesaveb->Show(0);
1415
1416 SaveResults();
1417 NeuralNet();
1418 // Attention: NeuralNet() ->Gives Shower2.root as output!
1419
1420 // Open File. Get Tree.
1421 TFile *_file0 = new TFile("Shower2.root");
1422 TTree *tr = (TTree*)_file0->Get("treebranch");
1424 TObjArray* RecoShowerArray = GetRecoShowerArray() ;
1425 // Check the number of entries:
1426 cout << tr->GetEntries() << endl;
1427 cout << GetRecoShowerArrayN() << endl;
1428 // Instantate ShowerAlgorithmEnergy Class
1430 // Run Shower Energy Algorith on all shower/tracks
1432 cout << "// Write the values then into Shower.root (old Shower.root will be replaced(and backuped)!);" << endl;
1433
1435
1436
1437#ifndef WIN32
1438 strcpy(cmd,"rm shower1.root");
1439 gSystem->Exec(cmd);
1440 strcpy(cmd,"rm Shower2.root");
1441 gSystem->Exec(cmd);
1442#else
1443 gSystem->Exec("del shower1.root");
1444 gSystem->Exec("del Shower2.root");
1445#endif
1446
1447 return;
1448}
float Z() const
Definition: EdbLayer.h:77
void InitPiece(EdbDataPiece &piece, const char *cpfile, const char *parfile)
Definition: EdbShowerRec.cxx:263
int ReadPiece(EdbDataPiece &piece, EdbPattern &pat)
Definition: EdbShowerRec.cxx:1905
void ReadAffAndZ(char *fname, Float_t *pZoffs, Float_t *a11, Float_t *a12, Float_t *a21, Float_t *a22, Float_t *b1, Float_t *b2)
Definition: EdbShowerRec.cxx:1860

◆ remove()

void EdbShowerRec::remove ( char *  shfname,
char *  def,
int  MAXPLATE,
int  piece2par 
)
1455{
1456
1457 treesaveb = new TTree("treebranch","tree of branchtrack");
1458 treesaveb->Branch("number_eventb",&number_eventb,"number_eventb/I");
1459 treesaveb->Branch("sizeb",&sizeb,"sizeb/I");
1460 treesaveb->Branch("sizeb15",&sizeb15,"sizeb15/I");
1461 treesaveb->Branch("sizeb20",&sizeb20,"sizeb20/I");
1462 treesaveb->Branch("sizeb30",&sizeb30,"sizeb30/I");
1463 treesaveb->Branch("E_MC",&E_MC,"E_MC/F");
1464 treesaveb->Branch("isizeb",&isizeb,"isizeb/I");
1465 treesaveb->Branch("xb",xb,"xb[sizeb]/F");
1466 treesaveb->Branch("yb",yb,"yb[sizeb]/F");
1467 treesaveb->Branch("zb",zb,"zb[sizeb]/F");
1468 treesaveb->Branch("txb",txb,"txb[sizeb]/F");
1469 treesaveb->Branch("tyb",tyb,"tyb[sizeb]/F");
1470 treesaveb->Branch("nfilmb",nfilmb,"nfilmb[sizeb]/I");
1471 treesaveb->Branch("ntrace1simub",ntrace1simub,"ntrace1simu[sizeb]/I");
1472 treesaveb->Branch("ntrace2simub",ntrace2simub,"ntrace2simu[sizeb]/I");
1473 treesaveb->Branch("chi2btkb",chi2btkb,"chi2btkb[sizeb]/F");
1474 treesaveb->Branch("deltarb",deltarb,"deltarb[sizeb]/F");
1475 treesaveb->Branch("deltathetab",deltathetab,"deltathetab[sizeb]/F");
1476 treesaveb->Branch("deltaxb",deltaxb,"deltaxb[sizeb]/F");
1477 treesaveb->Branch("deltayb",deltayb,"deltayb[sizeb]/F");
1478 treesaveb->Branch("tagprimary",tagprimary,"tagprimary[sizeb]/F");
1479 fileout = new TFile("shower.root","RECREATE");
1480
1481// vert(shfname,def,Rcut,Tcut);
1482 vert(shfname,def,MAXPLATE,piece2par);
1483
1484 SaveResults();
1485
1486}
void vert(const char *name2, const char *def, int MAXPLATE, int piece2par)
Definition: EdbShowerRec.cxx:1490

◆ ResetAlgoParameters()

void EdbShowerRec::ResetAlgoParameters ( )
4807{
4808 eAlgoParameterConeRadius=800; // Radius of spanning cone from first BT
4809 eAlgoParameterConeAngle=0.015; // Opening angle of spanning cone from first BT
4810 eAlgoParameterConnectionDR=150; // Connection Criterium: delta R
4811 eAlgoParameterConnectionDT=0.15; // Connection Criterium: delta T
4812 eAlgoParameterNPropagation=3; // N plates backpropagating
4813 return;
4814}

◆ ResetInBTArray()

void EdbShowerRec::ResetInBTArray ( )
inline
719 {
721 eInBTArrayN = 0;
722 }

◆ ResetRecoShowerArray()

void EdbShowerRec::ResetRecoShowerArray ( )
inline
723 {
726 }

◆ SaveLNK()

int EdbShowerRec::SaveLNK ( )
3102{
3103 const char *fname="linked_tracks.root";
3104 const char *rcut="";
3105
3106 FILE *f = fopen(fname, "r");
3107 if (!f)
3108 {
3109 printf("Cannot find linked_tracks.root file !\n");
3110 return -1;
3111 }
3112 fclose(f);
3113
3114 EdbPVRec *ali = new EdbPVRec();
3115 EdbDataProc *dproc = new EdbDataProc();
3116 dproc->ReadTracksTree(*ali, "linked_tracks.root",rcut);
3117
3118 sprintf(cmd,"cp -v linked_tracks.root linked_tracks.backup.root");
3119 gSystem->Exec(cmd);
3120
3121 int ntracks=ali->Ntracks();
3122 cout << "nb tracks: " << ntracks << endl;
3123
3124 ali->Link();
3126 ali->MakeTracks(2,0);
3127
3128 // --------------------------------------------------------------
3129
3130 EdbSegP *segS;
3131 EdbTrackP *trackS;
3132
3133 char fname_e[128];
3134 float x,y,tx,ty,z;
3135
3136 Int_t sizeb;
3137 Int_t isizeb;
3138 Float_t xb[10000];
3139 Float_t yb[10000];
3140 Float_t zb[10000];
3141 Float_t txb[10000];
3142 Float_t tyb[10000];
3143 Int_t nfilmb[10000];
3144 // Int_t ngrainb[10000];
3145 // Int_t ntrace1simub[10000];
3146 Int_t ntrace2simub[10000];
3147 Float_t chi2btkb[10000];
3148 int eProb90;
3149 int eProb1;
3150
3151 int number_eventb,w2,plate[10000];
3152
3153 sprintf(fname_e,"Shower.root"); //input shower tree file
3154
3155 f = fopen(fname_e, "r");
3156 if (!f)
3157 {
3158 printf("Cannot find Shower.root file !\n");
3159 return -2;
3160 }
3161 fclose(f);
3162
3163
3164 TFile *file_e2 = new TFile(fname_e ,"READ");
3165 TTree *treebranch_e = (TTree*)file_e2->Get("treebranch");
3166 treebranch_e->SetBranchAddress("nfilmb", nfilmb); // max(nfilmb)=npl
3167 treebranch_e->SetBranchAddress("sizeb", &sizeb); // nseg
3168 treebranch_e->SetBranchAddress("isizeb", &isizeb);
3169 treebranch_e->SetBranchAddress("chi2btkb", &chi2btkb);
3170 treebranch_e->SetBranchAddress("txb", txb);
3171 treebranch_e->SetBranchAddress("tyb", tyb);
3172 treebranch_e->SetBranchAddress("xb", xb);
3173 treebranch_e->SetBranchAddress("yb", yb);
3174 treebranch_e->SetBranchAddress("zb", zb);
3175 treebranch_e->SetBranchAddress("number_eventb", &number_eventb);
3176 treebranch_e->SetBranchAddress("ntrace2simub", &ntrace2simub); // grain
3177 treebranch_e->SetBranchAddress("eProb1", &eProb1);
3178 treebranch_e->SetBranchAddress("eProb90", &eProb90);
3179 int nentries = treebranch_e->GetEntries();
3180
3181 for (int i=0; i<nentries; i++)
3182 {
3183 trackS = new EdbTrackP();
3184 treebranch_e->GetEntry(i);
3185
3186 if (eProb1==0||eProb90==0) continue; // remove non electron!!!
3187
3188 for (int j=0; j<sizeb; j++)
3189 {
3190 x=xb[j];
3191 y=yb[j];
3192 tx=txb[j];
3193 ty=tyb[j];
3194 z=zb[j];
3195 // plate[j] = abs(57+(int)(z/1273.)); // compiler instability with gcc4.3
3196 plate[j] = TMath::Abs(57+(int)(z/1273.)); // compiler instability with gcc4.3
3197 // cout << plate[j] << endl;
3198 w2=ntrace2simub[j];
3199 segS = new EdbSegP();
3200 segS->Set(j, x, y, tx, ty, w2, 0);
3201 segS->SetZ(z);
3202 segS->SetDZ(300.);
3203 //segS->SetPID(plate[j]); // DISPLAY PROBLEM IF RIGHT PID IS USED !!!!!!!!!!!!!!
3204 segS->SetPID(j);
3205 trackS->AddSegment(segS);
3206 trackS->AddSegmentF(segS);
3207// cout << i<< " " << x << " " << y << " " << z << endl;
3208 }
3209 trackS->SetSegmentsTrack(i);
3210 trackS->SetPID(plate[0]);
3211 trackS->SetID(i);
3212 trackS->SetNpl(nfilmb[sizeb-1]);
3213 trackS->SetProb(1.);
3214 trackS->SetFlag(-100);
3215 trackS->FitTrack();
3216 ali->AddTrack(trackS);
3217 }
3218
3219 file_e2->Close();
3220
3221 // --------------------------------------------------------------
3222
3223 dproc->MakeTracksTree(ali,"linked_tracks.root");
3224
3225 cout << endl << "----------------------------------------------" << endl;
3226 cout << "Nb of tracks before adding showers : " << ntracks << endl;
3227 cout << "Nb of tracks after adding showers : " << ali->Ntracks() << endl;
3228 cout << "Nb of stored showers : " << ali->Ntracks()-ntracks << endl;
3229 cout << "----------------------------------------------" << endl << endl;
3230
3231 return 1;
3232}
FILE * f
Definition: RecDispMC.C:150
static int ReadTracksTree(EdbPVRec &ali, const char *fname="linked_tracks.root", const char *rcut="t.eFlag>-1&&nseg>2&&t.eProb>.01")
Definition: EdbDataSet.cxx:2922
static int MakeTracksTree(EdbPVRec *ali=0, const char *file="linked_tracks.root")
Definition: EdbDataSet.cxx:2506
int MakeTracks(int nsegments=2, int flag=0)
Definition: EdbPVRec.cxx:1989
void FillTracksCell()
Definition: EdbPVRec.cxx:1319
Int_t Ntracks() const
Definition: EdbPVRec.h:203
int Link()
Definition: EdbPVRec.cxx:1187
void AddTrack(EdbTrackP *track)
Definition: EdbPVRec.h:246
void SetPID(int pid)
Definition: EdbSegP.h:129
void SetProb(float prob)
Definition: EdbSegP.h:134
void SetID(int id)
Definition: EdbSegP.h:128
void SetZ(float z)
Definition: EdbSegP.h:125
void SetDZ(float dz)
Definition: EdbSegP.h:126
void SetFlag(int flag)
Definition: EdbSegP.h:130
void Set(int id, float x, float y, float tx, float ty, float w, int flag)
Definition: EdbSegP.h:87
void AddSegmentF(EdbSegP *s)
Definition: EdbPattern.h:233
void AddSegment(EdbSegP *s)
Definition: EdbPattern.h:214
void SetNpl(int npl)
Definition: EdbPattern.h:168
int SetSegmentsTrack(int id)
Definition: EdbPattern.h:246
void FitTrack()
Definition: EdbPattern.cxx:696
Int_t plate
Definition: merge_Energy_SytematicSources_Electron.C:1

◆ SaveResults()

void EdbShowerRec::SaveResults ( )
279{
280 fileout->cd();
281 treesaveb->Write();
282 fileout->Close();
283 fileout->Delete();
284}

◆ Set0()

void EdbShowerRec::Set0 ( )

Reset all internal variables to default values.

This is new/changed (06.June 2011):
If we used eUseAliSub=true, then it results in large memory
consumption when having many InitiatorBTs. To avoid this the standard
behaviour is reconstruction on normal EdbPVRec object. Only in case
of either large MC/Data ratio or only few InitiatorBTs, we do it this
way. See also the function: CheckEdbPVRecSetUseAliSub.

231{
233
234 eUseAliSub=kFALSE;
241
242 eShowerTreeIsDone=kFALSE;
244 eEnergyIsDone=kFALSE;
245 eShowersN=0;
246
247 eAlgoParameterConeRadius=800; // Radius of spanning cone from first BT
248 eAlgoParameterConeAngle=0.02; // Opening angle of spanning cone from first BT
249 eAlgoParameterConnectionDR=150; // Connection Criterium: delta R
250 eAlgoParameterConnectionDT=0.15; // Connection Criterium: delta T
251 eAlgoParameterNPropagation=3; // N plates backpropagating
252
253 eFilename_LinkedTracks="linked_tracks.root";
254
255 eQualityPar[0]=0.12;
256 eQualityPar[1]=1.0;
257 eUseQualityPar=kFALSE;
258
259 mlp1=mlp2=mlp3=mlp4=0;
260}
Bool_t eDoEnergyCalculation
EnergyEstimation to do or not.
Definition: EdbShowerRec.h:144

◆ SetAlgoParameter()

void EdbShowerRec::SetAlgoParameter ( Double_t  paravalue,
Int_t  paranr 
)
4819{
4820 if (paranr==0) eAlgoParameterConeRadius=paravalue;
4821 else if (paranr==1) eAlgoParameterConeAngle=paravalue;
4822 else if (paranr==2) eAlgoParameterConnectionDR=paravalue;
4823 else if (paranr==3) eAlgoParameterConnectionDT=paravalue;
4824 else if (paranr==4) eAlgoParameterNPropagation=paravalue;
4825 else {
4826 return;
4827 }
4828}

◆ SetChi20()

void EdbShowerRec::SetChi20 ( float  chi2)
inline
401 {
402 eChi20=chi2;
403 }
Float_t chi2
Definition: testBGReduction_By_ANN.C:14

◆ SetChi2b()

void EdbShowerRec::SetChi2b ( float  chi2b,
int  i 
)
inline
483 {
484 eChi2b[i]= chi2b;
485 }

◆ SetDeltarb()

void EdbShowerRec::SetDeltarb ( float  deltarb,
int  i 
)
inline
498 {
499 eDeltarb[i]= deltarb;
500 }

◆ SetDelthetab()

void EdbShowerRec::SetDelthetab ( float  deltathetab,
int  i 
)
inline
501 {
503 }

◆ SetDoEnergyCalculation()

void EdbShowerRec::SetDoEnergyCalculation ( Bool_t  DoEnergyCalculation)
inline
555 {
556 eDoEnergyCalculation=DoEnergyCalculation;
557 }

◆ SetDz()

void EdbShowerRec::SetDz ( float  dz)
inline
442 {
443 eDz = dz;
444 }
brick dz
Definition: RecDispMC.C:107

◆ SetEdbPVRec()

void EdbShowerRec::SetEdbPVRec ( EdbPVRec Ali)
inline
629 {
630 eAli = Ali;
634 eAliLoaded=kTRUE;
635 }

◆ SetFlag0()

void EdbShowerRec::SetFlag0 ( int  flag)
inline
410 {
411 eFlag0=flag;
412 }

◆ SetFlagb()

void EdbShowerRec::SetFlagb ( int  flag,
int  i 
)
inline
492 {
493 eFlagb[i]= flag;
494 }

◆ SetID()

void EdbShowerRec::SetID ( int  id)
inline
388 {
389 eID = id;
390 }

◆ SetIDb()

void EdbShowerRec::SetIDb ( int  idb2,
int  i 
)
inline
465 {
466 eIDb[i] = idb2;
467 }

◆ SetInBTArray() [1/3]

void EdbShowerRec::SetInBTArray ( EdbPVRec Ali,
Int_t  mode = 0 
)

SetInBTArray( EdbPVRec* Ali , Int_t mode )
Set the Initiator BaseTrack Array From the EdbPVRec
object. Using a mode of:
-1) if it has tracks inside, we take first segment of the
-1) tracks (TO BE IMPLEMENTED...mode=-1)
0) otherwise (mode is 0) ALL Basetracks in the volume.
0) ATTENTION...TAKES VERY LONG
1) If mode is 1, then we take only the
1) first Z plate ... Mainly DEBUG purpose ....
2) If mode is 2, then we take only 5 random
2) basetracksfirst Z plate ... Mainly DEBUG purpose ....

4949 {
4950
4962
4963 if (gEDBDEBUGLEVEL>1) {
4964 cout << "-----------------------------------------------------------------------------" << endl;
4965 cout << "-- EdbShowerRec SetInBTArray( EdbPVRec* Ali , Int_t mode ) --" << endl;
4966 cout << "-- EdbShowerRec Set the Initiator BaseTrack Array From the EdbPVRec --" << endl;
4967 cout << "-- EdbShowerRec object. --" << endl;
4968 cout << "-- EdbShowerRec A) if it has tracks inside, we take first segment of the --" << endl;
4969 cout << "-- EdbShowerRec A) tracks (TO BE IMPLEMENTED...mode=-1) --" << endl;
4970 cout << "-- EdbShowerRec B) otherwise (mode is 0) ALL Basetracks in the volume. --" << endl;
4971 cout << "-- EdbShowerRec B) ATTENTION...TAKES VERY LONG --" << endl;
4972 cout << "-- EdbShowerRec C) If mode is 1, then we take only the --" << endl;
4973 cout << "-- EdbShowerRec C) first Z plate ... Mainly DEBUG purpose ....--" << endl;
4974 cout << "-- EdbShowerRec D) If mode is 2, then we take only (1,5) random --" << endl;
4975 cout << "-- EdbShowerRec D) basetracksfirst Z plate ... Mainly DEBUG purpose ....--" << endl;
4976 }
4977
4978 TObjArray* InBTArray = new TObjArray();
4979
4980 Int_t nBT=1;
4981 if (mode>10) {
4982 // help construction, i hope noone ever needs to look at this ugly part of code :)
4983 nBT=mode;
4984 mode=2;
4985 }
4986
4987 if (1==mode) {
4988 InBTArray->Clear();
4990 int nseg= pat->N();
4991 for (int j=0; j<nseg; j++) {
4992 EdbSegP* seg = pat->GetSegment(j);
4993 InBTArray->Add(seg);
4994 }
4995 }
4996 else if (2==mode) {
4997 for (int k=0; k<nBT; k++) {
4998 EdbPattern* pat = Ali->GetPattern(gRandom->Uniform(0,Ali->Npatterns()));
4999 EdbSegP* seg = pat->GetSegment(gRandom->Uniform(0,pat->N()));
5000 //seg->PrintNice();
5001 InBTArray->Add(seg);
5002 }
5003 cout << "-- EdbShowerRec D) Set " << nBT << " Random BTs for shower reco. --" << endl;
5004 }
5005 else {
5006 int npat=Ali->Npatterns();
5007 for (int i=0; i<npat; i++) {
5008 EdbPattern* pat = Ali->GetPattern(i);
5009 int nseg= pat->N();
5010 for (int j=0; j<nseg; j++) {
5011 EdbSegP* seg = pat->GetSegment(j);
5012 InBTArray->Add(seg);
5013 }
5014 }
5015 }
5016
5017
5018 if (gEDBDEBUGLEVEL>1) cout << "-- EdbShowerRec InBTArray->GetEntries(): " << setw(20) << InBTArray->GetEntries() << " --" << endl;
5019 eInBTArray = InBTArray;
5020 eInBTArrayN=eInBTArray->GetEntries();
5021 if (eInBTArrayN>0) {
5022 eInBTArrayIsFilled=kTRUE;
5023 }
5024
5025 if (gEDBDEBUGLEVEL>1) cout << "-- EdbShowerRec SetInBTArray( EdbPVRec* Ali ) done.--" << endl;
5026 if (gEDBDEBUGLEVEL>1) cout << "-----------------------------------------------------------------------------" << endl;
5027 return;
5028}
EdbPattern * GetPatternZLowestHighest(Bool_t lowestZ=kTRUE) const
Definition: EdbPattern.cxx:1816

◆ SetInBTArray() [2/3]

void EdbShowerRec::SetInBTArray ( EdbSegP InBT)
inline
648 {
649 // check if eInBTArray was created, if not do it now.:
650 if (!eInBTArray) eInBTArray=new TObjArray();
651 eInBTArray->Clear();
652 eInBTArray->Add(InBT);
653 eInBTArrayN=eInBTArray->GetEntries();
654 if (eInBTArrayN>0) {
655 eInBTArrayIsFilled=kTRUE;
656 }
657 }

◆ SetInBTArray() [3/3]

void EdbShowerRec::SetInBTArray ( TObjArray *  InBTArray)
inline
636 {
637 eInBTArray = InBTArray;
638 eInBTArrayN=eInBTArray->GetEntries();
639 if (eInBTArrayN>0) {
640 eInBTArrayIsFilled=kTRUE;
641 }
642 }

◆ SetInBTArrayN()

void EdbShowerRec::SetInBTArrayN ( Int_t  InBTArrayN)
inline
644 {
645 eInBTArrayN = InBTArrayN;
646 }

◆ SetL()

void EdbShowerRec::SetL ( int  L)
inline
445 {
446 eL = L;
447 }

◆ SetmcDigitIndexBottom()

void EdbShowerRec::SetmcDigitIndexBottom ( int  mcDb,
int  i 
)
inline
510 {
511 emcDigitIndexBottom[i]= mcDb;
512 }

◆ SetmcDigitIndexBottom0()

void EdbShowerRec::SetmcDigitIndexBottom0 ( int  mcDb)
inline
416 {
418 }
Int_t emcDigitIndexBottom0
Bottom Digit index of the first shower segment.
Definition: EdbShowerRec.h:55

◆ SetmcDigitIndexTop()

void EdbShowerRec::SetmcDigitIndexTop ( int  mcDt,
int  i 
)
inline
507 {
508 emcDigitIndexTop[i]= mcDt;
509 }

◆ SetmcDigitIndexTop0()

void EdbShowerRec::SetmcDigitIndexTop0 ( int  mcDt)
inline
413 {
415 }
Int_t emcDigitIndexTop0
Top Digit index of the first shower segment.
Definition: EdbShowerRec.h:54

◆ SetNFilmb()

void EdbShowerRec::SetNFilmb ( int  nfilmb,
int  i 
)
inline
495 {
496 eNFilmb[i]= nfilmb;
497 }

◆ SetOutput()

void EdbShowerRec::SetOutput ( float  output)
inline
449 {
450 eOutput = output;
451 }

◆ SetOutput15()

void EdbShowerRec::SetOutput15 ( float  output)
inline
452 {
453 eOutput15= output;
454 }

◆ SetOutput20()

void EdbShowerRec::SetOutput20 ( float  output)
inline
455 {
456 eOutput20 = output;
457 }

◆ SetOutput30()

void EdbShowerRec::SetOutput30 ( float  output)
inline
458 {
459 eOutput30 = output;
460 }

◆ SetP0()

void EdbShowerRec::SetP0 ( float  p)
inline
407 {
408 eP0=p;
409 }
p
Definition: testBGReduction_AllMethods.C:8

◆ SetPb()

void EdbShowerRec::SetPb ( float  p,
int  i 
)
inline
489 {
490 ePb[i]= p;
491 }

◆ SetPlateb()

void EdbShowerRec::SetPlateb ( int  plate2,
int  i 
)
inline
468 {
469 ePlateb[i] = plate2;
470 }

◆ SetPrimary()

void EdbShowerRec::SetPrimary ( int  tagprimary,
int  i 
)
inline
504 {
506 }

◆ SetQualityCutValues()

void EdbShowerRec::SetQualityCutValues ( Double_t  p0,
Double_t  p1 
)
inline
670 {
671 eQualityPar[0]=p0;
672 eQualityPar[1]=p1;
673 eUseQualityPar=kTRUE;
674 }

◆ SetRecoShowerArray()

void EdbShowerRec::SetRecoShowerArray ( TObjArray *  RecoShowerArray)
inline
664 {
666 }

◆ SetRecoShowerArrayN()

void EdbShowerRec::SetRecoShowerArrayN ( Int_t  RecoShowerArrayN)
inline
661 {
662 eRecoShowerArrayN = RecoShowerArrayN;
663 }

◆ SetSize()

void EdbShowerRec::SetSize ( int  size)
inline
429 {
430 eSize = size;
431 }

◆ SetSize15()

void EdbShowerRec::SetSize15 ( int  size)
inline
432 {
433 eSize15 = size;
434 }

◆ SetSize20()

void EdbShowerRec::SetSize20 ( int  size)
inline
435 {
436 eSize20 = size;
437 }

◆ SetSize30()

void EdbShowerRec::SetSize30 ( int  size)
inline
438 {
439 eSize30 = size;
440 }

◆ SetTrID()

void EdbShowerRec::SetTrID ( int  id)
inline
425 {
426 eTrID = id;
427 }

◆ SetTx()

void EdbShowerRec::SetTx ( float  tx)
inline
419 {
420 eTx = tx;
421 }

◆ SetTXb()

void EdbShowerRec::SetTXb ( float  txb,
int  i 
)
inline
477 {
478 eTXb[i]= txb;
479 }

◆ SetTy()

void EdbShowerRec::SetTy ( float  ty)
inline
422 {
423 eTy = ty;
424 }

◆ SetTYb()

void EdbShowerRec::SetTYb ( float  tyb,
int  i 
)
inline
480 {
481 eTYb[i]= tyb;
482 }

◆ SetUseAliSub()

void EdbShowerRec::SetUseAliSub ( Bool_t  UseAliSub)
inline
625 {
626 eUseAliSub=UseAliSub;
627 }

◆ SetW0()

void EdbShowerRec::SetW0 ( int  w)
inline
404 {
405 eW0=w;
406 }
void w(int rid=2, int nviews=2)
Definition: test.C:27

◆ SetWb()

void EdbShowerRec::SetWb ( int  w,
int  i 
)
inline
486 {
487 eWb[i]= w;
488 }

◆ SetX0()

void EdbShowerRec::SetX0 ( float  x)
inline
392 {
393 eX0 = x;
394 }

◆ SetXb()

void EdbShowerRec::SetXb ( float  xb,
int  i 
)
inline
462 {
463 eXb[i]= xb;
464 }

◆ SetY0()

void EdbShowerRec::SetY0 ( float  y)
inline
395 {
396 eY0 = y;
397 }

◆ SetYb()

void EdbShowerRec::SetYb ( float  yb,
int  i 
)
inline
471 {
472 eYb[i]= yb;
473 }

◆ SetZ0()

void EdbShowerRec::SetZ0 ( float  z)
inline
398 {
399 eZ0 = z;
400 }

◆ SetZb()

void EdbShowerRec::SetZb ( float  zb,
int  i 
)
inline
474 {
475 eZb[i]= zb;
476 }

◆ ShowerToEdbSegPArray()

TObjArray * EdbShowerRec::ShowerToEdbSegPArray ( )

Very simple function to transfer all treebranch entries to an TObjArray of EdbSegPs. Mainly used for eda.C drawing framework

3240{
3243
3244 cout << "-------------------EdbShowerRec::ShowerToEdbSegPArray()---------------------------" << endl << endl;
3245 TObjArray* segArray=new TObjArray(999999);
3246
3247 float x,y,tx,ty,z;
3248 Int_t sizeb;
3249 Float_t xb[10000];
3250 Float_t yb[10000];
3251 Float_t zb[10000];
3252 Float_t txb[10000];
3253 Float_t tyb[10000];
3254 Int_t nfilmb[10000];
3255 Int_t ntrace2simub[10000];
3256 int eProb90;
3257 int eProb1;
3258 int w2,plate[10000];
3259
3260 if (!eShowerTreeIsDone) {
3261 TTree * treesaveb = (TTree*)(FileReconstructedShowerTree->Get("treebranch"));
3262 treesaveb->SetBranchAddress("sizeb", &sizeb);
3263 treesaveb->SetBranchAddress("txb", txb);
3264 treesaveb->SetBranchAddress("tyb", tyb);
3265 treesaveb->SetBranchAddress("xb", xb);
3266 treesaveb->SetBranchAddress("yb", yb);
3267 treesaveb->SetBranchAddress("zb", zb);
3268 treesaveb->SetBranchAddress("eProb90", &eProb90);
3269 treesaveb->SetBranchAddress("eProb1", &eProb1);
3270 treesaveb->SetBranchAddress("nfilmb", nfilmb);
3271
3272 }
3273 int nentries = treesaveb->GetEntries();
3274 if (gEDBDEBUGLEVEL>2) treesaveb->Print();
3275
3276 cout << "nentries= " << nentries << endl;
3277
3278 for (int i=0; i<nentries; i++)
3279 {
3280 treesaveb->GetEntry(i);
3281 treesaveb->Show(i);
3282
3283 for (int j=0; j<sizeb; j++)
3284 {
3285 x=xb[j];
3286 y=yb[j];
3287 tx=txb[j];
3288 ty=tyb[j];
3289 z=zb[j];
3290 // This is to have the absolute plate reference frame where Plate 57 is at Z==0
3291 // plate[j] = abs(57+(int)(z/1273.)); // compiler instability with gcc4.3
3292 plate[j] = TMath::Abs(57+(int)(z/1273.)); // fix.
3293 cout << "DOING j= " << j << " Z== " << z << " Platee[j]= " << plate[j] << endl;
3294 w2=ntrace2simub[j];
3295 EdbSegP* segS = new EdbSegP();
3296 segS->Set(j, x, y, tx, ty, w2, 0);
3297 segS->SetZ(z);
3298 segS->SetDZ(300.);
3299 //segS->SetPID(plate[j]); // DISPLAY PROBLEM IF RIGHT PID IS USED !!!!!!!!!!!!!!
3300 segS->SetPID(j);
3301 segArray->Add(segS);
3302// cout << i<< " " << x << " " << y << " " << z << endl;
3303 }
3304 }
3305 cout << "segArray->GetEntries();= " << segArray->GetEntries() << endl;
3306
3307 return segArray;
3308}

◆ TransferShowerObjectArrayIntoEntryOfTreebranchShowerTree()

void EdbShowerRec::TransferShowerObjectArrayIntoEntryOfTreebranchShowerTree ( TObjArray *  segarray)

---------— ONLY FOR EDBSHOWERREC.... NOT FOR MY OWN STUFF!!------------------------—

---------— ONLY FOR EDBSHOWERREC.... NOT FOR MY OWN STUFF!!------------------------—

4286{
4287 Log(2, "EdbShowerRec", "--- void* TransferShowerObjectArrayIntoEntryOfTreebranchShowerTree() ---Interim SOLUTIION !!!! ");
4288
4289 TFile* interim_fileout = new TFile("shower1.root","RECREATE");
4290 // EdbShowerRec::T-S-O-A-I-E-O-T-S-T
4291
4292 // Interim SOLUTIION !!!! shower tree definition
4293
4294 //---------------------------------------------------------------------------------
4295 //- VARIABLES: shower_ "treebranch" reconstruction
4296 //---------------------------------------------------------------------------------
4300 Float_t shower_xb[9999];
4301 Float_t shower_yb[9999];
4302 Float_t shower_zb[9999];
4303 Float_t shower_txb[9999];
4304 Float_t shower_tyb[9999];
4305 Float_t shower_deltarb[9999];
4306 Float_t shower_deltathetab[9999];
4307 Float_t shower_deltaxb[9999];
4308 Float_t shower_deltayb[9999];
4309 Int_t shower_nfilmb[9999];
4310 //Int_t shower_ngrainb[9999];
4311 Float_t shower_chi2btkb[9999];
4312 Int_t shower_ntrace1simub[9999]; // MCEvt
4313 Int_t shower_ntrace2simub[9999]; // s->W()
4314 Float_t shower_ntrace3simub[9999]; // s->P()
4315 Int_t shower_ntrace4simub[9999]; // s->Flag()
4316 Float_t shower_tagprimary[9999];
4317 Int_t shower_idb[9999];
4318 Int_t shower_plateb[9999];
4319 Float_t shower_deltasigmathetab[58];
4320 Int_t shower_numberofilms;
4321 Float_t shower_purityb,shower_E_MC,shower_trackdensb;
4322 //---------------------------------------------------------------------------------
4323
4324 TTree* interim_treesaveb = new TTree("treebranch","tree of branchtrack");
4325 interim_treesaveb->Branch("number_eventb",&shower_number_eventb,"number_eventb/I");
4326 interim_treesaveb->Branch("sizeb",&shower_sizeb,"sizeb/I");
4327 interim_treesaveb->Branch("sizeb15",&shower_sizeb15,"sizeb15/I");
4328 interim_treesaveb->Branch("sizeb20",&shower_sizeb20,"sizeb20/I");
4329 interim_treesaveb->Branch("sizeb30",&shower_sizeb30,"sizeb30/I");
4330 interim_treesaveb->Branch("E_MC",&shower_E_MC,"E_MC/F");
4331 interim_treesaveb->Branch("isizeb",&shower_isizeb,"isizeb/I");
4332 interim_treesaveb->Branch("showerID",&shower_showerID,"showerID/I");
4333 interim_treesaveb->Branch("idb",shower_idb,"idb[sizeb]/I");
4334 interim_treesaveb->Branch("plateb",shower_plateb,"plateb[sizeb]/I");
4335 interim_treesaveb->Branch("xb",shower_xb,"xb[sizeb]/F");
4336 interim_treesaveb->Branch("yb",shower_yb,"yb[sizeb]/F");
4337 interim_treesaveb->Branch("zb",shower_zb,"zb[sizeb]/F");
4338 interim_treesaveb->Branch("txb",shower_txb,"txb[sizeb]/F");
4339 interim_treesaveb->Branch("tyb",shower_tyb,"tyb[sizeb]/F");
4340 interim_treesaveb->Branch("nfilmb",shower_nfilmb,"nfilmb[sizeb]/I");
4341 interim_treesaveb->Branch("ntrace1simub",shower_ntrace1simub,"ntrace1simu[sizeb]/I");
4342 interim_treesaveb->Branch("ntrace2simub",shower_ntrace2simub,"ntrace2simu[sizeb]/I"); // s->W()
4343 interim_treesaveb->Branch("ntrace3simub",shower_ntrace3simub,"ntrace3simu[sizeb]/F"); // s->P()
4344 interim_treesaveb->Branch("ntrace4simub",shower_ntrace4simub,"ntrace4simu[sizeb]/I"); // s->Flag()
4345 interim_treesaveb->Branch("chi2btkb",shower_chi2btkb,"chi2btkb[sizeb]/F");
4346 interim_treesaveb->Branch("deltarb",shower_deltarb,"deltarb[sizeb]/F");
4347 interim_treesaveb->Branch("deltathetab",shower_deltathetab,"deltathetab[sizeb]/F");
4348 interim_treesaveb->Branch("deltaxb",shower_deltaxb,"deltaxb[sizeb]/F");
4349 interim_treesaveb->Branch("deltayb",shower_deltayb,"deltayb[sizeb]/F");
4350 interim_treesaveb->Branch("tagprimary",shower_tagprimary,"tagprimary[sizeb]/F");
4351 interim_treesaveb->Branch("purityb",&shower_purityb,"purityb/F");
4352 interim_treesaveb->Branch("trackdensb",&shower_trackdensb,"trackdensb/F");
4353
4354 Int_t showrecoarrayN=showrecoarray->GetEntries();
4355 cout << "showrecoarray->GetEntries(); " << showrecoarray->GetEntries() << endl;
4356
4357
4358 // LOOP OVER ENTRIES FROM showrecoarray:
4359 for (Int_t ooo=0; ooo< showrecoarrayN; ++ooo) {
4360 if (gEDBDEBUGLEVEL>2) cout << "EdbShowerRec::T-S-O-A-I-E-O-T-S-T: Doing entry " << ooo << endl;
4361
4362 // Get Track from showrecoarray
4363 EdbTrackP* segarray = (EdbTrackP*)showrecoarray->At(ooo);
4364 if (gEDBDEBUGLEVEL>2) cout << "EdbShowerRec::T-S-O-A-I-E-O-T-S-T: segarray = " << segarray << endl;
4365 if (gEDBDEBUGLEVEL>2) cout << "EdbShowerRec::T-S-O-A-I-E-O-T-S-T: segarray->N(),N0(): " << segarray->N() << " " << segarray->N0() << endl;
4366 if (gEDBDEBUGLEVEL>2) segarray->PrintNice();
4367
4368 EdbSegP* seg;
4369 EdbSegP* Inseg;
4370 Int_t diff_pid;
4371 Float_t min_shower_deltathetab=99999;
4372 Float_t min_shower_deltar=99999;
4373 Float_t test_shower_deltathetab=99999;
4374 Float_t test_shower_deltar=99999;
4375 Float_t test_shower_deltax,test_shower_deltay;
4376
4377 Float_t shower_sizebNHELP=0;
4378 Float_t shower_sizebMCNHELP=0;
4379
4380 Float_t extrapol_x,extrapol_y, extrapo_diffz;
4381
4382 // Initialize arrays...
4386 shower_sizeb=0;
4389 for (int ii=0; ii<9999; ii++) {
4390 shower_xb[ii]=0;
4391 shower_yb[ii]=0;
4392 shower_zb[ii]=0;
4393 shower_txb[ii]=0;
4394 shower_tyb[ii]=0;
4395 shower_nfilmb[ii]=0;
4396 shower_tagprimary[ii]=0;
4397 shower_ntrace1simub[ii]=0;
4398 shower_ntrace2simub[ii]=0;
4399 shower_ntrace3simub[ii]=0;
4400 shower_ntrace4simub[ii]=0;
4401 shower_deltaxb[ii]=0;
4402 shower_deltayb[ii]=0;
4403 shower_chi2btkb[ii]=0;
4404 shower_idb[ii]=0;
4405 shower_plateb[ii]=0;
4406 }
4407 for (int i=1; i<59; ++i) {
4409 }
4410
4411 // Part To calculate the TransfereedVariables....
4412 shower_sizeb=segarray->N();
4413 Inseg=(EdbSegP*)segarray->GetSegment(0);
4415 if (gEDBDEBUGLEVEL>2) cout << "EdbShowerRec::T-S-O-A-I-E-O-T-S-T shower_sizeb= "<< shower_sizeb << endl;
4416 if (gEDBDEBUGLEVEL>2) cout << "EdbShowerRec::T-S-O-A-I-E-O-T-S-T Inseg->PrintNice()= " << endl;
4417 if (gEDBDEBUGLEVEL>2) Inseg->PrintNice();
4418
4419
4420
4421 if (gEDBDEBUGLEVEL>3) cout << "--- --- ---------------------"<<endl;
4422 //-------------------------------------
4423 for (int ii=0; ii<shower_sizeb; ii++) {
4424 if (gEDBDEBUGLEVEL>3) cout << "EdbShowerRec::T-S-O-A-I-E-O-T-S-T Doing Segment "<< ii << endl;
4425
4426 if (ii>=9999) {
4427 cout << "EdbShowerRec::T-S-O-A-I-E-O-T-S-T: WARNING: shower_sizeb ( " << shower_sizeb<< ") greater than SHOWERARRAY. Set sizeb to 9999 and Stop filling!."<<endl;
4428 shower_sizeb=9999;
4429 break;
4430 }
4431// seg=(EdbSegP*)segarray->At(ii); // works when TObjArray
4432 seg=(EdbSegP*)segarray->GetSegment(ii); // works when EdbTrackP
4433
4434 //-------------------------------------
4435 shower_xb[ii]=seg->X();
4436 shower_yb[ii]=seg->Y();
4437 shower_txb[ii]=seg->TX();
4438 shower_tyb[ii]=seg->TY();
4439 shower_zb[ii]=seg->Z();
4440 shower_chi2btkb[ii]=seg->Chi2();
4441 shower_deltathetab[ii]=0.5;
4442 shower_deltarb[ii]=200;
4443 shower_tagprimary[ii]=0;
4444 if (ii==0) shower_tagprimary[ii]=1;
4445 shower_isizeb=1; // always 1, not needed anymore
4446 if (seg->MCEvt()>0) {
4447 shower_ntrace1simub[ii]=seg->MCEvt();
4448 shower_ntrace2simub[ii]=seg->W();
4449 shower_ntrace3simub[ii]=seg->P();
4450 shower_ntrace4simub[ii]=seg->Flag();
4451 }
4452 else {
4453 // keep the seg->BT settings for BG:
4454 // that come out of "normal" scanned data from fedra:
4455 // shower_ntrace1simub=-999
4456 // shower_ntrace2simub=seg->W();
4457 // shower_ntrace3simub=-999
4458 // shower_ntrace4simub=0
4459 shower_ntrace1simub[ii]=-999;
4460 shower_ntrace2simub[ii]=seg->W();
4461 shower_ntrace3simub[ii]=-999;
4462 shower_ntrace4simub[ii]=0;
4463 }
4464 shower_idb[ii]=seg->ID();
4465 shower_plateb[ii]=seg->PID();
4466 shower_E_MC=seg->P();
4467 //-------------------------------------
4468 // PUT HERE: deltarb,deltarb, nflimb, sizeb15......
4469 diff_pid=TMath::Abs( Inseg->PID()-seg->PID() )+1;
4470 // (does this work for up/downsream listing??)
4471 // (yes, since InBT->PID is also changed.)
4472 // but works only if the gAli Object has no missing plates
4473 // otherwise f.e. PID(1) and PID(2) are not necessaryly abay by dZ=1273
4474 // (could be Z(1)=1273 and Z(2)=3900...)
4475
4476 // Calc pur:
4477 shower_sizebNHELP++;
4478 // Increase the shower_sizebMCNHELP variable ONLY and ONLY if there is MC segment
4479 if (seg->MCEvt()>0) shower_sizebMCNHELP++;
4480
4481
4482 // InBT:
4483 if (ii==0) {
4484 shower_deltathetab[0]=0.5;
4485 shower_deltarb[0]=200;
4486 shower_nfilmb[0]=1;
4487 }
4488 // All other BTs:
4489 if (ii>0) {
4490 // its correct like this, since this is the way it is done in
4491 // the official FJ-Algorithm:
4492 shower_nfilmb[ii]=diff_pid;
4493 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;
4494
4495 if (diff_pid >= 15 ) shower_sizeb15++;
4496 if (diff_pid >= 20 ) shower_sizeb20++;
4497 if (diff_pid >= 30 ) shower_sizeb30++;
4498
4499 // PUT HERE: calculation routine for shower_deltasigmathetab
4500 // see referenc in thesis of Luillo Esposito, page 109.
4501 shower_deltasigmathetab[diff_pid]=shower_deltasigmathetab[diff_pid]+(TMath::Power(shower_txb[ii]-shower_txb[0],2)+TMath::Power(shower_tyb[ii]-shower_tyb[0],2));
4502
4503 // PUT HERE: calculation routine for shower_deltathetab, shower_deltarb
4504 // ExSetTreebranchNametrapolate the BT [ii] to the position [jj] and then calc the
4505 // position and slope differences;
4506 // For the backward extrapolation of the shower_deltathetab and shower_deltarb
4507 // calulation for BaseTrack(ii), Basetrack(jj)->Z() hast to be smaller.
4508 min_shower_deltathetab=99999; // Reset
4509 min_shower_deltar=99999; // Reset
4510
4511 for (int jj=0; jj<shower_sizeb; jj++) {
4512 if (ii==jj) continue;
4513
4514 // since we do not know if BTs are ordered by their Z positions:
4515 // and cannot cut directly on the number in the shower entry:
4516 if (shower_zb[ii]<shower_zb[jj]) continue;
4517
4518
4519
4520 extrapo_diffz=shower_zb[ii]-shower_zb[jj];
4521 if (TMath::Abs(extrapo_diffz)>4*1273+1.0) continue;
4522 if (TMath::Abs(extrapo_diffz)<1.0) continue; // remove same positions.
4523
4524 extrapol_x=shower_xb[ii]-shower_txb[ii]*extrapo_diffz; // minus, because its ii after jj.
4525 extrapol_y=shower_yb[ii]-shower_tyb[ii]*extrapo_diffz; // minus, because its ii after jj.
4526
4527 // Delta radius we need to extrapolate.
4528 test_shower_deltax=extrapol_x;//shower_txb[ii]*(shower_zb[ii]-shower_zb[jj])+shower_xb[ii];
4529 test_shower_deltay=extrapol_y;//shower_tyb[ii]*(shower_zb[ii]-shower_zb[jj])+shower_yb[ii];
4530 test_shower_deltax=test_shower_deltax-shower_xb[jj];
4531 test_shower_deltay=test_shower_deltay-shower_yb[jj];
4532 test_shower_deltar=TMath::Sqrt(test_shower_deltax*test_shower_deltax+test_shower_deltay*test_shower_deltay);
4533
4534 // Delta theta we do not need to extrapolate. (old version...)
4535 //test_shower_deltathetab=TMath::Sqrt(shower_txb[ii]*shower_txb[ii]+shower_tyb[ii]*shower_tyb[ii]);
4536 //test_shower_deltathetab=test_shower_deltathetab-TMath::Sqrt(shower_txb[jj]*shower_txb[jj]+shower_tyb[jj]*shower_tyb[jj]);
4537 //test_shower_deltathetab=TMath::Abs(test_shower_deltathetab);
4538 //----
4539 // As before in ShowRec this way of calculation is not equivalent as calculating
4540 // DeltaTheta domponentwise:
4541 // Code from libShower:
4542 // delta = sqrt((SX0-a->GetTXb(l2))*(SX0-a->GetTXb(l2))+((SY0-a->GetTYb(l2))*(SY0-a->GetTYb(l2))));
4543 test_shower_deltathetab=TMath::Sqrt(TMath::Power(shower_txb[ii]-shower_txb[jj],2)+TMath::Power(shower_tyb[ii]-shower_tyb[jj],2));
4544
4545 // Check if both dr,dt match parameter criteria and then just take these values.....
4546 // Maybe a change is necessary because it is not exactly the same as in the off. algorithm.
4547 //if (test_shower_deltar<400 && test_shower_deltathetab<0.8 ) {
4548 if (test_shower_deltar<150 && test_shower_deltathetab<0.15 ) {
4549 if (test_shower_deltar<min_shower_deltar) {
4550 min_shower_deltathetab=test_shower_deltathetab;
4551 min_shower_deltar=test_shower_deltar;
4552 shower_deltathetab[ii]=min_shower_deltathetab;
4553 shower_deltarb[ii]=min_shower_deltar;
4554 }
4555 }
4556 }
4557 }
4558 //-------------------------------------
4559
4560 shower_purityb=shower_sizebMCNHELP/shower_sizebNHELP;
4562 }
4563 //-------------------------------------
4564 for (int i=1; i<59; ++i) {
4566 }
4567 shower_numberofilms=shower_nfilmb[shower_sizeb-1]; // there we assume (this is correct always?) when
4568 // the last shower BT is in the last film...(otherwise we would again have to loop on sizeb array);
4569
4570
4571 // Fill Tree:
4572 interim_treesaveb->Fill();
4573 if (gEDBDEBUGLEVEL>2) interim_treesaveb->Show(interim_treesaveb->GetEntries()-1);
4574
4575 if (gEDBDEBUGLEVEL>2) cout << "Now we have interim_treesaveb Entries: " << interim_treesaveb->GetEntries() << endl;
4576 if (gEDBDEBUGLEVEL>3) interim_treesaveb->Show(interim_treesaveb->GetEntries()-1);
4577
4578
4579 } // LOOP OVER ENTRIES FROM showrecoarray: END.
4580 //-----------------------------------------------------------------------------------------------
4581
4582
4583
4585 interim_fileout->cd();
4586 interim_treesaveb->Write();
4587 interim_fileout->Close();
4589
4590
4591 return;
4592}
Int_t shower_nfilmb[5000]
Definition: ShowRec.h:382
Float_t shower_yb[5000]
Definition: ShowRec.h:374
Int_t shower_showerID
Definition: ShowRec.h:370
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_tyb[5000]
Definition: ShowRec.h:377
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
Float_t shower_trackdensb
Definition: ShowRec.h:395
Int_t shower_idb[5000]
Definition: ShowRec.h:390
Int_t shower_number_eventb
Definition: ShowRec.h:370
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
Int_t shower_plateb[5000]
Definition: ShowRec.h:391
Int_t shower_ntrace1simub[5000]
Definition: ShowRec.h:385
Int_t PID() const
Definition: EdbSegP.h:148
Int_t Flag() const
Definition: EdbSegP.h:149
Int_t N0() const
Definition: EdbPattern.h:163

◆ TransferTreebranchShowerTreeIntoShowerObjectArray()

void EdbShowerRec::TransferTreebranchShowerTreeIntoShowerObjectArray ( TTree *  treebranch)

DEBUGTEST DEBUG TEST FOR FREDERIC !!! (FWM, 27.08.2010)

showseg->SetPID(shower_nfilmb[j]);

4599 {
4600 Log(2, "EdbShowerRec", "--- void* TransferTreebranchShowerTreeIntoShowerObjectArray() ---Interim SOLUTIION !!!! ");
4601
4602 // Decaring ObjArray which are needed. Use out of private member variables of this class.
4603 TObjArray* showarray;
4604 showarray = new TObjArray();
4605 TTree* eShowerTree = treebranch;
4606
4607 // EdbShowerP* show=0; // libShowRec
4608 EdbTrackP* show=0; // libShower
4609
4610 EdbSegP* showseg=0;
4611
4612 //- VARIABLES: shower_ "treebranch" reconstruction
4616 Float_t shower_xb[10000];
4617 Float_t shower_yb[10000];
4618 Float_t shower_zb[10000];
4619 Float_t shower_txb[10000];
4620 Float_t shower_tyb[10000];
4621 Float_t shower_deltarb[10000];
4622 Float_t shower_deltathetab[10000];
4623 Float_t shower_deltaxb[10000];
4624 Float_t shower_deltayb[10000];
4625 Int_t shower_nfilmb[10000];
4626 Float_t shower_chi2btkb[10000];
4627 Int_t shower_ntrace1simub[10000]; // MCEvt
4628 Int_t shower_ntrace2simub[10000]; // s->W()
4629 Float_t shower_ntrace3simub[10000]; // s->P()
4630 Int_t shower_ntrace4simub[10000]; // s->Flag()
4631 Float_t shower_tagprimary[10000];
4632 Int_t shower_idb[10000];
4633 Int_t shower_plateb[10000];
4634 Float_t shower_deltasigmathetab[58];
4635 Int_t shower_numberofilms;
4636 Float_t shower_purb; // purity of shower
4637 Int_t shower_mcDigitIndexTop[1000]; //
4638 Int_t shower_mcDigitIndexBottom[1000]; //
4639
4640
4641 // Set Addresses of treebranch tree:
4642 eShowerTree->SetBranchAddress("number_eventb",&shower_number_eventb);
4643 eShowerTree->SetBranchAddress("sizeb",&shower_sizeb);
4644 eShowerTree->SetBranchAddress("sizeb15",&shower_sizeb15);
4645 eShowerTree->SetBranchAddress("sizeb20",&shower_sizeb20);
4646 eShowerTree->SetBranchAddress("sizeb30",&shower_sizeb30);
4647 eShowerTree->SetBranchAddress("isizeb",&shower_isizeb);
4648 eShowerTree->SetBranchAddress("xb",shower_xb);
4649 eShowerTree->SetBranchAddress("yb",shower_yb);
4650 eShowerTree->SetBranchAddress("zb",shower_zb);
4651 eShowerTree->SetBranchAddress("txb",shower_txb);
4652 eShowerTree->SetBranchAddress("tyb",shower_tyb);
4653 eShowerTree->SetBranchAddress("nfilmb",shower_nfilmb);
4654 eShowerTree->SetBranchAddress("ntrace1simub",shower_ntrace1simub); // s.eMCEvt
4655 eShowerTree->SetBranchAddress("ntrace2simub",shower_ntrace2simub); // s.eW
4656 eShowerTree->SetBranchAddress("ntrace3simub",shower_ntrace3simub); // s.eP
4657 eShowerTree->SetBranchAddress("ntrace4simub",shower_ntrace4simub); // s.eFlag
4658 eShowerTree->SetBranchAddress("chi2btkb",shower_chi2btkb);
4659 eShowerTree->SetBranchAddress("deltarb",shower_deltarb);
4660 eShowerTree->SetBranchAddress("deltathetab",shower_deltathetab);
4661 eShowerTree->SetBranchAddress("deltaxb",shower_deltaxb);
4662 eShowerTree->SetBranchAddress("deltayb",shower_deltayb);
4663 eShowerTree->SetBranchAddress("tagprimary",shower_tagprimary);
4664 eShowerTree->SetBranchAddress("energy_shot_particle",&shower_energy_shot_particle);
4665 eShowerTree->SetBranchAddress("E_MC",&shower_energy_shot_particle);
4666 eShowerTree->SetBranchAddress("showerID",&shower_showerID);
4667 eShowerTree->SetBranchAddress("idb",shower_idb);
4668 eShowerTree->SetBranchAddress("plateb",shower_plateb);
4669 eShowerTree->SetBranchAddress("deltasigmathetab",shower_deltasigmathetab);
4670 eShowerTree->SetBranchAddress("lenghtfilmb",&shower_numberofilms);
4671 eShowerTree->SetBranchAddress("purityb",&shower_purb); // shower purity
4672 eShowerTree->SetBranchAddress("mcDigitIndexTop",shower_mcDigitIndexTop);
4673 eShowerTree->SetBranchAddress("mcDigitIndexBottom",shower_mcDigitIndexBottom);
4674
4675
4676 Int_t nent=eShowerTree->GetEntries();
4677 cout << "nent = " << nent << endl;
4678
4679 Int_t nenttotalcount=0;
4680 cout << "nenttotalcount = " << nenttotalcount << endl;
4681
4682 Bool_t QUICK_READ=kFALSE;
4683// QUICK_READ=kTRUE; cout << "QUICK_READ=kTRUE; "<< endl;
4684 if (QUICK_READ) nent=1; // read only first shower... (mainly for debug purposes).
4685
4686 // Loop over Tree Entries (==different showers):
4687 for (int i=0; i<nent; ++i) {
4688 eShowerTree->GetEntry(i);
4689 //cout << "i = " << i << endl;
4690 //cout << "shower_tagprimary[0] = " << shower_tagprimary[0] << endl;
4691 if (gEDBDEBUGLEVEL>3) eShowerTree->Show(i);
4692
4693
4694 // Since we do not take showers with below 1segment
4695 //if (shower_sizeb<=1) continue;
4696
4697// show = new EdbShowerP(shower_sizeb); // libShowRec
4698 show = new EdbTrackP(shower_sizeb); // libShower
4699
4700 // For Frederics algorithm, shower_number_eventb gives NOT -999 as for a BG track,
4701 // but "0". So we need to disticnct also for "0" cases:
4703 if (shower_number_eventb==0) show ->SetMC(-999,999);
4704
4705 // To Have unique profile histograms in the memory:
4706 // show = new EdbShowerP(0,eRecoShowerArrayN,shower_sizeb);
4707
4708 //cout << "------------------- shower_tagprimary[0] shower_tagprimary[shower_sizeb-1] " << shower_tagprimary[0] << " " << shower_tagprimary[shower_sizeb-1] << endl;
4709
4710 int nplmax=0;
4711
4712 // Loop over shower Entries (==different basetracks):
4713 for (int j=0; j<shower_sizeb; ++j) {
4714
4715 //cout << "------------------ --- j= " << j << endl;
4716
4717 // Keep Notice of the order!!!
4718 // shower_tagprimary has to be added first!!
4719 // temporary solution: if that is not the case as below, no segment will be added....
4720 // ...
4721 if (shower_tagprimary[0]!=1) continue;
4722
4723 // int id, float x, float y, float tx, float ty, float w = 0, int flag = 0
4724 showseg = new EdbSegP(j,shower_xb[j],shower_yb[j],shower_txb[j],shower_tyb[j],shower_ntrace2simub[j],0);
4725
4726 showseg->SetZ(shower_zb[j]);
4727 showseg->SetChi2(shower_chi2btkb[j]);
4728 showseg->SetP(shower_ntrace3simub[j]);
4729 showseg->SetFlag(shower_ntrace4simub[j]);
4731 // For Frederics algorithm, ntrace1simub gives NOT -999 as for a BG track,
4732 // but "0". So we need to disticnct also for "0" cases:
4733 if (shower_ntrace1simub[j]==0) showseg->SetMC(-999,-999);
4734
4735 showseg->SetPID(shower_plateb[j]);
4736 // in real data plateb is 57 for emulsion 57...(sim may be different, depending on orfeo...)
4737
4740 showseg->SetPID(shower_nfilmb[j]);
4742 // in real data plateb is 57 for emulsion 57...(sim may be different, depending on orfeo...)
4743
4744 showseg->SetID(shower_idb[j]);
4745 showseg->SetProb(1);
4746
4747 //Set Npl right. In libShowRec we dont have to to this since we call the EdbShowerP::Update() function
4748 //int npl = TMath::Abs(shower_plateb[j]-shower_plateb[0]);
4749 // The first plate of shower_plateb[0] when used in ::rec() mode is somehow wrong,
4750 // therefore we rather take nfilmb for plate references...
4751 int npl = TMath::Abs(shower_nfilmb[j]-shower_nfilmb[0]);
4752 if (npl>nplmax) {
4753 show->SetNpl(npl);
4754 }
4755
4756 //showseg->PrintNice();
4757
4758 show->AddSegment(showseg);
4759 // Attention: If you have a EdbTrackP object and you add a segment, then
4760 // you have to manually set Counters for N(), NPl(). It is not done auto.
4761 show -> SetCounters();
4762 } // Loop over shower Entries (==different basetracks):
4763
4764
4765 // This ID should be unique!
4766 // (Means every shower has one different!)
4767 show->SetID(nenttotalcount);
4768 nenttotalcount++;
4769
4770 // Add Shower Object to Shower Reco Array.
4771 // Not, if its empty:
4772 // Not, if its containing only one BT:
4773 if (show->N()>=1) {
4774 showarray->Add(show);
4776 if (gEDBDEBUGLEVEL>3) cout << "EdbShowRec::Treebranch_To_RecoShowerArray showarray->Add(show) ... done." << endl;
4777 }
4778
4779 if (gEDBDEBUGLEVEL>3) show->PrintNice();
4780
4781 }// Loop over Tree Entries (==different showers):
4782 //---------------------------------------------------
4783
4784 if (gEDBDEBUGLEVEL>2) eShowerTree->Show(0);
4785 if (gEDBDEBUGLEVEL>2) eShowerTree->Show(nent-1);
4786
4787 cout << "EdbShowRec::Treebranch_To_RecoShowerArray Loop over Tree Entries (==different showers) done." << endl;
4788 cout << "EdbShowRec::Treebranch_To_RecoShowerArray showarray->N()" << showarray->GetEntries() <<endl;
4789
4790 SetRecoShowerArray(showarray);
4791 SetRecoShowerArrayN(showarray->GetEntries());
4792
4793 Log(2,"EdbShowRec::Treebranch_To_RecoShowerArray","EdbShowRec::Treebranch_To_RecoShowerArray...done.");
4794 return;
4795}
Float_t shower_purb
Definition: ShowRec.h:394
void SetChi2(float chi2)
Definition: EdbSegP.h:135
void SetP(float p)
Definition: EdbSegP.h:133
void SetMC(int mEvt, int mTrack)
Definition: EdbSegP.h:141
void SetRecoShowerArray(TObjArray *RecoShowerArray)
Definition: EdbShowerRec.h:664

◆ Transform_eAli()

void EdbShowerRec::Transform_eAli ( EdbSegP InitiatorBT,
Float_t  ExtractSize = 1000 
)

Transform an EdbPVRec Object into a smaller EdbPVRec object.
The length (number of plates/patterns) of eAli_Sub is not changed.
Only XY-size (+- ExtractSize) and MC cuts (same MC or BG) around
the InitiatorBT are applied.
This method increases speed of processing, useful for large simulation MC
datasets.
( Code Detail Warning:
In case there are tooo many InitiatorBTs (order of 10k), the memory
consumption be very high, the reason is that we cannot delete the
small EdbPVRec objects build for the previous InitiatorBT, since the
addresses of the segments will be deleted as well, segfault will appear.
In this case the EdbPattern::ExtractSubPattern function will not only
clone the InitiatorBTs, but also the EdbPatterns, and the existing
EdbSegPs in it.
This method is more intended to use for the standalone program
ShowReco because in this program the EdbSegP objects are not used
in its following code way, and then one can easyly delete the
eAli_Sub object.
In this case, use the SetUseAliSub(0), then reconstruction will operate
on the original EdbPVRec object.
)
Test have shown that, the Transform_eAli with ExtractSubPattern method
gains highly in speed the more MC BTs are in the volume. For a
sample consisting only of data, the only advantage is the loop over a
smaller reconstruction area. If many MC BTs are in the volume, the advantage
by cutting out also the other MC for one eAli_Sub object becomes really
visible in time (but unfortunately also in memory).
So maybe a good tradeoff is like this:
If ratio of MC/Data basetracks in the volume is significant then
SetUseAliSub(1).
If number of InitiatorBTs exceeds 5000 (number choosen by me after few
tests) then we automatically switch to SetUseAliSub(0).
For volumes containing only Data basetracks (i.e. MCEvt==-999) we
do right from the start the operation on SetUseAliSub(0).
/ IMPLEMENT THIS !!!


DEBUG if (eAli_Sub) { delete eAli_Sub;eAli_Sub=0;} original, but keeps not adresses of segment in eAli; if it is deleted, then segfault will appear... But if not removed, memory can increase very quickly. In this case, use the SetUseAliSub(0), then reconstruction will operate on the on the original EdbPVRec Object.

do nothing now... let it live... delete eAli_Sub;eAli_Sub=0;}

3725{
3766
3767 Log(3,"EdbShowerRec::Transform_eAli","Transform eAli to eAli_Sub.");
3768
3769 // eUseAliSub=kTRUE; // Now possible to choose between use of full ali, or extracted ali.
3770 eAli_Sub_halfsize=ExtractSize;
3771
3772 // IF TO RECREATE THE gALI_SUB in RECONSTRUCTION or if to use gAli global (slowlier but maybe memory leak safe).
3773 if (eUseAliSub==0)
3774 {
3775 if (gEDBDEBUGLEVEL>2) cout << "EdbShowerRec::Transform_eAli UseAliSub==0 No new eAli_Sub created. Use eAli instead. "<<endl;
3776 eAli_Sub=eAli;
3777 if (gEDBDEBUGLEVEL>3) eAli_Sub->Print();
3778 return;
3779 }
3780
3781 Int_t npat;
3782 npat = eAli->Npatterns(); //number of plates
3783
3784 // has to be deleted in some part of the script outside this function...
3785 // Dont forget , otherwise memory heap overflow!
3791 if (NULL!=eAli_Sub) {
3792 ;
3793 }
3794 eAli_Sub = new EdbPVRec();
3795
3796 if (gEDBDEBUGLEVEL>2) cout << "EdbShowerRec::Transform_eAli eAli_Sub created."<<endl;
3797
3798 // Create SubPattern objects
3799 EdbSegP* ExtrapolateInitiatorBT=0;
3800 ExtrapolateInitiatorBT = (EdbSegP*)InitiatorBT->Clone();
3801
3802 Int_t InitiatorBTMCEvt=InitiatorBT->MCEvt();
3803
3804 // Create Variables For ExtractSubpattern boundaries
3805 Float_t mini[5];
3806 Float_t maxi[5];
3807 //Float_t ExtractSize=1000;// now in fucntion header
3808 mini[0]=ExtrapolateInitiatorBT->X()-ExtractSize;
3809 mini[1]=ExtrapolateInitiatorBT->Y()-ExtractSize;
3810 maxi[0]=ExtrapolateInitiatorBT->X()+ExtractSize;
3811 maxi[1]=ExtrapolateInitiatorBT->Y()+ExtractSize;
3812 mini[2]=-0.7;
3813 mini[3]=-0.7;
3814 mini[4]=0.0;
3815 maxi[2]=0.7;
3816 maxi[3]=0.7;
3817 maxi[4]=100.0;
3818
3819 EdbPattern* singlePattern;
3820 Float_t ExtrapolateInitiatorBT_zpos_orig=ExtrapolateInitiatorBT->Z();
3821
3822 //InitiatorBT->PrintNice();
3823
3824 // Add the subpatterns in a loop for the plates:
3825 // in reverse ordering.due to donwstream behaviour (!):
3826 // (Only downstream is supported now...)
3827 for (Int_t ii=0; ii<npat; ++ii) {
3828
3829 Float_t zpos=eAli->GetPattern(ii)->Z();
3830 //cout << " Doing pattern " << ii << " at Z postion = " << zpos << endl;
3831
3832 ExtrapolateInitiatorBT->PropagateTo(zpos);
3833
3834 mini[0]=ExtrapolateInitiatorBT->X()-ExtractSize;
3835 mini[1]=ExtrapolateInitiatorBT->Y()-ExtractSize;
3836 maxi[0]=ExtrapolateInitiatorBT->X()+ExtractSize;
3837 maxi[1]=ExtrapolateInitiatorBT->Y()+ExtractSize;
3838
3839 singlePattern=(EdbPattern*)eAli->GetPattern(ii)->ExtractSubPattern(mini,maxi,InitiatorBTMCEvt);
3840 // This sets PID() analogue to (upstream), nut not PID of the BTs !
3841 singlePattern-> SetID(eAli->GetPattern(ii)->ID());
3842 // This sets PID() analogue to (upstream), nut not PID of the BTs !
3843 singlePattern-> SetPID(eAli->GetPattern(ii)->PID());
3844
3845 eAli_Sub->AddPattern(singlePattern);
3846
3847 // Propagate back...! (in order not to change the original BT)
3848 ExtrapolateInitiatorBT->PropagateTo(ExtrapolateInitiatorBT_zpos_orig);
3849
3850 //cout << "singlePattern: N segments filled: " << singlePattern->N() << endl;
3851 }
3852
3853 delete ExtrapolateInitiatorBT;
3854 eAli_SubNpat=eAli_Sub->Npatterns(); //number of plates
3855
3856 if (gEDBDEBUGLEVEL>2) eAli_Sub->Print();
3857 return;
3858}
int ID() const
Definition: EdbPattern.h:319
void PropagateTo(float z)
Definition: EdbSegP.cxx:293
Int_t eAli_SubNpat
Definition: EdbShowerRec.h:104

◆ vert()

void EdbShowerRec::vert ( const char *  name2,
const char *  def,
int  MAXPLATE,
int  piece2par 
)
1491{
1492 double ZZ0[57];
1493 char nme[64];
1494 int ind;
1495 float a11, a12, a21, a22, bb1, bb2;
1496 float Zoff;
1497 const Int_t eNSM = 10000;
1498 const Int_t eNTM = 1000;
1499
1500 TArrayF xbb(eNTM*eNSM);
1501 TArrayF ybb(eNTM*eNSM);
1502 TArrayF zbb(eNTM*eNSM);
1503 TArrayF txbb(eNTM*eNSM);
1504 TArrayF tybb(eNTM*eNSM);
1505 TArrayF deltarbb(eNTM*eNSM);
1506 TArrayF deltatbb(eNTM*eNSM);
1507 TArrayI sigbb(eNTM*eNSM);
1508 TArrayI nfilmbb(eNTM*eNSM);
1509 TArrayI Flag(eNTM*eNSM);
1510 TArrayI add(eNTM*eNSM);
1511 TArrayI EvNum(eNSM);
1512
1513 for (int i=0; i<eNSM; i++)
1514 {
1515 for (int j=0; j<eNTM; j++)
1516 {
1517 ind = i*eNTM+j;
1518 xbb[ind];
1519 ybb[ind];
1520 zbb[ind];
1521 txbb[ind];
1522 tybb[ind];
1523 deltarbb[ind];
1524 deltatbb[ind];
1525 sigbb[ind];
1526 nfilmbb[ind];
1527 Flag[ind];
1528
1529 }
1530 }
1531
1532 file = new TFile(name2 ,"READ");
1533 TTree *treebranch_e = (TTree *) file->Get("treebranch");
1534 treebranch_e->SetBranchAddress("number_eventb", &number_eventb);
1535 treebranch_e->SetBranchAddress("nfilmb", nfilmb);
1536 treebranch_e->SetBranchAddress("sizeb", &sizeb);
1537 treebranch_e->SetBranchAddress("tagprimary", tagprimary);
1538 treebranch_e->SetBranchAddress("txb", txb);
1539 treebranch_e->SetBranchAddress("tyb", tyb);
1540 treebranch_e->SetBranchAddress("xb", xb);
1541 treebranch_e->SetBranchAddress("yb",yb);
1542 treebranch_e->SetBranchAddress("zb",zb);
1543 treebranch_e->SetBranchAddress("chi2btkb",chi2btkb);
1544
1545 int nentries_e = int(treebranch_e->GetEntries());
1546 TList *eS = new TList;
1547
1548 for (Int_t ii = 0; ii<nentries_e; ii++)
1549 {
1550 treebranch_e->GetEntry(ii);
1551
1552 EdbShowerRec* shower = new EdbShowerRec();
1553 shower->SetID(ii);
1554 shower->SetX0(xb[0]);
1555 shower->SetY0(yb[0]);
1556 shower->SetZ0(zb[0]);
1557 shower->SetTx(txb[0]);
1558 shower->SetTy(tyb[0]);
1559 shower->SetTrID(number_eventb);
1560
1561 shower->SetDeltarb(200.,0);
1562 shower->SetDelthetab(0.5,0);
1563 shower->SetPrimary(0,0);
1564 shower->SetNFilmb(1,0);
1565 shower->SetSize(sizeb);
1566
1567 shower->SetXb(xb[0],0);
1568 shower->SetYb(yb[0],0);
1569 shower->SetZb(zb[0],0);
1570 shower->SetTXb(txb[0],0);
1571 shower->SetTYb(tyb[0],0);
1572
1573 for (Int_t ibtke = 1; ibtke < sizeb; ibtke++)
1574 {
1575 shower->SetXb(xb[ibtke],ibtke);
1576 shower->SetYb(yb[ibtke],ibtke);
1577 shower->SetZb(zb[ibtke],ibtke);
1578 shower->SetTXb(txb[ibtke],ibtke);
1579 shower->SetTYb(tyb[ibtke],ibtke);
1580 shower->SetNFilmb(nfilmb[ibtke],ibtke);
1581 }
1582 eS->Add(shower);
1583 }
1584
1585 EdbShowerRec* a=0;
1586
1587 //================================================================
1588 float Z0, Z1, TX0,TY0 ;
1589 float X0, Y0, X1, Y1, Xss,Yss;
1590 float Delta, rayon,rayon2, diff, delta;
1591 float diff2, Delta2;
1592 float Xe[4], Ye[4];
1593 int nseg;
1594
1595 for (int jj=0; jj<eNSM; jj++)
1596 {
1597 for (int ii=0; ii<eNTM; ii++)
1598 {
1599 ind = jj*eNTM +ii;
1600 Flag[ind] = 0;
1601 }
1602 }
1603
1604 EdbTrackP *tr=0;
1605//read the linked_tracks.root tree
1606 initproc(def, 100,"nseg>3");
1607
1608 //printf("nseg>3&&s.eChi2<(s.eW*0.3-3.)\n");
1609 gAli->FillCell(30,30,0.009,0.009);
1610
1611 int ntr = gAli->eTracks->GetEntries();
1612 printf("ntr = %d\n",ntr);
1613
1614 EdbSegP *s = new EdbSegP();
1615 for (int i=0; i<ntr; i++) {
1616 tr = (EdbTrackP*)(gAli->eTracks->At(i));
1617 if (i%1000==0) printf( "Processed tracks %d/%d\n",i,ntr);
1618 nseg = tr->N();
1619 if (nseg<4) continue; //do not take into account tracks with less than 4 segments
1620
1621 s = tr->GetSegment(0);
1622 X1 = s->X();
1623 Y1 = s->Y();
1624 Z1 = s->Z();
1625 for (int l=0; l<nseg; l++)
1626 {
1627 s = tr->GetSegment(l);
1628 Z0 = s->Z();
1629 TX0 = s->TX();
1630 TY0 = s->TY();
1631 X0 = s->X();
1632 Y0 = s->Y();
1633// loop over the shower
1634 int ii=0;
1635 TIter next(eS);
1636 while ((a=(EdbShowerRec*)next()))
1637 {
1638 for (Int_t ibtke = 1; ibtke < a->GetSize(); ibtke++)
1639 {
1640 if ( a->GetXb(ibtke)==X0&&a->GetYb(ibtke)==Y0&&a->GetZb(ibtke)==Z0 )
1641 {
1642 rayon = 800.; // cylinder with 400 microns radius
1643
1644 // Extrapolation of the first shower basetrack at the Z basetrack position of the first basetrack of the track
1645 Xss = a->GetX0() + (Z1-a->GetZ0())*a->GetTx();
1646 Yss = a->GetY0() + (Z1-a->GetZ0())*a->GetTy();
1647
1648 // check if the first basetrack of the track is inside the cone
1649 diff2 = sqrt((X1-Xss)*(X1-Xss)+(Y1-Yss)*(Y1-Yss));
1650 Delta2 = 20. + fabs(0.02*(Z1-a->GetZ0())); // cone with 20 mrad
1651
1652 // Extrapolation of the first shower basetrack at the current Z basetrack position
1653 Xss = a->GetX0() + (Z0-a->GetZ0())*a->GetTx();
1654 Yss = a->GetY0() + (Z0-a->GetZ0())*a->GetTy();
1655 // check if the current basetrack is inside the cone
1656 diff = sqrt((X0-Xss)*(X0-Xss)+(Y0-Yss)*(Y0-Yss));
1657 Delta = 20. + fabs(0.02*(Z0-a->GetZ0())); // cone with 20 mrad
1658
1659 if ( (diff<rayon&&diff<Delta)&&(diff2>Delta2||diff2>rayon) ) // (the BT must be in the cone)&&(the first BT of the track must be outside the cone)
1660 {
1661 printf( "%f %f %f %f %d %f\n", Z1, Delta2,diff2,Z0,ii,chi2btkb[ibtke]);
1662 Flag[ibtke+ii*eNTM] = 1;
1663 }
1664 }
1665 }
1666 ii++;
1667 }
1668 }
1669 }
1670 file->Close();
1671 gAli->Delete();
1672
1673// get Z value for each plate
1674 ZZ0[0] = 0.;
1675 for (Int_t iii = 1; iii<MAXPLATE; iii++)
1676 {
1677 if (iii<10)
1678 {
1679 if (piece2par<10)
1680 {
1681 sprintf(nme,"%s/0%d_00%d.par","par",iii,piece2par);
1682 }
1683 else
1684 {
1685 sprintf(nme,"%s/0%d_0%d.par","par",iii,piece2par);
1686 }
1687 }
1688 else
1689 {
1690 if (piece2par<10)
1691 {
1692 sprintf(nme,"%s/%d_00%d.par","par",iii,piece2par);
1693 }
1694 else
1695 {
1696 sprintf(nme,"%s/%d_0%d.par","par",iii,piece2par);
1697 }
1698 }
1699 // if(iii<10) {sprintf(nme,"%s/0%d_00%d.par","par",iii,piece2par);}
1700 // else {sprintf(nme,"%s/%d_00%d.par","par",iii,piece2par);}
1701
1702 ReadAffAndZ(nme,&Zoff,&a11,&a12,&a21,&a22,&bb1,&bb2);
1703 ZZ0[iii] = Zoff;
1704
1705 }
1706
1707 float zpos,rr;
1708 int nntr, d, max =0;
1709 int ok;
1710// float Rcut = 100.;
1711// float Tcut = 0.05;
1712 float Rcut = 150.;
1713 float Tcut = 0.15;
1714
1715 int ige =0;
1716
1717 TIter next(eS);
1718 while ((a=(EdbShowerRec*)next()))
1719 {
1720 ind = 0 + ige*eNTM;
1721 add[ige] = 1;
1722 EvNum[ige] = a->GetTrID();
1723 xbb[ind] = a->GetX0();
1724 ybb[ind] = a->GetY0();
1725 zbb[ind] = a->GetZ0();
1726 txbb[ind] = a->GetTx();
1727 tybb[ind] = a->GetTy();
1728 deltarbb[ind]= 200. ;
1729 deltatbb[ind]= 0.5;
1730
1731 nfilmbb[ind] = 1;
1732 for ( int ibtke = 1; ibtke < a->GetSize() ; ibtke++)
1733 {
1734 ok = 0;
1735 Xss = a->GetX0() + (a->GetZb(ibtke)-a->GetZ0())*a->GetTx();
1736 Yss = a->GetY0() + (a->GetZb(ibtke)-a->GetZ0())*a->GetTy();
1737
1738 Delta = 20. + fabs(0.02*(a->GetZb(ibtke)-a->GetZ0())); // cone with 20
1739 rayon = 800.; // cylinder with 400 microns radius
1740 diff = sqrt((a->GetXb(ibtke)-Xss)*(a->GetXb(ibtke)-Xss)+(a->GetYb(ibtke)-Yss)*(a->GetYb(ibtke)-Yss));
1741
1742 if ( diff<rayon&&diff<Delta&&Flag[ibtke+ige*eNTM]==0 ) //BT must be in the cone and does not belong to a track which starts outside the cone volume
1743 {
1744
1745 d = a->GetNFilmb(ibtke);
1746 zpos = a->GetZb(ibtke);
1747 if (zpos>1000&&zpos<1500.)
1748 {
1749 max = 1;
1750 } else if (zpos<3000)
1751 {
1752 max = 2;
1753 }
1754 else
1755 {
1756 max = 3;
1757 }
1758 for (int el=0; el<max; el++)
1759 {
1760
1761 rr = a->GetZb(ibtke)/1273;
1762 d = int(round(rr));
1763
1764 Xe[el] = a->GetXb(ibtke) -(a->GetZb(ibtke)-ZZ0[d-el])*a->GetTXb(ibtke);
1765 Ye[el] = a->GetYb(ibtke) -(a->GetZb(ibtke)-ZZ0[d-el])*a->GetTYb(ibtke);
1766 nntr = add[ige];
1767
1768 for (int l2=0; l2<nntr; l2++) {
1769
1770 if (fabs(a->GetZb(l2)-(a->GetZb(ibtke)-(el+1)*1273))<500)
1771 {
1772
1773 rayon2 = sqrt((Xe[el]-a->GetXb(l2))*(Xe[el]-a->GetXb(l2))+((Ye[el]-a->GetYb(l2))*(Ye[el]-a->GetYb(l2))));
1774 delta = sqrt((a->GetTXb(ibtke)-a->GetTXb(l2))*(a->GetTXb(ibtke)-a->GetTXb(l2))+((a->GetTYb(ibtke)-a->GetTYb(l2))*(a->GetTYb(ibtke)-a->GetTYb(l2))));
1775
1776
1777 if (rayon2<Rcut&&delta<Tcut&&Flag[ige+l2*eNSM]==0) // connection criteria with a BT which does not belong to a track which starts outside the cone volume
1778 {
1779 if (ok==0)
1780 {
1781 //ind = ige + add[ige]*eNSM;
1782 ind = add[ige] + ige*eNTM;
1783 xbb[ind] = a->GetXb(ibtke);
1784 ybb[ind] = a->GetYb(ibtke);
1785 zbb[ind] = a->GetZb(ibtke);
1786 txbb[ind] = a->GetTXb(ibtke);
1787 tybb[ind] = a->GetTYb(ibtke);
1788 deltarbb[ind] = rayon2 ;
1789 deltatbb[ind] = delta ;
1790 EvNum[ige]= a->GetTrID();
1791
1792 nfilmbb[ind] = a->GetNFilmb(ibtke);
1793
1794 sigbb[ind] = int(chi2btkb[ibtke]);
1795 ok =1;
1796 add[ige]++;
1797
1798 }
1799 else if (ok==1&&rayon2<deltarbb[(add[ige]-1)+ige*eNTM])
1800 {
1801 ind = (add[ige]-1) + ige*eNTM;
1802 deltarbb[ind] = rayon2 ;
1803 deltatbb[ind] = delta ;
1804 }
1805 }
1806 }
1807 } //for (int l2=0;l2<nntr;l2++)
1808 } // for (int el=0;el<max;el++)
1809 }//if ( diff<rayon&&diff<Delta )
1810 } // for ( ibtke = 1;
1811 ige++;
1812 } // while
1813
1814 for (int i=0; i<nentries_e; i++)
1815 {
1816// number_eventb = i;
1817 number_eventb = EvNum[i];
1818
1819 sizeb = add[i];
1820 sizeb15 = 0;
1821 sizeb20 = 0;
1822 sizeb30 = 0;
1823
1824 isizeb = 0;
1825
1826 for (int j=0; j<sizeb; j++)
1827 {
1828 ind = j + i*eNTM;
1829 if (zbb[ind]>zb[0]+5000) isizeb = 1;
1830 if (nfilmbb[ind]<16) sizeb15++;
1831 if (nfilmbb[ind]<21) sizeb20++;
1832 if (nfilmbb[ind]<31) sizeb30++;
1833// }
1834
1835// for (int j=0;j<sizeb; j++)
1836// {
1837 xb[j] = xbb[ind];
1838 yb[j] = ybb[ind];
1839 zb[j] = zbb[ind];
1840 txb[j] = txbb[ind];
1841 tyb[j] = tybb[ind];
1842 deltarb[j] = deltarbb[ind] ;
1843 deltathetab[j] = deltatbb[ind];
1844
1845 nfilmb[j] = nfilmbb[ind];
1846 tagprimary[j] = 0;
1847 if (j==0) tagprimary[j] = 1;
1848// if (j==0) chi2btkb[j] = 1;
1849// if (j>0) chi2btkb[j] = sigbb[ind];
1850 if (j==0) ntrace1simub[j]= 1;
1851 if (j>0) ntrace1simub[j] = sigbb[j+i*eNTM];
1852 }
1853 if (isizeb > 0)treesaveb->Fill();
1854 }
1855
1856}
TObjArray * eTracks
Definition: EdbPVRec.h:161
void FillCell(float stepx, float stepy, float steptx, float stepty)
Definition: EdbPVRec.cxx:1092
TFile * file
Definition: EdbShowerRec.h:220
void initproc(const char *def, int iopt, const char *rcut)
Definition: EdbShowerRec.cxx:271
void SetSize(int size)
Definition: EdbShowerRec.h:429

Member Data Documentation

◆ a

EdbDataProc* EdbShowerRec::a

◆ ANNInterimTreeInputvariables

TTree* EdbShowerRec::ANNInterimTreeInputvariables
private

◆ bin1

Double_t EdbShowerRec::bin1

◆ bin10

Double_t EdbShowerRec::bin10

◆ bin11

Double_t EdbShowerRec::bin11

◆ bin12

Double_t EdbShowerRec::bin12

◆ bin13

Double_t EdbShowerRec::bin13

◆ bin14

Double_t EdbShowerRec::bin14

◆ bin15

Double_t EdbShowerRec::bin15

◆ bin16

Double_t EdbShowerRec::bin16

◆ bin17

Double_t EdbShowerRec::bin17

◆ bin18

Double_t EdbShowerRec::bin18

◆ bin19

Double_t EdbShowerRec::bin19

◆ bin2

Double_t EdbShowerRec::bin2

◆ bin20

Double_t EdbShowerRec::bin20

◆ bin21

Double_t EdbShowerRec::bin21

◆ bin22

Double_t EdbShowerRec::bin22

◆ bin23

Double_t EdbShowerRec::bin23

◆ bin24

Double_t EdbShowerRec::bin24

◆ bin25

Double_t EdbShowerRec::bin25

◆ bin26

Double_t EdbShowerRec::bin26

◆ bin27

Double_t EdbShowerRec::bin27

◆ bin28

Double_t EdbShowerRec::bin28

◆ bin29

Double_t EdbShowerRec::bin29

◆ bin3

Double_t EdbShowerRec::bin3

◆ bin30

Double_t EdbShowerRec::bin30

◆ bin31

Double_t EdbShowerRec::bin31

◆ bin32

Double_t EdbShowerRec::bin32

◆ bin33

Double_t EdbShowerRec::bin33

◆ bin34

Double_t EdbShowerRec::bin34

◆ bin35

Double_t EdbShowerRec::bin35

◆ bin4

Double_t EdbShowerRec::bin4

◆ bin41

Double_t EdbShowerRec::bin41

◆ bin42

Double_t EdbShowerRec::bin42

◆ bin43

Double_t EdbShowerRec::bin43

◆ bin44

Double_t EdbShowerRec::bin44

◆ bin45

Double_t EdbShowerRec::bin45

◆ bin46

Double_t EdbShowerRec::bin46

◆ bin47

Double_t EdbShowerRec::bin47

◆ bin48

Double_t EdbShowerRec::bin48

◆ bin49

Double_t EdbShowerRec::bin49

◆ bin5

Double_t EdbShowerRec::bin5

◆ bin50

Double_t EdbShowerRec::bin50

◆ bin51

Double_t EdbShowerRec::bin51

◆ bin52

Double_t EdbShowerRec::bin52

◆ bin53

Double_t EdbShowerRec::bin53

◆ bin54

Double_t EdbShowerRec::bin54

◆ bin55

Double_t EdbShowerRec::bin55

◆ bin56

Double_t EdbShowerRec::bin56

◆ bin57

Double_t EdbShowerRec::bin57

◆ bin58

Double_t EdbShowerRec::bin58

◆ bin59

Double_t EdbShowerRec::bin59

◆ bin6

Double_t EdbShowerRec::bin6

◆ bin60

Double_t EdbShowerRec::bin60

◆ bin7

Double_t EdbShowerRec::bin7

◆ bin8

Double_t EdbShowerRec::bin8

◆ bin9

Double_t EdbShowerRec::bin9

◆ chi2btkb

Float_t EdbShowerRec::chi2btkb[10000]

◆ cmd

char EdbShowerRec::cmd[500]

◆ deltarb

Float_t EdbShowerRec::deltarb[10000]

◆ deltathetab

Float_t EdbShowerRec::deltathetab[10000]

◆ deltaxb

Float_t EdbShowerRec::deltaxb[10000]

◆ deltayb

Float_t EdbShowerRec::deltayb[10000]

◆ dproc

EdbDataProc* EdbShowerRec::dproc

◆ E_MC

Float_t EdbShowerRec::E_MC

energy of the first starting basetrack

◆ eAlgoParameterConeAngle

Double_t EdbShowerRec::eAlgoParameterConeAngle
private

Opening angle of spanning cone from first BT.

◆ eAlgoParameterConeRadius

Double_t EdbShowerRec::eAlgoParameterConeRadius
private

Radius of spanning cone from first BT.

◆ eAlgoParameterConnectionDR

Double_t EdbShowerRec::eAlgoParameterConnectionDR
private

Connection Criterium: delta R.

◆ eAlgoParameterConnectionDT

Double_t EdbShowerRec::eAlgoParameterConnectionDT
private

Connection Criterium: delta T.

◆ eAlgoParameterNPropagation

Int_t EdbShowerRec::eAlgoParameterNPropagation
private

N plates backpropagating.

◆ eAli

EdbPVRec* EdbShowerRec::eAli
private

◆ eAli_Sub

EdbPVRec* EdbShowerRec::eAli_Sub
private

◆ eAli_Sub_halfsize

Float_t EdbShowerRec::eAli_Sub_halfsize
private

◆ eAli_SubNpat

Int_t EdbShowerRec::eAli_SubNpat
private

◆ eAliLoaded

Bool_t EdbShowerRec::eAliLoaded
private

◆ eAliNpat

Int_t EdbShowerRec::eAliNpat
private

◆ eAliNpatM1

Int_t EdbShowerRec::eAliNpatM1
private

◆ eChi20

Float_t EdbShowerRec::eChi20
private

Chi2 of the first shower segment.

◆ eChi2b

Float_t EdbShowerRec::eChi2b[10000]
private

Chi2 of basetrack.

◆ eDeltarb

Float_t EdbShowerRec::eDeltarb[10000]
private

Distance criteria of basetrack.

◆ eDeltathetab

Float_t EdbShowerRec::eDeltathetab[10000]
private

Angular criteria of basetrack.

◆ eDoEnergyCalculation

Bool_t EdbShowerRec::eDoEnergyCalculation
private

EnergyEstimation to do or not.

◆ eDz

Float_t EdbShowerRec::eDz
private

length of the shower along Z

◆ eEnergyANN

TObjArray* EdbShowerRec::eEnergyANN
private

Container for the ANNs trained on different.

◆ eEnergyCorrectedb

Float_t EdbShowerRec::eEnergyCorrectedb
private

Neural Network output for Corrected Energy.

◆ eEnergyIsDone

Bool_t EdbShowerRec::eEnergyIsDone
private

EnergyEstimation already done or not.

◆ eEnergyResolutionFitFunction_All

TF1* EdbShowerRec::eEnergyResolutionFitFunction_All
private

◆ eEnergySigmaCorrectedb

Float_t EdbShowerRec::eEnergySigmaCorrectedb
private

Neural Network output for Corrected Energy Sigma.

◆ eEnergySigmaUnCorrectedb

Float_t EdbShowerRec::eEnergySigmaUnCorrectedb
private

Neural Network output for UnCorrected Energy Sigma.

◆ eEnergyUnCorrectedb

Float_t EdbShowerRec::eEnergyUnCorrectedb
private

Neural Network output for UnCorrected Energy.

◆ eEnergyWeightFileString

TString* EdbShowerRec::eEnergyWeightFileString[9]
private

Container for the weightfiles trained on different.

◆ eFilename_LinkedTracks

TString EdbShowerRec::eFilename_LinkedTracks
private

◆ eFlag0

Int_t EdbShowerRec::eFlag0
private

Flag of the first shower segment.

◆ eFlagb

Int_t EdbShowerRec::eFlagb[10000]
private

Flag of basetrack.

◆ eHistEnergyCorrectedb

TH1F* EdbShowerRec::eHistEnergyCorrectedb
private

◆ eHistEnergyNominal

TH1F* EdbShowerRec::eHistEnergyNominal
private

◆ eHistEnergySigmaCorrectedb

TH1F* EdbShowerRec::eHistEnergySigmaCorrectedb
private

◆ eHistEnergySigmaUnCorrectedb

TH1F* EdbShowerRec::eHistEnergySigmaUnCorrectedb
private

◆ eHistEnergyUnCorrectedb

TH1F* EdbShowerRec::eHistEnergyUnCorrectedb
private

◆ eID

Int_t EdbShowerRec::eID
private

shower ID

◆ eIDb

Int_t EdbShowerRec::eIDb[10000]
private

ID of basetrack.

◆ eInBTArray

TObjArray* EdbShowerRec::eInBTArray
private

◆ eInBTArrayIsFilled

Bool_t EdbShowerRec::eInBTArrayIsFilled
private

◆ eInBTArrayLoaded

Bool_t EdbShowerRec::eInBTArrayLoaded
private

◆ eInBTArrayMaxSize

Int_t EdbShowerRec::eInBTArrayMaxSize
private

◆ eInBTArrayN

Int_t EdbShowerRec::eInBTArrayN
private

◆ eInitiatorBTIsCreated

Bool_t EdbShowerRec::eInitiatorBTIsCreated
private

◆ eL

Int_t EdbShowerRec::eL
private

length of the shower in number of film

◆ emcDigitIndexBottom

Int_t EdbShowerRec::emcDigitIndexBottom[1000]
private

mc bottom digit index of basetrack

◆ emcDigitIndexBottom0

Int_t EdbShowerRec::emcDigitIndexBottom0
private

Bottom Digit index of the first shower segment.

◆ emcDigitIndexTop

Int_t EdbShowerRec::emcDigitIndexTop[1000]
private

mc top digit index of basetrack

◆ emcDigitIndexTop0

Int_t EdbShowerRec::emcDigitIndexTop0
private

Top Digit index of the first shower segment.

◆ energy_shot_particle

Float_t EdbShowerRec::energy_shot_particle
private

◆ EnergyCorrectedb

Float_t EdbShowerRec::EnergyCorrectedb

◆ EnergySigmaCorrectedb

Float_t EdbShowerRec::EnergySigmaCorrectedb

◆ EnergySigmaUnCorrectedb

Float_t EdbShowerRec::EnergySigmaUnCorrectedb

◆ EnergyUnCorrectedb

Float_t EdbShowerRec::EnergyUnCorrectedb

◆ eNFilmb

Int_t EdbShowerRec::eNFilmb[10000]
private

Plate number of basetrack in the shower reference.

◆ eNumberPlate_eAliPID

Int_t EdbShowerRec::eNumberPlate_eAliPID
private

◆ eOutput

Float_t EdbShowerRec::eOutput
private

Neural Network output for e/pi separation.

◆ eOutput15

Float_t EdbShowerRec::eOutput15
private

Neural Network output for e/pi separation (for 15 films crossed)

◆ eOutput20

Float_t EdbShowerRec::eOutput20
private

Neural Network output for e/pi separation (for 20 films crossed)

◆ eOutput30

Float_t EdbShowerRec::eOutput30
private

Neural Network output for e/pi separation (for 30 films crossed)

◆ eP0

Float_t EdbShowerRec::eP0
private

P of the first shower segment.

◆ ePb

Float_t EdbShowerRec::ePb[10000]
private

P of basetrack.

◆ ePlateb

Int_t EdbShowerRec::ePlateb[10000]
private

Plate ID of basetrack.

◆ eProb1

Int_t EdbShowerRec::eProb1

◆ eProb90

Int_t EdbShowerRec::eProb90

◆ eQualityPar

Double_t EdbShowerRec::eQualityPar[2]
private

◆ eRecoShowerArray

TObjArray* EdbShowerRec::eRecoShowerArray
private

◆ eRecoShowerArrayN

Int_t EdbShowerRec::eRecoShowerArrayN
private

◆ eShowersN

Int_t EdbShowerRec::eShowersN
private

Number how many showers have been reconstructed.

◆ eShowerTreeIsDone

Bool_t EdbShowerRec::eShowerTreeIsDone
private

ShowerReconstruction already done or not.

◆ eSize

Int_t EdbShowerRec::eSize
private

number of BT in the shower

◆ eSize15

Int_t EdbShowerRec::eSize15
private

number of BT in the shower (for 15 films crossed)

◆ eSize20

Int_t EdbShowerRec::eSize20
private

number of BT in the shower (for 20 films crossed)

◆ eSize30

Int_t EdbShowerRec::eSize30
private

number of BT in the shower (for 30 films crossed)

◆ eTagPrimary

Int_t EdbShowerRec::eTagPrimary[10000]
private

1 for first Basetrack - 0 for the other

◆ eTrID

Int_t EdbShowerRec::eTrID
private

ID of the tracks of the first BT (in cp file if simulation!)

◆ eTx

Float_t EdbShowerRec::eTx
private

tanX: deltaX/deltaZ for the first shower segment

◆ eTXb

Float_t EdbShowerRec::eTXb[10000]
private

Slope X position of basetrack.

◆ eTy

Float_t EdbShowerRec::eTy
private

tanY: deltaY/deltaZ for the first shower segment

◆ eTYb

Float_t EdbShowerRec::eTYb[10000]
private

Slope Y position of basetrack.

◆ eUseAliSub

Bool_t EdbShowerRec::eUseAliSub
private

◆ eUseQualityPar

Bool_t EdbShowerRec::eUseQualityPar
private

◆ eW0

Int_t EdbShowerRec::eW0
private

W of the first shower segment.

◆ eWb

Int_t EdbShowerRec::eWb[10000]
private

W of basetrack.

◆ eX0

Float_t EdbShowerRec::eX0
private

|_coordinates of the first shower segment

◆ eXb

Float_t EdbShowerRec::eXb[10000]
private

X position of basetrack.

◆ eY0

Float_t EdbShowerRec::eY0
private

| in the SAME FOR ALL SEGMENTS aligned coordinate system

◆ eYb

Float_t EdbShowerRec::eYb[10000]
private

Y position of basetrack.

◆ eZ0

Float_t EdbShowerRec::eZ0
private

|

◆ eZb

Float_t EdbShowerRec::eZb[10000]
private

Z position of basetrack.

◆ file

TFile* EdbShowerRec::file

◆ fileout

TFile* EdbShowerRec::fileout

◆ fileout2

TFile* EdbShowerRec::fileout2

◆ fileout3

TFile* EdbShowerRec::fileout3

◆ FileReconstructedShowerTree

TFile* EdbShowerRec::FileReconstructedShowerTree

◆ FileShowerParametrisationTree

TFile* EdbShowerRec::FileShowerParametrisationTree

◆ gAli

EdbPVRec* EdbShowerRec::gAli

◆ histo_deltaR_mean

TH1D* EdbShowerRec::histo_deltaR_mean

◆ histo_deltaR_rms

TH1D* EdbShowerRec::histo_deltaR_rms

◆ histo_deltaT_mean

TH1D* EdbShowerRec::histo_deltaT_mean

◆ histo_deltaT_rms

TH1D* EdbShowerRec::histo_deltaT_rms

◆ histo_longprofile_av

TH1D* EdbShowerRec::histo_longprofile_av

◆ histo_nbtk_av

TH1D* EdbShowerRec::histo_nbtk_av

◆ idb

Int_t EdbShowerRec::idb[10000]

??? forgot what it was ???

◆ inANN

Double_t EdbShowerRec::inANN[70]
private

◆ isizeb

Int_t EdbShowerRec::isizeb

??? forgot what it was ???

◆ mcDigitIndexBottom

Int_t EdbShowerRec::mcDigitIndexBottom[1000]

◆ mcDigitIndexTop

Int_t EdbShowerRec::mcDigitIndexTop[1000]

◆ mlp1

TMultiLayerPerceptron* EdbShowerRec::mlp1

◆ mlp2

TMultiLayerPerceptron* EdbShowerRec::mlp2

◆ mlp3

TMultiLayerPerceptron* EdbShowerRec::mlp3

◆ mlp4

TMultiLayerPerceptron* EdbShowerRec::mlp4

◆ nfilmb

Int_t EdbShowerRec::nfilmb[10000]

plate position of segment i w.r.t. starting segment.

◆ ngrainb

Int_t EdbShowerRec::ngrainb[10000]

◆ ntrace1simub

Int_t EdbShowerRec::ntrace1simub[10000]

◆ ntrace2simub

Int_t EdbShowerRec::ntrace2simub[10000]

◆ ntrace3simub

Float_t EdbShowerRec::ntrace3simub[10000]

◆ ntrace4simub

Int_t EdbShowerRec::ntrace4simub[10000]

◆ number_eventb

Int_t EdbShowerRec::number_eventb

definition of treebranch

MC number of the shower

◆ output15

Float_t EdbShowerRec::output15

old neural net variables for e/pi separation

◆ output20

Float_t EdbShowerRec::output20

old neural net variables for e/pi separation

◆ output30

Float_t EdbShowerRec::output30

old neural net variables for e/pi separation

◆ output50

Float_t EdbShowerRec::output50

old neural net variables for e/pi separation

◆ plateb

Int_t EdbShowerRec::plateb[10000]

plate id of segment i

◆ purityb

Float_t EdbShowerRec::purityb

purity of the shower (MC info needed).

◆ showerID

Int_t EdbShowerRec::showerID

??? forgot what it was ???

◆ ShowerParametrisationTree

TTree* EdbShowerRec::ShowerParametrisationTree

◆ sizeb

Int_t EdbShowerRec::sizeb

number of basetracks

◆ sizeb15

Int_t EdbShowerRec::sizeb15

sizeb15: basetracks within the first 15 plates

◆ sizeb20

Int_t EdbShowerRec::sizeb20

sizeb20: basetracks within the first 20 plates

◆ sizeb30

Int_t EdbShowerRec::sizeb30

sizeb30: basetracks within the first 30 plates

◆ tagprimary

Float_t EdbShowerRec::tagprimary[10000]

◆ trackdensb

Float_t EdbShowerRec::trackdensb

Track density around the shower (BT/mm2) (using eAli_Sub_halfsize).

◆ treesaveb

TTree* EdbShowerRec::treesaveb

◆ treesaveb2

TTree* EdbShowerRec::treesaveb2

◆ treesaveb3

TTree* EdbShowerRec::treesaveb3

◆ txb

Float_t EdbShowerRec::txb[10000]

position of segment i

◆ tyb

Float_t EdbShowerRec::tyb[10000]

position of segment i

◆ type

Int_t EdbShowerRec::type

◆ varia

TTree* EdbShowerRec::varia

◆ xb

Float_t EdbShowerRec::xb[10000]

position of segment i

◆ yb

Float_t EdbShowerRec::yb[10000]

position of segment i

◆ zb

Float_t EdbShowerRec::zb[10000]

position of segment i


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