X-Git-Url: http://git.uio.no/git/?a=blobdiff_plain;f=ZDC%2FZDCPEDESTALda.cxx;h=b5f81de51b4a2e03d337b769e23b592a98e896c0;hb=89d03e5ae80bbc877750c106a022c63106cbd1b6;hp=49c51d8fd78a96c131f102caad3d956736d026a8;hpb=3018cd7f6e2c6a6b6f3e6f1adc58f9a96ee0009d;p=u%2Fmrichter%2FAliRoot.git diff --git a/ZDC/ZDCPEDESTALda.cxx b/ZDC/ZDCPEDESTALda.cxx index 49c51d8fd78..b5f81de51b4 100644 --- a/ZDC/ZDCPEDESTALda.cxx +++ b/ZDC/ZDCPEDESTALda.cxx @@ -66,8 +66,16 @@ int main(int argc, char **argv) { TVirtualFitter::SetDefaultFitter("Minuit"); int status = 0; + int const kNModules = 9; int const kNChannels = 24; int const kNScChannels = 32; + Int_t kFirstADCGeo=0, kLastADCGeo=3; + + Int_t iMod=-1; + Int_t modGeo[kNModules], modType[kNModules],modNCh[kNModules]; + for(Int_t kl=0; kleventType; - Int_t iScCh=0; - Int_t scMod[kNScChannels], scCh[kNScChannels], scSigCode[kNScChannels]; - Int_t scDet[kNScChannels], scSec[kNScChannels]; - for(Int_t y=0; ySetSODReading(kTRUE); // -------------------------------------------------------- @@ -248,42 +264,62 @@ int main(int argc, char **argv) { else{ while((rawStreamZDC->Next())){ if(rawStreamZDC->IsHeaderMapping()){ // mapping header - modNum = rawStreamZDC->GetADCModule(); - modType = rawStreamZDC->GetModType(); + iMod++; + modGeo[iMod] = rawStreamZDC->GetADCModule(); + modType[iMod] = rawStreamZDC->GetModType(); + modNCh[iMod] = rawStreamZDC->GetADCNChannels(); } if(rawStreamZDC->IsChMapping()){ - if(modType==1){ // ADC mapping ---------------------- + if(modType[iMod]==1){ // ADC mapping ---------------------- adcMod[ich] = rawStreamZDC->GetADCModFromMap(ich); adcCh[ich] = rawStreamZDC->GetADCChFromMap(ich); sigCode[ich] = rawStreamZDC->GetADCSignFromMap(ich); det[ich] = rawStreamZDC->GetDetectorFromMap(ich); sec[ich] = rawStreamZDC->GetTowerFromMap(ich); - // - fprintf(mapFile4Shuttle,"\t%d\t%d\t%d\t%d\t%d\t%d\n", - ich,adcMod[ich],adcCh[ich],sigCode[ich],det[ich],sec[ich]); - // - //printf(" Mapping in DA -> %d ADC: mod %d ch %d, code %d det %d, sec %d\n", - // ich,adcMod[ich],adcCh[ich],sigCode[ich],det[ich],sec[ich]); - // ich++; } - else if(modType==2){ //VME scaler mapping -------------------- + else if(modType[iMod]==2){ //VME scaler mapping -------------------- scMod[iScCh] = rawStreamZDC->GetScalerModFromMap(iScCh); scCh[iScCh] = rawStreamZDC->GetScalerChFromMap(iScCh); scSigCode[iScCh] = rawStreamZDC->GetScalerSignFromMap(iScCh); scDet[iScCh] = rawStreamZDC->GetScDetectorFromMap(iScCh); - scSec[iScCh] = rawStreamZDC->GetScTowerFromMap(iScCh); - // - fprintf(mapFile4Shuttle,"\t%d\t%d\t%d\t%d\t%d\t%d\n", - iScCh,scMod[iScCh],scCh[iScCh],scSigCode[iScCh],scDet[iScCh],scSec[iScCh]); - // - //printf(" Mapping in DA -> %d Scaler: mod %d ch %d, code %d det %d, sec %d\n", - // iScCh,scMod[iScCh],scCh[iScCh],scSigCode[iScCh],scDet[iScCh],scSec[iScCh]); - // + scSec[iScCh] = rawStreamZDC->GetScTowerFromMap(iScCh); iScCh++; } + else if(modType[iMod]==6 && modGeo[iMod]==4){ // ZDC TDC mapping -------------------- + tdcMod[itdcCh] = rawStreamZDC->GetTDCModFromMap(itdcCh); + tdcCh[itdcCh] = rawStreamZDC->GetTDCChFromMap(itdcCh); + tdcSigCode[itdcCh] = rawStreamZDC->GetTDCSignFromMap(itdcCh); + itdcCh++; + } } + } + // Writing data on output FXS file + for(Int_t is=0; is<2*kNChannels; is++){ + fprintf(mapFile4Shuttle,"\t%d\t%d\t%d\t%d\t%d\t%d\n", + is,adcMod[is],adcCh[is],sigCode[is],det[is],sec[is]); + //printf(" Pedestal DA -> %d ADC: mod %d ch %d, code %d det %d, sec %d\n", + // is,adcMod[is],adcCh[is],sigCode[is],det[is],sec[is]); + } + for(Int_t is=0; is %d Scaler: mod %d ch %d, code %d det %d, sec %d\n", + // is,scMod[is],scCh[is],scSigCode[is],scDet[is],scSec[is]); + } + for(Int_t is=0; is %d TDC: mod %d ch %d, code %d\n", + // is,tdcMod[is],tdcCh[is],tdcSigCode[is]); + } + for(Int_t is=0; is Module mapping: geo %d type %d #ch %d\n", + // modGeo[is],modType[is],modNCh[is]); } + } fclose(mapFile4Shuttle); }// SOD event @@ -299,7 +335,7 @@ int main(int argc, char **argv) { } else{ printf("ZDCPEDESTALda.cxx -> NO STANDALONE_PEDESTAL RUN raw data found\n"); - printf(" Attributes: %x\n", message); + printf(" CDH attributes: %x\n", message); return -1; } } @@ -339,7 +375,8 @@ int main(int argc, char **argv) { //printf(" rawData: det %d sec %d value %d\n", // detector, sector,rawStreamZDC->GetADCGain(),rawStreamZDC->GetADCValue() ); - if(rawStreamZDC->IsADCDataWord() && (detector!=-1)){ + if((rawStreamZDC->IsADCDataWord()) && (detector!=-1) && + (rawStreamZDC->GetADCModule()>=kFirstADCGeo && rawStreamZDC->GetADCModule()<=kLastADCGeo)){ if(sector!=5){ // Physics signals if(detector==1) index = sector; // *** ZNC else if(detector==2) index = sector+5; // *** ZPC @@ -385,14 +422,15 @@ int main(int argc, char **argv) { } iraw++; }//IsADCDataWord() - // - if(iraw == 4*kNChannels){ // Last ADC channel -> Filling correlation histos - for(Int_t k=0; kFill(RawADCoothg[k], RawADChg[k]); - hPedCorrlg[k]->Fill(RawADCootlg[k], RawADClg[k]); - } - } } + // + if(iraw==4*kNChannels ){ // Last ADC channel -> Filling correlation histos + for(Int_t k=0; kFill(RawADCoothg[k], RawADChg[k]); + hPedCorrlg[k]->Fill(RawADCootlg[k], RawADClg[k]); + } + //printf(" ev. %d -> Filling correlation histo %d\n",nevents_physics, kNChannels); + } nevents_physics++; // delete reader; @@ -469,36 +507,57 @@ int main(int argc, char **argv) { } // --- Correlations - // NB -> The correlations are NOT fitted since at the moment - // (Sptember 2009) they are NOT correlations and the DA would fail!!! -/* Float_t CorrCoeff0[2*kNChannels], CorrCoeff1[2*kNChannels]; + Float_t CorrCoeff0[2*kNChannels], CorrCoeff1[2*kNChannels]; TProfile *hPedCorrProfhg[kNChannels], *hPedCorrProflg[kNChannels]; TF1 *ffunchg[kNChannels], *ffunclg[kNChannels]; char namhist4[50]; for(int i=0;iProfileX(namhist4,-1,-1,"S"); hPedCorrProfhg[i]->SetName(namhist4); - hPedCorrProfhg[i]->Fit("pol1","Q"); - ffunchg[i] = hPedCorrProfhg[i]->GetFunction("pol1"); - CorrCoeff0[i] = (Double_t) ffunchg[i]->GetParameter(0); - CorrCoeff1[i] = (Double_t) ffunchg[i]->GetParameter(1); - fprintf(fileShuttle,"\t%f\t%f\n",CorrCoeff0[i],CorrCoeff1[i]); - //printf("\t CorrCoeff0[%d] = %f, CorrCoeff1[%d] = %f\n",i, CorrCoeff0[i], i, CorrCoeff1[i]); + if(hPedCorrProfhg[i]->GetEntries()!=0){ + hPedCorrProfhg[i]->Fit("pol1","Q"); + ffunchg[i] = hPedCorrProfhg[i]->GetFunction("pol1"); + CorrCoeff0[i] = (Double_t) ffunchg[i]->GetParameter(0); + CorrCoeff1[i] = (Double_t) ffunchg[i]->GetParameter(1); + //printf("\t CorrCoeff0[%d] = %f, CorrCoeff1[%d] = %f\n",i, CorrCoeff0[i], i, CorrCoeff1[i]); + } + else{ + printf(" Warning -> Correlation for high range ch. %d has no entry and can't be fitted!\n",i); + } + } + else{ + CorrCoeff0[i] = 0.; + CorrCoeff1[i] = 0.; + } + fprintf(fileShuttle,"\t%f\t%f\n",CorrCoeff0[i],CorrCoeff1[i]); + } for(int i=0;iProfileX(namhist4,-1,-1,"S"); hPedCorrProflg[i]->SetName(namhist4); - hPedCorrProflg[i]->Fit("pol1","Q"); - ffunclg[i] = hPedCorrProflg[i]->GetFunction("pol1"); - CorrCoeff0[i+kNChannels] = (Double_t) ffunclg[i]->GetParameter(0); - CorrCoeff1[i+kNChannels] = (Double_t) ffunclg[i]->GetParameter(1); - fprintf(fileShuttle,"\t%f\t%f\n",CorrCoeff0[i+kNChannels],CorrCoeff1[i+kNChannels]); - //printf("\t CorrCoeff0[%d] = %f, CorrCoeff1[%d] = %f\n", - // i+kNChannels, CorrCoeff0[i+kNChannels], i+kNChannels, CorrCoeff1[i+kNChannels]); + if(hPedCorrProflg[i]->GetEntries()!=0){ + hPedCorrProflg[i]->Fit("pol1","Q"); + ffunclg[i] = hPedCorrProflg[i]->GetFunction("pol1"); + CorrCoeff0[i+kNChannels] = (Double_t) ffunclg[i]->GetParameter(0); + CorrCoeff1[i+kNChannels] = (Double_t) ffunclg[i]->GetParameter(1); + //printf("\t CorrCoeff0[%d] = %f, CorrCoeff1[%d] = %f\n", + // i+kNChannels, CorrCoeff0[i+kNChannels], i+kNChannels, CorrCoeff1[i+kNChannels]); + } + else{ + printf(" Warning -> Correlation for low range ch. %d has no entry and can't be fitted!\n",i); + } + } + else{ + CorrCoeff0[i+kNChannels] = 0.; + CorrCoeff1[i+kNChannels] = 0.; + } + fprintf(fileShuttle,"\t%f\t%f\n",CorrCoeff0[i+kNChannels],CorrCoeff1[i+kNChannels]); } -*/ + // fclose(fileShuttle); //