- Link: - http://www.to.infn.it/~prino/alice/RawData/run11173.date
- Run Type: - PULSER_RUN
- DA Type: - LDC
-- Number of events needed: 100
+- Number of events needed: >15
- Input Files: - SDDbase_step1_ddl*c*_sid*.data
- Output Files: - SDDbase_ddl*c*_sid*.data
- Trigger types used:
#include <TSystem.h>
#include <TROOT.h>
#include <TPluginManager.h>
+#include <TObjArray.h>
+#include <TObjString.h>
+#include <TDatime.h>
// AliRoot includes
#include "AliRawReaderDate.h"
#include "AliITSOnlineSDDTP.h"
#include "AliITSRawStreamSDD.h"
+#include "AliITSRawStreamSDDCompressed.h"
+
+#ifdef ALI_AMORE
+#include <AmoreDA.h>
+#endif
/* Main routine
Arguments: list of DATE raw data files
*/
const Int_t kTotDDL=24;
const Int_t kModPerDDL=12;
const Int_t kSides=2;
- Int_t adcSamplFreq=40;
- if(gSystem->Getenv("DAQ_DETDB_LOCAL")!=NULL){
- const char* dir=gSystem->Getenv("DAQ_DETDB_LOCAL");
- TString filnam=Form("%s/fee.conf",dir);
- FILE* feefil=fopen(filnam.Data(),"r");
- fscanf(feefil,"%d \n",&adcSamplFreq);
- TString shcomm=Form("tar -rf SDDbase_LDC.tar -C %s fee.conf",dir);
- gSystem->Exec(shcomm.Data());
- fclose(feefil);
- }
+ UInt_t amSamplFreq=40;
+ UChar_t cdhAttr=0;
+
+ gSystem->Exec("rm -f SDDbase_LDC.tar");
AliITSOnlineSDDTP **tpan=new AliITSOnlineSDDTP*[kTotDDL*kModPerDDL*kSides];
TH2F **histo=new TH2F*[kTotDDL*kModPerDDL*kSides];
Bool_t isFilled[kTotDDL*kModPerDDL*kSides];
+ Bool_t writtenoutput=kFALSE;
Char_t hisnam[20];
for(Int_t iddl=0; iddl<kTotDDL;iddl++){
for(Int_t imod=0; imod<kModPerDDL;imod++){
for(Int_t isid=0;isid<kSides;isid++){
Int_t index=kSides*(kModPerDDL*iddl+imod)+isid;
tpan[index]=new AliITSOnlineSDDTP(iddl,imod,isid,100.);
- if(adcSamplFreq==20) tpan[index]->SetLastGoodTB(126);
- else tpan[index]->SetLastGoodTB(254);
sprintf(hisnam,"h%02dc%02ds%d",iddl,imod,isid);
histo[index]=new TH2F(hisnam,"",256,-0.5,255.5,256,-0.5,255.5);
isFilled[index]=0;
case PHYSICS_EVENT: // uncomment this line for test raw data
printf(" event number = %i \n",iev);
AliRawReader *rawReader = new AliRawReaderDate((void*)event);
-
- Int_t evtyp=0;
- while(rawReader->ReadHeader()){
- const UInt_t *subev = rawReader->GetSubEventAttributes();
- if(subev[0]==0 && subev[1]==0 && subev[2]==0) evtyp=1;
+ rawReader->Reset();
+ cdhAttr=AliITSRawStreamSDD::ReadBlockAttributes(rawReader);
+ amSamplFreq=AliITSRawStreamSDD::ReadAMSamplFreqFromCDH(cdhAttr);
+ AliITSRawStream* s=AliITSRawStreamSDD::CreateRawStreamSDD(rawReader,cdhAttr);
+ if(!writtenoutput){
+ printf("Use %s raw stream, sampling frequency %d MHz\n",s->ClassName(),amSamplFreq);
+ writtenoutput=kTRUE;
}
- rawReader->Reset();
for(Int_t iddl=0; iddl<kTotDDL;iddl++){
for(Int_t imod=0; imod<kModPerDDL;imod++){
for(Int_t isid=0;isid<kSides;isid++){
}
}
}
- AliITSRawStreamSDD s(rawReader);
-
- while(s.Next()){
+
+ while(s->Next()){
Int_t iDDL=rawReader->GetDDLID();
- Int_t iCarlos=s.GetCarlosId();
- if(s.IsCompletedModule()) continue;
- if(s.IsCompletedDDL()) continue;
+ Int_t iCarlos=s->GetCarlosId();
+ if(s->IsCompletedModule()) continue;
+ if(s->IsCompletedDDL()) continue;
if(iDDL>=0 && iDDL<kTotDDL){
- Int_t index=kSides*(kModPerDDL*iDDL+iCarlos)+s.GetChannel();
- histo[index]->Fill(s.GetCoord2(),s.GetCoord1(),s.GetSignal());
+ Int_t index=kSides*(kModPerDDL*iDDL+iCarlos)+s->GetChannel();
+ histo[index]->Fill(s->GetCoord2(),s->GetCoord1(),s->GetSignal());
isFilled[index]=1;
}
}
+ delete s;
delete rawReader;
for(Int_t iddl=0; iddl<kTotDDL;iddl++){
for(Int_t imod=0; imod<kModPerDDL;imod++){
for(Int_t isid=0;isid<kSides;isid++){
Int_t index=kSides*(kModPerDDL*iddl+imod)+isid;
+ if(amSamplFreq==20) tpan[index]->SetLastGoodTB(126);
+ else tpan[index]->SetLastGoodTB(254);
if(isFilled[index]) tpan[index]->AddEvent(histo[index]);
}
}
}
- TFile *fh=new TFile("SDDgainHistos.root","RECREATE");
+ /* write report */
+ TDatime time;
+ TObjString timeinfo(Form("%02d%02d%02d%02d%02d%02d",time.GetYear()-2000,time.GetMonth(),time.GetDay(),time.GetHour(),time.GetMinute(),time.GetSecond()));
+ printf("Run #%s, received %d calibration events, time %s\n",getenv("DATE_RUN_NUMBER"),iAnalyzedEv,timeinfo.GetString().Data());
+
+ /* report progress */
+ daqDA_progressReport(90);
+
+ TObjArray* gainHistos=new TObjArray();
+ TObjArray* statusHistos=new TObjArray();
+
Char_t filnam[100],command[120];
for(Int_t iddl=0; iddl<kTotDDL;iddl++){
for(Int_t imod=0; imod<kModPerDDL;imod++){
if(isFilled[index]){
tpan[index]->ValidateAnodes();
tpan[index]->WriteToASCII();
- tpan[index]->WriteToROOT(fh);
+ gainHistos->AddLast(tpan[index]->GetGainAnodeHisto());
+ statusHistos->AddLast(tpan[index]->GetStatusAnodeHisto());
sprintf(filnam,"SDDbase_ddl%02dc%02d_sid%d.data",iddl,imod,isid);
sprintf(command,"tar -rf SDDbase_LDC.tar %s",filnam);
gSystem->Exec(command);
}
}
}
- fh->Close();
- /* write report */
- printf("Run #%s, received %d calibration events\n",getenv("DATE_RUN_NUMBER"),iAnalyzedEv);
-
- /* report progress */
- daqDA_progressReport(90);
+ FILE *conffil=fopen("fee.conf","w");
+ fprintf(conffil,"%d\n",amSamplFreq);
+ fprintf(conffil,"%02X\n",cdhAttr);
+ fclose(conffil);
+ gSystem->Exec("tar -rf SDDbase_LDC.tar fee.conf");
+ status=daqDA_FES_storeFile("./SDDbase_LDC.tar","SDD_Calib");
+#ifdef ALI_AMORE
+ amore::da::AmoreDA amoreDA(amore::da::AmoreDA::kSender);
+ Int_t statusamore =0;
+ statusamore += amoreDA.Send("TimeInfoPulser",&timeinfo);
+ statusamore += amoreDA.Send("Gain",gainHistos);
+ if ( statusamore )
+ printf("Warning: Failed to write Arrays in the AMORE database\n");
+ else
+ printf("amoreDA.Send() OK\n");
+#else
+ printf("Warning: SDDGAIN DA not compiled with AMORE support\n");
+#endif
+
+
+ TFile *fh=new TFile("SDDgainHistos.root","RECREATE");
+ gainHistos->Write();
+ statusHistos->Write();
fh->Close();
-
- status=daqDA_FES_storeFile("./SDDbase_LDC.tar","SDD_Calib");
-
/* report progress */
daqDA_progressReport(100);