FEDRA emulsion software from the OPERA Collaboration
shower_btr.C File Reference
#include "TMultiLayerPerceptron.h"
Include dependency graph for shower_btr.C:

Namespaces

namespace  SHOWER_PAR
 

Functions

void shower_btr ()
 

Function Documentation

◆ shower_btr()

void shower_btr ( )
28{
29 using namespace SHOWER_PAR;
30
31 EdbShowerRec shower;
32
33 char fname[128];
34 char nme[64];
35 float a11, a12, a21, a22, bb1, bb2;
36 float Zoff;
37
38 double x0[10000];
39 double y0[10000];
40 double z0[10000];
41 double tx0[10000];
42 double ty0[10000];
43 double chi20[10000];
44 double P0[10000];
45 int W0[10000];
46 int Flag0[10000];
47 int MCid[10000];
48 int TRid[10000];
49 double Esim[10000];
50 int id[10000];
51 int Pid[10000];
52 int Ncand=0;
53 int trid(0), nseg, n0;
54
55 //SELECTION of the FIRST BASETRACK FOR THE SHOWER RECONSTRUCTION
56 //
57 // Here as an exemple we select BT from the first plate of the brick "data/01_001.cp.root"
58 //
59 // this part can be modified as you want
60
61 sprintf(fname,"data/01_001.cp.root");
62
63 file1 = new TFile(fname ,"READ");
64
65 sprintf(nme,"par/01_001.par"); // READ AFFINE TRANSFORMATION
66 shower.ReadAffAndZ(nme,&Zoff,&a11,&a12,&a21,&a22,&bb1,&bb2 );
67
68// Get the values for shower reconstruction from cp file
69 TTree *tree = (TTree*)file1->Get("couples");
70 EdbSegP *s = 0;
72
73 s = new EdbSegP();
74 tree->SetBranchAddress("s.", &s);
75 tree->SetBranchAddress("cp", &cp);
76 int nentries = int(tree->GetEntries());
77
78 for(int i=0;i<nentries;i++){
79 tree->GetEntry(i);
80 //================================================================
81 // CUTS for the first basetrack selection to fill the x0, y0, z0, tx0, ty0
82 // here you can add the cuts you want
83 // if((fabs(s->TX()-0.15)>0.02&&fabs(s->TY()-0.15)>0.02)) continue;
84 // if((fabs(s->TX())>0.05&&fabs(s->TY())>0.05)) continue;
85 if (s->MCEvt()!=1)continue;
86 //if (s->MCEvt()==-999)continue;
87 //if((fabs(s->TX())>0.1||fabs(s->TY())>0.1)) continue;
88 //if(s->W()<25) continue;
89 //if(s->Z()<24000) continue;
90 //filling
91
92 if (DATA==1)
93 {
94 x0[Ncand] = a11*s->X() + a12*s->Y() + bb1;
95 y0[Ncand] = a21*s->X() + a22*s->Y() + bb2;
96 z0[Ncand] = Zoff;
97 tx0[Ncand] = a11*s->TX()+ a12*s->TY() ;
98 ty0[Ncand] = a21*s->TX()+ a22*s->TY();
99 TRid[Ncand] = s->MCEvt(); //this has to be a positive number
100 Esim[Ncand] = s->P();
101 id[Ncand] = s->ID();
102 Pid[Ncand] = Zoff/1290+1;
103 //cout <<s->X()<<" "<<s->Y()<<" "<<Zoff<<" "<<s->TX()<<" "<<s->TY()<<" "<<s->W()<<" "<<Ncand <<endl;
104 }
105 else
106 {
107 x0[Ncand] = s->X();
108 y0[Ncand] = s->Y();
109 z0[Ncand] = Zoff;
110 tx0[Ncand] = s->TX();
111 ty0[Ncand] = s->TY();
112 chi20[Ncand] = s->Chi2();
113 W0[Ncand] = s->W();
114 P0[Ncand] = s->P();
115 Flag0[Ncand] = s->Flag();
116 TRid[Ncand] = s->MCEvt();//this has to be a positive number
117 Esim[Ncand] = s->P();
118 id[Ncand] = s->ID();
119 Pid[Ncand] = Zoff/1290+1;
120 //cout <<s->X()<<" "<<s->Y()<<" "<<Zoff<<" "<<s->TX()<<" "<<s->TY()<<" "<<s->W()<<" "<<Ncand <<endl;
121 }
122 Ncand++;
123 }
124 printf("Ncand: %f\n",Ncand);
125 file1->Close();
126
127 /* --- Depreciated
128 // Here call of the shower algorithm using x0,y0,z0,tx0,ty0,Pid,id,TRid,Esim as seed
129 // The results will be put in Shower.root file
130 shower.rec(PLATE,MAXPLATE,0,Ncand,x0,y0,z0,tx0,ty0,Pid,id,TRid,Esim,piece2,piece2par,DOWN);
131 */
132
133 // Here call of the shower algorithm using x0,y0,z0,tx0,ty0,chi20,W0,P0,Flag0,Pid,id,TRid,Esim as seed
134 // chi20,W0,P0,Flag0 are not necessary but if not given first segment in shower will not have these values!
135 shower.rec(num,MAXPLATE,DATA,Ncand,x0,y0,z0,tx0,ty0,chi20,W0,P0,Flag0,Pid,id,TRid,Esim,piece2,piece2par,UPDOWN);
136
137
138}
brick z0
Definition: RecDispMC.C:106
Definition: EdbSegCouple.h:17
Definition: EdbSegP.h:21
Definition: EdbShowerRec.h:25
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
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
int nentries
Definition: check_shower.C:40
s
Definition: check_shower.C:55
EdbSegCouple * cp
Definition: tlg2couples.C:28
const char * fname
Definition: mc2raw.cxx:41
Definition: shower_btr.C:15
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