X-Git-Url: http://git.uio.no/git/?a=blobdiff_plain;f=VZERO%2FVZEROPbPbda.cxx;h=191d679c25c77d55b25d163318b8ee80d567405f;hb=eb5de7ee5991aaa19ec2db15e15383a38b4b9f34;hp=9e419b8e1e3cf71bd35ef32b81ef1923ea22c557;hpb=83176645257ba5ba7fa4ab1697a8dff89edd40c6;p=u%2Fmrichter%2FAliRoot.git diff --git a/VZERO/VZEROPbPbda.cxx b/VZERO/VZEROPbPbda.cxx index 9e419b8e1e3..191d679c25c 100644 --- a/VZERO/VZEROPbPbda.cxx +++ b/VZERO/VZEROPbPbda.cxx @@ -60,14 +60,14 @@ int main(int argc, char **argv) { //___________________________________________________ // Get parameters from V00DAEqualFactors.config file + Int_t neventsMin = 2000; Int_t kStartClock = 9; // First clock in the search for max adc Int_t kEndClock = 11; // Last clock in the search for max adc Int_t kNPreClocks = 6; // Number of clock before max used in the charge sum Int_t kNPostClocks = 1; // Number of clock after max used in the charge sum - UShort_t kTriggerAcc = 64; // Trigger mask for accepted events (64 = CTA1 & CTC1) - UShort_t kTriggerRej = 256; // Trigger mask for rejected events (256 = CTA2 & CTC2) + UChar_t kNFlagsCut = 63;// Minimum number of TDC flags requested, replaces the trigger selection Int_t kNBins = 10000; Float_t kRange = 0.1; @@ -79,16 +79,16 @@ int main(int argc, char **argv) { } else { /* open the config file and retrieve cuts */ FILE *fpConfig = fopen("V00DAEqualFactors.config","r"); - int res = fscanf(fpConfig,"%d %d %d %d %u %u %d %f", - &kStartClock,&kEndClock,&kNPreClocks,&kNPostClocks,&kTriggerAcc,&kTriggerRej,&kNBins,&kRange); + int res = fscanf(fpConfig,"%d %d %d %d %d %hhu %d %f", + &neventsMin,&kStartClock,&kEndClock,&kNPreClocks,&kNPostClocks,&kNFlagsCut,&kNBins,&kRange); if(res!=8) { printf("Failed to get values from Config file (V00DAEqualFactors.config): wrong file format - 7 integers and 1 float are expected - \n"); } fclose(fpConfig); } - printf("First LHC Clock = %d; Last LHC Clock = %d; N Pre Clock = %d ; N Post Clock = %d; Trigger mask for accepted events = %u; Trigger mask for rejected events = %u; Number of histogram bins = %d; Histogram range = %.3f\n", - kClockStart, kClockStop, kNPreClock, kNPostClock, kTriggerAcc, kTriggerRej, kNBins, kRange); + printf("Minimum number of events to process = %d; First LHC Clock = %d; Last LHC Clock = %d; N Pre Clock = %d; N Post Clock = %d; Minimum number of TDC flags = %hhu; Number of histogram bins = %d; Histogram range = %.3f\n", + neventsMin,kStartClock, kEndClock, kNPreClocks, kNPostClocks, kNFlagsCut, kNBins, kRange); TH1D *fMedian[64]; for(Int_t j = 0; j < 64; ++j) fMedian[j] = new TH1D(Form("fMedian_%d",j),"Slopes weighted median, channel par channel",kNBins,0,kRange); @@ -99,13 +99,6 @@ int main(int argc, char **argv) { for(Int_t j = 0; j < 64; ++j) fPrevadc[j] = 0; //___________________________________________________ - - /* open result file to be exported to FES */ - FILE *fp=NULL; - fp=fopen("./V0_EqualizationFactors.dat","w"); - if (fp==NULL) { - printf("Failed to open local result file\n"); - return -1;} /* define data source : this is argument 1 */ status=monitorSetDataSource( argv[1] ); @@ -126,6 +119,7 @@ int main(int argc, char **argv) { monitorSetNoWaitNetworkTimeout(1000); /* init counters on events */ + int neventsPhysicsAll=0; int neventsPhysics=0; int neventsTotal=0; @@ -171,9 +165,14 @@ int main(int argc, char **argv) { AliVZERORawStream* rawStream = new AliVZERORawStream(rawReader); if (rawStream->Next()) { + neventsPhysicsAll++; UShort_t triggers = rawStream->GetTriggerInputs(); - if (((triggers & kTriggerAcc) == kTriggerAcc) && // Check if the requested trigger(s) is fired - ((triggers & kTriggerRej) == 0)) { // Check if the requested trigger(s) is NOT fired + UChar_t nFlags = 0; + for(Int_t i = 0; i < 64; ++i) { + if (rawStream->GetBBFlag(i,10)) nFlags++; + } + if (nFlags >= kNFlagsCut) { // Check if the number of minimum number of TDC flags is reached (trigger selection) + neventsPhysics++; Float_t adc[64]; @@ -238,27 +237,32 @@ int main(int argc, char **argv) { } // loop over events - printf("%d physics events processed\n",neventsPhysics); + printf("%d physics events processed (out of %d physics and %d total events)\n",neventsPhysics,neventsPhysicsAll,neventsTotal); //___________________________________________________________________________ // Computes regression parameters // charge_i = p0 + charge_tot * p1 - Double_t beta[64]; - Double_t q = 0.5; - for(int i = 0; i < 64; ++i) fMedian[i]->GetQuantiles(1,&beta[i],&q); + if(neventsPhysics>neventsMin){ + /* open result file to be exported to FES */ + FILE *fp=NULL; + fp=fopen("./V0_EqualizationFactors.dat","w"); + if (fp==NULL) { + printf("Failed to open local result file\n"); + return -1;} - for(Int_t i=0; i<64; i++) { - fprintf(fp," %d %.3f\n",GetOfflineChannel(i), beta[i]*64.); - printf(" %d %.3f\n",GetOfflineChannel(i), beta[i]*64.); - } - -//________________________________________________________________________ - - /* close local result file and FXS result file*/ - fclose(fp); + Double_t beta[64]; + Double_t q = 0.5; + for(int i = 0; i < 64; ++i) fMedian[i]->GetQuantiles(1,&beta[i],&q); + + for(Int_t i=0; i<64; i++) { + fprintf(fp," %d %.5f\n",GetOfflineChannel(i), beta[i]*64.); + printf(" %d %.5f\n",GetOfflineChannel(i), beta[i]*64.); + } - if(neventsPhysics>2000){ + /* close local result file and FXS result file*/ + fclose(fp); + /* export result file to FES */ status=daqDA_FES_storeFile("./V0_EqualizationFactors.dat","V00DAEqualFactors"); if (status) { @@ -271,6 +275,19 @@ int main(int argc, char **argv) { printf("Failed to store file into Online DB: %d\n",status); return -1; } } + else { + // Take the last run's file from the DB + status=daqDA_DB_getFile("V00DAEqualFactors","./V0_EqualizationFactors.dat"); + if (status) { + printf("Failed to get file from Online DB: %d\n",status); + return -1; } + + /* export result file to FES */ + status=daqDA_FES_storeFile("./V0_EqualizationFactors.dat","V00DAEqualFactors"); + if (status) { + printf("Failed to export file : %d\n",status); + return -1; } + } return status; }