X-Git-Url: http://git.uio.no/git/?p=u%2Fmrichter%2FAliRoot.git;a=blobdiff_plain;f=ITS%2FITSSDDGAINda.cxx;h=279f07c8a8005c44d1ad3767e63cc3c153d858bc;hp=e4ebebaa5dcb8854abe1845e64677c70440811bf;hb=6cc876261c786bd5bf980074b2ff9ed7ec9d4588;hpb=1ccdd571e58d730e942dfe68e16b2f956dd85da8 diff --git a/ITS/ITSSDDGAINda.cxx b/ITS/ITSSDDGAINda.cxx index e4ebebaa5dc..279f07c8a80 100644 --- a/ITS/ITSSDDGAINda.cxx +++ b/ITS/ITSSDDGAINda.cxx @@ -1,11 +1,11 @@ /* - Contact: - prino@to.infn.it -- Link: - http://www.to.infn.it/~prino/alice/RawData/run11173.date +- Link: - alien:///alice/data/2009/LHC09c_SDD/000079095/raw/09000079095024.10.root - Run Type: - PULSER_RUN - DA Type: - LDC -- Number of events needed: 100 -- Input Files: - SDDbase_step2_mod*_sid*.data -- Output Files: - SDDbase_mod*_sid*.data +- Number of events needed: >15 +- Input Files: - SDDbase_step1_ddl*c*_sid*.data (output of previous PEDESTAL run) +- Output Files: - SDDbase_ddl*c*_sid*.data - Trigger types used: */ @@ -44,16 +44,24 @@ extern "C" { #include #include #include +#include +#include +#include // AliRoot includes #include "AliRawReaderDate.h" #include "AliITSOnlineSDDTP.h" #include "AliITSRawStreamSDD.h" +#include "AliITSRawStreamSDDCompressed.h" + +#ifdef ALI_AMORE +#include +#endif /* Main routine Arguments: list of DATE raw data files */ int main(int argc, char **argv) { - + // main - Arguments: list of DATE raw data files int status = 0; // line added to solve IO problems @@ -64,7 +72,7 @@ int main(int argc, char **argv) { "TStreamerInfo()"); /* log start of process */ - printf("ITS SDD TP algorithm program started\n"); + printf("ITS SDD TEST-PULSE algorithm program started\n"); /* check that we got some arguments = list of files */ @@ -74,27 +82,40 @@ int main(int argc, char **argv) { } - Int_t eqOffset = 256; - Int_t DDLrange = 24; Int_t maxNEvents=15; // maximum number of events to be analyzed - const Int_t nSDDmodules=260; // temp for test raw data - AliITSOnlineSDDTP **tpan=new AliITSOnlineSDDTP*[2*nSDDmodules]; - TH2F **histo=new TH2F*[2*nSDDmodules]; - Bool_t isFilled[2*nSDDmodules]; + const Int_t kTotDDL=24; + const Int_t kModPerDDL=12; + const Int_t kSides=2; + 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 imod=0; imod=maxNEvents) break; iev++; /* use event - here, just write event id to result file */ @@ -149,80 +169,122 @@ int main(int argc, char **argv) { case CALIBRATION_EVENT: break; // uncomment this line for test raw data case PHYSICS_EVENT: // uncomment this line for test raw data - printf(" event number = %i \n",iev); - AliRawReader *rawReader = new AliRawReaderDate((void*)event); - rawReader->SelectEquipment(17,eqOffset+1,eqOffset+DDLrange); - - 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; + printf(" Event number = %i ",iev); + ievPul++; + if(ievPul<=nEvToBeSkipped){ + printf(" -> SKIP\n"); + break; } + printf(" -> Analyze\n"); + ievUsed++; + AliRawReader *rawReader = new AliRawReaderDate((void*)event); rawReader->Reset(); - for(Int_t imod=0; imodReset(); + 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; + } + + for(Int_t iddl=0; iddlReset(); + } } } - AliITSRawStreamSDD s(rawReader); - - while(s.Next()){ - Int_t isddmod=s.GetModuleID();//Number(iddl,s.GetCarlosId()); - isddmod-=240; // to have SDD modules from 0 to 259 - if(isddmod>0 && isddmodFill(s.GetCoord2(),s.GetCoord1(),s.GetSignal()); + + while(s->Next()){ + Int_t iDDL=rawReader->GetDDLID(); + Int_t iCarlos=s->GetCarlosId(); + if(s->IsCompletedModule()) continue; + if(s->IsCompletedDDL()) continue; + if(iDDL>=0 && iDDLGetChannel(); + histo[index]->Fill(s->GetCoord2(),s->GetCoord1(),s->GetSignal()); isFilled[index]=1; } } + delete s; delete rawReader; - for(Int_t imod=0; imodAddEvent(histo[index]); + for(Int_t iddl=0; iddlSetLastGoodTB(126); + else tpan[index]->SetLastGoodTB(254); + if(isFilled[index]) tpan[index]->AddEvent(histo[index]); + } } } /* free resources */ - iAnalyzedEv++; free(event); } - } - + if(ievUsed>=maxNEvents) break; + } } - TFile *fh=new TFile("SDDgainHistos.root","RECREATE"); - Char_t filnam[100],command[120]; - for(Int_t imod=0; imodValidateAnodes(); - tpan[index]->WriteToASCII(); - tpan[index]->WriteToROOT(fh); - sprintf(filnam,"SDDbase_mod%03d_sid%d.data",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); + 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"),ievUsed,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; iddlValidateAnodes(); + tpan[index]->WriteToASCII(); + 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(); + 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);