* *
* This program connects to the DAQ data source passed as argument. *
* It computes calibration parameters, populates local "./V0_Ped_Width_Gain.dat" *
-* file and exports it to the FES. *
+* file, exports it to the FES, and stores it into DAQ DB *
* The program exits when being asked to shut down (daqDA_checkshutdown) *
-* or End of Run event. *
+* or on End of Run event. *
* We have 128 channels instead of 64 as expected for V0 due to the two sets of *
* charge integrators which are used by the FEE ... *
* *
printf("Wrong number of arguments\n");
return -1;
}
-
-// printf(" argc = %d, argv = %s \n",argc, &(**argv));
-
- Int_t kHighCut = 50; // high cut on pedestal distribution - to be tuned
- Int_t kLowCut = 30; // low cut on signal distribution - to be tuned
+
Double_t ADCmean[128];
Double_t ADCsigma[128];
Double_t PEDmean[128];
Double_t PEDsigma[128];
+
+//___________________________________________________
+// Get cuts from V00DA.config file
+
+ Int_t kLowCut; // = 60; low cut on signal distribution - to be tuned
+ Int_t kHighCut; // = 50; high cut on pedestal distribution - to be tuned
+ status = daqDA_DB_getFile("V00DA.config","./V00DA.config");
+ if (status) {
+ printf("Failed to get config file (V00DA.config) from DAQ DB, status=%d\n", status);
+ return -1;
+ }
+ /* open the config file and retrieve cuts */
+ FILE *fpConfig = fopen("V00DA.config","r");
+ fscanf(fpConfig,"%d %d",&kLowCut,&kHighCut);
+ fclose(fpConfig);
+
+ printf("LowCut on signal = %d ; HighCut on pedestal = %d\n",kLowCut,kHighCut);
+
//___________________________________________________
// Book HISTOGRAMS - dynamics of p-p collisions -
for (Int_t i=0; i<128; i++) {
sprintf(ADCname,"hADC%d",i);
sprintf(texte,"ADC cell%d",i);
- hADCname[i] = new TH1F(ADCname,texte,1024,0,1023);
+ hADCname[i] = new TH1F(ADCname,texte,1024,-0.5, 1023.5);
sprintf(PEDname,"hPED%d",i);
sprintf(texte,"PED cell%d",i);
- hPEDname[i] = new TH1F(PEDname,texte,1024,0,1023);
+ hPEDname[i] = new TH1F(PEDname,texte,1024,-0.5, 1023.5);
}
//___________________________________________________
-
-
+
/* open result file to be exported to FES */
FILE *fp=NULL;
- fp=fopen("./V0_Ped_Width_Gain.dat","a");
+ fp=fopen("./V0_Ped_Width_Gain.dat","w");
if (fp==NULL) {
printf("Failed to open result file\n");
return -1;}
case PHYSICS_EVENT:
nevents_physics++;
-
-// fprintf(flog,"Run #%lu, event size: %lu, BC:%u, Orbit:%u, Period:%u\n",
-// (unsigned long)event->eventRunNb,
-// (unsigned long)event->eventSize,
-// EVENT_ID_GET_BUNCH_CROSSING(event->eventId),
-// EVENT_ID_GET_ORBIT(event->eventId),
-// EVENT_ID_GET_PERIOD(event->eventId) );
-
+
AliRawReader *rawReader = new AliRawReaderDate((void*)event);
AliVZERORawStream* rawStream = new AliVZERORawStream(rawReader);
rawStream->Next();
for(Int_t i=0; i<64; i++) {
- if(!rawStream->GetIntegratorFlag(i,10))
- hADCname[i]->Fill(float(rawStream->GetADC(i))); // even integrator - fills 0 to 63
- else
- hADCname[i+64]->Fill(float(rawStream->GetADC(i))); // odd integrator - fills 64 to 123
- for(Int_t j=0; j<21; j++) {
- if(j==10) continue;
- if(!rawStream->GetIntegratorFlag(i,j))
- { hPEDname[i]->Fill(float(rawStream->GetPedestal(i,j))); } // even integrator
- else
- { hPEDname[i+64]->Fill(float(rawStream->GetPedestal(i,j))); } // odd integrator
- }
+ Int_t nFlag = 0;
+ for(Int_t j=0; j<21; j++) {
+ if((rawStream->GetBBFlag(i,j)) || (rawStream->GetBGFlag(i,j))) nFlag++;
+ }
+ if(nFlag == 0){ // Pedestal
+ for(Int_t j=5;j<16;j++){
+ Int_t Integrator = rawStream->GetIntegratorFlag(i,j);
+ Float_t pedestal = (float)(rawStream->GetPedestal(i,j));
+ hPEDname[i + 64 * Integrator]->Fill(pedestal);
+ }
+ }
+ if((rawStream->GetBBFlag(i,10)) || (rawStream->GetBGFlag(i,10))){ // Charge
+ Int_t Integrator = rawStream->GetIntegratorFlag(i,10);
+ Float_t charge = (float)(rawStream->GetADC(i));
+ hADCname[i + 64 * Integrator]->Fill(charge);
+ }
}
delete rawStream;
rawStream = 0x0;
}
} // loop over events
+
+ printf("%d physics events processed\n",nevents_physics);
//________________________________________________________________________
// Computes mean values, dumps them into the output text file
hPEDname[i]->GetXaxis()->SetRange(0,kHighCut);
PEDmean[i] = hPEDname[i]->GetMean();
PEDsigma[i] = hPEDname[i]->GetRMS();
- hADCname[i]->GetXaxis()->SetRange(kLowCut,1023);
+ hADCname[i]->GetXaxis()->SetRange(kLowCut,1024);
ADCmean[i] = hADCname[i]->GetMean();
ADCsigma[i] = hADCname[i]->GetRMS();
fprintf(fp," %.3f %.3f %.3f %.3f\n",PEDmean[i],PEDsigma[i],ADCmean[i],ADCsigma[i]);
- }
-
+ }
+
//________________________________________________________________________
// Write root file with histos for users further check - just in case -
TFile *histoFile = new TFile("VZERO_histos.root","RECREATE");
for (Int_t i=0; i<128; i++) {
- hADCname[i]->GetXaxis()->SetRange(0,1023);
+ hADCname[i]->GetXaxis()->SetRange(0,1024);
hADCname[i]->Write();
hPEDname[i]->Write(); }
//________________________________________________________________________
-
/* close result file */
fclose(fp);
printf("Failed to export file : %d\n",status);
return -1; }
+ /* store result file into Online DB */
+ status=daqDA_DB_storeFile("./V0_Ped_Width_Gain.dat","V00da_results");
+ if (status) {
+ printf("Failed to store file into Online DB: %d\n",status);
+ return -1; }
+
return status;
}