From 4969a7fa1a6c02a6148dae97cc5750f378b5c701 Mon Sep 17 00:00:00 2001 From: cvetan Date: Fri, 13 Jun 2008 20:04:18 +0000 Subject: [PATCH] Urgent fixes by Levente --- HMPID/AliHMPIDCalib.cxx | 108 +++++++--------------------------------- HMPID/AliHMPIDCalib.h | 13 ++--- HMPID/HMPIDda.cxx | 57 ++++++++++----------- 3 files changed, 46 insertions(+), 132 deletions(-) diff --git a/HMPID/AliHMPIDCalib.cxx b/HMPID/AliHMPIDCalib.cxx index abbef796dc7..139f95ad39d 100644 --- a/HMPID/AliHMPIDCalib.cxx +++ b/HMPID/AliHMPIDCalib.cxx @@ -48,9 +48,7 @@ fWritePads(0), fnDDLInStream(0x0), fnDDLOutStream(0x0), fLargeHisto(kFALSE), -fSelectDDL(0), -fDaOut(0), -fFeeIn(0) +fSelectDDL(0) { // //constructor @@ -187,10 +185,7 @@ void AliHMPIDCalib::Init() // fSigCut=3; //the standard cut - fFeeIn=""; - fDaOut=""; - - + for(Int_t iDDL=0; iDDL< AliHMPIDRawStream::kNDDL; iDDL++) { for(Int_t ierr=0; ierr >nSigCut; } infile.close(); + if(nSigCut< 0 || nSigCut > 15 ) {Printf("WARNING: DAQ Sigma Cut from DAQ DB is out of bounds: %d, resetting it to 3!!!",nSigCut);nSigCut=3;} + Printf("DAQ Sigma Cut from DAQ DB is: %d",nSigCut); fSigCut=nSigCut; }//SetSigCutFromFile() //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -void AliHMPIDCalib::SetSigCutFromShell(Char_t *env) -{ - // - //Set Sigma Cut from the Shell on the LDC, if the input file is not present default value is set! - //Arguments: none - //Returns: none - // - Int_t nSigCut=0; - TString ssc(gSystem->Getenv(env)); - //make it nicer later... - if(ssc=="1") { nSigCut=1; Printf("DAQ Sigma Cut from shell is: %d",nSigCut);} - else if(ssc=="2") { nSigCut=2; Printf("DAQ Sigma Cut from shell is: %d",nSigCut);} - else if(ssc=="3") { nSigCut=3; Printf("DAQ Sigma Cut from shell is: %d",nSigCut);} - else if(ssc=="4") { nSigCut=4; Printf("DAQ Sigma Cut from shell is: %d",nSigCut);} - else if(ssc=="5") { nSigCut=5; Printf("DAQ Sigma Cut from shell is: %d",nSigCut);} - else if(ssc=="6") { nSigCut=6; Printf("DAQ Sigma Cut from shell is: %d",nSigCut);} - else if(ssc=="7") { nSigCut=7; Printf("DAQ Sigma Cut from shell is: %d",nSigCut);} - else if(ssc=="8") { nSigCut=8; Printf("DAQ Sigma Cut from shell is: %d",nSigCut);} - else if(ssc=="9") { nSigCut=9; Printf("DAQ Sigma Cut from shell is: %d",nSigCut);} - else if(ssc=="10") { nSigCut=10; Printf("DAQ Sigma Cut from shell is: %d",nSigCut);} - else if(ssc=="11") { nSigCut=11; Printf("DAQ Sigma Cut from shell is: %d",nSigCut);} - else if(ssc=="12") { nSigCut=12; Printf("DAQ Sigma Cut from shell is: %d",nSigCut);} - else if(ssc=="13") { nSigCut=13; Printf("DAQ Sigma Cut from shell is: %d",nSigCut);} - else if(ssc=="14") { nSigCut=14; Printf("DAQ Sigma Cut from shell is: %d",nSigCut);} - else if(ssc=="15") { nSigCut=15; Printf("DAQ Sigma Cut from shell is: %d",nSigCut);} - else { nSigCut=3; Printf("DAQ Sigma Cut from shell is too large set it back to default: %d",nSigCut);} - - fSigCut=nSigCut; -}//SetSigCutFromFile() -//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ void SetDaOutFromShell(Char_t* name); //Set out dir. of DA from Bash Shell -void AliHMPIDCalib::SetFeeInFromShell(Char_t* env) -{ - // - //Set the path where the Fe2C is looking for the threshold files - //Arguments: none - //Returns: none - // - TString sFeeIn(gSystem->Getenv(env)); - if(sFeeIn.Data()=="") sFeeIn="/local/home/hmpid/"; - if(sFeeIn.EndsWith("/")) fFeeIn=sFeeIn; - else fFeeIn=Form("%s/",sFeeIn.Data()); - if(gSystem->OpenDirectory(fFeeIn.Data())==0) - { - Printf("========== HMPID-DA WARNING: directory %s does not exist! Switching to /tmp! ==========",fFeeIn.Data()); - fFeeIn="/tmp/"; - } - Printf("HMPID_FEE_IN=%s",fFeeIn.Data()); -} -//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ void SetDaOutFromShell(Char_t* name); //Set out dir. of DA from Bash Shell -void AliHMPIDCalib::SetDaOutFromShell(Char_t* env) -{ - // - //Set the standard path where the DA write the output - //Arguments: none - //Returns: none - // - TString sDaOut(gSystem->Getenv(env)); - if(sDaOut=="") sDaOut="/local/home/hmpid/"; - if(sDaOut.EndsWith("/")) fDaOut=sDaOut; - else fDaOut=Form("%s/",sDaOut.Data()); - - if(gSystem->OpenDirectory(fDaOut.Data())==0) - { - Printf("========== HMPID-DA WARNING: directory %s does not exist! Switching to /tmp! ==========",fDaOut.Data()); - fDaOut="/tmp/"; - } - Printf("HMPID_DA_OUT=%s",fDaOut.Data()); -} -//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ void AliHMPIDCalib::InitHisto(Int_t q,Int_t histocnt,Char_t* name) { // @@ -471,7 +399,7 @@ Bool_t AliHMPIDCalib::WriteErrors(Int_t nDDL, Char_t* name, Int_t nEv) }//FillErrors() //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -Bool_t AliHMPIDCalib::CalcPedestal(Int_t nDDL, Char_t* name, Int_t nEv) +Bool_t AliHMPIDCalib::CalcPedestal(Int_t nDDL, Char_t* name, Char_t *name2,Int_t nEv) { // //Calculate pedestal for each pad @@ -480,15 +408,13 @@ Bool_t AliHMPIDCalib::CalcPedestal(Int_t nDDL, Char_t* name, Int_t nEv) // if(faddl[nDDL]==kFALSE) return kFALSE; //if ddl is missing no ped file is created (and also for LDC selection). Check with Paolo what he checks for?! - Int_t ddlOffset=1536; + Int_t feeOffset=196657; - ofstream feeInput[24]; + ofstream feeInput; feeInput.open(Form("%s",name2)); //write thr file for Fe2C - for(Int_t ir=0;ir 3.0) Printf("WARNING SIGMA DDL: %2d row: %2d dil: %2d pad: %2d mean: %3.2f sigma: %2.2f nEvPerPad: %02d fnDDLOutStream: %02d fpedQ0: %02d",nDDL,row,dil,pad,mean,sigma,nEvPerPad,fnDDLOutStream[nDDL],fpedQ0[nDDL][row][dil][pad]); }//adr //we have to write up to 64 not 48 in the DILOGIC since they are daisy chained! //offset and format is defined for the Fe2C code - for(Int_t idd=0;idd<16;idd++) feeInput[row-1] << Form("0x%4.4x\n",idd+feeOffset); + for(Int_t idd=0;idd<16;idd++) feeInput << Form("0x%4.4x\n",idd+feeOffset); }//dil }//row out.close(); //write pedestal file - for(Int_t ir=0;irGetPluginManager()->AddHandler("TVirtualStreamerInfo", - "*", - "TStreamerInfo", - "RIO", - "TStreamerInfo()"); + gROOT->GetPluginManager()->AddHandler("TVirtualStreamerInfo","*","TStreamerInfo","RIO","TStreamerInfo()"); /* check that we got some arguments = list of files */ if (argc<2) { @@ -59,13 +60,10 @@ int main(int argc, char **argv){ 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 */ + /* copy locally a file from daq detector config db */ + hmpIn=Form("./%s",hmpConfigFile); + status=daqDA_DB_getFile(hmpConfigFile,hmpIn.Data()); + if (status) { printf("Failed to get HMPID config file status: %d\n",status); return -1; } /* report progress */ daqDA_progressReport(10); @@ -83,12 +81,7 @@ int main(int argc, char **argv){ AliHMPIDCalib *pCal=new AliHMPIDCalib(); /* Set the number of sigma cuts inside the file HmpidSigmaCut.txt on BOTH LDCs! */ /* If the file is NOT present then the default cut 3 will be used!*/ - - //pCal->SetSigCutFromFile("HmpidSigmaCut.txt"); - pCal->SetSigCutFromShell("HMPID_SIGMA_CUT"); //decision to make later: wether to use file or env variable... - pCal->SetDaOutFromShell("HMPID_DA_OUT"); //decision to make later: wether to use file or env variable... - pCal->SetFeeInFromShell("HMPID_FEE_IN"); //decision to make later: wether to use file or env variable... - + pCal->SetSigCutFromFile(hmpIn); /* ONLY set this option to kTRUE if you want to create the ADC dsitributions for all 161280 pads!!!!*/ /* kTRUE is not suggested for production mode b/c of the memory consumption! */ @@ -199,23 +192,22 @@ int main(int argc, char **argv){ /* report progress */ daqDA_progressReport(90); - TString sDaOut=pCal->GetDaOutFromShell(); - for(Int_t nDDL=0; nDDL < AliHMPIDRawStream::kNDDL; nDDL++) { - + for(Int_t nDDL=0; nDDL < AliHMPIDRawStream::kNDDL; nDDL++) { + feeIn=Form("thr%d.dat",ddlOffset+nDDL); /* Calculate pedestal for the given ddl, if there is no ddl go t next */ - if(!pCal->CalcPedestal(nDDL,Form("%sHmpidPedDdl%02i.txt",sDaOut.Data(),nDDL),iEvtNcal)) continue; + if(pCal->CalcPedestal(nDDL,Form("HmpidPedDdl%02i.txt",nDDL),Form("%s",feeIn.Data()),iEvtNcal)) { + status=daqDA_DB_storeFile(feeIn.Data(),feeIn.Data()); //store a single threshold file for a DDL in DAQ DB + if (status) { printf("Failed to store file %s in DAQ DB, status: %d\n",feeIn.Data(),status); } + status=daqDA_FES_storeFile(Form("HmpidPedDdl%02i.txt",nDDL),Form("HmpidPedDdl%02i.txt",nDDL)); //store a single pedestal file for a DDL + if (status) { printf("Failed to export file on FES: %d\n",status); } + }//pedestals and thresholds + if(pCal->WriteErrors(nDDL,Form("HmpidErrorsDdl%02i.txt",nDDL),iEvtNcal)) { + status=daqDA_FES_storeFile(Form("HmpidErrorsDdl%02i.txt",nDDL),Form("HmpidErrorsDdl%02i.txt",nDDL)); + if (status) { printf("Failed to export file : %d\n",status); } + }//errors /* to create pedestal file as Paolo uncomment the line */ - //if(!pCal->CalcPedestalPaolo(nDDL,Form("%sHmpidPedDdl%02i.txt",sDaOut.Data(),nDDL),iEvtNcal)) continue; - if(!pCal->WriteErrors(nDDL,Form("%sHmpidErrorsDdl%02i.txt",sDaOut.Data(),nDDL),iEvtNcal)) continue; - - /* store the result file on FES */ - - status=daqDA_FES_storeFile(Form("%sHmpidPedDdl%02i.txt",sDaOut.Data(),nDDL),Form("HmpidPedDdl%02i.txt",nDDL)); - if (status) { printf("Failed to export file : %d\n",status); } - status=daqDA_FES_storeFile(Form("%sHmpidErrorsDdl%02i.txt",sDaOut.Data(),nDDL),Form("HmpidErrorsDdl%02i.txt",nDDL)); - if (status) { printf("Failed to export file : %d\n",status); } - + //if(!pCal->CalcPedestalPaolo(nDDL,Form("%sHmpidPedDdl%02i.txt",sDaOut.Data(),nDDL),iEvtNcal)) continue; }//nDDL if(pCal->GetWritePads()==kTRUE) pCal->CloseFile(); @@ -228,3 +220,4 @@ int main(int argc, char **argv){ return status; } + -- 2.39.3