#include #include using namespace std; Bool_t Debug = true; void UnpackMBCHI(){ cout << "important: uncomment the only branches you want to write around line 23 of TRootEvent/TRootEvent.cxx!"<Load("libMbs"); gSystem->Load("libMbsAPI"); gSystem->Load("libTCHIEvent"); gSystem->Load("libTMBALLEvent"); gSystem->Load("libTRootEvent"); gSystem->Load("libTCHIGridCsI"); string dir = getenv("VMCWORKDIR"); string caldir = dir + "/CALFILES/CHIMERA/"; string chipar = caldir + "gsieos.par"; string chiped = caldir + "asyeos.ped"; string chioffset = caldir + "r1428_v16112011.offset"; string chiecalib = caldir + "ecalib141111.txt"; string chiecalibrec = caldir + "dee.txt"; string chigrid = caldir + "grid_16032012.dat"; TRootDefine chitree; TRootCHIEvent *evt = 0; TRootMBallEvent *mevt = 0; chitree.Open("asyeosCHIMB.root"); chitree.GetTree()->SetTitle("AsyEos beam"); evt = chitree.GetCHIEvt(); mevt = chitree.GetMBallEvt(); int MBSTSh,MBSTSm,MBSTSs; int CHITSh,CHITSm,CHITSs; unsigned long int CHIMERA_TimeStamp, MBS_TimeStamp; int Trig_Patt; int bit_Trig_Patt[16]; vector pchim; Int_t time, de, fastpg, fastgg, slowpg, slowgg, timecsi; Float_t x,y; int idcode; TCHIEvent* chimera_evt = 0; chimera_evt = new TCHIEvent(chipar,2); chimera_evt->ProcessParFile(); chimera_evt->Get_Pedestal_Data(chiped.c_str()); chimera_evt->Get_Offset_Data(chioffset.c_str()); //identfication 02/09/2011 //20032012-> TMBALLEvent* mball_evt = 0; mball_evt = new TMBALLEvent(); mball_evt->LoadMapping("microball_mappingwTDC.txt"); mball_evt->LoadThresholds("adc_thresh.dat"); //20032012<- TCHIResult idr; //define results object TCHICsIGSIEnergy calib(chiecalib,chiecalibrec,caldir); //define calibration object calib.Init(); //init calibration TCHIGridCsI csigrid(chigrid); csigrid.ReadAsciiFile(); csigrid.Initialize(); //identfication 02/09/2011 int Nruns; TString InFile ; ifstream inputfile; inputfile.open("runlistMB.dat"); inputfile >> Nruns; int flag=-1; MbsFile* myMbs=0; Int_t *status=new Int_t; Int_t* sebuflenght=new Int_t; Short_t* setype=new Short_t; Short_t* sesubtype=new Short_t; Char_t* sesubcrate=new Char_t; Int_t* SubEventDataPtr=new Int_t; for(int irun=0;irun>InFile; myMbs= new MbsFile(InFile,status); cout << "$$$$$$$$$$$$$$$$$$$$$$$$$$$$" << endl; cout <PrintFileHeader(); Int_t lastevent=0; Int_t evnum=0; Int_t chievt=0; Int_t mbsevt=0; if(Debug) cout<<"Set here the number of events to be analysed: UnpackBasic2 L98"<GetSubEvent(j,sebuflenght,setype,sesubtype,sesubcrate); if((*setype==10) && (*sesubtype==1) && (*SubEventDataPtr==512)) { MBSTSs=*(SubEventDataPtr+1) & 0x0000ffff; MBSTSm=*(SubEventDataPtr+2) & 0x0000ffff; MBSTSh=*(SubEventDataPtr+3) & 0x0000ffff; mbsevt++; MBS_TimeStamp=MBSTSm*65535+MBSTSs; } //_________________________________________________________________________________________ //_____________________________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(); //paolo02042011 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(); } //_________________________________________________________________________________________ //_________________________________________________________________________________________ //_________________________________________________________________________________________ //_________________________________________________________________________________________ if((*setype==10) && (*sesubtype==1) && (*SubEventDataPtr==256)){ Int_t ftotfired=chimera_evt->ProcessCurrentEventMBS(SubEventDataPtr); chimera_evt->GetTiMeStamp(&CHITSs,&CHITSm,&CHITSh); CHIMERA_TimeStamp=CHITSm*65535+CHITSs; chievt++; multTOF = chimera_evt->GetTofMultiplicity(); chimera_evt->GetFired(pchim); int ntel = pchim.size(); int num = 0; int none; float tsumcsi=0; evt->tavecsi=-100; int ntcsi=0; for(int k=0; kGet_Data_Telescope(numtel, TOFSi,SI, LG,LG, &time, &de); chimera_evt->Get_Data_Telescope(numtel, SLOW, FAST,LG,LG, &slowpg, &fastpg); chimera_evt->Get_Data_Telescope(numtel, SLOW, FAST,HG,HG, &slowgg, &fastgg); chimera_evt->Get_Data_Telescope(numtel, TOF30,NONE,LG,LG, &timecsi,&none); if(numtel>=144 && numtel<=495) { csigrid.Identify(numtel, slowpg, fastpg, &idr); idcode=idr.Getcod(); if(idcode<10){ evt->IdA[num] = idr.GetA(); evt->Idcode[num] = idr.Getcod(); evt->IdPID[num] = idr.GetPID(); if(idr.GetZ()>10)cout << numtel <<" prima di ecalib"<Idcode[num] = idr.Getcod(); evt->IdE[num]= calib.GetDE(); evt->IdA[num] = idr.GetA(); evt->IdZ[num] = idr.GetZ(); if(idr.GetZ()>10)cout << numtel <<" dopo di ecalib"<Idnumtel[num]= numtel; evt->Idstopped[num]=idr.GetIfStopped(); evt->fastpg[num]= fastpg; evt->slowpg[num]= slowpg; num++; } } evt->Idmulti = num; if(timecsi && numtel >= 144 && numtel <= 495){ if(numtel==144)timecsi=0;if(numtel==154)timecsi=0;if(numtel==164)timecsi=0;if(numtel==174)timecsi=0; if(numtel==184)timecsi=0;if(numtel==194)timecsi=0;if(numtel==204)timecsi=0;if(numtel==214)timecsi=0; if(numtel==224)timecsi=0;if(numtel==234)timecsi=0;if(numtel==244)timecsi=0;if(numtel==254)timecsi=0; if(numtel==264)timecsi=0;if(numtel==274)timecsi=0;if(numtel==284)timecsi=0;if(numtel==294)timecsi=0; if(numtel==412)timecsi=0;if(numtel==460)timecsi=0;tsumcsi=tsumcsi+timecsi; if(timecsi!=0)ntcsi++; } } if (ntcsi)evt->tavecsi= tsumcsi/ntcsi; // chitree.GetTree()->Fill(); chimera_evt->Clear_fired_param(0); } } if(evnum==1){ cout << "###################################### evnum= " << evnum << endl; cout << "CHIMERA"<0){ if(evnum%2==1){ chitree.GetTree()->Fill(); // cout << " scrivo per i="<