From 4479217f2de301672f98462b3859c8ea032c32cd Mon Sep 17 00:00:00 2001 From: fronchet Date: Wed, 26 May 2010 14:34:19 +0000 Subject: [PATCH] added access to TRU FALTRO and STU payload and related histograms --- HLT/EMCAL/AliHLTEMCALRawHistoMaker.cxx | 188 +++++++++++++++++++------ HLT/EMCAL/AliHLTEMCALRawHistoMaker.h | 7 + 2 files changed, 150 insertions(+), 45 deletions(-) diff --git a/HLT/EMCAL/AliHLTEMCALRawHistoMaker.cxx b/HLT/EMCAL/AliHLTEMCALRawHistoMaker.cxx index f8262de830c..8189b2d2b46 100644 --- a/HLT/EMCAL/AliHLTEMCALRawHistoMaker.cxx +++ b/HLT/EMCAL/AliHLTEMCALRawHistoMaker.cxx @@ -45,7 +45,8 @@ AliHLTEMCALRawHistoMaker::AliHLTEMCALRawHistoMaker(): fAnalyzerPtr(0), fEMCALConstants(NULL), hList(0), - fChannelEMap(0), fChannelTMap(0), fChannelETMap(0) + fChannelEMap(0), fChannelTMap(0), fChannelETMap(0), h2DTRU(0), h2DSTU(0) + { // See header file for documentation @@ -67,11 +68,18 @@ AliHLTEMCALRawHistoMaker::AliHLTEMCALRawHistoMaker(): char id[100]; char title[100]; + hList = new TObjArray; + fChannelEMap = new TProfile2D *[fCaloConstants->GetNMODULES()]; fChannelTMap = new TProfile2D *[fCaloConstants->GetNMODULES()]; fChannelETMap = new TH2F *[fCaloConstants->GetNMODULES()]; - hList = new TObjArray; + h2DTRU = new TH2I ("h2DTRU","",24,0,24,4,0,4); + hList->Add(h2DTRU); + + h2DSTU = new TH2I ("h2DSTU","",24,0,24,4,0,4); + hList->Add(h2DSTU); + for (int i=0; iGetNMODULES(); i++) { sprintf(title, "E(X vs Z): SM %d ", i); @@ -119,26 +127,137 @@ AliHLTEMCALRawHistoMaker::MakeHisto(AliHLTCaloChannelDataHeaderStruct* channelDa Short_t channelCount = 0; AliHLTCaloCoordinate coord; - AliHLTCaloChannelDataStruct* currentchannel = 0; - fShmPtr->SetMemory(channelDataHeader); AliHLTCaloChannelDataHeaderStruct *channelDataHeaderPtr = reinterpret_cast(outputPtr); AliHLTCaloChannelDataStruct *channelDataPtr = reinterpret_cast(outputPtr+sizeof(AliHLTCaloChannelDataHeaderStruct)); - fRawCounterMemoryPtr->SetMemory( reinterpret_cast( iter->fPtr ), static_cast( iter->fSize ) ); + fRawCounterMemoryPtr->SetMemory( reinterpret_cast( iter->fPtr ), static_cast( iter->fSize ) ); fRawCounterMemoryPtr->SetEquipmentID( fMapperPtr->GetDDLFromSpec( iter->fSpecification) + fCaloConstants->GetDDLOFFSET() ); + fRawCounterMemoryPtr->Reset(); - fRawCounterMemoryPtr->NextEvent(); -//------ + //fRawCounterMemoryPtr->NextEvent(); + + //--- from STU macro + //while ( rawReader->NextEvent() ) + + while (fRawCounterMemoryPtr->NextEvent()) + { + fRawCounterMemoryPtr->Reset(); + fRawCounterMemoryPtr->Select("EMCAL",44); + + const UInt_t* evtId = fRawCounterMemoryPtr->GetEventId(); + int evno_raw = (int)evtId[0]; + + UInt_t eventType = fRawCounterMemoryPtr->GetType(); + + //cout << "event type: " << eventType << endl; + +// if (eventType != AliRawEventHeaderBase::kPhysicsEvent) continue; + +// fRawCounterMemoryPtr->DumpData(); + +// fRawCounterMemoryPtr->Reset(); + + fSTURawStreamPtr->ReadPayLoad(); +// fSTURawStreamPtr->DumpPayLoad("ALL"); + + UInt_t adc[96]; + + for (Int_t i=0;i<96;i++) + adc[i] = 0; + + fSTURawStreamPtr->GetADC(29, adc); + + for (Int_t i=0;i<96;i++) + { + Int_t x = i / 4; + Int_t y = i % 4; + + h2DSTU->Fill( x , y , adc[i] ); + } + + fRawCounterMemoryPtr->Reset(); + fRawCounterMemoryPtr->Select("EMCAL",0,43); + + while (fRawStreamPtr->NextDDL()) + { + Int_t iRCU = fRawStreamPtr->GetDDLNumber() % 2; + + while (fRawStreamPtr->NextChannel()) + { + Int_t iSM = fRawStreamPtr->GetModule(); + + Int_t iTRUId = 3 * iSM + iRCU * fRawStreamPtr->GetBranch() + iRCU; + + if (iSM==0) + { + Int_t nsamples = 0; + vector bunchlist; + while (fRawStreamPtr->NextBunch()) + { + nsamples += fRawStreamPtr->GetBunchLength(); + bunchlist.push_back( AliCaloBunchInfo(fRawStreamPtr->GetStartTimeBin(), fRawStreamPtr->GetBunchLength(), fRawStreamPtr->GetSignals() ) ); + } + + Int_t max = 0; + + for (std::vector::iterator itVectorData = bunchlist.begin(); itVectorData != bunchlist.end(); itVectorData++) + { + AliCaloBunchInfo bunch = *(itVectorData); + + const UShort_t* sig = bunch.GetData(); + Int_t startBin = bunch.GetStartBin(); + + for (Int_t iS = 0; iS < bunch.GetLength(); iS++) + { + if ( sig[iS] > max ) max = sig[iS]; + } + } + + if (nsamples) // this check is needed for when we have zero-supp. on, but not sparse readout + { + if (fRawStreamPtr->IsTRUData() && fRawStreamPtr->GetColumn() < 96) + { + if (iTRUId == 2) + { + Int_t x = fRawStreamPtr->GetColumn() / 4; + Int_t y = fRawStreamPtr->GetColumn() % 4; + + h2DTRU->Fill( x , y , max ); + } + } + } + } + } + } + +// c_0->cd(1); +// h2DTRU->Draw("TEXT"); +// +// c_0->cd(2); +// h2DSTU->Draw("TEXT"); +// +// c_0->Update(); +// +// h2DTRU->Reset(); +// h2DSTU->Reset(); + } + + //--- end of while + + +//------ FIXME +//------ old stuff to be removed or re-utilized //fRawDataWriter->NewEvent( ); if(fAltroRawStreamPtr->NextDDL()) { int cnt = 0; int fOffset = 0; + while( fAltroRawStreamPtr->NextChannel() ) { // cout << __FILE__ << ":" << __LINE__ << ":" <<__FUNCTION__ << "T3" << endl; @@ -151,37 +270,16 @@ AliHLTEMCALRawHistoMaker::MakeHisto(AliHLTCaloChannelDataHeaderStruct* channelDa ++ cnt; UShort_t* firstBunchPtr = 0; int chId = fMapperPtr->GetChannelID(iter->fSpecification, fAltroRawStreamPtr->GetHWAddress()); - // HLTError("Channel HW address: %d", fAltroRawStreamPtr->GetHWAddress()); - - //fRawDataWriter->SetChannelId( chId ); - - cout << fRawStreamPtr->GetCaloFlag() << endl; - - fRawCounterMemoryPtr->Select("EMCAL",44); - fRawCounterMemoryPtr->Reset(); + //HLTError("Channel HW address: %d", fAltroRawStreamPtr->GetHWAddress()); - int nJ, nG; - - - fSTURawStreamPtr->ReadPayLoad(); - nJ = fSTURawStreamPtr->GetNL1JetPatch(); - nG = fSTURawStreamPtr->GetNL1GammaPatch(); - if(nJ != 0 || nG != 0) { - - Printf(" %d L1Jet, %d L1Gamma", nJ, nG); - Printf("Jet thr : %d, Gamma thr : %d", fSTURawStreamPtr->GetL1JetThreshold(), fSTURawStreamPtr->GetL1GammaThreshold()); - Printf("####"); - } - - - - fSTURawStreamPtr->DumpPayLoad("L0"); + //cout << fRawStreamPtr->GetCaloFlag() << endl; // return 1; + vector bvctr; while( fAltroRawStreamPtr->NextBunch() == true ) { - //bvctr.push_back( AliCaloBunchInfo( fAltroRawStreamPtr->GetStartTimeBin(), fAltroRawStreamPtr->GetBunchLength(), fAltroRawStreamPtr->GetSignals() ) ); + bvctr.push_back( AliCaloBunchInfo( fAltroRawStreamPtr->GetStartTimeBin(), fAltroRawStreamPtr->GetBunchLength(), fAltroRawStreamPtr->GetSignals() ) ); nSamples = fAltroRawStreamPtr->GetBunchLength(); @@ -220,21 +318,21 @@ AliHLTEMCALRawHistoMaker::MakeHisto(AliHLTCaloChannelDataHeaderStruct* channelDa //------- currentchannel = fShmPtr->NextChannel(); - - while(currentchannel != 0) { - AliHLTCaloChannelRawDataStruct rawdata = fShmPtr->GetRawData(); + while(currentchannel != 0) { + + AliHLTCaloChannelRawDataStruct rawdata = fShmPtr->GetRawData(); + + fMapperPtr->ChannelId2Coordinate(currentchannel->fChannelID, coord); + + fChannelTMap[coord.fModuleId]->Fill( coord.fZ, coord.fX , currentchannel->fTime); + fChannelEMap[coord.fModuleId]->Fill( coord.fZ, coord.fX , currentchannel->fEnergy); + fChannelETMap[coord.fModuleId]->Fill(currentchannel->fEnergy, currentchannel->fTime); + + currentchannel = fShmPtr->NextChannel(); // Get the next channel + + } - fMapperPtr->ChannelId2Coordinate(currentchannel->fChannelID, coord); - - fChannelTMap[coord.fModuleId]->Fill( coord.fZ, coord.fX , currentchannel->fTime); - fChannelEMap[coord.fModuleId]->Fill( coord.fZ, coord.fX , currentchannel->fEnergy); - fChannelETMap[coord.fModuleId]->Fill(currentchannel->fEnergy, currentchannel->fTime); - - currentchannel = fShmPtr->NextChannel(); // Get the next channel - - } - return (0); } diff --git a/HLT/EMCAL/AliHLTEMCALRawHistoMaker.h b/HLT/EMCAL/AliHLTEMCALRawHistoMaker.h index 2961308132a..56e6c5944f8 100644 --- a/HLT/EMCAL/AliHLTEMCALRawHistoMaker.h +++ b/HLT/EMCAL/AliHLTEMCALRawHistoMaker.h @@ -40,10 +40,12 @@ #include "TProfile2D.h" #include "TH1F.h" #include "TH2F.h" +#include "TH2I.h" #include "TObjArray.h" #include "TString.h" + class AliHLTEMCALConstants; class AliHLTCaloSharedMemoryInterfacev2; class AliHLTCaloChannelDataHeaderStruct; @@ -55,6 +57,7 @@ class AliCaloRawStreamV3; class AliCaloRawAnalyzer; class TString; class TH2F; +class TH2I; class AliHLTEMCALRawHistoMaker : AliHLTCaloConstantsHandler @@ -90,6 +93,10 @@ private: TProfile2D **fChannelEMap; TProfile2D **fChannelTMap; TH2F **fChannelETMap; + + TH2I* h2DTRU; + TH2I* h2DSTU; + TObjArray *hList; /** Pointer to shared memory interface */ -- 2.43.0