//////////////////////////////////// // MicroBall Event Unpacker // for the Asy-Eos experiment // Apr 29, 2010 // revison 1/2011 // zibi //////////////////////////////////// #include "TMBALLEvent.h" #include #include #include #define ADC0 0x50000000 #define ADC1 0x58000000 #define ADC2 0x60000000 #define ADC3 0x68000000 #define TDC0 0x70000000 #define TDC1 0x78000000 Bool_t DebugMultiplicity = kFALSE; TMBALLEvent *gmballevent = 0; using namespace std; //Constructor TMBALLEvent::TMBALLEvent() { if(gmballevent==0)gmballevent = this; mMult = 0; mRawMult = 0; for (int i=0; i<4;i++){ mMultRing[i] = 0; mRawMultRing[i] = 0; } fMBALLHistoList = 0; fMBALLHistoList = new TList(); //---------This var tells us if the halo detector has been fired (Paola 28Oct2011) fIsHaloFired = kFALSE; //----------------- } //Destructor TMBALLEvent::~TMBALLEvent() { // cout<<"TMBALLEvent destructor...done"< 0) //this makes you continue to the following ADC once the fired channels of one ADC have been read (Paola) { buffer++; tWords--; tag = *buffer; isheader = (tag & 0x07000000)>> 24; isfooter = (tag & 0x07000000)>> 24; // we don't really have to check whether it's a footer if (isheader!=2) continue; // only if it's a header, otherwise continue mNumEvts = tag & 0x0000003F; baseadd = tag & 0xF8000000; switch(baseadd) { case ADC0: module = 0; break; case ADC1: module = 1; break; case ADC2: module = 2; break; case ADC3: module = 3; break; case TDC0: module = 4; break; case TDC1: module = 5; break; default: module = 1000; mNumEvts = 0; break; } if(DebugMultiplicity) cout<<"number of fired channels for THAT adc (also TDC) for this event : "<> 24; if (isdata != 0) continue; adc_channel = (int)(((*buffer)&(0x001f0000))>>16); adc_data = (int)((*buffer)&0x00000fff); baseadd_word = (int)((*buffer)&0xF8000000); // if ((module==4) || (module ==5)) // cout<<"module = "<4) && (tRing < 9))) continue; // if(DebugMultiplicity) PrintEvent(module,adc_channel, adc_data, tRing, tDet); //---------Paola: the halo detector, at least at the beginning, was on ADC 0 (module 0) channels 22 and 23. // The pedestal for those 2 channels are 140 and 123, respectively (this are the values used durng the // experiment). I'm hardcoding these values here now, but we will change it if(module==0){ if(adc_channel==22&&adc_data>140) fIsHaloFired=kTRUE; //looking at ADC of halo det if(adc_channel==23&&adc_data>123) fIsHaloFired=kTRUE; } //---------done with looking at the Halo detector; if ((module==0) || (module==1)) { if(DebugMultiplicity) PrintEvent(module,adc_channel, adc_data, tRing, tDet); mRawMult++; mRawMultRing[tRing-5]++; int r = GetDetector(module,adc_channel)/100; int d = GetDetector(module,adc_channel) - r*100; if (adc_data > mLookupAdcThreshTable[module*32+adc_channel][2]) { mMult++; mMultRing[tRing-5]++; if(DebugMultiplicity) { cout<<"good : saving event ->"; cout << "module=" << module << " adc channel=" << adc_channel << " adc data =" << adc_data << endl; } uBallModule.push_back(module); uBallChannel.push_back(adc_channel); uBallData.push_back(adc_data); } } } // for (int i=0;i 0) if(DebugMultiplicity) cout<<"Done loop on fired ADCs in the event"<> num; for (int c=0; c<12; c++) inFile >> mLookupTable[r][c]; cout << num << " "; for (int c=0; c<12; c++) cout << mLookupTable[r][c] <<" "; cout<> mLookupAdcThreshTable[r][0] >> mLookupAdcThreshTable[r][1] >> mLookupAdcThreshTable[r][2]; cout << r<< "\t"<