/* ********************************************************* Author: * this file provides the detector algorithm for HMPID. * ********************************************************* */ extern "C" { #include } #include "event.h" #include "monitor.h" #include #include #include //AliRoot #include "AliHMPIDRawStream.h" #include "AliHMPIDCalib.h" #include "AliRawReaderDate.h" #include "AliBitPacking.h" #include "TMath.h" //ROOT #include "TFile.h" #include "TSystem.h" #include "TKey.h" #include "TH2S.h" #include "TObject.h" #include "TBenchmark.h" #include "TMath.h" #include "TRandom.h" int main(int argc, char **argv){ int status; /* log start of process */ printf("HMPID DA program started\n"); /* check that we got some arguments = list of files */ if (argc<2) { printf("Wrong number of arguments\n"); return -1; } /* copy locally a file from daq detector config db status=daqDA_DB_getFile("myconfig","./myconfig.txt"); if (status) { printf("Failed to get config file : %d\n",status); return -1; } and possibly use it */ /* report progress */ daqDA_progressReport(10); /* init the pedestal calculation */ AliHMPIDCalib *pCal=new AliHMPIDCalib(); /* init event counter */ Int_t iEvtNcal=0; Int_t cnt=0; int n; for (n=1;neventType; if (eventT==PHYSICS_EVENT) { //we use PHYSICS_EVENT for pedestal not CALIBRATION_EVENT iEvtNcal++; AliRawReader *reader = new AliRawReaderDate((void*)event); // Temporary there. Shall be removed as soon as the equipment ID is set correctly // For the moment ddl.map file contains one line which maps // the observed eqID=225 to the first HMPID DDL with ID=1536 // reader->LoadEquipmentIdsMap("ddl.map"); AliHMPIDRawStream stream(reader); while(stream.Next()) { Int_t nDDL=stream.GetDDLNumber(); for(Int_t row = 1; row <=AliHMPIDRawStream::kNRows; row++){ for(Int_t dil = 1; dil <=AliHMPIDRawStream::kNDILOGICAdd; dil++){ for(Int_t pad = 0; pad < AliHMPIDRawStream::kNPadAdd; pad++){ pCal->FillPedestal(nDDL,row,dil,pad,stream.GetCharge(nDDL,row,dil,pad)); }//pad }//dil }//row } //raw data loop delete reader; }// if CALIBRATION_EVENT /* exit when last event received, no need to wait for TERM signal */ if (eventT==END_OF_RUN) { printf("EOR event detected\n"); break; } // events loop free(event); } }//arg /* write report */ printf("Run #%s, received %d calibration events\n",getenv("DATE_RUN_NUMBER"),iEvtNcal); if (!iEvtNcal) { printf("No calibration events have been read. Exiting\n"); return -1; } /* report progress */ daqDA_progressReport(90); for(Int_t nDDL=0; nDDL < AliHMPIDCalib::kNDDL; nDDL++) { /* Calculate pedestal for the given ddl, if there is no ddl go t next */ if(!pCal->CalcPedestal(nDDL,Form("./HmpidPedDdl%02i.txt",nDDL),iEvtNcal)) continue; /* store the result file on FES */ status=daqDA_FES_storeFile(Form("./HmpidPedDdl%02i.txt",nDDL),Form("HMPID_DA_Pedestals_ddl=%02i",nDDL)); if (status) { printf("Failed to export file : %d\n",status); return -1; } }//nDDL /* report progress */ daqDA_progressReport(100); return status; }