4 Log(2,
"ShowRec.cpp",
"--- void ReconstructShowers_N3() ---");
36 TFile* N3_ALG_ANN_TrainingsFile;
38 N3_ALG_ANN_TrainingsFile =
new TFile(Form(
"N3_ALG_ANN_TrainingsFile_PARASET_%d.root",
GLOBAL_PARASETNR),
"RECREATE");
43 TTree *
simu =
new TTree(
"TreeSignalBackgroundBT",
"TreeSignalBackgroundBT");
54 TTree *simu_SG =
new TTree(
"TreeSignalBT",
"TreeSignalBT");
55 simu_SG->Branch(
"N3_Type", &
N3_Type,
"N3_Type/I");
56 simu_SG->Branch(
"N3_Inputvar",
N3_Inputvar,
"N3_Inputvar[24]/D");
57 TTree *simu_BG =
new TTree(
"TreeBackgroundBT",
"TreeBackgroundBT");
58 simu_BG->Branch(
"N3_Type", &
N3_Type,
"N3_Type/I");
59 simu_BG->Branch(
"N3_Inputvar",
N3_Inputvar,
"N3_Inputvar[24]/D");
77 Float_t local_gAli_pat_interim_halfsize=0;
104 Int_t local_NBTallMC=0;
105 Int_t local_NBTeMC=0;
106 float_t local_pure=-1;
107 float_t local_purall=-1;
118 cout << endl << endl <<
"--- Starting Shower for Number " << i <<
" now: "<<endl;
139 for (Int_t loop=0; loop<24; ++loop)
N3_Inputvar[loop]=0;
140 Int_t NaddedSGToTrainTree=0;
141 Int_t NaddedBGToTrainTree=0;
147 Int_t local_gAli_npat=local_gAli->
Npatterns();
149 if (
gEDBDEBUGLEVEL>2) cout <<
"--- local_gAli_npat= " << local_gAli_npat << endl;
153 for (Int_t patterloop_cnt=local_gAli_npat-1; patterloop_cnt>=0; --patterloop_cnt) {
154 if (
gEDBDEBUGLEVEL>3) cout <<
"--- --- Doing patterloop_cnt= " << patterloop_cnt << endl;
161 Int_t btloop_cnt_N=TestPattern->
GetN();
163 for (Int_t btloop_cnt=0; btloop_cnt<btloop_cnt_N; ++btloop_cnt) {
216 Float_t mindMinDist=0;
217 Int_t nDifferentSegs=-1;
222 Int_t deltaNpl[5]= {0,-1,1,-2,2};
226 for (Int_t loop_deltaNpl = 0; loop_deltaNpl<5; ++loop_deltaNpl) {
239 dNpl=deltaNpl[loop_deltaNpl];
247 N3_FindBestCompliments( seg, TestPattern, local_gAli, dNpl, mindeltaZ, mindT, mindR, mindMinDist, nDifferentSegs );
267 cout <<
"*******************************************************************"<<endl;
268 cout <<
"Print out all variables for BT i ___ connected with InBT : *****"<<endl;
270 printf(
"BT i->ID(), Type, dZ, dR, dT, dMinDist: %07d %d %.03f %.03f %.03f %.03f\n",seg->
ID(),
N3_Type,
N3_Inputvar[OffsetNVar+0],
N3_Inputvar[OffsetNVar+1],
N3_Inputvar[OffsetNVar+2],
N3_Inputvar[OffsetNVar+3]);
272 cout <<
"Print out all variables for BT i NOT connected with InBT : *****"<<endl;
273 for (Int_t loop_deltaNpl = 0; loop_deltaNpl<5; ++loop_deltaNpl) {
274 dNpl=deltaNpl[loop_deltaNpl];
275 printf(
"BT i->ID(), Type, dNpl, mindR, mindT, mindMinDist nDifferentSegs, : %07d %d %.03f %.03f %.03f %.03f %d \n",seg->
ID(),
N3_Type, dNpl,
N3_Inputvar[OffsetNVar+0],
N3_Inputvar[OffsetNVar+1],
N3_Inputvar[OffsetNVar+2],
N3_Inputvar[OffsetNVar+3]);
278 cout <<
"*******************************************************************"<<endl;
291 NaddedSGToTrainTree++;
296 Double_t currentBGSGRatio= Double_t (NaddedBGToTrainTree)/(1+Double_t(NaddedSGToTrainTree));
297 Double_t currentBGTotalRatio= Double_t (NaddedBGToTrainTree)/(1+Double_t(NaddedSGToTrainTree+NaddedBGToTrainTree));
302 Bool_t addBGTrack=kFALSE;
303 Double_t UniformTestNumber=gRandom->Uniform();
308 if ( UniformTestNumber > currentBGTotalRatio) addBGTrack=kTRUE;
316 NaddedBGToTrainTree++;
332 Double_t EvalValue=0;
333 Double_t N3_Evalvar4[4];
334 Double_t N3_Evalvar8[8];
335 Double_t N3_Evalvar12[12];
336 Double_t N3_Evalvar16[16];
337 Double_t N3_Evalvar20[20];
338 Double_t N3_Evalvar24[24];
445 if (seg->
X()==InBT->
X()&&seg->
Y()==InBT->
Y()) {
458 CalcTrackDensity(pat_interim,local_gAli_pat_interim_halfsize,npat_int,npat_total,npatN);
483 Double_t eff, purall, pure;
536 cout <<
" Now write NN SG/BG Trees with the Inputvariables: --------------------"<<endl;
540 cout <<
" Now show first entry of SG/BG Trees with the Inputvariables: --------------------"<<endl;
541 cout <<
" Signal Tree: --------------------"<<endl;
543 cout <<
" Background Tree: --------------------"<<endl;
546 cout <<
"--------------------"<<endl;
550 cout <<
"void ReconstructShowers_N3() N3_TMLP_ANN->GetStructure() " <<
N3_TMLP_ANN->GetStructure() << endl;
556 cout <<
" ------------------------------------------------------------" << endl;
557 cout <<
" NOW TRAIN THE NETWORK .... " << endl;
559 cout <<
" NOW TRAIN THE NETWORK .... done." << endl;
560 cout <<
" Dump Weights into the file .... " << endl;
563 cout <<
" Dump Weights into the file done. " << endl;
566 cout <<
" Use TMLPAnalyzer to see what it looks for " << endl;
571 ana->GatherInformations();
582 ana->DrawNetwork(0,
"N3_Type==1",
"N3_Type==0");
585 cout <<
" Use TMLPAnalyzer to see what it looks for... done." << endl;
586 cout <<
" ------------------------------------------------------------" << endl;
587 cout <<
" NOW WRITE FILES to THE ROOT FILES .... " << endl;
601 N3_ALG_ANN_TrainingsFile->Close();
602 cout <<
" NOW WRITE FILES to THE ROOT FILES .... done. " << endl;
606 Log(2,
"ShowRec.cpp",
"--- void ReconstructShowers_N3() done.");
void N3_Dump_ALG_MLP_weights(TMultiLayerPerceptron *mlp, Int_t parasetnr)
Definition: ShowRec_Alg_N3.cpp:696
void N3_FindBestCompliments(EdbSegP *seg, EdbPattern *TestPattern, EdbPVRec *local_gAli, Int_t Downstream, Float_t &mindeltaZ, Float_t &mindT, Float_t &mindR, Float_t &mindMinDist, Int_t &nDifferentSegs)
Definition: ShowRec_Alg_N3.cpp:772
void N3_Create_ALG_MLP(TTree *simu, Int_t parasetnr)
Definition: ShowRec_Alg_N3.cpp:655
void N3_Load_ALG_MLP_weights(TMultiLayerPerceptron *mlp, Int_t parasetnr)
Definition: ShowRec_Alg_N3.cpp:682
Double_t N3_OutputValue
Definition: ShowRec_Alg_N3.h:15
Int_t N3_Type
Definition: ShowRec_Alg_N3.h:12
Double_t N3_ANN_OUTPUTTHRESHOLD
Definition: ShowRec_Alg_N3.h:24
Int_t N3_ANN_EQUALIZESGBG
Definition: ShowRec_Alg_N3.h:25
Int_t N3_ANN_PLATE_DELTANMAX
Definition: ShowRec_Alg_N3.h:20
Double_t N3_Inputvar[24]
Definition: ShowRec_Alg_N3.h:8
Int_t N3_ANN_NTRAINEPOCHS
Definition: ShowRec_Alg_N3.h:22
void CalcTrackDensity(EdbPattern *pat_interim, Float_t pat_interim_halfsize, Int_t &npat_int, Int_t &npat_total, Int_t &npatN)
Definition: ShowRec.cpp:8749
void TransferShowerObjectArrayIntoEntryOfTreebranchShowerTree(TTree *treebranchtree, TObjArray *segarray)
Definition: ShowRec.cpp:7940
EdbPVRec * TransformEdbPVRec(EdbPVRec *gAli, EdbSegP *InitiatorBT)
DEBUG OPENMP TEST!!!!!!!
Definition: ShowRec.cpp:6299
void CalcEffPurOfShower2(TObjArray *arr, Int_t &NBT, Int_t &NBTMC, Int_t &NBTallMC, Int_t &NBTeMC, Double_t &purall, Double_t &pure, Int_t NBT_Neff, Int_t NBTMC_Neff, Int_t NBTMCe_Neff)
Definition: ShowRec.cpp:7631
void PrintShowerObjectArray(TObjArray *segarray)
Definition: ShowRec.cpp:6967
void CalcEfficencyNumbers(EdbPattern *pat_interim, Int_t MCCheck, Int_t &NBT_Neff, Int_t &NBTMC_Neff, Int_t &NBTMCe_Neff)
Definition: ShowRec.cpp:8771
Int_t GLOBAL_INBTSHOWERNR
Definition: ShowRec.h:80
Double_t GLOBAL_trckdens
Definition: ShowRec.h:39
EdbPVRec * GLOBAL_gAli
Definition: ShowRec.h:73
Int_t cmd_OUTPUTLEVEL
Definition: ShowRec.h:33
Int_t GLOBAL_PARASETNR
Definition: ShowRec.h:79
Int_t GLOBAL_EvtBT_FlagArray[99999]
Definition: ShowRec.h:51
TObjArray * GLOBAL_ShowerSegArray
Definition: ShowRec.h:76
Int_t GLOBAL_InBT_MC
Definition: ShowRec.h:43
Double_t GLOBAL_EvtBT_EArray[99999]
Definition: ShowRec.h:52
Int_t GLOBAL_EvtBT_MCArray[99999]
Definition: ShowRec.h:51
TTree * TREE_ShowRecEff
Definition: ShowRec.h:62
Float_t shower_trackdensb
Definition: ShowRec.h:395
Int_t GLOBAL_InBT_Flag
Definition: ShowRec.h:43
Double_t GLOBAL_EvtBT_E
Definition: ShowRec.h:50
Double_t GLOBAL_InBT_TanTheta
Definition: ShowRec.h:44
Double_t GLOBAL_InBT_E
Definition: ShowRec.h:44
Double_t CUT_PARAMETER[10]
Definition: ShowRec.h:78
Int_t GLOBAL_EvtBT_MC
Definition: ShowRec.h:49
Int_t GLOBAL_InBTArrayEntries
Definition: ShowRec.h:75
Double_t GLOBAL_EvtBT_TanThetaArray[99999]
Definition: ShowRec.h:52
Double_t GLOBAL_EvtBT_TanTheta
Definition: ShowRec.h:50
TTree * TREE_ShowShower
Definition: ShowRec.h:68
Int_t GLOBAL_EvtBT_Flag
Definition: ShowRec.h:49
TObjArray * GLOBAL_InBTArray
Definition: ShowRec.h:74
Definition: EdbPVRec.h:148
Int_t Npatterns() const
Definition: EdbPattern.h:380
EdbPattern * GetPattern(int id) const
Definition: EdbPattern.cxx:1887
Float_t P() const
Definition: EdbSegP.h:149
Float_t Theta() const
Definition: EdbSegP.h:181
Int_t MCEvt() const
Definition: EdbSegP.h:142
Int_t Flag() const
Definition: EdbSegP.h:146
Int_t GetN() const
Definition: EdbPattern.h:65
Int_t cmd_ALN3DUMP
Definition: ShowRec.h:34
Double_t GetDistToAxis(EdbSegP *segAxis, EdbSegP *segTest)
Definition: ShowRecCalculatingFunctions.cpp:185
Int_t cmd_ALN3TRAIN
Definition: ShowRec.h:33
TCanvas * mlpa_canvas
Definition: testBGReduction_By_ANN.C:66