diff --git a/NeLinkDef.h b/NeLinkDef.h index d04b1ef78ff94f93f246a7124539d27580799c8c..393d32e562c6258b523ade3cde0c8a6622c933e0 100644 --- a/NeLinkDef.h +++ b/NeLinkDef.h @@ -22,6 +22,7 @@ #pragma link C++ class TNeProc+; #pragma link C++ class TNeMParms+; #pragma link C++ class TNeSel+; +#pragma link C++ class TDSSD16+; #endif diff --git a/README.md b/README.md index 05bbe49692df5dfd3381d45be008a056ffbfb769..e04d17a10595a7830db83654fda30adf3dceaef7 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,15 @@ ## 24e01 ### Naming conventions - - prefix T[number]x is for telescope - - By default channel 1--16 for X-strips 16--32 for Y. +- prefix L is for left shoulder R for right +- By default channel 1--16 for X-strips 16--32 for Y. +### TDSSD16 +`TDSSD16` is container for double-side 1mm telescope. +Members: + - multx,multy --- multiplicity on each side + - sx,sy --- strip number + - depx,depy --- Edep in MeV + - posx,posy --- local position in mm + +now only left 1mm detector added to `TNeEvent` (it named as `L1`). diff --git a/TNeEvent.cxx b/TNeEvent.cxx index b6bc56b49502c28ab6d6e6582b2332a464842617..a9647fc0f852e86c6abdeba2c900e1dd01484941 100644 --- a/TNeEvent.cxx +++ b/TNeEvent.cxx @@ -34,6 +34,7 @@ void TNeEvent::Clear(Option_t *t) //== memset(fRawData,0, sizeof(fRawData)); //================================================================== // Si + L1.Clear(); memset(Lxa, 0, sizeof(Lxa)); memset(Lxt, 0, sizeof(Lxt)); memset(Lya, 0, sizeof(Lya)); diff --git a/TNeEvent.h b/TNeEvent.h index 151f8f13a65ef8faee315db408072aba7d1e8d60..3b55f5e1843da8a2e90422c6391c1d963d6497a1 100644 --- a/TNeEvent.h +++ b/TNeEvent.h @@ -8,6 +8,7 @@ #define TNeEVENT_H #include "TGo4EventElement.h" +#include "TDSSD16.h" class TNeEvent : public TGo4EventElement { @@ -20,6 +21,7 @@ public: void Clear(Option_t *t=""); //-----Si----- + TDSSD16 L1; unsigned short Lxa[16]; unsigned short Lxt[16]; unsigned short Lxc[16]; diff --git a/TNeProc.cxx b/TNeProc.cxx index d51d27b152109dfcb84bdd100484d1cf2624b75c..16e8c795d4eaf5dab036fadbc01405d8ed456b35 100644 --- a/TNeProc.cxx +++ b/TNeProc.cxx @@ -1,3 +1,4 @@ +/* -*- mode:c++ c-file-style:"linux" -*- */ //=================================================================== //== EXPERIMENT A-2 //== VERSION: 30.10.2018 @@ -49,20 +50,16 @@ TNeProc::TNeProc() : TGo4EventProcessor() fTrigger = NULL; fSubEvents = NULL; fEventsSizes = NULL; - - for(i = 0; i < 4; ++i) - { + 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) - { + for(i = 0; i < 16; ++i) { //-----Si----- d1Lxa[i] = NULL; d1Lxt[i] = NULL; @@ -291,7 +288,7 @@ Bool_t TNeProc::BuildEvent(TGo4EventElement* target) TGo4Analysis *go4 = TGo4Analysis::Instance(); TNeEvent* NeEvent = (TNeEvent*) target; - target->Clear(); + NeEvent->Clear(); TGo4MbsSubEvent* psubevt; TGo4MbsEvent* fInput = (TGo4MbsEvent* ) GetInputEvent(); @@ -316,503 +313,483 @@ Bool_t TNeProc::BuildEvent(TGo4EventElement* target) double af3=0., af5=0., tf3=0., tf5=0., ToF=0.; fInput->ResetIterator(); - while((psubevt = fInput->NextSubEvent()) != 0) - { + while((psubevt = fInput->NextSubEvent()) != 0) { num++; sz += psubevt->GetIntLen(); idata = (uint32_t*) psubevt->GetDataField(); - n = -1; - while(++n < psubevt->GetIntLen()) - { + 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); + + 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 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] & 0x1fff; //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] & 0x1fff; //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] & 0x1fff; //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] & 0x1fff; //only 12 bits - if(chnl<16) { - NeEvent->AnVa[chnl] = adc; - } else { - NeEvent->R20a[chnl-16] = adc; - } - break; - - case 2: // 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 3: // mADC: amp Rcs & Lcs - chnl= (idata[n] >> 16)&0x1f; - adc = idata[n] & 0x1fff; //only 12 bits - if(chnl<16) { - NeEvent->Lcsa[chnl] = adc; - } else { - NeEvent->Rcsa[chnl-16] = adc; - } - break; - - case 4: // mTDC: time Rvt - chnl= (idata[n] >> 16)&0x3f; - adc = idata[n] & 0xfff; //only 12 bits + 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] & 0x1fff; //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] & 0x1fff; //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] & 0x1fff; //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] & 0x1fff; //only 12 bits + if(chnl<16) { + NeEvent->AnVa[chnl] = adc; + } else { + NeEvent->R20a[chnl-16] = adc; + } + break; + + case 2: // 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 3: // mADC: amp Rcs & Lcs + chnl= (idata[n] >> 16)&0x1f; + adc = idata[n] & 0x1fff; //only 12 bits + if(chnl<16) { + NeEvent->Lcsa[chnl] = adc; + } else { + NeEvent->Rcsa[chnl-16] = adc; + } + break; + + case 4: // mTDC: time Rvt + chnl= (idata[n] >> 16)&0x3f; + adc = idata[n] & 0xfff; //only 12 bits if(chnl<16) NeEvent->Rvt[chnl] = adc; break; - - case 5: // mADC: amp Ra - chnl= (idata[n] >> 16)&0x1f; + + case 5: // mADC: amp Ra + chnl= (idata[n] >> 16)&0x1f; adc = idata[n] & 0x1fff; //only 12 bits if(chnl<16) NeEvent->Rva[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) - { - } - // 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; + 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; + 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; + } - 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; + break; // end of CAMAC - case 3: //-----MESYTEC footer----- - m_bool=false; - break; + case 200: //VME_1, see setup.usf - default: - printf("ERROR !!!!!! Unknown MESYTEC typ %d\n", typ); - printf("Data = %x\n", idata[n]); + 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; + } + 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("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]); - + 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 - - + } + 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) + 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[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.; + 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.; + 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.; + 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; + ToF = (tf5 - tf3)*0.015625 + 68.475; - if(af3*af5*tf3*tf5!=0) - { + 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); - - } + + 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) @@ -894,22 +871,31 @@ ToF = (tf5 - tf3)*0.015625 + 68.475; */ //______ calibrated spectra __________________________ - for (n=0; n<16; ++n) - { + for (int n=0; n<16; ++n) { if(NeEvent->Lxt[n]>0){ - value1 = (double)NeEvent->Lxa[n] + gRandom->Uniform(); + value1 = (double)NeEvent->Lxa[n] + gRandom->Uniform(); value2 = ((TNeAnalysis*)go4)->p_Lxa->Energy(value1, n); d1Lxc[n]->Fill(value2); mLxa++; eLxa = value2; + // fill TNeEvent + NeEvent->L1.sx[NeEvent->L1.multx]=n; + NeEvent->L1.posx[NeEvent->L1.multx]=NeEvent->L1.str2pos(n); + NeEvent->L1.depx[NeEvent->L1.multx]=value2; + NeEvent->L1.multx++; } if(NeEvent->Lyt[n]>0){ - value1 = (double)NeEvent->Lya[n] + gRandom->Uniform(); + value1 = (double)NeEvent->Lya[n] + gRandom->Uniform(); value2 = ((TNeAnalysis*)go4)->p_Lya->Energy(value1, n); d1Lyc[n]->Fill(value2); mLya++; eLya = value2; + NeEvent->L1.sy[NeEvent->L1.multy]=n; + NeEvent->L1.posy[NeEvent->L1.multy]=NeEvent->L1.str2pos(n); + NeEvent->L1.depy[NeEvent->L1.multy]=value2; + NeEvent->L1.multy++; + } if(NeEvent->Rxt[n]>0){