added access to TRU FALTRO and STU payload and related histograms
authorfronchet <fronchet@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 26 May 2010 14:34:19 +0000 (14:34 +0000)
committerfronchet <fronchet@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 26 May 2010 14:34:19 +0000 (14:34 +0000)
HLT/EMCAL/AliHLTEMCALRawHistoMaker.cxx
HLT/EMCAL/AliHLTEMCALRawHistoMaker.h

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