#define __WORDSIZE 64 #include #include #include #include #include #include #include "evioFileChannel.hxx" #include "cdcgeom.h" using namespace std; using namespace evio; // root include files #include "TApplication.h" // needed to display canvas #include "TSystem.h" #include "TFile.h" #include "TH1.h" #include "TH1F.h" #include "TH2F.h" #include "TH3F.h" #include "TF1.h" #include "TMath.h" #include "TTree.h" #include "TGraph.h" #include "TMultiGraph.h" #include "TCanvas.h" #include "TText.h" #include "TSpectrum.h" void analyzeEvent(evioDOMTree &eventTree); void analyzeBank(evioDOMNodeP bankPtr); void initRootTree(const char* filename); void fADC250DataDecode(unsigned int data); uint32_t swap_uint32( uint32_t val ); // ??? these need to be checked...ejw #define TDC_LOOKBACK 15794 // get this when configure TDC #define TDC_v2BIN_SIZE 0.058076 // ns/LSB #define TDC_v3BIN_SIZE 0.11615 // ns/LSB #define TDC_CAENBIN_SIZE 0.023475 // ns/LSB int ROLLOVER_COUNT = 65250; // get this when configure TDC //int ROLLOVER_COUNT = 65535; int DODisplayPS = 0; int DODisplayPSC = 0; int DODisplayTAGM = 0; int DODisplayTAGH = 0; int DODisplayBCAL = 0; int DODisplayTAC = 0; int DODisplayFCAL = 0; int DODisplayTOF = 0; int DODisplayST = 0; int DODisplay = 0; int DODisplayTDC = 0; int VERBOSE=0; int DOVis = 0; int DOCDCDisp = 0; int DOFDCDisp = 0; int TDCDATA = 0; int TDCDATAHIRES = 0; int BCALTDCDATA = 0; int FCALTDCDATA = 0; int STTDCDATA = 0; int TAGTDCDATA = 0; int TOFTDCDATA = 0; int TACDATA = 0; TCanvas *myc, *mycR, *mycSingle, *myD, *mycST, *mycPS, *mycTOF, *mycBCAL, *mycFCAL, *mycCDC, *mycFDC, *mycTDC, *mycTDC1, *mycTAGM, *mycTAGH, *myADCtime, *mycTAC; float ADCSamples[20][20][72][5000]; float ADCPedestal[20][20][72]; int TimeHitCounter[20][20][72]; float STADCSamples[1][2][16][5000]; float STADCPedestal[1][2][16]; float PSADCSamples[2][20][16][5000]; float PSADCPedestal[2][20][16]; float TAGMADCSamples[1][20][16][5000]; float TAGMADCPedestal[1][20][16]; float TAGHADCSamples[1][20][16][5000]; float TAGHADCPedestal[1][20][16]; float TOFADCSamples[1][20][16][5000]; float TOFADCPedestal[1][20][16]; float BCALADCSamples[10][20][16][1000]; float BCALADCPedestal[10][20][16]; float TACADCSamples[10][20][16][1000]; float TACADCPedestal[10][20][16]; float FCALADCSamples[15][20][16][2000]; float FCALADCPedestal[15][20][16]; float ADCPedSum[20][20][72]; float ADCPedSum2[20][20][72]; float STADCPedSum[20][20][72]; float STADCPedSum2[20][20][72]; float TAGMADCPedSum[20][20][72]; float TAGMADCPedSum2[20][20][72]; float PSADCPedSum[20][20][72]; float PSADCPedSum2[20][20][72]; float TAGHADCPedSum[20][20][72]; float TAGHADCPedSum2[20][20][72]; float TOFADCPedSum[1][20][16]; float TOFADCPedSum2[1][20][16]; float BCALADCPedSum[10][20][16]; float BCALADCPedSum2[10][20][16]; float FCALADCPedSum[10][20][16]; float FCALADCPedSum2[10][20][16]; float PedestalsOverTime[20][20][72][1000]; float PedestalsOverTimeSigma[20][20][72][1000]; int PedCounter; int OverThresh[20][20][72]; int TAGMOverThresh[1][20][16]; int PSOverThresh[2][20][16]; int TAGHOverThresh[1][20][16]; int STOverThresh[1][2][16]; int TOFOverThresh[1][20][16]; int BCALOverThresh[10][20][16]; int TACOverThresh[10][20][16]; int FCALOverThresh[15][20][16]; int STWindowSize; int PSWindowSize; int PSOVERTHRESH; int TAGMWindowSize; int TAGMOVERTHRESH; int TAGHWindowSize; int TAGHOVERTHRESH; int STOVERTHRESH; int TOFWindowSize; int TOFOVERTHRESH; int BCALWindowSize; int BCALOVERTHRESH; int TACOVERTHRESH; int FCALWindowSize; int FCALOVERTHRESH; int ROCSlots[20]; int WindowSize[20]; int HitCounts[2]; unsigned int ADCCheck[20][20][3]; float TDCData[4][20][48][20]; int TDChits[4][20][48]; float TDCDataBCAL[4][20][32][20]; int TDChitsBCAL[4][20][32]; float TDCDataST[1][20][32][20]; int TDChitsST[1][20][32]; float TDCDataTAG[1][20][32][20]; int TDChitsTAG[1][20][32]; float TDCDataTOF[1][20][32][20]; int TDChitsTOF[1][20][32]; int TDCHITCOUNTER[5]; //0=TOF, 1=FCAL, 2=FDC, 3=TAGGER, 4=ST int DetectorData[15]; int DetectorDataSZ[15]; int FDCCrates[12]; int EventCounter = 0; int CDCHitCounter = 0; double CDCHitX[3000]; double CDCHitY[3000]; void dodisplayTIMEupdate(int s); void dodisplayFCAL(); void dodisplayBCAL(); void dodisplayTAC(); void dodisplayTOF(int k); void dodisplayST(); void dodisplayPS(); void dodisplayTAGM(); void dodisplayTAGH(); void dodisplayT(int ROC, int S, int width, int C, char *c); void dodisplaySingles(int ROC, int S, int width, int C, char *c); void makeRings(); void drawRings(); void makeTranslationTable(); void doCDCdisplay(int width); void doFDCdisplay(int width); void initPedSums(); void doMeanPed(int N); void dodisplay(int t); TH1F* hists[6]; TH2F* hist2d[9]; int FDCTrigger=0; int CDCTrigger=0; int GOODTriggerTime = 0; int ERRORCHECK = 0; unsigned long EventNumber; unsigned long EventTime; unsigned long EVENTCounter; int CDCOnly; int ISCANCDC = 0; int ISCANFDC = 0; int evtCount = 0; int DEBUG = 0; int DEBUGGER = 0; int RunNumber = 0; int FInput=0; int FAInput=0; int FVInput=0; int FNInput=0; int TS3 = 0; int FoundSlot3; int FADC125DataFound; float HiresTDC[32][8]; int TheHiresTDC = 0; int HiresTDCcounter[32]; float TDCTriggerTime; float OldTOFVAL = 0; int TOFTriggerCounter = 1; TH1F *cosmic; // = new TH1F("cosmic","Trigger time trigger-cosmic",1200,100.,400.); TH1F *fdcwiretime; //= new TH1F("fdc","FDC wire time Wire-Trigger",1000,0.,4000.); TH1F *bcaltime; TH1F *sttime; TH1F *tagtime; TH1F *toftime; TH1F *tagmtime; TH1F *taghtime; TH2F *bcalvsst; TH1F *bcalhits; TH1F *pstime; TH1F *RFtime; TH2F *TDtime; TH1F *ADCTOFtime; TH1F *ADCFCALtime; TH1F *ADCBCALtime; TH1F *ADCSTtime; TH1F *ADCTAGHtime; TH1F *ADCTAGMtime; TH1F *ADCPStime; TH1F *ADCCDCtime; TH1F *ADCFDCtime; int Version = 0; void printhelp(){ cout<<"usage: scanevio -R # [Options]"<1776){ ROLLOVER_COUNT = 64678; } if (RunNumber>2010){ ROLLOVER_COUNT = 64466; } if (RunNumber>2600){ ROLLOVER_COUNT = 64466; } if (FAInput || FVInput){ sprintf(filename,"%s/Run%06d/hd_rawdata_%06d_%03d.evio",dirnam,RunNumber,RunNumber,Version); } if (FNInput){ sprintf(filename,"%s/tagm_calib_%d.0",dirnam,RunNumber); } RFtime = new TH1F("RFtime"," FDC1 CRATE: RFtime - TSTriggertime [ns]",6000, -1000., 1000.); TDtime = new TH2F("TDtime"," FDC1 CRATE: TDtime - TSTriggertime + c[ns]",500, 250., 300., 10, 0., 10.); RFtime->GetXaxis()->SetTitle("RFtime - TriggerTime [ns]"); TDtime->GetXaxis()->SetTitle("SDtime - TriggerTime [ns]"); TDtime->GetYaxis()->SetTitle("SD#"); // cosmic = new TH1F("cosmic","Trigger time trigger-cosmic",900,100.,400.); char t[126]; sprintf(t,"Trigger time trigger-cosmic RUN%d ",RunNumber); cosmic = new TH1F("cosmic",t,2000,-5000.,9000.); cosmic->GetXaxis()->SetTitle("ch16-ch9 (TS-Cosmic) [ns]"); cosmic->GetXaxis()->SetTitleSize(0.07); cosmic->GetXaxis()->SetLabelSize(0.065); cosmic->GetYaxis()->SetLabelSize(0.065); cosmic->GetXaxis()->SetTitleOffset(0.75); cosmic->GetXaxis()->SetTitleFont(32); cosmic->GetXaxis()->SetTitleColor(9); fdcwiretime = new TH1F("fdcwiretime","FDC wire time Wire-Trigger",2000,-500.,8000.); fdcwiretime->GetXaxis()->SetTitle("wire-ch16 (bcal-TS) [ns]"); fdcwiretime->GetXaxis()->SetTitleSize(0.07); fdcwiretime->GetXaxis()->SetLabelSize(0.065); fdcwiretime->GetYaxis()->SetLabelSize(0.065); fdcwiretime->GetXaxis()->SetTitleOffset(0.75); fdcwiretime->GetXaxis()->SetTitleFont(32); fdcwiretime->GetXaxis()->SetTitleColor(9); bcaltime = new TH1F("bcaltime","BCAL time BCAL-Trigger",4000,-500.,4000.); bcaltime->GetXaxis()->SetTitle("bcal-ch16 (bcal-TS) [ns]"); bcaltime->GetXaxis()->SetTitleSize(0.07); bcaltime->GetXaxis()->SetLabelSize(0.065); bcaltime->GetYaxis()->SetLabelSize(0.065); bcaltime->GetXaxis()->SetTitleFont(32); bcaltime->GetXaxis()->SetTitleOffset(0.75); bcaltime->GetXaxis()->SetTitleColor(9); //sttime = new TH1F("sttime","ST time ST-Trigger",8000,500.,2500.); sttime = new TH1F("sttime","ST time ST-Trigger",8000,-8000.,8000.); sttime->GetXaxis()->SetTitle("st-ch16 (st-TS) [ns]"); sttime->GetXaxis()->SetTitleSize(0.07); sttime->GetXaxis()->SetLabelSize(0.065); sttime->GetYaxis()->SetLabelSize(0.065); sttime->GetXaxis()->SetTitleOffset(0.75); sttime->GetXaxis()->SetTitleFont(32); sttime->GetXaxis()->SetTitleColor(9); tagtime = new TH1F("tagtime","TAGGER(H&M) time TAGGER-Trigger",6000,-8000.,8000.); tagtime->GetXaxis()->SetTitle("TAG(M/H)-ch16 (TAGGER-Trigger) [ns]"); tagtime->GetXaxis()->SetTitleSize(0.07); tagtime->GetXaxis()->SetLabelSize(0.065); tagtime->GetYaxis()->SetLabelSize(0.065); tagtime->GetXaxis()->SetTitleOffset(0.75); tagtime->GetXaxis()->SetTitleFont(32); tagtime->GetXaxis()->SetTitleColor(9); toftime = new TH1F("toftime","TOF time TOF-Trigger",8400,-200.,4000.); toftime->GetXaxis()->SetTitle("TOF-S8ch17 (TOF-Trigger) [ns]"); toftime->GetXaxis()->SetTitleSize(0.07); toftime->GetXaxis()->SetLabelSize(0.065); toftime->GetYaxis()->SetLabelSize(0.065); toftime->GetXaxis()->SetTitleOffset(0.75); toftime->GetXaxis()->SetTitleFont(32); toftime->GetXaxis()->SetTitleColor(9); tagmtime = new TH1F("tagmtime","TAGM ADC Time",400, 10., 400.); tagmtime->GetXaxis()->SetTitle("TaggerM ADC time [samples]"); tagmtime->GetXaxis()->SetTitleSize(0.07); tagmtime->GetXaxis()->SetLabelSize(0.065); tagmtime->GetYaxis()->SetLabelSize(0.065); tagmtime->GetXaxis()->SetTitleOffset(0.75); tagmtime->GetXaxis()->SetTitleFont(32); tagmtime->GetXaxis()->SetTitleColor(9); taghtime = new TH1F("taghtime","TAGH ADC Time",400, 10., 400.); taghtime->GetXaxis()->SetTitle("TaggerH ADC time [samples]"); taghtime->GetXaxis()->SetTitleSize(0.07); taghtime->GetXaxis()->SetLabelSize(0.065); taghtime->GetYaxis()->SetLabelSize(0.065); taghtime->GetXaxis()->SetTitleOffset(0.75); taghtime->GetXaxis()->SetTitleFont(32); taghtime->GetXaxis()->SetTitleColor(9); pstime = new TH1F("pstime","PS ADC Time", 400, 10., 400.); pstime->GetXaxis()->SetTitle("PS ADC time [samples]"); pstime->GetXaxis()->SetTitleSize(0.07); pstime->GetXaxis()->SetLabelSize(0.065); pstime->GetYaxis()->SetLabelSize(0.065); pstime->GetXaxis()->SetTitleOffset(0.75); pstime->GetXaxis()->SetTitleFont(32); pstime->GetXaxis()->SetTitleColor(9); ADCFDCtime = new TH1F("ADCFDCtime","FDC ADC Time", 400, 0., 800.); ADCFDCtime->GetXaxis()->SetTitle("FDC ADC time [ns]"); ADCFDCtime->GetXaxis()->SetTitleSize(0.07); ADCFDCtime->GetXaxis()->SetLabelSize(0.065); ADCFDCtime->GetYaxis()->SetLabelSize(0.065); ADCFDCtime->GetXaxis()->SetTitleOffset(0.75); ADCFDCtime->GetXaxis()->SetTitleFont(32); ADCFDCtime->GetXaxis()->SetTitleColor(9); ADCCDCtime = new TH1F("ADCCDCtime","CDC ADC Time", 400, 0., 1600.); ADCCDCtime->GetXaxis()->SetTitle("CDC ADC time [ns]"); ADCCDCtime->GetXaxis()->SetTitleSize(0.07); ADCCDCtime->GetXaxis()->SetLabelSize(0.065); ADCCDCtime->GetYaxis()->SetLabelSize(0.065); ADCCDCtime->GetXaxis()->SetTitleOffset(0.75); ADCCDCtime->GetXaxis()->SetTitleFont(32); ADCCDCtime->GetXaxis()->SetTitleColor(9); ADCTOFtime = new TH1F("ADCTOFtime","TOF ADC Time", 400, 10., 400.); ADCTOFtime->GetXaxis()->SetTitle("TOF ADC time [ns]"); ADCTOFtime->GetXaxis()->SetTitleSize(0.07); ADCTOFtime->GetXaxis()->SetLabelSize(0.065); ADCTOFtime->GetYaxis()->SetLabelSize(0.065); ADCTOFtime->GetXaxis()->SetTitleOffset(0.75); ADCTOFtime->GetXaxis()->SetTitleFont(32); ADCTOFtime->GetXaxis()->SetTitleColor(9); ADCBCALtime = new TH1F("ADCBCALtime","BCAL ADC Time", 400, 10., 400.); ADCBCALtime->GetXaxis()->SetTitle("BCAL ADC time [ns]"); ADCBCALtime->GetXaxis()->SetTitleSize(0.07); ADCBCALtime->GetXaxis()->SetLabelSize(0.065); ADCBCALtime->GetYaxis()->SetLabelSize(0.065); ADCBCALtime->GetXaxis()->SetTitleOffset(0.75); ADCBCALtime->GetXaxis()->SetTitleFont(32); ADCBCALtime->GetXaxis()->SetTitleColor(9); ADCFCALtime = new TH1F("ADCFCALtime","FCAL ADC Time", 400, 10., 400.); ADCFCALtime->GetXaxis()->SetTitle("FCAL ADC time [ns]"); ADCFCALtime->GetXaxis()->SetTitleSize(0.07); ADCFCALtime->GetXaxis()->SetLabelSize(0.065); ADCFCALtime->GetYaxis()->SetLabelSize(0.065); ADCFCALtime->GetXaxis()->SetTitleOffset(0.75); ADCFCALtime->GetXaxis()->SetTitleFont(32); ADCFCALtime->GetXaxis()->SetTitleColor(9); ADCSTtime = new TH1F("ADCSTtime","ST ADC Time", 400, 10., 400.); ADCSTtime->GetXaxis()->SetTitle("ST ADC time [ns]"); ADCSTtime->GetXaxis()->SetTitleSize(0.07); ADCSTtime->GetXaxis()->SetLabelSize(0.065); ADCSTtime->GetYaxis()->SetLabelSize(0.065); ADCSTtime->GetXaxis()->SetTitleOffset(0.75); ADCSTtime->GetXaxis()->SetTitleFont(32); ADCSTtime->GetXaxis()->SetTitleColor(9); ADCTAGHtime = new TH1F("ADCTAGHtime","TAGH ADC Time", 400, 10., 400.); ADCTAGHtime->GetXaxis()->SetTitle("TAGH ADC time [ns]"); ADCTAGHtime->GetXaxis()->SetTitleSize(0.07); ADCTAGHtime->GetXaxis()->SetLabelSize(0.065); ADCTAGHtime->GetYaxis()->SetLabelSize(0.065); ADCTAGHtime->GetXaxis()->SetTitleOffset(0.75); ADCTAGHtime->GetXaxis()->SetTitleFont(32); ADCTAGHtime->GetXaxis()->SetTitleColor(9); ADCTAGMtime = new TH1F("ADCTAGMtime","TAGH ADC Time", 400, 10., 400.); ADCTAGMtime->GetXaxis()->SetTitle("TAGM ADC time [ns]"); ADCTAGMtime->GetXaxis()->SetTitleSize(0.07); ADCTAGMtime->GetXaxis()->SetLabelSize(0.065); ADCTAGMtime->GetYaxis()->SetLabelSize(0.065); ADCTAGMtime->GetXaxis()->SetTitleOffset(0.75); ADCTAGMtime->GetXaxis()->SetTitleFont(32); ADCTAGMtime->GetXaxis()->SetTitleColor(9); ADCPStime = new TH1F("ADCPStime","PS ADC Time", 400, 10., 400.); ADCPStime->GetXaxis()->SetTitle("PS ADC time [ns]"); ADCPStime->GetXaxis()->SetTitleSize(0.07); ADCPStime->GetXaxis()->SetLabelSize(0.065); ADCPStime->GetYaxis()->SetLabelSize(0.065); ADCPStime->GetXaxis()->SetTitleOffset(0.75); ADCPStime->GetXaxis()->SetTitleFont(32); ADCPStime->GetXaxis()->SetTitleColor(9); bcalvsst = new TH2F("bcalvsst","Bcal_Time vs ST_Time", 800,700.,1100., 800.,700.,1100.); bcalvsst->GetXaxis()->SetTitle("ST time [ns]"); bcalvsst->GetXaxis()->SetTitleSize(0.07); bcalvsst->GetXaxis()->SetLabelSize(0.065); bcalvsst->GetYaxis()->SetLabelSize(0.065); bcalvsst->GetXaxis()->SetTitleOffset(0.75); bcalvsst->GetXaxis()->SetTitleFont(32); bcalvsst->GetXaxis()->SetTitleColor(9); bcalvsst->GetYaxis()->SetTitle("BCAL time [ns]"); bcalvsst->GetYaxis()->SetTitleSize(0.07); bcalvsst->GetYaxis()->SetLabelSize(0.065); bcalvsst->GetYaxis()->SetTitleOffset(0.75); bcalvsst->GetYaxis()->SetTitleFont(32); bcalvsst->GetYaxis()->SetTitleColor(9); bcalhits = new TH1F("bcalhits","BCAL TDC hits", 4000, 10., 4000.); initROC2Board(); ofstream OUTF; char gf[128]; sprintf(gf,"fdcevents_run%d.dat",RunNumber); OUTF.open(gf); TApplication theApp("App", &argc, argv); sprintf(gf,"DetectorAnal_run%d.root",RunNumber); TFile *ROOTFile = new TFile(gf, "recreate"); ROOTFile->cd(); hists[0] = new TH1F("hists0", "Trigger Multiplicity",18, -0.5,17.5); hists[1] = new TH1F("hists1", "FDC Trigger Delta T",200, -100., 100); hists[2] = new TH1F("hists2", "FDCTRIGGER SUM of drift time spectra",1500, -500., 1000.); hists[3] = new TH1F("hists3", "FDCTRIGGER FDC wire hits",30, -0.5, 29.5); hists[4] = new TH1F("hists4", "ALLTRIGGER SUM of drift time spectra",1500, -500., 1000.); hists[5] = new TH1F("hists5", "ALLTRIGGER FDC wire hits",30, -0.5, 29.5); hist2d[0] = new TH2F("hist2d0", "FDCTRIGGER ROCFDC1 TDC data", 1000, -2000., 2000., 780, -0.5, 779.5); hist2d[1] = new TH2F("hist2d1", "FDCTRIGGER ROCFDC4 TDC data", 1000, -2000., 2000., 780, -0.5, 779.5); hist2d[2] = new TH2F("hist2d2", "FDCTRIGGER ROCFDC13 TDC data", 1000, -2000., 2000., 780, -0.5, 779.5); hist2d[3] = new TH2F("hist2d3", "FDCTRIGGER ROCFDC14 TDC data", 1000, -2000., 2000., 780, -0.5, 779.5); hist2d[4] = new TH2F("hist2d4", "ALLTRIGGER ROCFDC1 TDC data", 1000, -2000., 2000., 780, -0.5, 779.5); hist2d[5] = new TH2F("hist2d5", "ALLTRIGGER ROCFDC4 TDC data", 1000, -2000., 2000., 780, -0.5, 779.5); hist2d[6] = new TH2F("hist2d6", "ALLTRIGGER ROCFDC13 TDC data", 1000, -2000., 2000., 780, -0.5, 779.5); hist2d[7] = new TH2F("hist2d7", "ALLTRIGGER ROCFDC14 TDC data", 1000, -2000., 2000., 780, -0.5, 779.5); hist2d[8] = new TH2F("hist2d8", "Number of Wire Hits vs. delta Time", 100, -50., 50., 50, -0.5, 49.5); if (DOCDCDisp){ mycCDC = new TCanvas("mycCDC","CDC flash ADC data",200,10,1000,700); mycCDC->SetFillColor(42); mycCDC->cd(); mycCDC->SetGrid(); mycCDC->Draw(); //gPad->Update(); } if ( DOFDCDisp){ mycFDC = new TCanvas("mycFDC","FDC flash ADC data",200,10,1000,700); mycFDC->SetFillColor(42); mycFDC->cd(); mycFDC->SetGrid(); mycFDC->Draw(); } if (DODisplayST){ mycST = new TCanvas("mycST","ST flash ADC data",200,10,1000,700); mycST->SetFillColor(42); mycST->Divide(1,2); mycST->cd(1); mycST->SetGrid(); mycST->cd(2); mycST->SetGrid(); mycST->Draw(); } if (DODisplayPS){ mycPS = new TCanvas("mycPS","PS flash ADC data",200,10,1000,700); mycPS->SetFillColor(42); mycPS->SetGrid(); } if (DODisplayTAGM){ mycTAGM = new TCanvas("mycTAGM","TAGM flash ADC data",200,10,1000,700); mycTAGM->SetFillColor(42); mycTAGM->SetGrid(); } if (DODisplayTAGH){ mycTAGH = new TCanvas("mycTAGH","TAGH flash ADC data",200,10,1000,700); mycTAGH->SetFillColor(42); mycTAGH->SetGrid(); } if (DODisplayTOF){ mycTOF = new TCanvas("mycTOF","TOF raw data samples",200,10,1000,700); mycTOF->SetFillColor(42); mycTOF->SetGrid(); mycTOF->Draw(); } if (DODisplayBCAL){ mycBCAL = new TCanvas("mycBCAL","BCAL raw data samples",200,10,1000,700); mycBCAL->SetFillColor(42); mycBCAL->SetGrid(); mycBCAL->Draw(); } if (DODisplayTAC){ mycTAC = new TCanvas("mycTAC","TAC raw data samples",200,10,1000,700); mycTAC->SetFillColor(42); mycTAC->SetGrid(); mycTAC->Draw(); } if (DODisplayFCAL){ mycFCAL = new TCanvas("mycFCAL","FCAL raw data samples",200,10,1000,700); mycFCAL->SetFillColor(42); mycFCAL->SetGrid(); mycFCAL->Draw(); } if (DODisplayTDC){ mycTDC = new TCanvas("mycTDC","TDC data",200,10,1000,700); mycTDC->SetFillColor(42); mycTDC->SetGrid(); mycTDC->Draw(); mycTDC1 = new TCanvas("mycTDC1","TDC data cont.",200,10,1000,700); mycTDC1->SetFillColor(42); mycTDC1->SetGrid(); mycTDC1->Draw(); } if (DODisplay){ myADCtime = new TCanvas("myADCtime","ADC TIMING",200,10,1000,700); myADCtime->SetFillColor(42); myADCtime->Divide(2,3); for (int s=1;s<7;s++){ myADCtime->cd(s); myADCtime->SetGrid(); } myADCtime->Draw(); } if (DOVis){ mycR = new TCanvas("mycR","CDC Center View",200,10,700,700); mycR->SetFillColor(42); mycR->SetGrid(); mycR->Draw(); } // try { evtCount = 0; int imod = 100; int OK = 1; PedCounter = 0; initPedSums(); // create evio file channel object using first arg as file name char ofnam[128]; sprintf(ofnam,"/gluonraid2/Users/zihlmann/fdctriggerdata_run%d.evio",RunNumber); evioFileChannel EvioOutChan(ofnam,"w",8000000); EvioOutChan.open(); while (OK) { ostringstream ss; ss<10){ sprintf(ifnam,"/gluonraid2/Users/hdcdcops/%srun%s_%d.evio",prefix,str1.c_str(),OK-1); } } else { sprintf(ifnam,"%s",filename); //sprintf(ifnam,"/gluonraid2/rawdata/active/RunPeriod000/DAQtesting/mc_%d_%d.evio",RunNumber,OK-1); //if (OK>10){ // sprintf(ifnam,"/gluonraid2/rawdata/active/RunPeriod000/DAQtesting/mc_%d_%d.evio",RunNumber,OK-1); //} } cout<<"test file "<20000){ ddd = 1; } } //if (EVENTCounter%1000 == 0){ if (ddd){ cout<<"Event: "<0){ cout<<" OK "; } else { cout<<" ? "; } } cout<0) { for (int n=0;nFill(dt); } } } } } vector BcalTimes; if (TDCHITCOUNTER[1]){ for (int k=0; k<4; k++) { for (int i=0; i<12; i++) { for (int j=0; j<32; j++) { if (TDChitsBCAL[k][i][j]>0) { float dt = TDCDataBCAL[k][i][j][0] - HiresTDC[8][0]; if (dt<0){ dt += ROLLOVER_COUNT*TDC_v2BIN_SIZE; } else if (dt>4000.) { dt -= ROLLOVER_COUNT*TDC_v2BIN_SIZE; } bcaltime->Fill(dt); BcalTimes.push_back(dt); if (dt<1000){ //cout<Fill((float)idx); } //cout< STTimes; if (TDCHITCOUNTER[4]){ float EarliestTime=9999999999999.; int found = 0; for (int i=0; i<3; i++) { for (int j=0; j<32; j++) { if (TDChitsST[0][i][j]>0) { float dt = TDCDataST[0][i][j][0] - HiresTDC[8][0]; if (dt<0){ dt += ROLLOVER_COUNT*TDC_v2BIN_SIZE; } else if (dt>4000.) { dt -= ROLLOVER_COUNT*TDC_v2BIN_SIZE; } sttime->Fill(dt); if (dtFill(STTimes[n], BcalTimes[n]); } } if (TDCHITCOUNTER[3]){ for (int i=0; i<12; i++) { for (int j=0; j<32; j++) { if (TDChitsTAG[0][i][j]>0) { for (int n=0;n4000.) { dt -= ROLLOVER_COUNT*TDC_v2BIN_SIZE; } tagtime->Fill(dt); //cout<4000.) { d -= ROLLOVER_COUNT*TDC_v2BIN_SIZE; } cosmic->Fill(d); for (int k=0; k<4; k++) { for (int i=0; i<12; i++) { for (int j=0; j<48; j++) { if (TDChits[k][i][j]>0) { float dt = TDCData[k][i][j][0] - HiresTDC[15][0]; float dt1 = TDCData[k][i][j][0] - HiresTDC[8][0]; if (dt<0){ dt += ROLLOVER_COUNT*TDC_v3BIN_SIZE; dt1 += ROLLOVER_COUNT*TDC_v3BIN_SIZE; } else if (dt>4000.) { dt -= ROLLOVER_COUNT*TDC_v2BIN_SIZE; dt1 -= ROLLOVER_COUNT*TDC_v2BIN_SIZE; } else if (dt>8000.) { dt -= 2*ROLLOVER_COUNT*TDC_v2BIN_SIZE; dt1 -= 2*ROLLOVER_COUNT*TDC_v2BIN_SIZE; } fdcwiretime->Fill(dt); cosmic->Fill(dt1); //cout<Fill( dt, (float)(i*48+j)); hists[2]->Fill(dt); } hist2d[k+4]->Fill( dt, (float)(i*48+j)); hists[4]->Fill(dt); WireHitsALL++; } } } } hists[3]->Fill((float)WireHits); hists[5]->Fill((float)WireHitsALL); if (FDCTrigger){ float t = TDCData[0][12][4][0] - TDCData[0][12][6][0]; hist2d[8]->Fill(t, (float)WireHits); t = fabs(t); if (fabs(t-27.)<8.){ OUTF<1){ for (int k=0;k<4;k++){ for (int j=0;j10){ s +=2; } //cout<<"ROCCDC"<10){ for (int k=4;k<14;k++){ /* int rid = k-2; if (k>5){ rid = k-1; } */ for (int j=0;j10){ s +=2; } //cout<<"ROCFDC"<3){ ROC = k-2; sprintf(Det,"ROCFDC%d",ROC); } if (k>5){ ROC = k-1; sprintf(Det,"ROCFDC%d",ROC); } for (int j=0;j10){ slot+=2; } cout<Write(); } for (int k=0; k<9;k++){ hist2d[k]->Write(); } for (int k=0;k<14;k++){ for (int i=0;i3) && (k<6)){ ROC = k-2; } else if (k>5){ ROC = k - 1; } int SL = i+3; if (SL>10){ SL +=2; } sprintf(hnamp,"CDC_ROC%dSLOT%d_Ped",ROC,SL); sprintf(hnams,"CDC_ROC%dSLOT%d_Sig",ROC,SL); char htitp[128]; char htits[128]; sprintf(htitp,"Pedestal CDCROC %d, Slot %d",ROC,SL); sprintf(htits,"Sigma CDCROC %d, Slot %d",ROC,SL); if (k>3){ sprintf(hnamp,"FDC_ROC%dSLOT%d_Ped",ROC,SL); sprintf(hnams,"FDC_ROC%dSLOT%d_Sig",ROC,SL); sprintf(htitp,"Pedestal FDCROC %d, Slot %d",ROC,SL); sprintf(htits,"Sigma FDCROC %d, Slot %d",ROC,SL); } TH2F *h2dp = new TH2F(hnamp, htitp, 1000, 0, 1000., 72, 0., 72.); TH2F *h2ds = new TH2F(hnams, htits, 1000, 0, 1000., 72, 0., 72.); for (int j=0;j<72;j++){ sprintf(hnamp,"CDCR%dS%dC%dPed",ROC,SL,j); sprintf(hnams,"CDCR%dS%dC%dSig",ROC,SL,j); sprintf(htitp,"Pedestal CDCROC %d, Slot %d, Channel %d",ROC,SL,j); sprintf(htits,"Sigma CDCROC %d, Slot %d, Channel %d",ROC,SL,j); if (k>3){ sprintf(hnamp,"FDCR%dS%dC%dPed",ROC,SL,j); sprintf(htitp,"Pedestal FDCROC %d, Slot %d, Channel %d",ROC,SL,j); sprintf(hnams,"FDCR%dS%dC%dSig",ROC,SL,j); sprintf(htits,"Sigma FDCROC %d, Slot %d, Channel %d",ROC,SL,j); } TH1F *hp = new TH1F(hnamp, htitp,1000,0.,1000.); TH1F *hs = new TH1F(hnams, htits,1000,0.,1000.); for (int n=0;nFill((float)n, PedestalsOverTime[k][i][j][n]); hs->Fill((float)n, PedestalsOverTimeSigma[k][i][j][n]); h2dp->Fill((float)n, (float)j, PedestalsOverTime[k][i][j][n]); h2ds->Fill((float)n, (float)j, PedestalsOverTimeSigma[k][i][j][n]); } //hp->Write(); //hs->Write(); } h2dp->Write(); h2ds->Write(); } } ROOTFile->Close(); //delete ROOTFile; std::cout<begin(); iter1!=bList->end(); iter1++) { evioDOMNodeList *pChildList = (*iter1)->getChildList(); int counter=0; if (pChildList->size() >0) { evioDOMNodeList::const_iterator cIter; for (cIter=pChildList->begin(); cIter!=pChildList->end(); cIter++) { //cout << "child has tag: " << (*cIter)->tag << endl; if (counter == 0){ counter++; const vector *vec = (*cIter)->getVector(); //cout<()); CDCHitCounter = 0; // analyze each bank memset(OverThresh,0,20*20*72*4); memset(STOverThresh,0,2*16*4); memset(PSOverThresh,0,2*20*16*4); memset(TAGMOverThresh,0,20*16*4); memset(TAGHOverThresh,0,20*16*4); memset(TOFOverThresh,0,20*16*4); memset(BCALOverThresh,0,10*20*16*4); memset(TACOverThresh,0,10*20*16*4); memset(FCALOverThresh,0,15*20*16*4); memset(TimeHitCounter,0,20*20*72*4); memset(STADCSamples,0,4*2*16*500); memset(TOFADCSamples,0,4*20*16*500); memset(BCALADCSamples,0,4*10*20*16*1000); memset(TACADCSamples,0,4*10*20*16*1000); memset(FCALADCSamples,0,4*15*20*16*200); STOVERTHRESH = 0; PSOVERTHRESH = 0; TAGMOVERTHRESH = 0; TAGHOVERTHRESH = 0; TOFOVERTHRESH = 0; BCALOVERTHRESH = 0; TACOVERTHRESH = 0; FCALOVERTHRESH = 0; //if ((TDCDATA) || (BCALTDCDATA) || (FCALTDCDATA)|| (STTDCDATA) || (TDCDATAHIRES)){ // cout<begin(),bankList->end(),analyzeBank); if (DOVis){ drawRings(); } } int DATAWORDCounter = 0; int OLDSlot =0; void analyzeBank(evioDOMNodeP bankPtr) { if ((bankPtr->tag&0x0fff) == 85) return; // dump bank info for all banks // cout << hex << left << "bank content type: 0x" << setw(6) << bankPtr->getContentType() // << " tag: 0x" << setw(6) << bankPtr->tag // << " num: 0x" << setw(6) << (int)bankPtr->num << dec << endl; evioDOMNodeP data_bank = bankPtr->getParent(); if( data_bank==NULL ) { if(VERBOSE==9) cout << " bank has no parent. skipping ... " << endl; return; } evioDOMNodeP physics_event_bank = data_bank->getParent(); if( physics_event_bank==NULL ){ if(VERBOSE==9) cout << " bank has no grandparent. skipping ... " << endl; return; } if( physics_event_bank->getParent() != NULL ){ if(VERBOSE==9) cout << " bank DOES have great-grandparent. skipping ... " << endl; return; // physics event bank should have no parent! } if(VERBOSE==9){ cout << " Physics Event Bank: tag=" << physics_event_bank->tag << " num=" << (int)physics_event_bank->num << dec << endl; cout << " Data Bank: tag=" << data_bank->tag << " num=" << (int)data_bank->num << dec << endl; } if((data_bank->tag & 0xFF00) == 0xFF00){ if(VERBOSE==9) cout << " Data Bank tag is in reserved CODA range. This bank is not ROC data. Skipping ..." << endl; return; } if(VERBOSE==9) cout << " bank lineage check OK. Continuing with parsing ... " << endl; // Get data from bank in the form of a vector of uint32_t const vector *vec = bankPtr->getVector(); //const uint32_t *iptr = &(*vec)[0]; //const uint32_t *iend = &(*vec)[vec->size()]; if(VERBOSE==6) cout << " uint32_t bank has " << vec->size() << " words" << endl; //cout<tag == 65313) { cout<<"65313 New event"<tag == 83) || (data_bank->tag == 84) ){ // // PAIR SPECTROMETER DATA int Sz; Sz = vec->size(); //cout<<"PS DATA ROC "<tag<<" size" <0)){ int ROCID=data_bank->tag-83; char Detector[128]; sprintf(Detector,"PS"); int OLDSLOT; int SLOTNUM, CHANNEL,WSize,DATAReady; int slotidx,idx; //int MaxSlot; float ped,adc1,adc2; int pedcnt; DATAReady = 0; for (int k=0; kdata[Indx]); unsigned int data = (*vec)[k]; //cout<<"0x"<>27) == 0x10) { // Block Header SLOTNUM = ((data& 0x07C00000)>>22); if (SLOTNUM!=OLDSLOT){ //cout<10){ slotidx -= 2; } //MaxSlot = slotidx; } else if ( ((data & 0xf8000000) >> 27) == 0x18) { // this is pulse time //int chan = (data>>23)&0xFFFF; //int qual = (data>>19) & 0x3; //cout<Fill((float)time/64.*4.); } else if (((data & 0xf8000000)>>27) == 0x14) { CHANNEL = ((data & 0x7e00000)>>23) ; // WSize = (data & 0xFFF); PSWindowSize = WSize; //cout<0) { // Window Raw Data values DATAReady--; if (pedcnt<20){ adc1 = (float)((data & 0x1FFF0000) >> 16); adc2 = (float)(data & 0x1FFF); ped += adc1; ped += adc2; PSADCSamples[ROCID][slotidx][CHANNEL][idx++] = adc1; PSADCSamples[ROCID][slotidx][CHANNEL][idx++] = adc2; pedcnt+=2; if (pedcnt>19){ ped /= 20.; PSADCPedestal[ROCID][slotidx][CHANNEL] = ped; PSADCPedSum[ROCID][slotidx][CHANNEL] += ped; PSADCPedSum2[ROCID][slotidx][CHANNEL] += ped*ped; } } else { adc1 = (float)((data & 0x1FFF0000) >> 16); adc2 = (float)(data & 0x1FFF); PSADCSamples[ROCID][slotidx][CHANNEL][idx++] = adc1; PSADCSamples[ROCID][slotidx][CHANNEL][idx++] = adc2; if( (adc1-PSADCPedestal[ROCID][slotidx][CHANNEL])>10. || (adc2-PSADCPedestal[ROCID][slotidx][CHANNEL])>10.) { PSOverThresh[ROCID][slotidx][CHANNEL] = 1; PSOVERTHRESH++; } } } } } } else if ( (data_bank->tag == 95)){ // ST TDCs // START COUNTER DATA DetectorData[0]++; DetectorDataSZ[0] = vec->size() ; if (STTDCDATA){ cout<tag <size();k++){ if (((*vec)[k]>>27) == 0x12){ //eventNum = (*vec)[k] & 0x3fffff; slot = ((*vec)[k]>>22) & 0x1f; if (slot<11){ SLOTID = slot - 3; } else { SLOTID = slot - 5; } } if (((*vec)[k]>>27) == 0x17){ chip = ((*vec)[k]>>19) & 0x7; channel = ((*vec)[k]>>16) & 0x7; time = (float)((*vec)[k] & 0xffff); //cout<size();k++){ unsigned int data = (*vec)[k]; if(data == 0xd00dd00d) {continue;} type = data>>27; switch(type){ case 0b01000: // Global Header slot = data & 0x1f; event_count = (data>>5) & 0xffffff; SLOTID = slot-3; if (slot>10){ SLOTID -=2; } break; case 0b10000: // Global Trailer slot = data & 0x1f; //word_count = (data>>5) & 0x7ffff; slot = event_count = 0; break; case 0b10001: // Global Trigger Time Tag //trigger_time_tag = (data>>5) & 0x7ffffff; break; case 0b00001: // TDC Header //tdc_num = (data>>24) & 0x03; //event_id = (data>>12) & 0x0fff; //bunch_id = data & 0x0fff; break; case 0b00000: // TDC Measurement //edge = (data>>26) & 0x01; channel = (data>>21) & 0x1f; tdc = (data>>0) & 0x1fffff; time = (float)tdc * TDC_CAENBIN_SIZE; TDCHITCOUNTER[0]++; TDCDataTOF[ ROCID ][ SLOTID ][ channel ][ TDChitsTOF[ROCID][SLOTID][channel]++ ] = time; if (TOFTDCDATA){ cout<<"HIRES TOF TDC: "<tag == 33) || (data_bank->tag == 36) || (data_bank->tag == 39) || (data_bank->tag == 42)) { // TDC BCAL DetectorData[3]++; DetectorDataSZ[3] += vec->size() ; if (BCALTDCDATA){ //cout<<"BCAL ROC :"<tag <tag; int ROCID = (tag1-33)/3; for (unsigned int k=0; ksize();k++){ if (((*vec)[k]>>27) == 0x12){ //eventNum = (*vec)[k] & 0x3fffff; slot = ((*vec)[k]>>22) & 0x1f; if (slot<11){ SLOTID = slot - 3; } else { SLOTID = slot - 5; } } if (((*vec)[k]>>27) == 0x17){ chip = ((*vec)[k]>>19) & 0x7; channel = ((*vec)[k]>>16) & 0x7; time = (float)((*vec)[k] & 0xffff); //cout<tag << " "<< (int)data_bank->getContentType()<<" " <isContainer()<<" "<isLeaf()<<" "<tag <size() ; int channel,chip,slot; //int eventNum; float time; int SLOTID; int TDCID; static int THCnt[32]; static float TDC17[32]; static float TimeHits[32][20]; HitCnt = 0; TDCID = data_bank->tag - 51; if(data_bank->tag == 54){ TDCID = 1; } else if(data_bank->tag == 63){ TDCID = 2; } else if(data_bank->tag == 64){ TDCID = 3; } if (TDCDATA){ cout<size(); for (int k=0; k>27) == 0x12){ //eventNum = (*vec)[k] & 0x3fffff; slot = ((*vec)[k]>>22) & 0x1f; if (slot<11){ SLOTID = slot - 3; } else { SLOTID = slot - 5; } if ((slot==17) && (TDCID==0)){ if (TDCID == 0) { for (int k=0;k<32;k++){ TDC17[k] = 0.; THCnt[k] = 0; } FDCTrigger = 0; CDCTrigger = 0; GOODTriggerTime = 0; } if (TDCDATAHIRES){ if (TDCDATAHIRES==1) cout<<"HIRES FDC TDC header"<>27) == 0x17){ chip = ((*vec)[k]>>19) & 0x7; channel = ((*vec)[k]>>16) & 0x7; time = (float)((*vec)[k] & 0xffff); //cout<1){ cout<<" dt= "<< HiresTDC[ch][HiresTDCcounter[ch]-1] - HiresTDC[ch][HiresTDCcounter[ch]-2]; cout<<" ( " << EVENTCounter << " )"; } cout<0){ cosmic->Fill(HiresTDC[15][0]-HiresTDC[0][0]); } if (THCnt[0]>0){ CDCTrigger = 1; } int FDCTrig = 0; for (int k=0;k<32;k++){ if (THCnt[k]>0){ hists[0]->Fill((float)k); if ((k==4) || (k==6)){ FDCTrig++; } } } if ((FDCTrig>1) && (!THCnt[0])){ float dtime = (float)(TimeHits[4][THCnt[4]-1] - TimeHits[6][THCnt[6]-1]); hists[1]->Fill(dtime); if (THCnt[2]>0){ FDCTrigger=1; } if (dtime>20. || dtime<-20.){ GOODTriggerTime = 1; } } if ((TDCDATAHIRES==200)){ cout<2500.) { dt -= ROLLOVER_COUNT*TDC_v2BIN_SIZE; } TDtime->Fill(dt+600.,(float)n); } for (int n=0;n2500.) { dt -= ROLLOVER_COUNT*TDC_v2BIN_SIZE; } RFtime->Fill(dt); //cout<tag == 77) { // TOF ADC250 DetectorData[5]++; DetectorDataSZ[5] = vec->size() ; int Sz; Sz = vec->size(); if ((Sz>0)){ //cout << "START COUNTER DATA SIZE IS "<data[Indx]); unsigned int data = (*vec)[k]; //cout<<"0x"<>27) == 0x10) { // Block Header SLOTNUM = ((data& 0x07C00000)>>22); if (SLOTNUM!=OLDSLOT){ //cout<10){ slotidx -= 2; } //MaxSlot = slotidx; } else if ( ((data & 0xf8000000) >> 27) == 0x18) { // this is pulse time //int chan = (data>>23)&0xFFFF; //int qual = (data>>19) & 0x3; //cout<Fill((float)time/64.*4.); } else if ( ((data & 0xf8000000) >> 27) == 0x19) { data = (*vec)[++k]; data = (*vec)[++k]; int time = (data>>15) & 0x7FFF; int hirest = (data) & 0x3F; // cout<Fill((float)time/64.*4.); } } else if (((data & 0xf8000000)>>27) == 0x14) { CHANNEL = ((data & 0x7e00000)>>23) ; // WSize = (data & 0xFFF); TOFWindowSize = WSize; //cout<0) { // Window Raw Data values DATAReady--; if (pedcnt<20){ adc1 = (float)((data & 0x1FFF0000) >> 16); adc2 = (float)(data & 0x1FFF); ped += adc1; ped += adc2; TOFADCSamples[ROCID][slotidx][CHANNEL][idx++] = adc1; TOFADCSamples[ROCID][slotidx][CHANNEL][idx++] = adc2; pedcnt+=2; if (pedcnt>19){ ped /= 20.; TOFADCPedestal[ROCID][slotidx][CHANNEL] = ped; TOFADCPedSum[ROCID][slotidx][CHANNEL] += ped; TOFADCPedSum2[ROCID][slotidx][CHANNEL] += ped*ped; } } else { adc1 = (float)((data & 0x1FFF0000) >> 16); adc2 = (float)(data & 0x1FFF); TOFADCSamples[ROCID][slotidx][CHANNEL][idx++] = adc1; TOFADCSamples[ROCID][slotidx][CHANNEL][idx++] = adc2; if( (adc1-TOFADCPedestal[ROCID][slotidx][CHANNEL])>10. || (adc2-TOFADCPedestal[ROCID][slotidx][CHANNEL])>10.) { TOFOverThresh[ROCID][slotidx][CHANNEL] = 1; TOFOVERTHRESH++; } } } } } } else if ( (data_bank->tag > 10) && // FCAL ADCs (data_bank->tag < 23)){ DetectorData[6]++; DetectorDataSZ[6] += vec->size() ; int Sz; Sz = vec->size(); if ((Sz>0)){ int ROCID; char Detector[128]; sprintf(Detector,"TOF"); int OLDSLOT; int SLOTNUM, CHANNEL,WSize,DATAReady; int slotidx,idx; //int MaxSlot; float ped,adc1,adc2; int pedcnt; DATAReady = 0; ROCID = data_bank->tag-11; for (int k=0; kdata[Indx]); unsigned int data = (*vec)[k]; //cout<<"0x"<>27) == 0x10) { // Block Header SLOTNUM = ((data& 0x07C00000)>>22); if (SLOTNUM!=OLDSLOT){ //cout<10){ slotidx -= 2; } //MaxSlot = slotidx; } else if ( ((data & 0xf8000000) >> 27) == 0x18) { // this is pulse time //int chan = (data>>23)&0xFFFF; //int qual = (data>>19) & 0x3; //cout<Fill((float)time/64.*4.); } else if ( ((data & 0xf8000000) >> 27) == 0x19) { data = (*vec)[++k]; data = (*vec)[++k]; int time = (data>>15) & 0x7FFF; int hirest = (data) & 0x3F; // cout<Fill((float)time/64.*4.); } else if (((data & 0xf8000000)>>27) == 0x14) { CHANNEL = ((data & 0x7e00000)>>23) ; // WSize = (data & 0xFFF); FCALWindowSize = WSize; //cout<0) { // Window Raw Data values DATAReady--; if (pedcnt<20){ adc1 = (float)((data & 0x1FFF0000) >> 16); adc2 = (float)(data & 0x1FFF); ped += adc1; ped += adc2; FCALADCSamples[ROCID][slotidx][CHANNEL][idx++] = adc1; FCALADCSamples[ROCID][slotidx][CHANNEL][idx++] = adc2; pedcnt+=2; if (pedcnt>19){ ped /= 20.; FCALADCPedestal[ROCID][slotidx][CHANNEL] = ped; FCALADCPedSum[ROCID][slotidx][CHANNEL] += ped; FCALADCPedSum2[ROCID][slotidx][CHANNEL] += ped*ped; } } else { adc1 = (float)((data & 0x1FFF0000) >> 16); adc2 = (float)(data & 0x1FFF); FCALADCSamples[ROCID][slotidx][CHANNEL][idx++] = adc1; FCALADCSamples[ROCID][slotidx][CHANNEL][idx++] = adc2; if( (adc1-FCALADCPedestal[ROCID][slotidx][CHANNEL])>5. || (adc2-FCALADCPedestal[ROCID][slotidx][CHANNEL])>5.) { FCALOverThresh[ROCID][slotidx][CHANNEL] = 1; FCALOVERTHRESH++; } if ((ROCID == 3) && (SLOTNUM == 20)){ TACADCSamples[ROCID][slotidx][CHANNEL][idx++] = adc1; TACADCSamples[ROCID][slotidx][CHANNEL][idx++] = adc2; if( (adc1-TACADCPedestal[ROCID][slotidx][CHANNEL])>5. || (adc2-TACADCPedestal[ROCID][slotidx][CHANNEL])>5.) { TACOverThresh[ROCID][slotidx][CHANNEL] = 1; TACOVERTHRESH++; } } } } } } } else if ( (data_bank->tag == 31) || // BCAL ADCs (data_bank->tag == 32) || (data_bank->tag == 34) || (data_bank->tag == 35) || (data_bank->tag == 37) || (data_bank->tag == 38) || (data_bank->tag == 40) || (data_bank->tag == 41)){ DetectorData[7]++; DetectorDataSZ[7] += vec->size() ; //cout<<"BCAL ADC DATA found"<size(); if ((Sz>0)){ //cout << "BCAL DATA SIZE IS "<tag>31){ ROCID++; } if (data_bank->tag>32){ ROCID++; } if (data_bank->tag>34){ ROCID++; } if (data_bank->tag>35){ ROCID++; } if (data_bank->tag>37){ ROCID++; } if (data_bank->tag>38){ ROCID++; } if (data_bank->tag>40){ ROCID++; } for (int k=0; kdata[Indx]); unsigned int data = (*vec)[k]; //cout<<"0x"<>27) == 0x10) { // Block Header SLOTNUM = ((data& 0x07C00000)>>22); if (SLOTNUM!=OLDSLOT){ //cout<10){ slotidx -= 2; } //MaxSlot = slotidx; } else if ( ((data & 0xf8000000) >> 27) == 0x18) { // this is pulse time //int chan = (data>>23)&0xFFFF; //int qual = (data>>19) & 0x3; //cout<Fill((float)time/64.*4.); } else if ( ((data & 0xf8000000) >> 27) == 0x19) { data = (*vec)[++k]; data = (*vec)[++k]; int time = (data>>15) & 0x7FFF; int hirest = (data) & 0x3F; // cout<Fill((float)time/64.*4.); } else if (((data & 0xf8000000)>>27) == 0x14) { CHANNEL = ((data & 0x7e00000)>>23) ; // WSize = (data & 0xFFF); BCALWindowSize = WSize; //cout<<"BCAL Window Size: "<0) { // Window Raw Data values DATAReady--; if (pedcnt<10){ adc1 = (float)((data & 0x1FFF0000) >> 16); adc2 = (float)(data & 0x1FFF); ped += adc1; ped += adc2; BCALADCSamples[ROCID][slotidx][CHANNEL][idx++] = adc1; BCALADCSamples[ROCID][slotidx][CHANNEL][idx++] = adc2; pedcnt+=2; if (pedcnt>9){ ped /= 10.; BCALADCPedestal[ROCID][slotidx][CHANNEL] = ped; BCALADCPedSum[ROCID][slotidx][CHANNEL] += ped; BCALADCPedSum2[ROCID][slotidx][CHANNEL] += ped*ped; } } else { adc1 = (float)((data & 0x1FFF0000) >> 16); adc2 = (float)(data & 0x1FFF); BCALADCSamples[ROCID][slotidx][CHANNEL][idx++] = adc1; BCALADCSamples[ROCID][slotidx][CHANNEL][idx++] = adc2; if( (adc1-BCALADCPedestal[ROCID][slotidx][CHANNEL])>5. || (adc2-BCALADCPedestal[ROCID][slotidx][CHANNEL])>5.) { BCALOverThresh[ROCID][slotidx][CHANNEL] = 1; BCALOVERTHRESH++; } } } } } } else if ( data_bank->tag == 71) { // TAGM ADC DetectorData[8]++; DetectorDataSZ[8] = vec->size() ; int Sz; Sz = vec->size(); if ((Sz>0)){ int ROCID=0; char Detector[128]; sprintf(Detector,"TAGM"); int OLDSLOT; int SLOTNUM, CHANNEL,WSize,DATAReady; int slotidx,idx; //int MaxSlot; float ped,adc1,adc2; int pedcnt; DATAReady = 0; for (int k=0; kdata[Indx]); unsigned int data = (*vec)[k]; //cout<<"0x"<>27) == 0x10) { // Block Header SLOTNUM = ((data& 0x07C00000)>>22); if (SLOTNUM!=OLDSLOT){ //cout<10){ slotidx -= 2; } //MaxSlot = slotidx; } else if ( ((data & 0xf8000000) >> 27) == 0x18) { // this is pulse time //int chan = (data>>23)&0xFFFF; //int qual = (data>>19) & 0x3; //cout<Fill((float)time/64.*4); ADCTAGMtime->Fill((float)time/64.*4); } } else if ( ((data & 0xf8000000) >> 27) == 0x19) { data = (*vec)[++k]; data = (*vec)[++k]; int time = (data>>15) & 0x7FFF; int hirest = (data) & 0x3F; // cout<Fill((float)time/64.*4); ADCTAGMtime->Fill((float)time/64.*4.); } } else if (((data & 0xf8000000)>>27) == 0x14) { CHANNEL = ((data & 0x7e00000)>>23) ; // WSize = (data & 0xFFF); TAGMWindowSize = WSize; //cout<0) { // Window Raw Data values DATAReady--; if (pedcnt<20){ adc1 = (float)((data & 0x1FFF0000) >> 16); adc2 = (float)(data & 0x1FFF); ped += adc1; ped += adc2; TAGMADCSamples[ROCID][slotidx][CHANNEL][idx++] = adc1; TAGMADCSamples[ROCID][slotidx][CHANNEL][idx++] = adc2; pedcnt+=2; if (pedcnt>19){ ped /= 20.; TAGMADCPedestal[ROCID][slotidx][CHANNEL] = ped; TAGMADCPedSum[ROCID][slotidx][CHANNEL] += ped; TAGMADCPedSum2[ROCID][slotidx][CHANNEL] += ped*ped; } } else { adc1 = (float)((data & 0x1FFF0000) >> 16); adc2 = (float)(data & 0x1FFF); TAGMADCSamples[ROCID][slotidx][CHANNEL][idx++] = adc1; TAGMADCSamples[ROCID][slotidx][CHANNEL][idx++] = adc2; if( (adc1-TAGMADCPedestal[ROCID][slotidx][CHANNEL])>5. || (adc2-TAGMADCPedestal[ROCID][slotidx][CHANNEL])>5.) { TAGMOverThresh[ROCID][slotidx][CHANNEL] = 1; TAGMOVERTHRESH++; } } } } } } else if ( data_bank->tag == 73) { // TAGH ADC DetectorData[9]++; DetectorDataSZ[9] = vec->size() ; int Sz; Sz = vec->size(); if ((Sz>0)){ int ROCID=0; char Detector[128]; sprintf(Detector,"TAGH"); int OLDSLOT; int SLOTNUM, CHANNEL,WSize,DATAReady; int slotidx,idx; //int MaxSlot; float ped,adc1,adc2; int pedcnt; DATAReady = 0; for (int k=0; kdata[Indx]); unsigned int data = (*vec)[k]; //cout<<"0x"<>27) == 0x10) { // Block Header SLOTNUM = ((data& 0x07C00000)>>22); if (SLOTNUM!=OLDSLOT){ //cout<10){ slotidx -= 2; } //MaxSlot = slotidx; } else if ( ((data & 0xf8000000) >> 27) == 0x18) { // this is pulse time //int chan = (data>>23)&0xFFFF; int time = (data)&0x7FFFF; int hirest = (data) & 0x3F; // cout<Fill((float)time/64.*4); ADCTAGHtime->Fill((float)time/64.*4); } } else if ( ((data & 0xf8000000) >> 27) == 0x19) { data = (*vec)[++k]; data = (*vec)[++k]; int time = (data>>15) & 0x7FFF; int hirest = (data) & 0x3F; // cout<Fill((float)time/64.*4); ADCTAGHtime->Fill((float)time/64.*4.); } } else if (((data & 0xf8000000)>>27) == 0x14) { CHANNEL = ((data & 0x7e00000)>>23) ; // WSize = (data & 0xFFF); TAGHWindowSize = WSize; //cout<0) { // Window Raw Data values DATAReady--; if (pedcnt<20){ adc1 = (float)((data & 0x1FFF0000) >> 16); adc2 = (float)(data & 0x1FFF); ped += adc1; ped += adc2; TAGHADCSamples[ROCID][slotidx][CHANNEL][idx++] = adc1; TAGHADCSamples[ROCID][slotidx][CHANNEL][idx++] = adc2; pedcnt+=2; if (pedcnt>19){ ped /= 20.; TAGHADCPedestal[ROCID][slotidx][CHANNEL] = ped; TAGHADCPedSum[ROCID][slotidx][CHANNEL] += ped; TAGHADCPedSum2[ROCID][slotidx][CHANNEL] += ped*ped; } } else { adc1 = (float)((data & 0x1FFF0000) >> 16); adc2 = (float)(data & 0x1FFF); TAGHADCSamples[ROCID][slotidx][CHANNEL][idx++] = adc1; TAGHADCSamples[ROCID][slotidx][CHANNEL][idx++] = adc2; if( (adc1-TAGHADCPedestal[ROCID][slotidx][CHANNEL])>5. || (adc2-TAGHADCPedestal[ROCID][slotidx][CHANNEL])>5.) { TAGHOverThresh[ROCID][slotidx][CHANNEL] = 1; TAGHOVERTHRESH++; } } } } } } else if (data_bank->tag == 94) { // START COUNTER ADC DetectorData[10]++; DetectorDataSZ[10] = vec->size() ; int Sz; Sz = vec->size(); if ((Sz>0) ){ //cout << "START COUNTER DATA SIZE IS "<data[Indx]); unsigned int data = (*vec)[k]; //cout<<"0x"<>27) == 0x10) { // Block Header SLOTNUM = ((data& 0x07C00000)>>22); if (SLOTNUM!=OLDSLOT){ //cout<10){ slotidx -= 2; } //MaxSlot = slotidx; } else if ( ((data & 0xf8000000) >> 27) == 0x18) { // this is pulse time //int chan = (data>>23)&0xFFFF; int time = (data)&0x7FFFF; int hirest = (data) & 0x3F; // cout<Fill((float)time/64.*4); } } else if ( ((data & 0xf8000000) >> 27) == 0x19) { data = (*vec)[++k]; data = (*vec)[++k]; int time = (data>>15) & 0x7FFF; int hirest = (data) & 0x3F; // cout<Fill((float)time/64.*4.); } } else if (((data & 0xf8000000)>>27) == 0x14) { CHANNEL = ((data & 0x7e00000)>>23) ; // WSize = (data & 0xFFF); STWindowSize = WSize; //cout<0) { // Window Raw Data values DATAReady--; if (pedcnt<20){ adc1 = (float)((data & 0x1FFF0000) >> 16); adc2 = (float)(data & 0x1FFF); ped += adc1; ped += adc2; STADCSamples[ROCID][slotidx][CHANNEL][idx++] = adc1; STADCSamples[ROCID][slotidx][CHANNEL][idx++] = adc2; pedcnt+=2; if (pedcnt>19){ ped /= 20.; STADCPedestal[ROCID][slotidx][CHANNEL] = ped; STADCPedSum[ROCID][slotidx][CHANNEL] += ped; STADCPedSum2[ROCID][slotidx][CHANNEL] += ped*ped; } } else { adc1 = (float)((data & 0x1FFF0000) >> 16); adc2 = (float)(data & 0x1FFF); STADCSamples[ROCID][slotidx][CHANNEL][idx++] = adc1; STADCSamples[ROCID][slotidx][CHANNEL][idx++] = adc2; if( (adc1-STADCPedestal[ROCID][slotidx][CHANNEL])>5. || (adc2-STADCPedestal[ROCID][slotidx][CHANNEL])>5.) { STOverThresh[ROCID][slotidx][CHANNEL] = 1; STOVERTHRESH++; } } } } } } else if ( (data_bank->tag == 25) || // CDCs (data_bank->tag == 26) || (data_bank->tag == 27) || (data_bank->tag == 28) || (data_bank->tag == 52) || // FDCs (data_bank->tag == 53) || (data_bank->tag == 55) || (data_bank->tag == 56) || (data_bank->tag == 57) || (data_bank->tag == 58) || (data_bank->tag == 59) || (data_bank->tag == 60) || (data_bank->tag == 61) || (data_bank->tag == 62)) { DetectorData[11]++; DetectorDataSZ[11] += vec->size() ; int Sz; Sz = vec->size(); memset(TimeHitCounter,0,20*20*72*4); if (DEBUGGER){ cout<<"EVENT: "<tag<<" Buffer Size:"<tag<<" Buffer Size:"<0)){ int OLDSLOT; int SLOTNUM, CHANNEL,WSize,DATAReady; int slotidx,idx; char Crate[128]; int C; float ped,adc1,adc2; int pedcnt; int MaxSlot; char Detector[128]; int DetectorID = 0; int ROCID=0; int EventNumber=0; int WindowCounterFDC[20][72]; int PeakCounterFDC[20][72]; int WindowCounterCDC[20][72]; int PeakCounterCDC[20][72]; int WINDIOWSIZEEXPECT; memset(WindowCounterFDC, 0, 20*72*4); memset(PeakCounterFDC, 0, 20*72*4); memset(WindowCounterCDC, 0, 20*72*4); memset(PeakCounterCDC, 0, 20*72*4); if (data_bank->tag<29){ sprintf(Detector,"CDC"); C = data_bank->tag - 24; DetectorID = 1; ROCID=C-1; //cout<<"CDC ROC "<tag - 50; ROCID = C+2; if (ROCID>5){ ROCID -=1; } int NEventsInROC = (data_bank->num & 0xFF); if (NEventsInROC != 1){ //cout<<"FDC ROCtag "<tag<<" Number of Events: "<>27) == 0x10) { // Block Header if (DEBUG){ cout<<" BLOCK HEADER"; } OLDSlot = SLOTNUM; SLOTNUM = ((data& 0x07C00000)>>22); if (TS3){ if (SLOTNUM==3){ FoundSlot3++; } } if (SLOTNUM!=OLDSLOT){ //cout<10){ slotidx -= 2; } MaxSlot = slotidx; } else if (((data & 0xf8000000)>>27) == 0x11) { if (DEBUG){ cout<<" BLOCK TRAILER"; } if (TWCounter[0] != TWCounter[1]){ cout<<" ERROR TWCounter not even "<>27) == 0x12) { if (DEBUG){ cout<<" EVENT Header"; } EventNumber = data & 0x3fffff ; memset(TimeHitCounter,0,20*20*72*4); TWCounter[0] = 0; TWCounter[1] = 0; } else if (((data & 0xf8000000)>>27) == 0x13) { if (DEBUG){ cout<<" TRIGGER TIME"; } } else if (((data & 0xf8000000)>>27) == 0x1b) { if (DEBUG){ cout<<" UNKNOWN 0x1b"; } } else if (((data & 0xf8000000)>>27) == 0x1c) { if (DEBUG){ cout<<" UNKNOWN 0x1c"; } } else if ((((data & 0xf8000000)>>27) == 0x15) || (((data & 0xf8000000)>>27) == 0x16) || (((data & 0xf8000000)>>27) == 0x19)) { if (DEBUG){ cout<<" PULSE DATA CDC or FDC"; } float timeVal = ((data >> 4) & 0x7FF); //cout<Fill(timeVal); } else { ADCFDCtime->Fill(timeVal); } if (data_bank->tag<30){ PeakCounterCDC[SLOTNUM][(data>>20) & 0x7f]++; } else { PeakCounterFDC[SLOTNUM][(data>>20) & 0x7f]++; } } else if (((data & 0xf8000000)>>27) == 0x17) { if (DEBUG){ cout<<" PULSE INTEGRAL"; } if (data_bank->tag<30){ PeakCounterCDC[SLOTNUM][(data>>20) & 0x7f]++; } else { PeakCounterFDC[SLOTNUM][(data>>20) & 0x7f]++; } } else if (((data & 0xf8000000)>>27) == 0x1d) { if (DEBUG){ cout<<" RESERVED"; } } else if (((data & 0xf8000000)>>27) == 0x1e) { if (DEBUG){ cout<<" DATA NOT VALID"; } } else if (((data & 0xf8000000)>>27) == 0x1f) { if (DEBUG){ cout<<" FILLER WORD"; } } else if (((data & 0xf8000000)>>27) == 0x18) { TWCounter[0]++; if (DEBUG){ cout<<" PULSE TIME DATA"; } // this is pulse time data float timeVal = (data &0xFFFF)/64.; int chan = (data &0x7F00000) >> 20; LOC_CHAN = chan; int qual = (data &0xc0000) >> 18; TimeHitCounter[ROCID][SLOTNUM][chan]++; if (TimeHitCounter[ROCID][SLOTNUM][chan]==3){ if (DEBUG) { cout<<"Number of hits: "<=0; z-=2){ unsigned int data1 = (*vec)[k-z]; float loctimeVal = (data1 &0xFFFF)/64.; int locchan = (data1 &0x7F00000) >> 20; int locqual = (data1 &0xc0000) >> 18; if (DEBUG){ cout<<"PT: "<>12) ; // pedestal from FPGA algo. int DPed = vmin - localPedestal[LOC_SLOT][c]; if (0) { if ((abs(DPed)>0) && (vmin>0)){ cout<<"PEDESTAL MISSMATCH: "<>27) == 0x14)) { if (DEBUG){ cout<<" RAW WINDOW DATA channel: "<<((data & 0x7F00000)>>20) <<" slotnumber: "<> 16); adc2 = (float)(data & 0x1FFF); ped += adc1; ped += adc2; ADCSamples[ROCID][slotidx][CHANNEL][idx++] = adc1; ADCSamples[ROCID][slotidx][CHANNEL][idx++] = adc2; pedcnt+=2; if (pedcnt>19){ ped /= 20.; ADCPedestal[ROCID][slotidx][CHANNEL] = ped; ADCPedSum[ROCID][slotidx][CHANNEL] += ped; ADCPedSum2[ROCID][slotidx][CHANNEL] += ped*ped; int pedover4 = ((int)(ADCSamples[ROCID][slotidx][CHANNEL][0] + ADCSamples[ROCID][slotidx][CHANNEL][1] + ADCSamples[ROCID][slotidx][CHANNEL][2] + ADCSamples[ROCID][slotidx][CHANNEL][3]))>>2; localPedestal[LOC_SLOT][LOC_CHAN] = pedover4; } } else { adc1 = (float)((data & 0x1FFF0000) >> 16); adc2 = (float)(data & 0x1FFF); ADCSamples[ROCID][slotidx][CHANNEL][idx++] = adc1; ADCSamples[ROCID][slotidx][CHANNEL][idx++] = adc2; if( (adc1-ADCPedestal[ROCID][slotidx][CHANNEL])>5. || (adc2-ADCPedestal[ROCID][slotidx][CHANNEL])>5.) { //if ((ROCID==1) && (slotidx==8) && (CHANNEL>33) && (CHANNEL<37) ) OverThresh[ROCID][slotidx][CHANNEL] = 1; } } } if (DEBUG){ cout<SetTitle(Crate); int width = STWindowSize; TMultiGraph *mg[2]; TGraph *graf[32]; mg[0] = new TMultiGraph("mg0","ADC250 raw data ST channel 1-16"); mg[1] = new TMultiGraph("mg1","ADC250 raw data ST channel 17-32"); float Xaxis[500]; for (int k=0; k<500; k++){ Xaxis[k] = (float)k; } int lc = 2; int CTop = 0; for (int k=0; k<16; k++){ if (STOverThresh[0][0][k]){ graf[CTop] = new TGraph(width, Xaxis, STADCSamples[0][0][k]); mg[0]->Add(graf[CTop]); char t1[128]; sprintf(t1,"ST-Crate slot%d channel%d",3,k); graf[CTop]->SetTitle(t1); graf[CTop]->SetLineColor(lc); graf[CTop]->SetMarkerStyle(20); graf[CTop]->SetMarkerSize(.5); CTop++; } } lc = 3; int CBot = 0; for (int k=0; k<16; k++){ if (STOverThresh[0][1][k]){ graf[CBot+CTop] = new TGraph(width, Xaxis, STADCSamples[0][1][k]); mg[1]->Add(graf[CBot+CTop]); char t1[128]; sprintf(t1,"ST-Crate slot%d channel%d",4,k+16); graf[CBot+CTop]->SetTitle(t1); graf[CBot+CTop]->SetLineColor(lc); graf[CBot+CTop]->SetMarkerStyle(20); graf[CBot+CTop]->SetMarkerSize(.5); CBot++; } } mycST->Clear(); mycST->Divide(1,2); mycST->cd(1); gPad->SetGrid(); mg[0]->Draw("acp"); mycST->cd(2); gPad->SetGrid(); mg[1]->Draw("acp"); mycST->Update(); char what; //gSystem->Sleep(1000); cout << " "<SaveAs(Crate); } if (what == 's'){ sprintf(Crate,"ST_Crate_run%d_event%d.root",RunNumber,(int)EVENTCounter); TFile *f = new TFile(Crate,"RECREATE"); mycST->Write(); for (int k=0; kWrite(); } f->ls(); f->Close(); } for (int k=0;kClear(); myADCtime->Divide(2,4); myADCtime->cd(1); gPad->SetGrid(); ADCFCALtime->Draw(); myADCtime->cd(2); gPad->SetGrid(); ADCTOFtime->Draw(); myADCtime->cd(3); gPad->SetGrid(); ADCBCALtime->Draw(); myADCtime->cd(4); gPad->SetGrid(); ADCSTtime->Draw(); myADCtime->cd(5); gPad->SetGrid(); ADCTAGHtime->Draw(); myADCtime->cd(6); gPad->SetGrid(); ADCTAGMtime->Draw(); myADCtime->Update(); myADCtime->cd(7); gPad->SetGrid(); ADCFDCtime->Draw(); myADCtime->Update(); myADCtime->cd(8); gPad->SetGrid(); ADCCDCtime->Draw(); myADCtime->Update(); if (type){ char file[128]; // sprintf(file,"timing_run%d.gif",RunNumber); //mycTDC->SaveAs(file); sprintf(file,"ADC_timing_run%d_%d.root",RunNumber,Version); TFile *f = new TFile(file,"RECREATE"); myADCtime->Write(); ADCFCALtime->Write(); ADCBCALtime->Write(); ADCTOFtime->Write(); ADCSTtime->Write(); ADCTAGHtime->Write(); ADCTAGMtime->Write(); ADCFDCtime->Write(); ADCCDCtime->Write(); f->ls(); f->Close(); } } void dodisplayT(int ROC, int S, int width, int C, char *det){ char Crate[128],Detector[128]; int SLOT; SLOT = S+3; if (SLOT>10){ SLOT+=2; } sprintf(Detector,"%s",det); sprintf(Crate,"%s_Crate%d SLOT%d",Detector,C,SLOT); myc->SetTitle(Crate); TMultiGraph *mg[3]; TGraph *graf[72]; mg[0] = new TMultiGraph("mg0","ADC125 raw data Strips channel 1-24"); mg[1] = new TMultiGraph("mg1","ADC125 raw data Strips channel 25-48"); mg[2] = new TMultiGraph("mg2","ADC125 raw data Strips channel 49-72"); float Xaxis[500]; for (int k=0; k<500; k++){ Xaxis[k] = (float)k; } int lc = 2; for (int k=0; k<72; k++){ graf[k] = new TGraph(width, Xaxis, ADCSamples[ROC][S][k]); mg[k/24]->Add(graf[k]); lc = k/24 + 1; char t1[128]; sprintf(t1,"crate%d slot%d channel%d",C,SLOT,k); graf[k]->SetTitle(t1); graf[k]->SetLineColor(lc); graf[k]->SetMarkerStyle(1); } myc->Clear(); myc->cd(1); mg[0]->Draw("acp"); myc->cd(2); mg[1]->Draw("acp"); myc->cd(3); mg[2]->Draw("acp"); myc->Update(); char what; //gSystem->Sleep(1000); cout << " "<SaveAs(Crate); } if (what == 's'){ sprintf(Crate,"%s_Crate%dSLOT%d_run%d.root",Detector,C,SLOT,RunNumber); TFile *f = new TFile(Crate,"RECREATE"); myc->Write(); for (int k=0; k<72; k++){ graf[k]->Write(); } f->ls(); f->Close(); } } void makeRings(){ double d2r = 3.1415926/180.; for (int k=0; k<28; k++){ double dphi = 3.1415926*2./NStraws[k]; int N = (int)NStraws[k]; for (int n=0; nAdd(graf[k]); graf[k]->SetLineColor(1); graf[k]->SetMarkerStyle(24); graf[k]->SetMarkerSize(0.5); } cout<Add(graf[28]); graf[28]->SetMarkerColor(2); graf[28]->SetMarkerStyle(21); graf[28]->SetMarkerSize(0.5); mycR->Clear(); mg->Draw("ap"); mycR->Update(); Int_t waiti; //gSystem->Sleep(1000); cout << " "<> waiti; } void makeTranslationTable(){ //int ADC2RING[4][20][3][2]; // RING and Board number int RING2ADC[9][30][3]; for (int k=0;k<9;k++){ for (int i=0;i<30;i++){ for (int j=0;j<3;j++){ RING2ADC[k][i][j] = 99; } } } //read connector ring info char datafile1[128] = "/home/zihlmann/scanevio/adccdcring.txt"; ifstream INF(datafile1); if (!INF.is_open()){ cout<<"Error open file "<>strings[0]; if (strings[0].find("OC")==1){ INF>>ROC; rocidx = ROC-1; slotidx = 0; } else { INF>>strings[1]>>strings[2]; for (int k=0;k<3;k++){ sprintf(dummy,"%s",strings[k].c_str()); Rings[k] = (int)dummy[0] - (int)'A'; string s1(strings[k],1,strings[k].size()); sprintf(dummy,"%s",s1.c_str()); RingsNum[k] = atoi(dummy)-1; //ADC2RING[rocidx][slotidx][k][0] = Rings[k]; //ADC2RING[rocidx][slotidx][k][1] = RingsNum[k]; //cout<>words[0]>>words[1]>>words[2]>>words[3]>>words[4]>>chan; if (VERBOSE==9){ for (int k=0; k<5; k++){ cout<10){ SLOT+=2; } sprintf(Detector,"%s",det); sprintf(Crate,"%s_Crate%d SLOT%d",Detector,C,SLOT); mycSingle->SetTitle(Crate); TGraph *graf[72]; float Xaxis[500]; for (int k=0; k<500; k++){ Xaxis[k] = (float)k; } int lc = 2; char t[128]; for (int k=0; k<72; k++){ graf[k] = new TGraph(width, Xaxis, ADCSamples[ROC][S][k]); lc = k/24 + 1; graf[k]->SetLineColor(lc); graf[k]->SetMarkerStyle(21); sprintf(t,"SLOT %d Channel %d",SLOT,k); graf[k]->SetTitle(t); graf[k]->GetXaxis()->SetTitle("Sample Number [8ns]"); mycSingle->Clear(); mycSingle->cd(); graf[k]->Draw("ALP"); mycSingle->Update(); gPad->SetGrid(); gPad->Modified(); char what; //gSystem->Sleep(1000); cout << " "<SaveAs(str); } } } void doCDCdisplay(int width){ mycCDC->SetTitle("CDC Detector"); int SLOT[4] = {13,12,12,13}; TMultiGraph *mg; TGraph *graf[4000]; mg = new TMultiGraph("mg","CDC ADC125 raw data"); float Xaxis[500]; for (int k=0; k<500; k++){ Xaxis[k] = (float)k; } int GCnt = 0; for (int ROC=0; ROC<4; ROC++){ int lc = ROC+1; for (int S=0; SSetMarkerStyle(1); graf[GCnt]->SetLineColor(lc); int SL = S+3; if (SL>10){ SL +=2; } char t1[128]; sprintf(t1,"ROCCDC%d slot%d channel%d",ROC+1,SL,k); graf[GCnt]->SetTitle(t1); mg->Add(graf[GCnt++]); } } } } mycCDC->Clear(); mycCDC->Update(); mycCDC->cd(1); mg->Draw("acp"); gPad->SetGrid(); mycCDC->Update(); cout<Sleep(1000); cout << " "<SaveAs(str); } if (what == 's'){ char Crate[128]; sprintf(Crate,"CDC_allhits_event%d_run%d.root",evtCount,RunNumber); TFile *f = new TFile(Crate,"RECREATE"); mycCDC->Write(); for (int k=0; kWrite(); } f->ls(); f->Close(); } mycCDC->Clear(); if (0) { for (int k=0;kDraw("alp"); gPad->SetGrid(); mycCDC->Update(); cout<SetTitle("FDC Detector"); // cout<<"WINDOWSIZE "<Clear(); float Xaxis[500]; for (int k=0; k<500; k++){ Xaxis[k] = (float)k; } int GCnt = 0; for (int ROC=4; ROC<14; ROC++){ int lc = ROC-2; for (int S=0; SAdd(graf[GCnt]); graf[GCnt]->SetMarkerStyle(1); graf[GCnt]->SetLineColor(lc); int r = ROC-2; if (ROC>5){ r +=1; } int SL = S+3; if (SL>10){ SL +=2; } if (ADCPedestal[ROC][S][k] == 0.){ cout<SetTitle(t1); GCnt++; } } } } mycFDC->Clear(); mycFDC->Update(); mycFDC->cd(1); mg->Draw("acp"); gPad->SetGrid(); mycFDC->Update(); char what; //gSystem->Sleep(1000); cout << " "<SaveAs(str); } if (what == 's'){ char Crate[128]; sprintf(Crate,"FDC_allhits_event%d_run%d.root",evtCount,RunNumber); TFile *f = new TFile(Crate,"RECREATE"); mycFDC->Write(); for (int k=0; kWrite(); } f->ls(); f->Close(); } for (int k=0;kSetTitle(Crate); int width = TOFWindowSize; TMultiGraph *mg[4]; TGraph *graf[16*20]; mg[0] = new TMultiGraph("mg0","ADC250 raw data TOF Channel1"); mg[1] = new TMultiGraph("mg1","ADC250 raw data TOF Channel2"); mg[2] = new TMultiGraph("mg2","ADC250 raw data TOF Channel1"); mg[3] = new TMultiGraph("mg3","ADC250 raw data TOF Channel2"); float Xaxis[500]; for (int k=0; k<500; k++){ Xaxis[k] = (float)k; } int GCnt = 0; int cnt[2] = {0, 0}; int cnt1[2] = {0, 0}; for (int n=0; n<12; n++){ int lc = n+1; for (int k=0; k<16; k++){ if ( (TOFOverThresh[0][n][k]) ){ //if ( 1 ){ if ( ((n == 1) && (k==0)) || ((n == 10) && (k==9))){ graf[GCnt] = new TGraph(width, Xaxis, TOFADCSamples[0][n][k]); mg[0]->Add(graf[GCnt]); cnt[0]++; char t1[128]; sprintf(t1,"TOF-Crate slot%d channel%d",n,k); graf[GCnt]->SetTitle(t1); graf[GCnt]->SetLineColor(lc); graf[GCnt]->SetMarkerStyle(1); graf[GCnt]->GetXaxis()->SetTitle("flash ADC samples [4ns]"); graf[GCnt]->GetYaxis()->SetTitle("flash ADC val [arb.]"); GCnt++; } } } } if (GCnt<1){ return; } mycTOF->Clear(); mycTOF->Divide(2,2); mycTOF->cd(1); if (cnt[0]) { mg[0]->Draw("acp"); gPad->SetGrid(); mg[0]->GetXaxis()->SetTitle("flash ADC North NEW samples [4ns]"); mg[0]->GetYaxis()->SetTitle("flash ADC val [arb.]"); mg[0]->Draw("acp"); } if (cnt[1]) { mycTOF->cd(3); mg[1]->Draw("acp"); gPad->SetGrid(); mg[1]->GetXaxis()->SetTitle("flash ADC South NEW samples [4ns]"); mg[1]->GetYaxis()->SetTitle("flash ADC val [arb.]"); mg[1]->Draw("acp"); } if (cnt1[0]) { mycTOF->cd(2); mg[2]->Draw("acp"); gPad->SetGrid(); mg[2]->GetXaxis()->SetTitle("flash ADC North REF samples [4ns]"); mg[2]->GetYaxis()->SetTitle("flash ADC val [arb.]"); mg[2]->Draw("acp"); } if (cnt1[1]) { mycTOF->cd(4); mg[3]->Draw("acp"); gPad->SetGrid(); mg[3]->GetXaxis()->SetTitle("flash ADC South REF samples [4ns]"); mg[3]->GetYaxis()->SetTitle("flash ADC val [arb.]"); mg[3]->Draw("acp"); } mycTOF->Update(); //gPad->Modified(); char what; //gSystem->Sleep(1000); cout << " "<SaveAs(Crate); } if (what == 's'){ sprintf(Crate,"TOF_Crate_run%d_event%d.root",RunNumber,(int)EVENTCounter); TFile *f = new TFile(Crate,"RECREATE"); mycTOF->Write(); for (int k=0; kWrite(); } f->ls(); f->Close(); } for (int k=0;kSetTitle(Crate); int width = TOFWindowSize; TMultiGraph *mg; TGraph *graf[16*20]; mg = new TMultiGraph("mg3","ADC250 raw data TOF"); float Xaxis[500]; for (int k=0; k<500; k++){ Xaxis[k] = (float)k; } int GCnt = 0; for (int n=0; n<12; n++){ int lc = n+1; for (int k=0; k<16; k++){ if ( (TOFOverThresh[0][n][k]) ){ graf[GCnt] = new TGraph(width, Xaxis, TOFADCSamples[0][n][k]); mg->Add(graf[GCnt]); char t1[128]; sprintf(t1,"TOF-Crate slot%d channel%d",n,k); graf[GCnt]->SetTitle(t1); graf[GCnt]->SetLineColor(lc); graf[GCnt]->SetMarkerStyle(1); graf[GCnt]->GetXaxis()->SetTitle("flash ADC samples [4ns]"); graf[GCnt]->GetYaxis()->SetTitle("flash ADC val [arb.]"); GCnt++; } } } if (GCnt<1){ return; } mycTOF->Clear(); mg->Draw("acp"); gPad->SetGrid(); mg->GetXaxis()->SetTitle("flash ADC South REF samples [4ns]"); mg->GetYaxis()->SetTitle("flash ADC val [arb.]"); mg->Draw("acp"); mycTOF->Update(); //gPad->Modified(); char what; //gSystem->Sleep(1000); cout << " "<SaveAs(Crate); } if (what == 's'){ sprintf(Crate,"TOF_Crate_run%d_event%d.root",RunNumber,(int)EVENTCounter); TFile *f = new TFile(Crate,"RECREATE"); mycTOF->Write(); for (int k=0; kWrite(); } f->ls(); f->Close(); } for (int k=0;kSetTitle(Crate); int width = FCALWindowSize; TMultiGraph *mg;//, *mg1; TGraph *graf[16*20*10]; //TGraph *graf1; mg = new TMultiGraph("mg","ADC250 raw data TAC"); float Xaxis[1000]; for (int k=0; k<1000; k++){ Xaxis[k] = (float)k; } int GCnt = 0; int lc; float YMAX = 0.; for (int i=0; i<10; i++){ for (int n=0; n<20; n++){ for (int k=0; k<16; k++){ if ((TACOverThresh[i][n][k])) { graf[GCnt] = new TGraph(width, Xaxis, TACADCSamples[i][n][k]); mg->Add(graf[GCnt]); char t1[128]; sprintf(t1,"TAC Crate%d slot%d channel%d",i,n,k); graf[GCnt]->SetTitle(t1); lc = k/8 + 1; graf[GCnt]->SetLineColor(lc); graf[GCnt]->SetMarkerStyle(20); graf[GCnt]->SetMarkerSize(0.5); float ymax = graf[GCnt]->GetHistogram()->GetMaximum(); if(ymax>YMAX){ YMAX = ymax; } GCnt++; } } } } mycTAC->Clear(); if (GCnt>0){ mg->SetMinimum(0.); mg->SetMaximum(YMAX); mg->Draw("acp"); gPad->SetGrid(); mg->GetXaxis()->SetTitle("ADC Samples [4ns]"); mg->Draw("acp"); } mycTAC->Update(); char what; //gSystem->Sleep(1000); cout << " "<SaveAs(Crate); } if (what == 's'){ sprintf(Crate,"TAC_Crate_run%d_event%d.root",RunNumber,(int)EVENTCounter); TFile *f = new TFile(Crate,"RECREATE"); mycTAC->Write(); for (int k=0; kWrite(); } f->ls(); f->Close(); } //delete graf1; for (int k=0;kSetTitle(Crate); int width = BCALWindowSize; TMultiGraph *mg;//, *mg1; TGraph *graf[16*20*10]; //TGraph *graf1; mg = new TMultiGraph("mg","ADC250 raw data BCAL"); //mg1 = new TMultiGraph("mg","ADC250 raw data PHOTON BEAM FLUX MONITOR"); float Xaxis[1000]; for (int k=0; k<1000; k++){ Xaxis[k] = (float)k; } int GCnt = 0; int lc; float YMAX = 0.; for (int i=0; i<10; i++){ for (int n=0; n<20; n++){ for (int k=0; k<16; k++){ //if ((BCALOverThresh[i][n][k]) && (i!=4) && (n!=14)) { if ((BCALOverThresh[i][n][k])) { graf[GCnt] = new TGraph(width, Xaxis, BCALADCSamples[i][n][k]); mg->Add(graf[GCnt]); char t1[128]; sprintf(t1,"BCAL Crate%d slot%d channel%d",i,n,k); graf[GCnt]->SetTitle(t1); lc = k/8 + 1; graf[GCnt]->SetLineColor(lc); graf[GCnt]->SetMarkerStyle(20); graf[GCnt]->SetMarkerSize(0.5); float ymax = graf[GCnt]->GetHistogram()->GetMaximum(); if(ymax>YMAX){ YMAX = ymax; } GCnt++; } } } } //graf1 = new TGraph(width, Xaxis, BCALADCSamples[4][14][6]); //graf1->SetMarkerStyle(20); //graf1->SetMarkerSize(0.5); //mg1->Add(graf1); mycBCAL->Clear(); //mycBCAL->Divide(1,2); //mycBCAL->cd(1); //mg1->SetMinimum(0.); //mg1->SetMaximum(500.); //mg1->Draw("acp"); //mg1->GetXaxis()->SetTitle("ADC Samples [4ns]"); //mg1->Draw("acp"); if (GCnt>0){ //mycBCAL->cd(2); mg->SetMinimum(0.); //mg->SetMaximum(1000.); mg->SetMaximum(YMAX); mg->Draw("acp"); gPad->SetGrid(); mg->GetXaxis()->SetTitle("ADC Samples [4ns]"); mg->Draw("acp"); } mycBCAL->Update(); char what; //gSystem->Sleep(1000); cout << " "<SaveAs(Crate); } if (what == 's'){ sprintf(Crate,"BCAL_Crates_run%d_event%d.root",RunNumber,(int)EVENTCounter); TFile *f = new TFile(Crate,"RECREATE"); mycBCAL->Write(); for (int k=0; kWrite(); } // graf1->Write(); f->ls(); f->Close(); } //delete graf1; for (int k=0;kSetTitle(Crate); int width = FCALWindowSize; TMultiGraph *mg; TGraph *graf[16*20*15]; mg = new TMultiGraph("mg","ADC250 raw data FCAL"); float Xaxis[500]; for (int k=0; k<500; k++){ Xaxis[k] = (float)k; } int GCnt = 0; for (int i=0; i<15; i++){ int lc = i+1; for (int n=0; n<20; n++){ for (int k=0; k<16; k++){ if ((FCALOverThresh[i][n][k])) { graf[GCnt] = new TGraph(width, Xaxis, FCALADCSamples[i][n][k]); mg->Add(graf[GCnt]); char t1[128]; sprintf(t1,"FCAL Crate%d slot%d channel%d",i,n,k); graf[GCnt]->SetTitle(t1); graf[GCnt]->SetLineColor(lc); graf[GCnt]->SetMarkerStyle(20); graf[GCnt]->SetMarkerSize(0.5); GCnt++; } } } } mycFCAL->Clear(); mg->SetMinimum(0.); mg->SetMaximum(1000.); mg->Draw("acp"); mg->GetXaxis()->SetTitle("ADC Samples [4ns]"); mg->Draw("acp"); gPad->SetGrid(); mycFCAL->Update(); char what; //gSystem->Sleep(1000); cout << " "<SaveAs(Crate); } if (what == 's'){ sprintf(Crate,"FCAL_Crates_run%d_event%d.root",RunNumber,(int)EVENTCounter); TFile *f = new TFile(Crate,"RECREATE"); mycFCAL->Write(); for (int k=0; kWrite(); } f->ls(); f->Close(); } for (int k=0;kSetTitle(title1); sprintf(title1,"Trigger time display Run %d cont.",RunNumber); mycTDC1->SetTitle(title1); mycTDC->Clear(); mycTDC->Divide(2,4,0.01,0.01); mycTDC->cd(1); gPad->SetLogy(); cosmic->Draw(); gPad->SetGrid(); mycTDC->cd(2); gPad->SetLogy(); fdcwiretime->Draw(); gPad->SetGrid(); mycTDC->cd(3); gPad->SetLogy(); bcaltime->Draw(); gPad->SetGrid(); mycTDC->cd(4); gPad->SetLogy(); sttime->Draw(); gPad->SetGrid(); mycTDC->cd(5); gPad->SetLogy(); tagtime->Draw(); gPad->SetGrid(); mycTDC->cd(6); gPad->SetLogy(); gPad->SetGrid(); toftime->Draw(); mycTDC->cd(7); gPad->SetLogy(); gPad->SetGrid(); tagmtime->Draw(); mycTDC->cd(8); gPad->SetLogy(); gPad->SetGrid(); taghtime->Draw(); mycTDC->Update(); mycTDC1->Clear(); mycTDC1->Divide(1,2,0.01,0.01); mycTDC1->cd(1); gPad->SetLogy(); mycTDC1->SetGrid(); RFtime->Draw(); mycTDC1->cd(2); // gPad->SetLogy(); mycTDC1->SetGrid(); TDtime->Draw(); mycTDC1->Update(); if (type){ char file[128]; // sprintf(file,"timing_run%d.gif",RunNumber); //mycTDC->SaveAs(file); sprintf(file,"TDC_timing_run%d_%d.root",RunNumber,Version); TFile *f = new TFile(file,"RECREATE"); mycTDC->Write(); cosmic->Write(); fdcwiretime->Write(); bcaltime->Write(); sttime->Write(); tagtime->Write(); toftime->Write(); tagmtime->Write(); taghtime->Write(); pstime->Write(); ADCTOFtime->Write(); bcalvsst->Write(); bcalhits->Write(); mycTDC1->Write(); RFtime->Write(); TDtime->Write(); f->ls(); f->Close(); } //cout<<"drawdata"<SetTitle(Crate); int width = PSWindowSize; TMultiGraph *mg[2]; TGraph *graf0[16*20]; TGraph *graf1[16*20]; mg[0] = new TMultiGraph("mg0","ADC250 raw data PS/PSC"); mg[1] = new TMultiGraph("mg1","ADC250 raw data TPOL"); float Xaxis[500]; for (int k=0; k<500; k++){ Xaxis[k] = (float)k; } int found = 0; int lc = 2; int CTop0 = 0; int CTop1 = 0; for (int i=0; i<2; i++){ lc+=i; for (int k=0; k<16; k++){ for (int n=0; n<16; n++){ if (PSOverThresh[i][k][n]){ if ((i>0) && (k>4)) { graf1[CTop1] = new TGraph(width, Xaxis, PSADCSamples[i][k][n]); mg[1]->Add(graf1[CTop1]); char t1[128]; sprintf(t1,"PS-Crate%d TPOL DATA slot%d channel%d",i,k+5,n); if ((n<15) || (k<8)){ found = 1; } graf1[CTop1]->SetTitle(t1); graf1[CTop1]->SetLineColor(lc); graf1[CTop1]->SetMarkerStyle(20); graf1[CTop1]->SetMarkerSize(.5); CTop1++; } else { graf0[CTop0] = new TGraph(width, Xaxis, PSADCSamples[i][k][n]); mg[0]->Add(graf0[CTop0]); char t1[128]; sprintf(t1,"PS-Crate%d slot%d channel%d",i,k+3,n); graf0[CTop0]->SetTitle(t1); graf0[CTop0]->SetLineColor(lc); graf0[CTop0]->SetMarkerStyle(20); graf0[CTop0]->SetMarkerSize(.5); CTop0++; } } } } } mycPS->Clear(); mycPS->Divide(1,2); mycPS->cd(1); mg[0]->Draw("acp"); mg[0]->SetMinimum(0.); mg[0]->SetMaximum(3500.); gPad->SetGrid(); gPad->Update(); mycPS->cd(2); mg[1]->Draw("acp"); mg[1]->SetMinimum(0.); mg[1]->SetMaximum(500.); gPad->SetGrid(); gPad->Update(); mycPS->Update(); char what; //gSystem->Sleep(1000); //if ((CTop1>0) && (found)){ //if (0){ cout << " "<SaveAs(Crate); } if (what == 's' ){ sprintf(Crate,"PS_Crates_run%d_event%d.root",RunNumber,(int)EVENTCounter); TFile *f = new TFile(Crate,"RECREATE"); mycPS->Write(); for (int k=0; kWrite(); } for (int k=0; kWrite(); } f->ls(); f->Close(); } for (int k=0;kSetTitle(Crate); int width = TAGMWindowSize; TMultiGraph *mg[2]; TGraph *graf[16*20]; mg[0] = new TMultiGraph("mg0","ADC250 raw data TAGM"); float Xaxis[500]; for (int k=0; k<500; k++){ Xaxis[k] = (float)k; } int lc = 2; int CTop = 0; for (int k=0; k<16; k++){ for (int n=0; n<16; n++){ if (TAGMOverThresh[0][k][n]){ graf[CTop] = new TGraph(width, Xaxis, TAGMADCSamples[0][k][n]); mg[0]->Add(graf[CTop]); char t1[128]; sprintf(t1,"TAGM-Crate slot%d channel%d",k,n); graf[CTop]->SetTitle(t1); graf[CTop]->SetTitle(t1); sprintf(t1,"graphS%dC%d",k,n); graf[CTop]->SetLineColor(lc); graf[CTop]->SetMarkerStyle(20); graf[CTop]->SetMarkerSize(.5); CTop++; } } } mycTAGM->Clear(); mycTAGM->cd(1); mg[0]->Draw("acp"); mg[0]->SetMinimum(0.); mg[0]->SetMaximum(1000.); char nu[128]; sprintf(nu,"N=%d",CTop); TText text1(152.,100.,nu); text1.Draw(); mycTAGM->Update(); char what; //gSystem->Sleep(1000); cout << " "<SaveAs(Crate); } if (what == 's'){ sprintf(Crate,"TAGM_Crate_run%d_event%d.root",RunNumber,(int)EVENTCounter); TFile *f = new TFile(Crate,"RECREATE"); mycTAGM->Write(); for (int k=0; kWrite(); } f->ls(); f->Close(); } for (int k=0;kSetTitle(Crate); int width = TAGHWindowSize; TMultiGraph *mg[2]; TGraph *graf[16*20]; mg[0] = new TMultiGraph("mg0","ADC250 raw data TAGH"); float Xaxis[500]; for (int k=0; k<500; k++){ Xaxis[k] = (float)k; } int lc = 2; int CTop = 0; TSpectrum *s = new TSpectrum(10, 1.); // peak search for max 10 peaks int Maxpeak = 0; int loc = 0; for (int k=0; k<16; k++){ for (int n=0; n<16; n++){ if (TAGHOverThresh[0][k][n]){ graf[CTop] = new TGraph(width, Xaxis, TAGHADCSamples[0][k][n]); mg[0]->Add(graf[CTop]); char t1[128]; sprintf(t1,"TAGH-Crate slot%d channel%d",k,n); graf[CTop]->SetTitle(t1); sprintf(t1,"graphS%dC%d",k,n); graf[CTop]->SetName(t1); graf[CTop]->SetLineColor(lc); graf[CTop]->SetMarkerStyle(20); graf[CTop]->SetMarkerSize(0.5); // make histogram and count peaks //TH1F *h = new TH1F("h","histogram of graph",width,0,width-1); TH1F *h = graf[CTop]->GetHistogram(); for (int i=1;i<=width;i++){ h->Fill((float)i,(float)TAGHADCSamples[0][k][n][i]); } int np = s->Search(h, 1., "", .8); if (np>Maxpeak){ Maxpeak = np; loc = CTop; } //h->Delete(); CTop++; lc++; } } } mycTAGH->Clear(); mycTAGH->Divide(1,2); mycTAGH->cd(1); mg[0]->Draw("acp"); char nu[128]; sprintf(nu,"N=%d",CTop); TText text1(102.,0.,nu); text1.Draw(); mycTAGH->cd(2); graf[loc]->Draw("acp"); mycTAGH->Update(); char what; //gSystem->Sleep(1000); cout << " "<SaveAs(Crate); } if (what == 's'){ sprintf(Crate,"TAGH_Crate_run%d_event%d.root",RunNumber,(int)EVENTCounter); TFile *f = new TFile(Crate,"RECREATE"); mycTAGH->Write(); for (int k=0; kWrite(); } f->ls(); f->Close(); } for (int k=0;k