From: masera Date: Sat, 25 Aug 2007 16:18:25 +0000 (+0000) Subject: SDD Quality Assurance protoype macro - SDD RawStreamer code changed in order to be... X-Git-Url: http://git.uio.no/git/?a=commitdiff_plain;h=765a9f95e7bc5d4e3f708f558f8ea1283c9d065b;p=u%2Fmrichter%2FAliRoot.git SDD Quality Assurance protoype macro - SDD RawStreamer code changed in order to be more compact (P. Cerello) --- diff --git a/ITS/AliITSRawStreamSDD.cxx b/ITS/AliITSRawStreamSDD.cxx index bdecf5cf144..15e3ae56ada 100644 --- a/ITS/AliITSRawStreamSDD.cxx +++ b/ITS/AliITSRawStreamSDD.cxx @@ -24,6 +24,7 @@ #include "AliITSRawStreamSDD.h" #include "AliRawReader.h" #include "AliLog.h" +#include "Riostream.h" ClassImp(AliITSRawStreamSDD) @@ -64,10 +65,6 @@ fEventId(0), fChannel(0), fJitter(0), fNCarlos(kModulesPerDDL), -fNfifo0(0), -fNfifo1(0), -fNfifo2(0), -fNfifo3(0), fDDL(0){ // create an object to read ITS SDD raw digits @@ -83,12 +80,14 @@ fDDL(0){ } fLowThreshold[i]=0; } + for(Int_t i=0;iReset(); fRawReader->Select("ITSSDD"); - // fRawReader->SelectEquipment(17, 101, 101);//select this for test data // fNCarlos = 8; //select this for test data + for(Short_t i=0; iGetDDLID(); Int_t ddln = fRawReader->GetDDLID(); if(ddln <0) ddln=0; - while (fSkip[ddln] < 9) { - if (!fRawReader->ReadNextInt(fData))return kFALSE; - if ((fData >> 30) == 0x01) continue; // JTAG word - fSkip[ddln]++; - } - + Bool_t kSkip = ResetSkip(ddln); + if(!kSkip) return kSkip; + + for(Int_t i=0;iGetDDLID(); - if(ddln!=fDDL){ - Reset(); - for(Int_t icr=0;icr (kDDLsNumber-1)) ddln = 0; - while (fSkip[ddln] < 9) { - if (!fRawReader->ReadNextInt(fData)){ - return kFALSE; - } - if ((fData >> 30) == 0x01) continue; // JTAG word - fSkip[ddln]++; - } + kSkip = ResetSkip(ddln); + if(!kSkip) return kFALSE; // read next word fChannel = -1; - if((fData>=iCarlos0Word&&fData<=iCarlos11Word)||(fData>=iFifo0Word&&fData<=iFifo3Word)){ - if(fData==iCarlos0Word){ + if((fData>=iCarlosWord[0]&&fData<=iCarlosWord[11])||(fData>=iFifoWord[0]&&fData<=iFifoWord[3])){ + for(Short_t ik=0;ik> 28) == 0x02) { // header fEventId = (fData >> 3) & 0x07FF; } else if ((fData >> 28) == 0x03) { // footer - countFoot[fCarlosId]++; // stop before the last word (last word=jitter) + iCountFoot[fCarlosId]++; // stop before the last word (last word=jitter) Bool_t exit=kTRUE; for(Int_t ic=0;icGetDDLID(); } + +Bool_t AliITSRawStreamSDD::ResetSkip(Int_t ddln){ + while (fSkip[ddln] < 9) { + if (!fRawReader->ReadNextInt(fData))return kFALSE; + if ((fData >> 30) == 0x01) continue; // JTAG word + fSkip[ddln]++; + } + return kTRUE; +} + diff --git a/ITS/AliITSRawStreamSDD.h b/ITS/AliITSRawStreamSDD.h index b57989c21b5..72a0fce6fcb 100644 --- a/ITS/AliITSRawStreamSDD.h +++ b/ITS/AliITSRawStreamSDD.h @@ -33,10 +33,13 @@ class AliITSRawStreamSDD: public AliITSRawStream { static Int_t GetModuleNumber(UInt_t iDDL, UInt_t iModule) {return fgkDDLModuleMap[iDDL][iModule];} virtual void Reset(); + virtual Bool_t ResetSkip(Int_t ddln); enum {kDDLsNumber = 24}; // number of DDLs in SDD enum {kModulesPerDDL = 12}; // number of modules in each DDL - enum ESDDRawStreamError { + enum {kCarlosWords = 12}; // number of FIFOCARLOS Words + enum {kFifoWords = 4}; // number of FIFO Words + enum ESDDRawStreamError { kDataError = 1, kDataFormatErr = 2 }; @@ -61,15 +64,20 @@ class AliITSRawStreamSDD: public AliITSRawStream { UInt_t fReadBits[kModulesPerDDL][2]; // number of bits to read Int_t fLowThreshold[2]; // low Carlos threshold Int_t fNCarlos; // number of Carlos + /* Int_t fNfifo0; // fifo n. 0 Int_t fNfifo1; // fifo n. 1 Int_t fNfifo2; // fifo n. 2 Int_t fNfifo3; // fifo n. 3 + */ + Int_t fNfifo[kFifoWords]; Int_t fTimeBin[kModulesPerDDL][2]; // current timebin [ncarlos][nchannels] Int_t fAnode[kModulesPerDDL][2]; // current anode [ncarlos][nchannels] Int_t fDDL; //current ddl number - - ClassDef(AliITSRawStreamSDD, 2) // class for reading ITS SDD raw digits + UInt_t iCarlosWord[kCarlosWords]; + UInt_t iFifoWord[kFifoWords]; + Int_t iCountFoot[kModulesPerDDL]; + ClassDef(AliITSRawStreamSDD, 4) // class for reading ITS SDD raw digits }; #endif diff --git a/ITS/ITSSDDQA.C b/ITS/ITSSDDQA.C new file mode 100644 index 00000000000..cd8ed45e7b0 --- /dev/null +++ b/ITS/ITSSDDQA.C @@ -0,0 +1,126 @@ +void ITSSDDQA(char *iFile, Int_t MaxEvts=1000000, Int_t FirstEvt=0) { + +cout << "SDD Quality Assurance Prototype Macro" << endl; + +const Int_t nSDDmodules= 260; +const Int_t imodoffset = 240; +const Int_t modtotSDD = nSDDmodules*2; + +Float_t xi = 0.5; +Float_t xf = xi + nSDDmodules; +TH1F *modulePattern = new TH1F("patternModule","Modules pattern",nSDDmodules,xi,xf); +xf = xi + modtotSDD; +TH1F *moduleSidePattern = new TH1F("patternSide","Modules/Side pattern",modtotSDD,xi,xf); + +TH2F *hismap[modtotSDD]; //260 dx e 260 sx with A, T, Q +TH2F *hispop[modtotSDD]; //260 dx e 260 sx with A, T, Ncounts + +Char_t *cindex = new Char_t[5]; +for(Int_t imod=0; imodCreateAliITSgeom(); + delete initgeom; + */ + + Int_t eqOffset = 256; + Int_t DDLid_range = 24; + do{ // start loop on events + if(++evCounter > MaxEvts) { cout << MaxEvts << " events read, stop" << endl; evCounter--; break; } + cout << "Read Event: " << evCounter+FirstEvt-1 << endl; + + rd->RequireHeader(kFALSE); + rd->SelectEvents(7); // read only events with the given type. no selection is applied if a value < 0 is used. + + rd->SelectEquipment(17,eqOffset+1,eqOffset+DDLid_range); + + rd->Reset(); // reset the current position to the beginning of the event + AliITSRawStreamSDD s(rd); //This class provides access to ITS SDD digits in raw data. + Int_t iddl; + Int_t isddmod; + Int_t moduleSDD; + while(s.Next()){ //read the next raw digit; returns kFALSE if there is no digit left + + iddl=rd->GetDDLID(); + isddmod=s.GetModuleNumber(iddl,s.GetCarlosId()); //this is the FEE Carlos + //cout<<"DDLID= "<Fill(s.GetCoord1(), s.GetCoord2(),s.GetSignal() ); + hispop[moduleSDD]->Fill(s.GetCoord1(), s.GetCoord2() ); + } + + } while(rd->NextEvent()); // end loop on events + delete rd; + + cout << "end after " << evCounter << " events" << endl; + + TString oFileName(iFile); + oFileName.Append(".root"); + TFile *oFile = TFile::Open(oFileName,"recreate"); + modulePattern->Write(); + moduleSidePattern->Write(); + for(Int_t i=0; iWrite(); + hispop[i]->Write(); + } + oFile->Close(); + + for(Int_t imod=0; imod