//=================================================================== //== EXPERIMENT A-2 //== VERSION: 24.11.2017 //=================================================================== #include "TNeProc.h" #include #include #include #include #include "Riostream.h" using std::cout; using std::endl; #include "TH1.h" #include "TH2.h" #include "TROOT.h" #include "TCutG.h" #include "TGo4WinCond.h" #include "TGo4PolyCond.h" #include "TGo4CondArray.h" #include "TGo4Picture.h" #include "TGo4MbsEvent.h" #include "snprintf.h" #include "TNeEvent.h" #include "TNeDet16.h" #include "TNeAnalysis.h" #include "TRandom.h" #include "TNeMParms.h" //#include "TNeSel.h" long TNeProc::bit[32] = {0x00000001, 0x00000002, 0x00000004, 0x00000008 ,0x00000010, 0x00000020, 0x00000040, 0x00000080 ,0x00000100, 0x00000200, 0x00000400, 0x00000800 ,0x00001000, 0x00002000, 0x00004000, 0x00008000 ,0x00010000, 0x00020000, 0x00040000, 0x00080000 ,0x00100000, 0x00200000, 0x00400000, 0x00800000 ,0x01000000, 0x02000000, 0x04000000, 0x08000000 ,0x10000000, 0x20000000, 0x40000000, 0x80000000}; TNeProc::TNeProc() : TGo4EventProcessor() { int i; cout << "**** TNeProc: Create instance " << endl; fTrigger = NULL; fSubEvents = NULL; fEventsSizes = NULL; for(i = 0; i < 4; ++i) { d1F3[i] = NULL; d1tF3[i] = NULL; d1F5[i] = NULL; d1tF5[i] = NULL; d1F6[i] = NULL; d1tF6[i] = NULL; d1tMWPC[i] = NULL; } d1ESQX_L = NULL; d1ESQX_R = NULL; // for(i = 0; i < 16; ++i) { d1CsI_L[i] = NULL; d1tCsI_L[i] = NULL; d1CsI_R[i] = NULL; d1tCsI_R[i] = NULL; d1SQ20[i] = NULL; d1tSQ20[i] = NULL; d1SQY_L[i] = NULL; d1tSQY_L[i] = NULL; d1SQY_R[i] = NULL; d1tSQY_R[i] = NULL; d1ANR[i] = NULL; d1ANS[i] = NULL; d2dE_E_L[i] = NULL; d2dE_E_R[i] = NULL; d2dE_E_L_c[i] = NULL; d2dE_E_R_c[i] = NULL; } // for(i = 0; i < 32; ++i) { d1SQX_L[i] = NULL; d1tSQX_L[i] = NULL; d1SQX_R[i] = NULL; d1tSQX_R[i] = NULL; d1neutAmp[i] = NULL; d1neutTAC[i] = NULL; d1neutTDC[i] = NULL; d2Ngamma[i] = NULL; } d2tF3aF3_L = NULL; d2tF3aF3_R = NULL; d2tF3aF3_U = NULL; d2tF3aF3_D = NULL; d1ToF = NULL; d1ToF = NULL; d1aF3 = NULL; d2ToFaF3 = NULL; } //------------------------------------------------------------------- TNeProc::~TNeProc() { cout << "**** TNeProc: Delete instance " << endl; } //------------------------------------------------------------------- TNeProc::TNeProc(const char* name) : TGo4EventProcessor(name) { cout << "**** TNeProc: Create instance " << name << endl; fTrigger = MakeTH1('I', "Trigger", "Values of trigger", 16, 0., 15.); fSubEvents = MakeTH1('I', "SubEvents", "Number of subevents", 16, 0., 15.); fEventsSizes = MakeTH1('I', "EventSizes", "Size of each event", 1024, 0., 1023.); int i; for (i = 0; i < 16; ++i) { d1CsI_L[i] = MakeTH1('I', Form("Left_telescope/CsI_L/raw/CsI_L_%2.2d",i) , Form("CsI left raw %2.2d",i), 8192, 0., 8191.); d1tCsI_L[i] = MakeTH1('I', Form("Left_telescope/CsI_L/tdc/tCsI_L_%2.2d",i) , Form("CsI left tdc %2.2d",i), 4096, 0., 4095.); d1CsI_R[i] = MakeTH1('I', Form("Right_telescope/CsI_R/raw/CsI_R_%2.2d",i) , Form("CsI right CH %2.2d",i), 8192, 0., 8191.); d1tCsI_R[i] = MakeTH1('I', Form("Right_telescope/CsI_R/tdc/tCsI_R_%2.2d",i) , Form("CsI right tdc %2.2d",i), 4096, 0., 4095.); d1SQY_L[i] = MakeTH1('I', Form("Left_telescope/SQY_L/raw/SQY_L_%2.2d",i) , Form("Square left DSSD Y stripes CH %2.2d",i), 4096, 0., 4095.); d1tSQY_L[i] = MakeTH1('I', Form("Left_telescope/SQY_L/tdc/tSQY_L_%2.2d",i) , Form("Square left DSSD Y tdc %2.2d",i), 4096, 0., 4095.); d1SQ20[i] = MakeTH1('I', Form("Left_telescope/SQ20/raw/SQ20_%2.2d",i) , Form("Square left 20mkm X stripes CH %2.2d",i), 4096, 0., 4095.); d1tSQ20[i] = MakeTH1('I', Form("Left_telescope/SQ20/tdc/tSQ20_%2.2d",i) , Form("Square left 20mkm X tdc %2.2d",i), 4096, 0., 4095.); d1SQY_R[i] = MakeTH1('I', Form("Right_telescope/SQY_R/raw/SQY_R_%2.2d",i) , Form("Square right DSSD Y stripes CH %2.2d",i), 4096, 0., 4095.); d1tSQY_R[i] = MakeTH1('I', Form("Right_telescope/SQY_R/tdc/tSQY_R_%2.2d",i) , Form("Square right DSSD Y tdc %2.2d",i), 4096, 0., 4095.); d1ANR[i] = MakeTH1('I', Form("Annular_telescope/ANR/ANR_%2.2d",i) , Form("Annular DSSD rings side CH %2.2d",i), 4096, 0., 4095.); d1ANS[i] = MakeTH1('I', Form("Annular_telescope/ANS/ANS_%2.2d",i) , Form("Annular DSSD sectors side CH %2.2d",i), 4096, 0., 4095.); } // d1ESQX_L = MakeTH1('D', "2D/ESQX_L", " energy (MeV)", 1000,0,80,"ESQX_L"); d1ESQX_R = MakeTH1('D', "2D/ESQX_R", " energy (MeV)", 1000,0,80,"ESQX_R"); // d2SQXSQY_L_D = MakeTH2('I', "2D/SQXSQY_L_D", "SQX_L vs SQY_L", 32,0,32,16,0,16,"SQX_L","SQY_L"); d1nSQY_L = MakeTH1('I', "2D/nSQY_L", "number of strip SQY_L", 16,0,16,"SQY_L"); d1nSQ20 = MakeTH1('I', "2D/nSQ20", "number of strip SQ20", 16,0,16,"SQ20"); d1nSQX_L = MakeTH1('I', "2D/nSQX_L", "number of strip SQX_L", 32,0,32,"SQX_L"); d1mSQY_L = MakeTH1('I', "2D/mSQY_L", "mult of strip SQY_L", 16,0,16,"mSQY_L"); d1mSQX_L = MakeTH1('I', "2D/mSQX_L", "mult of strip SQX_L", 32,0,32,"mSQX_L"); d2SQXSQY_R_D = MakeTH2('I', "2D/SQXSQY_R_D", "SQX_R vs SQY_R", 32,0,32,16,0,16,"SQX_R","SQY_R"); d1nSQY_R = MakeTH1('I', "2D/nSQY_R", "number of strip SQY_R", 16,0,16,"SQY_R"); d1nSQX_R = MakeTH1('I', "2D/nSQX_R", "number of strip SQX_R", 32,0,32,"SQX_R"); d1mSQY_R = MakeTH1('I', "2D/mSQY_R", "mult of strip SQY_R", 16,0,16,"mSQY_R"); d1mSQX_R = MakeTH1('I', "2D/mSQX_R", "mult of strip SQX_R", 32,0,32,"mSQX_R"); // for (i = 0; i < 32; ++i) { d1SQX_L[i] = MakeTH1('I', Form("Left_telescope/SQX_L/raw/SQX_L_%2.2d",i) , Form("Square left DSSD X stripes CH %2.2d",i), 4096, 0., 4095.); d1tSQX_L[i] = MakeTH1('I', Form("Left_telescope/SQX_L/tdc/tSQX_L_%2.2d",i) , Form("Square left DSSD X tdc %2.2d",i), 4096, 0., 4095.); d1SQX_R[i] = MakeTH1('I', Form("Right_telescope/SQX_R/raw/SQX_R_%2.2d",i) , Form("Square right DSSD X stripes CH %2.2d",i), 4096, 0., 4095.); d1tSQX_R[i] = MakeTH1('I', Form("Right_telescope/SQX_R/tdc/tSQX_R_%2.2d",i) , Form("Square right DSSD X tdc %2.2d",i), 4096, 0., 4095.); d1neutAmp[i] = MakeTH1('I', Form("Neutrons/Amp/Amp_%2.2d",i) , Form("Neutrons Amp CH %2.2d",i), 4096, 0., 4095.); d1neutTAC[i] = MakeTH1('I', Form("Neutrons/TAC/TAC_%2.2d",i) , Form("Neutrons TAC CH %2.2d",i), 4096, 0., 4095.); d1neutTDC[i] = MakeTH1('I', Form("Neutrons/time/time_%2.2d",i) , Form("Neutrons time CH %2.2d",i), 4999, 0., 5000.); d2Ngamma[i] = MakeTH2('I', Form("Neutrons/Ng/Ng_%2.2d",i) , Form("N gamma %2.2d",i), 400, 0., 4095., 400, 0., 4095.,"Amp","TAC"); } // d1F3[0] = MakeTH1('I',"F3/QDC/F3_QDC_L","F3 QDC left", 4096, 0., 4095.); d1F3[1] = MakeTH1('I',"F3/QDC/F3_QDC_R","F3 QDC right", 4096, 0., 4095.); d1F3[2] = MakeTH1('I',"F3/QDC/F3_QDC_U","F3 QDC up", 4096, 0., 4095.); d1F3[3] = MakeTH1('I',"F3/QDC/F3_QDC_D","F3 QDC down", 4096, 0., 4095.); d1tF3[0] = MakeTH1('I',"F3/TDC/tF3_TDC_L","F3 TDC left", 6400, 0., 6399.); d1tF3[1] = MakeTH1('I',"F3/TDC/tF3_TDC_R","F3 TDC right", 6400, 0., 6399.); d1tF3[2] = MakeTH1('I',"F3/TDC/tF3_TDC_U","F3 TDC up", 6400, 0., 6399.); d1tF3[3] = MakeTH1('I',"F3/TDC/tF3_TDC_D","F3 TDC down", 6400, 0., 6399.); // d1F5[0] = MakeTH1('I',"F5/QDC/F5_QDC_L","F5 QDC left", 4096, 0., 4095.); d1F5[1] = MakeTH1('I',"F5/QDC/F5_QDC_R","F5 QDC right", 4096, 0., 4095.); d1F5[2] = MakeTH1('I',"F5/QDC/F5_QDC_U","F5 QDC up", 4096, 0., 4095.); d1F5[3] = MakeTH1('I',"F5/QDC/F5_QDC_D","F5 QDC down", 4096, 0., 4095.); d1tF5[0] = MakeTH1('I',"F5/TDC/tF5_TDC_L","F5 TDC left", 6400, 0., 6399.); d1tF5[1] = MakeTH1('I',"F5/TDC/tF5_TDC_R","F5 TDC right", 6400, 0., 6399.); d1tF5[2] = MakeTH1('I',"F5/TDC/tF5_TDC_U","F5 TDC up", 6400, 0., 6399.); d1tF5[3] = MakeTH1('I',"F5/TDC/tF5_TDC_D","F5 TDC down", 6400, 0., 6399.); // d1F6[0] = MakeTH1('I',"F6/QDC/F6_QDC_L","F6 QDC left", 4096, 0., 4095.); d1F6[1] = MakeTH1('I',"F6/QDC/F6_QDC_R","F6 QDC right", 4096, 0., 4095.); d1F6[2] = MakeTH1('I',"F6/QDC/F6_QDC_U","F6 QDC up", 4096, 0., 4095.); d1F6[3] = MakeTH1('I',"F6/QDC/F6_QDC_D","F6 QDC down", 4096, 0., 4095.); d1tF6[0] = MakeTH1('I',"F6/TDC/tF6_TDC_L","F6 TDC left", 6400, 0., 6399.); d1tF6[1] = MakeTH1('I',"F6/TDC/tF6_TDC_R","F6 TDC right", 6400, 0., 6399.); d1tF6[2] = MakeTH1('I',"F6/TDC/tF6_TDC_U","F6 TDC up", 6400, 0., 6399.); d1tF6[3] = MakeTH1('I',"F6/TDC/tF6_TDC_D","F6 TDC down", 6400, 0., 6399.); d1tMWPC[0] = MakeTH1('I',"tMWPC/tX1","MWPC TDC X1", 6400, 0., 6399.); d1tMWPC[1] = MakeTH1('I',"tMWPC/tY1","MWPC TDC Y1", 6400, 0., 6399.); d1tMWPC[2] = MakeTH1('I',"tMWPC/tX2","MWPC TDC X2", 6400, 0., 6399.); d1tMWPC[3] = MakeTH1('I',"tMWPC/tY2","MWPC TDC Y2", 6400, 0., 6399.); // d1ToF = MakeTH1('D', "ToF/ToF", " time of flight (ns)", 2000,-10.,190.,"ToF"); d1aF3 = MakeTH1('D', "ToF/aF3", " amp of F3", 4000,0.,4000.,"amp f3"); d2ToFaF3 = MakeTH2('D', "ToF/ToFaF3", "ToF vs aF3", 400,40.,190.,400,0.,4000.,"ToF","aF3"); d1aF5 = MakeTH1('D', "ToF/aF5", " amp of F3", 4000,0.,400.,"amp f3"); d2ToFaF5 = MakeTH2('D', "ToF/ToFaF5", "ToF vs aF5", 400,40.,190.,400,0.,4000.,"ToF","aF5"); d2tF3aF3_L = MakeTH2('I', "2D/tF3aF3_L", "tdcF3 left vs qdcF3 left", 200,0.,4000.,200,0.,4000.,"tdc","qdc"); d2tF3aF3_R = MakeTH2('I', "2D/tF3aF3_R", "tdcF3 right vs qdcF3 right", 200,0.,4000.,200,0.,4000.,"tdc","qdc"); d2tF3aF3_U = MakeTH2('I', "2D/tF3aF3_U", "tdcF3 up vs qdcF3 up", 200,0.,4000.,200,0.,4000.,"tdc","qdc"); d2tF3aF3_D = MakeTH2('I', "2D/tF3aF3_D", "tdcF3 down vs qdcF3 down", 200,0.,4000.,200,0.,4000.,"tdc","qdc"); d2SQ20_SQY_L = MakeTH2('D', "2D/dE_E/Left/20um_1mm", "20um vs 1mm" , 400,0.,100.,400,0.0,20.,"SQY_L","Si_20um"); //CALIBRATED for (i = 0; i < 16; ++i) { d1SQY_L_C[i] = MakeTH1('D', Form("Left_telescope/SQY_L_C/SQY_L_C_%2.2d",i) , Form("Square left DSSD Y CALIBRATED stripes CH %2.2d",i), 4000, 0., 100.); d1SQ20_C[i] = MakeTH1('D', Form("Left_telescope/SQ20_C/SQ20_C_%2.2d",i) , Form("Square left 20mkm Y CALIBRATED stripes CH %2.2d",i), 4000, 0., 100.); d1SQY_R_C[i] = MakeTH1('D', Form("Right_telescope/SQY_R_C/SQY_R_C_%2.2d",i) , Form("Square right DSSD Y CALIBRATED stripes CH %2.2d",i), 4000, 0., 100.); d1ANR_C[i] = MakeTH1('D', Form("Annular_telescope/ANR/ANR_C_%2.2d",i) , Form("Annular DSSD CALIBRATED rings side CH %2.2d",i), 2000, 0., 50.); d1ANS_C[i] = MakeTH1('D', Form("Annular_telescope/ANS/ANS_C_%2.2d",i) , Form("Annular DSSD CALIBRATED sectors side CH %2.2d",i), 2000, 0., 50.); d1CsI_L_C[i] = MakeTH1('D', Form("Left_telescope/CsI_L_C/CsI_L_C_%2.2d",i) , Form("Square LEFT CsI CALIBRATED crystal CH %2.2d",i), 8000, 0., 240.); d1CsI_R_C[i] = MakeTH1('D', Form("Right_telescope/CsI_R_C/CsI_R_C_%2.2d",i) , Form("Square RIGHT CsI CALIBRATED crystal CH %2.2d",i), 8000, 0., 240.); d2dE_E_L[i] = MakeTH2('D', Form("2D/dE_E/Left/Left_%2.2d",i), Form("dE_L vs E_L %2.2d",i), 400,0,240.,400,0.0,100.,"CsI_L","Silicon_L"); d2dE_E_R[i] = MakeTH2('D', Form("2D/dE_E/Right/Right_%2.2d",i), Form("dE_R vs E_R %2.2d",i), 400,0,240.,400,0.0,100.,"CsI_R","Silicon_R"); d2dE_E_L_c[i] = MakeTH2('D', Form("2D/dE_E/Left_c/Left_c_%2.2d",i), Form("dE_L vs E_L trig %2.2d",i), 400,0,240.,400,0.0,100.,"CsI_L","Silicon_L"); d2dE_E_R_c[i] = MakeTH2('D', Form("2D/dE_E/Right_c/Right_c_%2.2d",i), Form("dE_R vs E_R trig %2.2d",i), 400,0,240.,400,0.0,100.,"CsI_R","Silicon_R"); } for (i = 0; i < 32; ++i) { d1SQX_L_C[i] = MakeTH1('D', Form("Left_telescope/SQX_L_C/SQX_L_C_%2.2d",i) , Form("Square left DSSD X CALIBRATED stripes CH %2.2d",i), 4000, 0., 100.); d1SQX_R_C[i] = MakeTH1('D', Form("Right_telescope/SQX_R_C/SQX_R_C_%2.2d",i) , Form("Square right DSSD X CALIBRATED stripes CH %2.2d",i), 4000, 0., 100.); } //MWPC d1X1 = MakeTH1('I', "WIRES/X1","WIRES X1",32,0.,32.); d1Y1 = MakeTH1('I', "WIRES/Y1","WIRES Y1",32,0.,32.); d1X2 = MakeTH1('I', "WIRES/X2","WIRES X2",32,0.,32.); d1Y2 = MakeTH1('I', "WIRES/Y2","WIRES Y2",32,0.,32.); d1NX1 = MakeTH1('I', "WIRES/NX1","WIRES X1",32,0.,32.); d1NY1 = MakeTH1('I', "WIRES/NY1","WIRES Y1",32,0.,32.); d1NX2 = MakeTH1('I', "WIRES/NX2","WIRES X2",32,0.,32.); d1NY2 = MakeTH1('I', "WIRES/NY2","WIRES Y2",32,0.,32.); d2XY1 = MakeTH2('I', "WIRES/XY1", "WIRES 1 Y1 vs X1", 32,0.,32.,32,0.,32.,"X1","Y1"); d2XY2 = MakeTH2('I', "WIRES/XY2", "WIRES 2 Y2 vs X2", 32,0.,32.,32,0.,32.,"X2","Y2"); d1CX1 = MakeTH1('I', "WIRES/CX1","CLASTERS X1",32,0.,32.); d1CY1 = MakeTH1('I', "WIRES/CY1","CLASTERS Y1",32,0.,32.); d1CX2 = MakeTH1('I', "WIRES/CX2","CLASTERS X2",32,0.,32.); d1CY2 = MakeTH1('I', "WIRES/CY2","CLASTERS Y2",32,0.,32.); //------------------------------------------------------------ cout << "**** TNeProc: Pictures" << endl; dx1=0.25; dx2=-0.05; dy1=-0.3; dy2=-0.15; dtx=0; dty=0; pxa0 = -95.; pxa1 = -90.; pxa2 = -30.; pxa3 = 0.; pxa4 = 5.; pya1 = 4.; pya2 = 4.; pya3 = 2.2; ntrackx = 100; ntracky = 100; fLWAX1 = new TLine(pxa1, -0.5*pya1+dx1, pxa1, 0.5*pya1+dx1); fLWAX2 = new TLine(pxa2, -0.5*pya2+dx2, pxa2, 0.5*pya2+dx2); fLWAX3 = new TLine(pxa3, -0.5*pya3+dtx, pxa3, 0.5*pya3+dtx); fLWAX1->SetLineWidth(5); fLWAX2->SetLineWidth(5); fLWAX3->SetLineWidth(5); fTracksX = new TGraph(ntrackx*3); fTracksX->SetName("Tracks X"); for(i = 0; i < fTracksX->GetN(); ++i) fTracksX->SetPoint(i,pxa1,0.); fTracksX->SetLineColor(3); AddObject(fTracksX); fPTrackX = new TGo4Picture("PTrackX","Tracking X wires"); fPTrackX->AddGraph(fTracksX,"AL"); fPTrackX->AddSpecialObject(fLWAX1,"SAME"); fPTrackX->AddSpecialObject(fLWAX2,"SAME"); fPTrackX->AddSpecialObject(fLWAX3,"SAME"); fPTrackX->SetAutoScale(false); fPTrackX->SetRangeX(pxa0,pxa4); fPTrackX->SetRangeY(-0.5*(pya1+1.),0.5*(pya1+1.)); fPTrackX->SetLegendDraw(false); fPTrackX->SetHisStats(false); AddPicture(fPTrackX); itrackAX = 0; pxb0 = -95.; pxb1 = -90.; pxb2 = -30.; pxb3 = 0.; pxb4 = 5.; pyb1 = 4.; pyb2 = 4.; pyb3 = 2.; fLWBX1 = new TLine(pxb1, -0.5*pyb1+dy1, pxb1, 0.5*pyb1+dy1); fLWBX2 = new TLine(pxb2, -0.5*pyb2+dy2, pxb2, 0.5*pyb2+dy2); fLWBX3 = new TLine(pxb3, -0.5*pyb3+dty, pxb3, 0.5*pyb3+dty); fLWBX1->SetLineWidth(5); fLWBX2->SetLineWidth(5); fLWBX3->SetLineWidth(5); fTracksY = new TGraph(ntracky*3); fTracksY->SetName("Tracks Y"); for(i = 0; i < fTracksY->GetN(); ++i) fTracksY->SetPoint(i,pxb1,0.); fTracksY->SetLineColor(3); AddObject(fTracksY); fPTrackY = new TGo4Picture("PTrackY","Tracking Y wires"); fPTrackY->AddGraph(fTracksY,"AL"); fPTrackY->AddSpecialObject(fLWBX1,"SAME"); fPTrackY->AddSpecialObject(fLWBX2,"SAME"); fPTrackY->AddSpecialObject(fLWBX3,"SAME"); fPTrackY->SetAutoScale(false); fPTrackY->SetRangeX(pxb0,pxb4); fPTrackY->SetRangeY(-0.5*(pyb1+1.),0.5*(pyb1+1.)); fPTrackY->SetLegendDraw(false); fPTrackY->SetHisStats(false); AddPicture(fPTrackY); itrackBX = 0; }//------------------------------------------------------------ Bool_t TNeProc::BuildEvent(TGo4EventElement* target) { // called by framework from TNeEvent to fill it TGo4Analysis *go4 = TGo4Analysis::Instance(); TNeEvent* NeEvent = (TNeEvent*) target; TGo4MbsSubEvent* psubevt; TGo4MbsEvent* fInput = (TGo4MbsEvent* ) GetInputEvent(); if(fInput == 0) { cout << "AnlProc: no input event !"<< endl; return kFALSE; } bool dooutput = false; double value1, value2; double EsqxL,EsqyL,EsqxR,EsqyR,EanS,EanR, Esq20; int num = 0, sz = 0; int i, n, geo, typ, header,caen_header, module_id=0, crate=-1, cnt, chnl, evnt, trigger_mTDC, ch, iSQX_L, iSQY_L, iSQ20, nSQX_L, nSQY_L, nSQ20, iSQX_R, iSQY_R, nSQX_R, nSQY_R; int nCsI_L,nCsI_R; #include "idCsI_L.c" #include "idCsI_R.c" bool m_bool= false, c_bool = false; uint16_t MSB, LSB; uint32_t MSBLSB, adc; uint32_t *idata; double af3=0., af5=0., tf3=0., tf5=0., ToF=0.; fInput->ResetIterator(); while((psubevt = fInput->NextSubEvent()) != 0) { num++; sz += psubevt->GetIntLen(); idata = (uint32_t*) psubevt->GetDataField(); n = -1; while(++n < psubevt->GetIntLen()) { header = idata[n] >> 24; caen_header = header & 0x7; if (dooutput) printf("Raw data = %x\n", idata[n]); switch (psubevt->GetProcid()) { case 100: //VME_0, see setup.usf if (header==0x40) m_bool=true; //MESYTEC header flag else if (caen_header == 2) c_bool=true; //CAEN header flag else if ((idata[n]==0xaffeaffe) || (idata[n]== 0x06000000) || (idata[n]== 0x05000000)) { c_bool=false; m_bool=false; } if (m_bool) //in case of MESYTEC data { typ=idata[n] >> 30; switch(typ) { case 1: //MESYTEC header module_id = (idata[n] >> 16) & 0xff; if (dooutput) printf("Mesytec Module ID %d\n", module_id); break; case 0: //MESYTEC data if(idata[n] >> 24!=0x04) break; switch (module_id) { case 5: //mADC: SQX left chnl= (idata[n] >> 16)&0x1f; adc = idata[n] & 0xfff; //only 12 bits NeEvent->SQX_L[chnl] = adc; break; case 6: //MADC: SQX right chnl= (idata[n] >> 16)&0x1f; adc = idata[n] & 0xfff; //only 12 bits NeEvent->SQX_R[chnl] = adc; break; case 7: //mADC: SQY left and right chnl= (idata[n] >> 16)&0x1f; adc = idata[n] & 0xfff; //only 13 bits if(chnl<16) { NeEvent->SQY_L[chnl] = adc; } else { NeEvent->SQY_R[chnl-16] = adc; } break; case 8: //mADC: CsI left and right chnl= (idata[n] >> 16)&0x1f; adc = idata[n] & 0x1fff; //only 13 bits if(chnl<16) { NeEvent->CsI_L[chnl] = adc; } else { NeEvent->CsI_R[chnl-16] = adc; } break; case 9: //mADC: chnl= (idata[n] >> 16)&0x1f; adc = idata[n] & 0xfff; //only 13 bits if(chnl<16) { NeEvent->SQ20[chnl] = adc; } break; case 10: //mQDC: chnl= (idata[n] >> 16) & 0x1f; adc = idata[n] & 0xfff; //only 12 bits if(chnl<4) NeEvent->F3[chnl] = adc; else if(chnl<8) NeEvent->F5[chnl-4] = adc; else if(chnl<12) NeEvent->F6[chnl-8] = adc; break; case 11: //mTDC: if ((idata[n] >> 16) & 0x20) break; //T bit analysis chnl= (idata[n] >> 16) & 0x1f; adc = idata[n] & 0x1fff; //only 13 bits if(chnl<4) NeEvent->tF3[chnl] = adc; else if(chnl<8) NeEvent->tF5[chnl-4] = adc; else if(chnl<12) NeEvent->tF6[chnl-8] = adc; else if(chnl<16) NeEvent->tMWPC[chnl-12] = adc; break; case 12: //mTDC: if ((idata[n] >> 16) & 0x20) break; //T bit analysis chnl= (idata[n] >> 16) & 0x1f; adc = idata[n] & 0xfff; //only 12 bits if(chnl<16) NeEvent->tSQ20[chnl] = adc; break; } break; case 3: //MESYTEC footer m_bool=false; break; default: printf("ERROR !!!!!! Unknown MESYTEC typ %d\n", typ); printf("Data = %x\n", idata[n]); break; } } else if (c_bool) //in case of CAEN data { typ = (idata[n] >> 24) & 0x7; geo = idata[n] >> 27; if (dooutput) printf("CAEN geo %d\n", geo); switch(typ) { case 2: //CAEN header crate = (idata[n] >> 16) & 0xff; cnt = (idata[n] >> 8) & 0x1f; if (geo==30) NeEvent->mtime=idata[n++];//machine time if (dooutput) printf("Header: geo:%d crate:%d cnt = %d\n", geo, crate, cnt); break; case 0: //CAEN data adc = idata[n] & 0xfff; chnl = (idata[n] >> 16) & 0x1f; //printf("DATA: geo:%d Channel = %d\n", geo, chnl); switch(geo) { case 0: //scaler v560 //for(i = 0; i < 16; ++i) // NeEvent->scaler[i]=idata[n++]; break; case 1: //TDC NeEvent->tSQX_L[chnl] = adc; break; case 2: //TDC NeEvent->tSQX_R[chnl] = adc; break; case 3: // TDC tSQY left and right if(chnl<16) { NeEvent->tSQY_L[chnl] = adc; } else { NeEvent->tSQY_R[chnl-16] = adc; } break; case 4: // CsI left & right tdc's if(chnl<16) { NeEvent->tCsI_L[chnl] = adc; } else { NeEvent->tCsI_R[chnl-16] = adc; } break; } // printf(" Data: geo:%d chnl:%d adc:%d\n", geo, chnl, adc); break; case 4: //CAEN footer c_bool = false; evnt = idata[n] & 0xffffff; if (dooutput) printf(" Event: geo:%d number:%d\n", geo, evnt); break; case 6: //CAEN no valid data c_bool = false; if (dooutput) printf("!!!No valid data from CAEN!!!"); break; default: printf("ERROR !!!!!! Uncknown CAEN typ %d\n", typ); printf("Data = %x\n", idata[n]); break; } } break; //end of VME_0 case 101: // CAMAC through VME_0, see setup.usf geo = idata[n] >> 27; switch(geo) { case 20: NeEvent->nx1 = 0; adc = idata[++n]; LSB=adc; //printf("First word from MWPC X1= %x\n", adc); for(i = 0; i < 16; ++i) if((adc & bit[i]) > 0) NeEvent->x1[NeEvent->nx1++] = i; adc = idata[++n]; MSB=adc; MSBLSB= MSB << 16 | LSB; //printf("Second word from MWPC X1= %x\n", adc); for(i = 0; i < 16; ++i) if((adc & bit[i]) > 0) NeEvent->x1[NeEvent->nx1++] = i+16; adc = idata[++n];//pass throug footer //printf("Third word from MWPC X1= %x\n", adc); NeEvent->rx1=MSBLSB; break; case 21: NeEvent->ny1 = 0; adc = idata[++n]; LSB=adc; //printf("First word from MWPC Y1 = %x\n", adc); for(i = 0; i < 16; ++i) if((adc & bit[i]) > 0) NeEvent->y1[NeEvent->ny1++] = i; adc = idata[++n]; MSB=adc; MSBLSB= MSB << 16 | LSB; //printf("Second word from MWPC Y1 = %x\n", adc); for(i = 0; i < 16; ++i) if((adc & bit[i]) > 0) NeEvent->y1[NeEvent->ny1++] = i+16; adc = idata[++n];//pass through footer //printf("Third word from MWPC Y1 = %x\n", adc); NeEvent->ry1=MSBLSB; break; case 22: NeEvent->nx2 = 0; adc = idata[++n]; LSB=adc; //printf("First word from MWPC X2 = %x\n", adc); for(i = 0; i < 16; ++i) if((adc & bit[i]) > 0) NeEvent->x2[NeEvent->nx2++] = i; adc = idata[++n]; MSB=adc; MSBLSB= MSB << 16 | LSB; //printf("Second word from MWPC X2 = %x\n", adc); for(i = 0; i < 16; ++i) if((adc & bit[i]) > 0) NeEvent->x2[NeEvent->nx2++] = i+16; adc = idata[++n];//pass through footer //printf("Third word from MWPC X2 = %x\n", adc); NeEvent->rx2=MSBLSB; break; case 23: NeEvent->ny2 = 0; adc = idata[++n]; LSB=adc; //printf("First word from MWPC Y2 = %x\n", adc); for(i = 0; i < 16; ++i) if((adc & bit[i]) > 0) NeEvent->y2[NeEvent->ny2++] = i; adc = idata[++n]; MSB=adc; MSBLSB= MSB << 16 | LSB; //printf("Second word from MWPC Y2 = %x\n", adc); for(i = 0; i < 16; ++i) if((adc & bit[i]) > 0) NeEvent->y2[NeEvent->ny2++] = i+16; adc = idata[++n];//pass throug footer //printf("Third word from MWPC Y2 = %x\n", adc); NeEvent->rx2=MSBLSB; break; } break; // end of CAMAC case 200: // VME_1, see setup.usf if (header==0x40) m_bool=true; //MESYTEC header flag else if (caen_header == 2) c_bool=true; //CAEN header flag else if ((idata[n]==0xaffeaffe) || (idata[n]== 0x06000000) || (idata[n]== 0x05000000)) { c_bool=false; m_bool=false; } if (m_bool) //in case of MESYTEC data { typ=idata[n] >> 30; switch(typ) { case 1: //MESYTEC header module_id = (idata[n] >> 16) & 0xff; break; case 0: //MESYTEC data if(idata[n] >> 24!=0x04) break; switch (module_id) { case 2: //mADC: chnl= (idata[n] >> 16)&0x1f; adc = idata[n] & 0x1fff; //only 13 bits NeEvent->neutTDC[chnl] = adc; break; } break; case 3: //MESYTEC footer m_bool=false; break; default: printf("ERROR !!!!!! Uncknown MESYTEC typ %d\n", typ); printf("Data = %x\n", idata[n]); break; } } else if (c_bool) //in case of CAEN data { typ = (idata[n] >> 24) & 0x7; geo = idata[n] >> 27; switch(typ) { case 2: //CAEN header crate = (idata[n] >> 16) & 0xff; cnt = (idata[n] >> 8) & 0x1f; if (dooutput) printf("Header: geo:%d crate:%d cnt = %d\n", geo, crate, cnt); break; case 0: //CAEN data adc = idata[n] & 0xfff; chnl = (idata[n] >> 16) & 0x1f; switch(geo) { case 0: //ADC if (chnl%2==0){ ch = chnl/2; NeEvent->neutAmp[ch] = adc; } else { ch = chnl/2; NeEvent->neutTAC[ch] = adc; } break; case 1: //ADC if (chnl%2==0){ ch = chnl/2; NeEvent->neutAmp[ch+16] = adc; } else { ch = chnl/2; NeEvent->neutTAC[ch+16] = adc; } break; } // printf(" Data: geo:%d chnl:%d adc:%d\n", geo, chnl, adc); break; case 4: //CAEN footer c_bool = false; evnt = idata[n] & 0xffffff; if (dooutput) printf(" Event: geo:%d number:%d\n", geo, evnt); break; case 6: //CAEN no valid data c_bool = false; if (dooutput) printf("!!!No valid data from CAEN!!!"); break; default: printf("ERROR !!!!!! Uncknown CAEN typ %d\n", typ); printf("Data = %x\n", idata[n]); break; } } break; //end of VME_1 } //end of GetProcID } //end of GetIntLen } //end of NextSubEvent NeEvent->nevent = fInput->GetCount(); NeEvent->trigger = fInput->GetTrigger(); NeEvent->subevents = num; NeEvent->evsize = sz; fTrigger->Fill(NeEvent->trigger); fSubEvents->Fill(num); fEventsSizes->Fill(sz); // for (n=0; n<4; ++n) // if(NeEvent->trigger == 2) { if(NeEvent->F3[n] > 0) d1F3[n]->Fill(NeEvent->F3[n]); if(NeEvent->F5[n] > 0) d1F5[n]->Fill(NeEvent->F5[n]); if(NeEvent->F6[n] > 0) d1F6[n]->Fill(NeEvent->F6[n]); if(NeEvent->tF3[n] > 0) d1tF3[n]->Fill(NeEvent->tF3[n]); if(NeEvent->tF5[n] > 0) d1tF5[n]->Fill(NeEvent->tF5[n]); if(NeEvent->tF6[n] > 0) d1tF6[n]->Fill(NeEvent->tF6[n]); if(NeEvent->tMWPC[n] > 0) d1tMWPC[n]->Fill(NeEvent->tMWPC[n]); } // if(NeEvent->tF3[0] > 0 && NeEvent->F3[0] > 0) d2tF3aF3_L->Fill(NeEvent->tF3[0],NeEvent->F3[0]); if(NeEvent->tF3[1] > 0 && NeEvent->F3[1] > 0) d2tF3aF3_R->Fill(NeEvent->tF3[1],NeEvent->F3[1]); if(NeEvent->tF3[2] > 0 && NeEvent->F3[2] > 0) d2tF3aF3_U->Fill(NeEvent->tF3[2],NeEvent->F3[2]); if(NeEvent->tF3[3] > 0 && NeEvent->F3[3] > 0) d2tF3aF3_D->Fill(NeEvent->tF3[3],NeEvent->F3[3]); // if(NeEvent->F3[0]>0&&NeEvent->F3[1]>0&&NeEvent->F3[2]>0&&NeEvent->F3[3]>0) af3 = (NeEvent->F3[0]+NeEvent->F3[1]+NeEvent->F3[2]+NeEvent->F3[3]+4.*gRandom->Uniform())/4.; if(NeEvent->F5[0]>0&&NeEvent->F5[1]>0&&NeEvent->F5[2]>0&&NeEvent->F5[3]>0) af5 = (NeEvent->F5[0]+NeEvent->F5[1]+NeEvent->F5[2]+NeEvent->F5[3]+4.*gRandom->Uniform())/4.; if(NeEvent->tF3[0]>0&&NeEvent->tF3[1]>0&&NeEvent->tF3[2]>0&&NeEvent->tF3[3]>0) tf3 = (NeEvent->tF3[0]+NeEvent->tF3[1]+NeEvent->tF3[2]+NeEvent->tF3[3]+4.*gRandom->Uniform())/4.; if(NeEvent->tF5[0]>0&&NeEvent->tF5[1]>0&&NeEvent->tF5[2]>0&&NeEvent->tF5[3]>0) tf5 = (NeEvent->tF5[0]+NeEvent->tF5[1]+NeEvent->tF5[2]+NeEvent->tF5[3]+4.*gRandom->Uniform())/4.; // ToF = (tf5 - tf3)*0.125+89.165; if(af3*af5*tf3*tf5!=0) { if(NeEvent->trigger == 1) { d1ToF->Fill(ToF); d1aF3->Fill(af3); d2ToFaF3->Fill(ToF,af3); d1aF5->Fill(af5); d2ToFaF5->Fill(ToF,af5); } } // for (n=0; n<16; ++n) { if(NeEvent->CsI_L[n] > 0 ) d1CsI_L[n]->Fill(NeEvent->CsI_L[n]); // if(NeEvent->CsI_R[n] > 0 && ToF> 172 && ToF<176 && NeEvent->trigger == 1) // d1CsI_R[n]->Fill(NeEvent->CsI_R[n]); if(NeEvent->CsI_R[n] > 0 ) d1CsI_R[n]->Fill(NeEvent->CsI_R[n]); if(NeEvent->tCsI_L[n] > 0) d1tCsI_L[n]->Fill(NeEvent->tCsI_L[n]); if(NeEvent->tCsI_R[n] > 0) d1tCsI_R[n]->Fill(NeEvent->tCsI_R[n]); if(NeEvent->SQY_L[n] > 0) d1SQY_L[n]->Fill(NeEvent->SQY_L[n]); if(NeEvent->tSQY_L[n] > 0) d1tSQY_L[n]->Fill(NeEvent->tSQY_L[n]); if(NeEvent->SQ20[n] > 0) d1SQ20[n]->Fill(NeEvent->SQ20[n]); if(NeEvent->tSQ20[n] > 0) d1tSQ20[n]->Fill(NeEvent->tSQ20[n]); if(NeEvent->SQY_R[n] > 0) d1SQY_R[n]->Fill(NeEvent->SQY_R[n]); if(NeEvent->tSQY_R[n] > 0) d1tSQY_R[n]->Fill(NeEvent->tSQY_R[n]); if(NeEvent->ANR[n] > 0) d1ANR[n]->Fill(NeEvent->ANR[n]); if(NeEvent->ANS[n] > 0) d1ANS[n]->Fill(NeEvent->ANS[n]); } for (n=0; n<32; ++n) { if(NeEvent->SQX_L[n] > 0) d1SQX_L[n]->Fill(NeEvent->SQX_L[n]); if(NeEvent->tSQX_L[n] > 0) d1tSQX_L[n]->Fill(NeEvent->tSQX_L[n]); if(NeEvent->SQX_R[n] > 0) d1SQX_R[n]->Fill(NeEvent->SQX_R[n]); if(NeEvent->tSQX_R[n] > 0) d1tSQX_R[n]->Fill(NeEvent->tSQX_R[n]); if(NeEvent->neutAmp[n] > 0) d1neutAmp[n]->Fill(NeEvent->neutAmp[n]); if(NeEvent->neutTAC[n] > 0) d1neutTAC[n]->Fill(NeEvent->neutTAC[n]); if(NeEvent->neutTDC[n] > 0) d1neutTDC[n]->Fill(NeEvent->neutTDC[n]); if(NeEvent->neutAmp[n] > 0 && NeEvent->neutTAC[n] > 0) d2Ngamma[n]->Fill(NeEvent->neutAmp[n],NeEvent->neutTAC[n]); } //CALIBRATED nSQX_L = 0; nSQY_L = 0; nSQX_R = 0; nSQY_R = 0; nCsI_L = 0; nCsI_R = 0; nSQ20 = 0; iSQX_L =0,iSQX_R =0,iSQY_L =0,iSQY_R =0, iSQ20 =0; EsqxL = 0.,EsqyL = 0.,EsqxR = 0.,EsqyR = 0.,EanS = 0.,EanR = 0., Esq20 = 0.; for (n=0; n<16; ++n) { if(NeEvent->SQY_L[n] > 0) { value1 = (double)NeEvent->SQY_L[n] + gRandom->Uniform(); value2 = ((TNeAnalysis*)go4)->pSQY_L_EC->Energy(value1, n); if(NeEvent->tSQY_L[n] > 100) { d1SQY_L_C[n]->Fill(value2); nSQY_L++; iSQY_L = n; d1nSQY_L->Fill(iSQY_L); EsqyL = value2; } } /* if(NeEvent->SQ20[n] > 80) { if(NeEvent->tSQ20[n] > 100) { nSQ20++; iSQ20 = n; Esq20 = (double)NeEvent->SQ20[n]; } }*/ if(NeEvent->SQ20[n] > 0) { value1 = (double)NeEvent->SQ20[n] + gRandom->Uniform(); value2 = ((TNeAnalysis*)go4)->pSQ20_EC->Energy(value1, n); if(NeEvent->tSQ20[n] > 100) { d1SQ20_C[n]->Fill(value2); nSQ20++; iSQ20 = n; d1nSQ20->Fill(iSQ20); Esq20 = value2; } } if(NeEvent->SQY_R[n] > 0) { value1 = (double)NeEvent->SQY_R[n] + gRandom->Uniform(); value2 = ((TNeAnalysis*)go4)->pSQY_R_EC->Energy(value1, n); // if(NeEvent->tSQY_R[n] > 100) if(NeEvent->SQY_R[n] > 100) { d1SQY_R_C[n]->Fill(value2); nSQY_R++; iSQY_R = n; d1nSQY_R->Fill(iSQY_R); EsqyR = value2; } } if(NeEvent->ANR[n] > 0) { value1 = (double)NeEvent->ANR[n] + gRandom->Uniform(); value2 = ((TNeAnalysis*)go4)->pANR_EC->Energy(value1, n); d1ANR_C[n]->Fill(value2); } if(NeEvent->ANS[n] > 0) { value1 = (double)NeEvent->ANS[n] + gRandom->Uniform(); value2 = ((TNeAnalysis*)go4)->pANS_EC->Energy(value1, n); d1ANS_C[n]->Fill(value2); } if(NeEvent->CsI_L[n] > 0) { value1 = (double)NeEvent->CsI_L[n] + gRandom->Uniform(); value2 = ((TNeAnalysis*)go4)->pCsI_L_EC->Energy(value1, n); CsI_L_calib_cont[n]=value2; if(NeEvent->tCsI_L[n] > 100) d1CsI_L_C[n]->Fill(value2); if(value2 > 5.0) { nCsI_L++; } } if(NeEvent->CsI_R[n] > 0) { value1 = (double)NeEvent->CsI_R[n] + gRandom->Uniform(); value2 = ((TNeAnalysis*)go4)->pCsI_R_EC->Energy(value1, n); CsI_R_calib_cont[n]=value2; if(NeEvent->tCsI_R[n] > 100) d1CsI_R_C[n]->Fill(value2); if(value2 > 5.0) { nCsI_R++; } } } for (n=0; n<32; ++n) { if(NeEvent->SQX_L[n] > 0) { value1 = (double)NeEvent->SQX_L[n] + gRandom->Uniform(); value2 = ((TNeAnalysis*)go4)->pSQX_L_EC->Energy(value1, n); if(NeEvent->tSQX_L[n] > 100) { d1SQX_L_C[n]->Fill(value2); nSQX_L++; iSQX_L = n; d1nSQX_L->Fill(iSQX_L); EsqxL = value2; } } if(NeEvent->SQX_R[n] > 0) { value1 = (double)NeEvent->SQX_R[n] + gRandom->Uniform(); value2 = ((TNeAnalysis*)go4)->pSQX_R_EC->Energy(value1, n); if(NeEvent->tSQX_R[n] > 100) { d1SQX_R_C[n]->Fill(value2); nSQX_R++; iSQX_R = n; d1nSQX_R->Fill(iSQX_R); EsqxR = value2; } } } /* for (n=0; n<16; ++n) { if(NeEvent->CsI_R[n] > 0 && EsqxL<20 && NeEvent->trigger == 3) d1CsI_R[n]->Fill(NeEvent->CsI_R[n]); }*/ // if(ToF>23&&ToF<29&&af5>350&&af5<850)//he6 condition // if(ToF>35&&ToF<55)//he6 condition // { if(nSQX_L == 1 && nSQY_L == 1) { d2SQXSQY_L_D->Fill(iSQX_L, iSQY_L); } if(nSQX_R == 1 && nSQY_R == 1) { d2SQXSQY_R_D->Fill(iSQX_R, iSQY_R); } // if(nSQY_L > 0 && nSQY_L <16) d1mSQY_L->Fill(nSQY_L); if(nSQX_L > 0 && nSQX_L <32) d1mSQX_L->Fill(nSQX_L); if(nSQY_R > 0 && nSQY_R <16) d1mSQY_R->Fill(nSQY_R); if(nSQX_R > 0 && nSQX_R <32) d1mSQX_R->Fill(nSQX_R); // if(nSQX_L == 1) d1ESQX_L->Fill(EsqxL); if(nSQX_R == 1) d1ESQX_R->Fill(EsqxR); /* for(i=0; i<16; ++i) { if(nSQX_L == 1) d2dE_E_L[i]->Fill(CsI_L_calib_cont[i], EsqxL); if(nSQX_R == 1) d2dE_E_R[i]->Fill(CsI_R_calib_cont[i], EsqxR); // if(nSQX_L == 1 && EsqxR > 2.0 && nSQX_R == 1) d2dE_E_L_c[i]->Fill(CsI_L_calib_cont[i], EsqxL); // if(nSQX_R == 1 && EsqxL > 2.0 && nSQX_L == 1) d2dE_E_R_c[i]->Fill(CsI_R_calib_cont[i], EsqxR); } */ if(nSQY_L == 1 && nSQ20 == 1) d2SQ20_SQY_L ->Fill(EsqyL,Esq20); // if(ToF> 165 && ToF<185 && NeEvent->trigger ==3) // { if(nSQX_L == 1 && nSQY_L == 1) { d2dE_E_L[idCsI_L[iSQY_L][iSQX_L]]->Fill(CsI_L_calib_cont[idCsI_L[iSQY_L][iSQX_L]], EsqxL); } if(nSQX_R == 1 && nSQY_R == 1) { d2dE_E_R[idCsI_R[iSQY_R][iSQX_R]]->Fill(CsI_R_calib_cont[idCsI_R[iSQY_R][iSQX_R]], EsqxR); } if(nSQX_L == 1 && nSQY_L == 1 && nSQX_R == 1 && nSQY_R == 1) { d2dE_E_L_c[idCsI_L[iSQY_L][iSQX_L]]->Fill(CsI_L_calib_cont[idCsI_L[iSQY_L][iSQX_L]], EsqxL); } if(nSQX_R == 1 && nSQY_R == 1 && nSQX_L == 1 && nSQY_L == 1 && nSQ20 == 1 && Esq20>2 && Esq20 <8 && EsqyL < 15) { d2dE_E_R_c[idCsI_R[iSQY_R][iSQX_R]]->Fill(CsI_R_calib_cont[idCsI_R[iSQY_R][iSQX_R]], EsqxR); } // } //---------------------start of MWPC---------------------------------------- // if(NeEvent->trigger == 1 && ToF > 165 && ToF <185) // { for(i = 0; i < NeEvent->nx1; ++i) d1X1->Fill(NeEvent->x1[i]); for(i = 0; i < NeEvent->ny1; ++i) d1Y1->Fill(NeEvent->y1[i]); for(i = 0; i < NeEvent->nx2; ++i) d1X2->Fill(NeEvent->x2[i]); for(i = 0; i < NeEvent->ny2; ++i) d1Y2->Fill(NeEvent->y2[i]); // } if(NeEvent->nx1 > 0) d1NX1->Fill(NeEvent->nx1); if(NeEvent->ny1 > 0) d1NY1->Fill(NeEvent->ny1); if(NeEvent->nx2 > 0) d1NX2->Fill(NeEvent->nx2); if(NeEvent->ny2 > 0) d1NY2->Fill(NeEvent->ny2); if(NeEvent->nx1 > 0) d1CX1->Fill(GetClasters(NeEvent->nx1, NeEvent->x1)); if(NeEvent->ny1 > 0) d1CY1->Fill(GetClasters(NeEvent->ny1, NeEvent->y1)); if(NeEvent->nx2 > 0) d1CX2->Fill(GetClasters(NeEvent->nx2, NeEvent->x2)); if(NeEvent->ny2 > 0) d1CY2->Fill(GetClasters(NeEvent->ny2, NeEvent->y2)); // if(NeEvent->nx1 > 0 && NeEvent->ny1 > 0 && (GetClasters(NeEvent->nx1, NeEvent->x1)) == 1 && (GetClasters(NeEvent->ny1, NeEvent->y1)) == 1 && NeEvent->trigger == 1) { d2XY1->Fill(NeEvent->x1[0],NeEvent->y1[0]); } if(NeEvent->nx2 > 0 && NeEvent->ny2 > 0 && (GetClasters(NeEvent->nx2, NeEvent->x2)) == 1 && (GetClasters(NeEvent->ny2, NeEvent->y2)) == 1 && NeEvent->trigger == 1) { d2XY2->Fill(NeEvent->x2[0],NeEvent->y2[0]); } /* if(NeEvent->nx1 == 1 && NeEvent->ny1 == 1 && NeEvent->trigger == 1) { d2XY1->Fill(NeEvent->x1[0],NeEvent->y1[0]); } if(NeEvent->nx2 == 1 && NeEvent->ny2 == 1 && NeEvent->trigger == 1) { d2XY2->Fill(NeEvent->x2[0],NeEvent->y2[0]); } */ //---Pictures--- /* if(NeEvent->nx1 == 1 && NeEvent->nx2 == 1) { ya1 = -0.5*pya1 + dx1 + (pya1 / 32.)*NeEvent->x1[0]; ya2 = -0.5*pya2 + dx2 + (pya2 / 32.)*NeEvent->x2[0]; ya3 = ya1 + dtx + (ya2 - ya1) * (pxa3 - pxa1) / (pxa2 - pxa1); if(ya3 > -0.5*pya1 && ya3 < 0.5*pya1) { if(((TNeAnalysis*)go4)->pMTracks->mtracksx != ntrackx) { ntrackx = ((TNeAnalysis*)go4)->pMTracks->mtracksx; fTracksX->Set(3*ntrackx); itrackAX = 0; for(i = 0; i < fTracksX->GetN(); ++i) fTracksX->SetPoint(i,pxb1,0.); } if(itrackAX == fTracksX->GetN()) itrackAX = 0; fTracksX->SetPoint(itrackAX++,pxa1,ya1); fTracksX->SetPoint(itrackAX++,pxa3,ya3); fTracksX->SetPoint(itrackAX++,pxa1,ya1); } } if(NeEvent->ny1 == 1 && NeEvent->ny2 == 1) { yb1 = -0.5*pyb1 + dy1+ (pyb1 / 32.)*NeEvent->y1[0]; yb2 = -0.5*pyb2 + dy2+ (pyb2 / 32.)*NeEvent->y2[0]; yb3 = yb1 + dty + (yb2 - yb1) * (pxb3 - pxb1) / (pxb2 - pxb1); if(yb3 > -0.5*pyb1 && yb3 < 0.5*pyb1) { if(((TNeAnalysis*)go4)->pMTracks->mtracksy != ntracky) { ntracky = ((TNeAnalysis*)go4)->pMTracks->mtracksy; fTracksY->Set(3*ntracky); itrackBX = 0; for(i = 0; i < fTracksY->GetN(); ++i) fTracksY->SetPoint(i,pxb1,0.); } if(itrackBX == fTracksY->GetN()) itrackBX = 0; fTracksY->SetPoint(itrackBX++,pxb1,yb1); fTracksY->SetPoint(itrackBX++,pxb3,yb3); fTracksY->SetPoint(itrackBX++,pxb1,yb1); } } if(NeEvent->nx1 == 1 && NeEvent->nx2 == 1 && NeEvent->ny1 == 1 && NeEvent->ny2 == 1 ) { d2Target->Fill(ya3,yb3); }*/ //--------------------end of MWPC---------------------------------------- NeEvent->SetValid(kTRUE); // to store return kTRUE; } //------------------------------------------------------------------- double TNeProc::GetClasters(unsigned short n, unsigned short *x) { int i; double clasters = 1; if(n == 0) clasters = 0.; else if(n > 1) { for(i = 1; i < n; ++i) { if(abs(x[i] - x[i-1]) > 1) clasters += 1.; } } return clasters; } //--------------------------------------------------------------------