//=================================================================== //== EXPERIMENT A-2 //== VERSION: 30.10.2018 //=================================================================== using namespace std; #include "TNeProc.h" #include #include #include #include #include "Riostream.h" #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; d1tMWPC[i] = NULL; } for(i = 0; i < 16; ++i) { //-----Si----- d1Lxa[i] = NULL; d1Lxt[i] = NULL; d1Lxc[i] = NULL; d1Lya[i] = NULL; d1Lyt[i] = NULL; d1Lyc[i] = NULL; d1Rxa[i] = NULL; d1Rxt[i] = NULL; d1Rxc[i] = NULL; d1Rya[i] = NULL; d1Ryt[i] = NULL; d1Ryc[i] = NULL; } //_________________________________Neutrons // d1ToF = NULL; d1aF3 = NULL; d2ToFaF3 = NULL; d1aF5 = NULL; d2ToFaF5 = NULL; d1X1 = NULL; d1Y1 = NULL; d1X2 = NULL; d1Y2 = NULL; d1NX1 = NULL; d1NY1 = NULL; d1NX2 = NULL; d1NY2 = NULL; d2XY1 = NULL; d2XY2 = NULL; d1CX1 = NULL; d1CY1 = NULL; d1CX2 = NULL; d1CY2 = NULL; } //------------------------------------------------------------------- TNeProc::~TNeProc() { cout << "**** TNeProc: Delete instance " << endl; } //------------------------------------------------------------------- TNeProc::TNeProc(const char* name) : TGo4EventProcessor(name) { TGo4Log::Info("**** TNeProc: Create instance %s", name); 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) { //-----SQ telescope raw----- d1Lxa[i] = MakeTH1('I', Form("Lxa/Lxas_%2.2d",i) //указывать не повторяющуюся структуру папок и уникальные имена , Form("L x amp CH %2.2d",i), 8192, 0., 8192.); d1Lxt[i] = MakeTH1('I', Form("Lxt/Lxts_%2.2d",i) , Form("L x time CH %2.2d",i), 4096, 1., 4096); d1Lxc[i] = MakeTH1('D', Form("Lxc/Lxcs_%2.2d",i) , Form("L x energy MeV %2.2d",i), 4000, -2., 98.); // d1Lya[i] = MakeTH1('I', Form("Lya/Lyas_%2.2d",i) //указывать не повторяющуюся структуру папок и уникальные имена , Form("L x amp CH %2.2d",i), 8192, 0., 8192.); d1Lyt[i] = MakeTH1('I', Form("Lyt/Lyts_%2.2d",i) , Form("L x time CH %2.2d",i), 4096, 1, 4096); d1Lyc[i] = MakeTH1('D', Form("Lyc/Lycs_%2.2d",i) // , Form("L x energy MeV %2.2d",i), 4000, -2., 98.); d1Rxa[i] = MakeTH1('I', Form("Rxa/Rxas_%2.2d",i) //указывать не повторяющуюся структуру папок и уникальные имена , Form("R x amp CH %2.2d",i), 8192, 0., 8192.); d1Rxt[i] = MakeTH1('I', Form("Rxt/Rxts_%2.2d",i) , Form("R x time CH %2.2d",i), 4096, 1., 4096); d1Rxc[i] = MakeTH1('D', Form("Rxc/Rxcs_%2.2d",i) , Form("R x energy MeV %2.2d",i), 4000, -2., 98.); // d1Rya[i] = MakeTH1('I', Form("Rya/Ryas_%2.2d",i) //указывать не повторяющуюся структуру папок и уникальные имена , Form("R x amp CH %2.2d",i), 8192, 0., 8192.); d1Ryt[i] = MakeTH1('I', Form("Ryt/Ryts_%2.2d",i) , Form("R x time CH %2.2d",i), 4096, 1, 4096); d1Ryc[i] = MakeTH1('D', Form("Ryc/Rycs_%2.2d",i) , Form("R x energy MeV %2.2d",i), 4000, -2., 98.); // d1AnSa[i] = MakeTH1('I', Form("AnSa/AnSas_%2.2d",i) //указывать не повторяющуюся структуру папок и уникальные имена , Form("Sect amp CH %2.2d",i), 8192, 0., 8192.); d1AnSt[i] = MakeTH1('I', Form("AnSt/AnSts_%2.2d",i) , Form("Sect time CH %2.2d",i), 4096, 1, 4096); d1AnSc[i] = MakeTH1('D', Form("AnSc/AnScs_%2.2d",i) , Form("Sect energy MeV %2.2d",i), 4000, -2., 98.); // d1AnRa[i] = MakeTH1('I', Form("AnRa/AnRas_%2.2d",i) //указывать не повторяющуюся структуру папок и уникальные имена , Form("Ring amp CH %2.2d",i), 8192, 0., 8192.); d1AnRt[i] = MakeTH1('I', Form("AnRt/AnRts_%2.2d",i) , Form("Ring time CH %2.2d",i), 4096, 1, 4096); d1AnRc[i] = MakeTH1('D', Form("AnRc/AnRcs_%2.2d",i) , Form("Ring energy MeV %2.2d",i), 4000, -2., 98.); } for (int i = 0; i < 16; ++i) { d1Lcsa[i] = MakeTH1('I', Form("Lcsa/Lcsa_%02d",i), Form("Lcs amp CH %02d",i), 4096, 0., 4096); d1Lcst[i] = MakeTH1('I', Form("Lcst/Lcst_%02d",i) , Form("Lcs time CH %02d",i), 4096, 1., 4095); d1Lcsc[i] = MakeTH1('D', Form("Lcsc/Lcsc_%02d",i), Form("Lcs energy MeV %2.2d",i), 4000, -2., 98.); } for (int i = 0; i < 16; ++i) { d1Rcsa[i] = MakeTH1('I', Form("Rcsa/Rcsa_%02d",i), Form("Rcs amp CH %02d",i), 4096, 0., 4096); d1Rcst[i] = MakeTH1('I', Form("Rcst/Rcst_%02d",i) , Form("Rcs time CH %02d",i), 4096, 1., 4095); d1Rcsc[i] = MakeTH1('D', Form("Rcsc/Rcsc_%02d",i), Form("Rcs energy MeV %2.2d",i), 4000, -2., 98.); } for (int i = 0; i < 16; ++i) { d1R20a[i] = MakeTH1('I', Form("R20a/R20a_%02d",i), Form("R20 amp CH %02d",i), 4096, 0., 4096); d1R20t[i] = MakeTH1('I', Form("R20t/R20t_%02d",i) , Form("R20 time CH %02d",i), 4096, 1., 4095); d1R20c[i] = MakeTH1('D', Form("R20c/R20c_%02d",i), Form("R20 energy MeV %2.2d",i), 4000, -2., 98.); } // 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", 10000, 0, 9999); d1tF3[1] = MakeTH1('I',"F3/TDC/tF3_TDC_R","F3 TDC right", 10000, 0, 9999); d1tF3[2] = MakeTH1('I',"F3/TDC/tF3_TDC_U","F3 TDC up", 10000, 0, 9999); d1tF3[3] = MakeTH1('I',"F3/TDC/tF3_TDC_D","F3 TDC down", 10000, 0, 9999); // 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", 10000, 0, 9999); d1tF5[1] = MakeTH1('I',"F5/TDC/tF5_TDC_R","F5 TDC right", 10000, 0, 9999); d1tF5[2] = MakeTH1('I',"F5/TDC/tF5_TDC_U","F5 TDC up", 10000, 0, 9999); d1tF5[3] = MakeTH1('I',"F5/TDC/tF5_TDC_D","F5 TDC down", 10000, 0, 9999); // //-----ToF----- d1ToF = MakeTH1('D', "ToF/ToF", "time of flight", 10000,-100.,400.,"ToF(ns)"); d1aF3 = MakeTH1('D', "ToF/aF3", "amplitude of plastic F3", 4000,0.,4000.,"amp F3"); d2ToFaF3 = MakeTH2('D', "ToF/ToFaF3", "ToF vs aF3", 400,50.,200.,400,0.,4000.,"ToF","aF3"); d1aF5 = MakeTH1('D', "ToF/aF5", "amplitude of plastic F5", 4000,0.,4000.,"amp F5"); d2ToFaF5 = MakeTH2('D', "ToF/ToFaF5", "ToF vs aF5", 400,50.,200.,400,0.,4000.,"ToF","aF5"); //-----MWPC----- d2XY1 = MakeTH2('I', "MWPC/XY1", "WIRES 1 Y1 vs X1", 32,0.,32.,32,0.,32.,"X1","Y1"); d2XY2 = MakeTH2('I', "MWPC/XY2", "WIRES 2 Y2 vs X2", 32,0.,32.,32,0.,32.,"X2","Y2"); d1X1 = MakeTH1('I', "MWPC/X1","WIRES X1",32,0.,32.); d1Y1 = MakeTH1('I', "MWPC/Y1","WIRES Y1",32,0.,32.); d1X2 = MakeTH1('I', "MWPC/X2","WIRES X2",32,0.,32.); d1Y2 = MakeTH1('I', "MWPC/Y2","WIRES Y2",32,0.,32.); d1tMWPC[0] = MakeTH1('I',"MWPC/tX1","MWPC TDC X1", 10000, 0, 9999); d1tMWPC[1] = MakeTH1('I',"MWPC/tY1","MWPC TDC Y1", 10000, 0, 9999); d1tMWPC[2] = MakeTH1('I',"MWPC/tX2","MWPC TDC X2", 10000, 0, 9999); d1tMWPC[3] = MakeTH1('I',"MWPC/tY2","MWPC TDC Y2", 10000, 0, 9999); d1NX1 = MakeTH1('I', "MWPC/NX1","WIRES X1",32,0.,32.); d1NY1 = MakeTH1('I', "MWPC/NY1","WIRES Y1",32,0.,32.); d1NX2 = MakeTH1('I', "MWPC/NX2","WIRES X2",32,0.,32.); d1NY2 = MakeTH1('I', "MWPC/NY2","WIRES Y2",32,0.,32.); d1CX1 = MakeTH1('I', "MWPC/CX1","clusters X1",32,0.,32.); d1CY1 = MakeTH1('I', "MWPC/CY1","clusters Y1",32,0.,32.); d1CX2 = MakeTH1('I', "MWPC/CX2","clusters X2",32,0.,32.); d1CY2 = MakeTH1('I', "MWPC/CY2","clusters Y2",32,0.,32.); //------ //------------------------------------------------------------ }//------------------------------------------------------------ Bool_t TNeProc::BuildEvent(TGo4EventElement* target) { // called by framework from TNeEvent to fill it // TGo4Analysis *go4 = TGo4Analysis::Instance(); TNeEvent* NeEvent = (TNeEvent*) target; target->Clear(); TGo4MbsSubEvent* psubevt; TGo4MbsEvent* fInput = (TGo4MbsEvent* ) GetInputEvent(); if(fInput == 0) { TGo4Log::Error( "TNeProc::BuildEvent: no input event !"); return false; } bool dooutput = false; // double value1, value2; // double eLxa,eLya; // int mLxa,mLya; // int num = 0, sz = 0; int i, n, geo, typ, header,caen_header, module_id=0, crate=-1, cnt, chnl, evnt /*,gch*/; // int mDSD_X, mDSD_Y, mCsI; 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 0: //mTDC: ToF if ((idata[n] >> 16) & 0x20) break; //T bit analysis chnl= (idata[n] >> 16) & 0x1f; adc = idata[n] & 0xffff; //only 16 bits if(chnl<4) NeEvent->tF3[chnl] = adc; else if(chnl<8) NeEvent->tF5[chnl-4] = adc; else if(chnl<12); else if(chnl<16) NeEvent->tMWPC[chnl-12] = adc; break; case 1: //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; break; case 6: //scaler v560 for(i = 0; i < 16; ++i) NeEvent->scaler[i]=idata[n++] & 0x07ffffff; break; case 8: // mTDC: time Lx & Ly chnl= (idata[n] >> 16)&0x3f; adc = idata[n] & 0xfff; //only 12 bits if(chnl<16) { NeEvent->Lxt[chnl] = adc; } else if(chnl<32) { NeEvent->Lyt[chnl-16] = adc; } break; case 9: // mADC: amp Lx & Ly chnl= (idata[n] >> 16)&0x1f; adc = idata[n] & 0xfff; //only 12 bits if(chnl<16) { NeEvent->Lxa[chnl] = adc; } else { NeEvent->Lya[chnl-16] = adc; } break; case 10: // mTDC: time Rx & Ry chnl= (idata[n] >> 16)&0x3f; adc = idata[n] & 0xfff; //only 12 bits if(chnl<16) { NeEvent->Rxt[chnl] = adc; } else if(chnl<32) { NeEvent->Ryt[chnl-16] = adc; } break; case 11: // mADC: amp Rx & Ry chnl= (idata[n] >> 16)&0x1f; adc = idata[n] & 0xfff; //only 12 bits if(chnl<16) { NeEvent->Rxa[chnl] = adc; } else { NeEvent->Rya[chnl-16] = adc; } break; case 12: // mTDC: time An S & R chnl= (idata[n] >> 16)&0x3f; adc = idata[n] & 0xfff; //only 12 bits if(chnl<16) { NeEvent->AnSt[chnl] = adc; } else if(chnl<32) { NeEvent->AnRt[chnl-16] = adc; } break; case 13: // mADC: amp An S & R chnl= (idata[n] >> 16)&0x1f; adc = idata[n] & 0xfff; //only 12 bits if(chnl<16) { NeEvent->AnSa[chnl] = adc; } else { NeEvent->AnRa[chnl-16] = adc; } break; case 14: // mTDC: time R20 & AnV chnl= (idata[n] >> 16)&0x3f; adc = idata[n] & 0xfff; //only 12 bits if(chnl<16) { NeEvent->AnVt[chnl] = adc; } else if(chnl<32) { NeEvent->R20t[chnl-16] = adc; } break; case 15: // mADC: amp R20 & AnV chnl= (idata[n] >> 16)&0x1f; adc = idata[n] & 0xfff; //only 12 bits if(chnl<16) { NeEvent->AnVa[chnl] = adc; } else { NeEvent->R20a[chnl-16] = adc; } break; } break; case 16: // mTDC: time Rcs & Lcs chnl= (idata[n] >> 16)&0x3f; adc = idata[n] & 0xfff; //only 12 bits if(chnl<16) { NeEvent->Lcst[chnl] = adc; } else if(chnl<32) { NeEvent->Rcst[chnl-16] = adc; } break; case 17: // mADC: amp Rcs & Lcs chnl= (idata[n] >> 16)&0x1f; adc = idata[n] & 0xfff; //only 12 bits if(chnl<16) { NeEvent->Lcsa[chnl] = adc; } else { NeEvent->Rcsa[chnl-16] = adc; } 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) { } // 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 1: 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 2: 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 3: 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 4: 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->ry2=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; 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 3: // mTDC: time sect & rings p1 chnl= (idata[n] >> 16)&0x3f; adc = idata[n] & 0xfff; //only 12 bits if(chnl<16) { NeEvent->Lxt[chnl] = adc; } else if(chnl<32) { NeEvent->Lyt[chnl-16] = adc; } break; case 4: // mADC: amp sect & rings p1 chnl= (idata[n] >> 16)&0x1f; adc = idata[n] & 0xfff; //only 12 bits if(chnl<16) { NeEvent->Lxa[chnl] = adc; } else { NeEvent->Lya[chnl-16] = 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 6: //scaler v560 for(i = 0; i < 16; ++i) NeEvent->scaler[i]=idata[n++] & 0x07ffffff; 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->tF3[n] > 0) d1tF3[n]->Fill(NeEvent->tF3[n]); if(NeEvent->tF5[n] > 0) d1tF5[n]->Fill(NeEvent->tF5[n]); if(NeEvent->tMWPC[n] > 0) d1tMWPC[n]->Fill(NeEvent->tMWPC[n]); } // 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; // ToF = (tf5 - tf3)*0.0625; // ToF = (tf5 - tf3)*0.0625 + 68.55; // ToF = (tf5 - tf3)*0.0625 + 68.475; ToF = (tf5 - tf3)*0.015625 + 68.475; 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 (int n=0; n<16; ++n) { if(NeEvent->Lxt[n]>0){ d1Lxa[n]->Fill(NeEvent->Lxa[n]); d1Lxt[n]->Fill(NeEvent->Lxt[n]); } if(NeEvent->Lyt[n]>0){ d1Lya[n]->Fill(NeEvent->Lya[n]); d1Lyt[n]->Fill(NeEvent->Lyt[n]); } if(NeEvent->Rxt[n]>0){ d1Rxa[n]->Fill(NeEvent->Rxa[n]); d1Rxt[n]->Fill(NeEvent->Rxt[n]); } if(NeEvent->Ryt[n]>0){ d1Rya[n]->Fill(NeEvent->Rya[n]); d1Ryt[n]->Fill(NeEvent->Ryt[n]); } if(NeEvent->R20t[n]>0){ d1R20a[n]->Fill(NeEvent->R20a[n]); d1R20t[n]->Fill(NeEvent->R20t[n]); } if(NeEvent->AnSt[n]>0){ d1AnSa[n]->Fill(NeEvent->AnSa[n]); d1AnSt[n]->Fill(NeEvent->AnSt[n]); } if(NeEvent->AnRt[n]>0){ d1AnRa[n]->Fill(NeEvent->AnRa[n]); d1AnRt[n]->Fill(NeEvent->AnRt[n]); } if(NeEvent->Rcst[n]>0){ d1Rcsa[n]->Fill(NeEvent->Rcsa[n]); d1Rcst[n]->Fill(NeEvent->Rcst[n]); } if(NeEvent->Lcst[n]>0){ d1Lcsa[n]->Fill(NeEvent->Lcsa[n]); d1Lcst[n]->Fill(NeEvent->Lcst[n]); } } //-----p1 secrors amp.----- /* for (n=0; n<16; ++n) { if(NeEvent->p1s[n] > 0) d1_p1s[n]->Fill(NeEvent->p1s[n]); } //----- time of p1 sectors --- for (n=0; n<16; ++n) { if(NeEvent->tp1s[n] > 0) d1_p1s[n]->Fill(NeEvent->tp1s[n]); } //______ calibrated spectra __________________________ for (n=0; n<16; ++n) { value1 = (double)NeEvent->p1s[n] + gRandom->Uniform(); value2 = ((TNeAnalysis*)go4)->p_p1s->Energy(value1, n); d1_Lxa_c[n]->Fill(value2); mp1s++; ep1s = value2; } */ 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; } //--------------------------------------------------------------------