#include Bool_t Debug = true; //void PrintMBALLEvent( int mball_evt,int uballi); void UnpackMB(){ cout << "important: uncomment the only branches you want to write around line 23 of TRootEvent/TRootEvent.cxx!"<Load("libMbs"); gSystem->Load("libMbsAPI"); gSystem->Load("libTMBALLEvent"); gSystem->Load("libTRootEvent"); TRootDefine chitree; chitree.Open("asyeosMB.root"); chitree.GetTree()->SetTitle("AsyEos beam"); TRootMBallEvent *mevt = 0; mevt = chitree.GetMBallEvt(); TMBALLEvent* mball_evt = 0; mball_evt = new TMBALLEvent(); mball_evt->LoadMapping("microball_mappingwTDC.txt"); // This is the ADC pedestal file for MBALL, even if the name is misleading (Paola) mball_evt->LoadThresholds("adc_thresh.dat"); int Nruns; TString InFile ; ifstream inputfile; inputfile.open("runlistMB.dat"); inputfile >> Nruns; if(Debug) cout<<"N runs to be analysed "<>InFile; myMbs= new MbsFile(InFile,status); cout << "$$$$$$$$$$$$$$$$$$$$$$$$$$$$____analysing run : "<< endl; cout <PrintFileHeader(); Int_t lastevent=0; Int_t evnum=0; if(Debug) cout<<"Set here the number of events to be analysed: UnpackBasic2 L59"<GetSubEvent(j,sebuflenght,setype,sesubtype,sesubcrate); //_________________________________________________________________________________________ //_____________________________MICROBALL subevent________________________________________________ if((*setype==36) && (*sesubtype==2700)) { if(Debug) cout<<"MICROBALL event"<ProcessCurrentEventMBS(SubEventDataPtr,*sebuflenght); if(Debug) cout<<"================Done in ProcessCurrentEventMBS()======"<IsHaloFired()<GetMBALLMultiplicity(); uballi++) { // mevt->uBallnRing = 4; int ADCmodule = mball_evt->uBallModule[uballi]; int ADCchannel = mball_evt->uBallChannel[uballi]; mevt->uBallModuleNum[unum] = ADCmodule; mevt->uBallChannelNum[unum] = ADCchannel; mevt->uBallDataRaw[unum] = mball_evt->uBallData[uballi]; mevt->uBallRingNum[unum] = mball_evt->GetDetectorRing(ADCmodule,ADCchannel); mevt->uBallDetNum[unum] = mball_evt->GetDetectorNumber(ADCmodule,ADCchannel); int ring = mball_evt->GetDetectorRing(ADCmodule,ADCchannel); int det = mball_evt->GetDetectorNumber(ADCmodule,ADCchannel); mevt->uBallTheta[unum] = mball_evt-> GetTheta(ring, det); mevt->uBallPhi[unum] = mball_evt-> GetPhi(ring, det); MperR[ring-5]++; unum++; //Recalculated multiplicity, it has to be = to GetMBALLMultiplicity() } if(unum != mball_evt->GetMBALLMultiplicity()) cout<<"unum : "<GetMBALLMultiplicity()<<" THEY ARE DIFFERENT!!"<uBallmulti = unum; //multiplicity above ADC pedestals for(int i=0;i<4;i++) { if(mball_evt->GetMBALLRingMultiplicity(i+5) != MperR[i]) cout<<"multiplicities per ring are different"<uBallmultiR[i] = mball_evt->GetMBALLRingMultiplicity(i+5); //multiplicity above ADC pedest per ring } //-----------------------Multiplicities saved----------------- //-----we save if the halo det has been fired or not ---Paola 28Oct2011 mevt->HaloDetFired = mball_evt->IsHaloFired(); chitree.GetTree()->Fill(); //for (int i = 0; i < mball_evt->GetMBALLMultiplicity() ; i++) { //cout << "EVENT OUT TO ROOT FILE ===== " << evt->uBallModuleNum[i] << endl; //cout << "EVENT OUT TO ROOT FILE ===== " << evt->uBallChannelNum[i] << endl; //cout << "EVENT OUT TO ROOT FILE ===== " << evt->uBallDataRaw[i] << endl; //} mball_evt->uBallModule.clear(); mball_evt->uBallChannel.clear(); mball_evt->uBallData.clear(); } //_________________________________________________________________________________________ //_________________________________________________________________________________________ //_________________________________________________________________________________________ //_________________________________________________________________________________________ //_________________________________________________________________________________ //_________________________________________________________________________________________ //_______________________________END of subevents!!____________________________________________ } if(Debug) cout<<"END OF LOOP ON SUBEVENTS"<CloseFile(); } } chitree.Close(); inputfile.close(); }