00001 void View_event(int i){
00002
00003 gSystem->Load("/home1/chefdevi/micromegasFrameWork/trunk/libMicro.so");
00004
00005
00006
00007
00008
00009
00010 TString path = "/home1/chefdevi/micromegasFrameWork/trunk/src/analyse/Gassiplex/Shower_profile/";
00011 TString fileName= "electron_2gev_6absorber.root";
00012
00013 TFile *f = new TFile(path+fileName);
00014 cout<<"reading File : "<<path<<fileName<<endl;
00015 TTree *tree;
00016 tree = (TTree*) f->Get("t1");cout<<"tree built\n";
00017 int nEvent = tree->GetEntries();
00018 MTEvent *evt = new MTEvent();
00019 TBranch *branch= tree->GetBranch("MTEvent");
00020 branch->SetAddress(&evt);
00021 cout <<"nEvent="<<nEvent<<endl;
00022 int NC = 672;
00023
00024
00025
00026
00027
00028
00029 TH2I * hxy1 = new TH2I("hxy1","",32,0,32,32,0,32);
00030 TH2I * hxy2 = new TH2I("hxy2","",32,0,32,32,0,32);
00031 TH2I * hxy3 = new TH2I("hxy3","",32,0,32,32,0,32);
00032 TH2I * hxy4 = new TH2I("hxy4","",32,0,32,32,0,32);
00033
00034
00035
00036
00037
00038
00039 int xpos1,ypos1,adc1,sum_adc1;
00040 int xpos2,ypos2,adc2,sum_adc2;
00041 int xpos3,ypos3,adc3,sum_adc3;
00042 int xpos4,ypos4,adc4,sum_adc4;
00043
00044 vector <int> vxpos1,vypos1,vadc1;
00045 vector <int> vxpos2,vypos2,vadc2;
00046 vector <int> vxpos3,vypos3,vadc3;
00047 vector <int> vxpos4,vypos4,vadc4;
00048
00049 float avgx[3],avgy[3];
00050 float posz1 = 6;
00051 float posz2 = 13;
00052 float posz3 = 19;
00053 float posz4 = 98;
00054 float avgz[3] = {posz1,posz2,posz3};
00055 float avgx1=0,avgx2=0,avgx3=0,avgx4=0;
00056 float avgy1=0,avgy2=0,avgy3=0,avgy4=0;
00057
00058 int threshold = 35;
00059 float nhit1=0,nhit2=0,nhit3=0,nhit4=0;
00060 int nclean = 0;
00061 bool clean = 0;
00062
00063 int event = 0;
00064 int crap_event = 0;
00065
00066 float x0 = 6.89;
00067 float y0 = 16.48;
00068 float deltax = 0,deltay = 0,radial = 0;
00069
00070
00071
00072
00073
00074
00075 cout<<"Event # "<<i<<endl;
00076
00077 tree->GetEntry(i);
00078 NC = evt->GetNchannel();
00079 if (NC != 672){cout<<"Crap event"<<endl;}
00080
00081 clean=0;
00082 nhit1=0,nhit2=0,nhit3=0,nhit4=0;
00083 sum_adc1=0;sum_adc2=0;sum_adc3=0;sum_adc4=0;
00084
00085
00086
00087
00088
00089 for(int j=0;j<96;j++){
00090
00091 MTChannel* channel = (MTChannel*)evt->GetChannels()->UncheckedAt(j);
00092 xpos1 = channel->GetX();
00093 ypos1 = channel->GetY();
00094 adc1 = channel->GetValue();
00095
00096 if (adc1>=threshold){
00097
00098 cout<<" x1="<<xpos1<<" y1="<<ypos1<<" adc1="<<adc1<<endl;
00099 nhit1++;
00100 hxy1->SetBinContent(xpos1+1,ypos1+1,adc1);}}
00101
00102
00103
00104
00105 for(int j=0+96;j<96+96;j++){
00106
00107 MTChannel* channel = (MTChannel*)evt->GetChannels()->UncheckedAt(j);
00108 xpos2 = channel->GetX();
00109 ypos2 = channel->GetY();
00110 adc2 = channel->GetValue();
00111
00112 if (adc2>=threshold){
00113
00114 cout<<" x2="<<xpos2<<" y2="<<ypos2<<" adc2="<<adc2<<endl;
00115 nhit2++;
00116 hxy2->SetBinContent(xpos2+1,ypos2+1,adc2);}}
00117
00118
00119
00120
00121 for(int j=0+96+96;j<96+96+96;j++){
00122
00123 MTChannel* channel = (MTChannel*)evt->GetChannels()->UncheckedAt(j);
00124 xpos3 = channel->GetX();
00125 ypos3 = channel->GetY();
00126 adc3 = channel->GetValue();
00127
00128 if (adc3>=threshold){
00129
00130 cout<<" x3="<<xpos3<<" y3="<<ypos3<<" adc3="<<adc3<<endl;
00131 nhit3++;
00132 hxy3->SetBinContent(xpos3+1,ypos3+1,adc3);}}
00133
00134
00135
00136
00137
00138 for(int j=287;j<672;j++){
00139 MTChannel* channel = (MTChannel*)evt->GetChannels()->UncheckedAt(j);
00140 xpos4 = channel->GetX();
00141 ypos4 = channel->GetY();
00142 adc4 = channel->GetValue();
00143
00144 if (adc4>=threshold){
00145
00146 cout<<" x4="<<xpos4<<" y4="<<ypos4<<" adc4="<<adc4<<endl;
00147 nhit4++;
00148 hxy4->SetBinContent(xpos4+1,ypos4+1,adc4);}}
00149
00150
00151 cout<<nhit1<<" "<<nhit2<<" "<<nhit3<<" "<<nhit4<<endl;
00152
00153
00154
00155
00156
00157
00158 TCanvas * myc3 = new TCanvas("myc3");
00159 myc3->Divide(2,2);
00160 myc3->cd(1);
00161 hxy1->Draw("zcol");
00162 myc3->cd(2);
00163 hxy2->Draw("zcol");
00164 myc3->cd(3);
00165 hxy3->Draw("zcol");
00166 myc3->cd(4);
00167 hxy4->Draw("zcol");
00168
00169 }