]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
First working implementation of the online cell energy/time evaluation. The
authorphille <phille@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 22 Jan 2007 17:12:56 +0000 (17:12 +0000)
committerphille <phille@f7af4fe6-9843-0410-8265-dc069ae4e863>
Mon, 22 Jan 2007 17:12:56 +0000 (17:12 +0000)
equippment ID is passed as an argument to the AliHLTPHOSRawAnalyzerCrudeComponent.
The idea is to run a process for each readout partition (RCU).

HLT/PHOS/AliHLTPHOSRawAnalyzerComponent.cxx
HLT/PHOS/AliHLTPHOSRawAnalyzerComponent.h
HLT/PHOS/AliHLTPHOSRawAnalyzerCrude.cxx

index b4c09d7415a71501ce62f7ff5105ee97fa7d7b1a..26530aeef8b1e5b306f423c552ce169c4949a3c7 100644 (file)
@@ -20,6 +20,8 @@
 
 #include "AliRawReaderMemory.h"
 #include "AliCaloRawStream.h"
+#include <cstdlib>
+//#include "TH2.h"
 
 //#include "AliHLTTPCDefinitions.h"
 
@@ -113,92 +115,88 @@ int AliHLTPHOSRawAnalyzerComponent::DoEvent( const AliHLTComponentEventData& evt
                                              AliHLTComponentTriggerData& trigData, AliHLTUInt8_t* outputPtr, 
                                              AliHLTUInt32_t& size, vector<AliHLTComponentBlockData>& outputBlocks )
 {
-  //  int tmpCnt = 0;
-  cout << "processing Event" << endl;
+  Int_t tmpMod  = 0;
+  Int_t tmpRow  = 0;
+  Int_t tmpCol  = 0;
+  Int_t tmpGain = 0;
+  Int_t processedChannels = 0;
+  //  Int_t tmpMax  = 0;
   const AliHLTComponentBlockData* iter = NULL; 
   unsigned long ndx;
-    
+  Reset();
+
   for( ndx = 0; ndx < evtData.fBlockCnt; ndx++ )
     {
-      cout <<"Inside for loop ndx =" << ndx << endl;
       iter = blocks+ndx;
-      
-       if (eventCount == 0)
-       {
-         continue;
-       }
+      if (eventCount == 0)
+       {
+         continue;
+       }
  
-      
-      if ( iter->fDataType == AliHLTPHOSDefinitions::gkDDLPackedRawDataType ) cout << "data type is :gkDDLPackedRawDataType " <<endl;
-      if ( iter->fDataType == AliHLTPHOSDefinitions::gkPackedRawDataType ) cout << "data type is : gkPackedRawDataType" <<endl;
-      if ( iter->fDataType == AliHLTPHOSDefinitions::gkUnpackedRawDataType) cout << "data type is gkUnpackedRawDataType" <<endl;
-      if ( iter->fDataType == AliHLTPHOSDefinitions::gkClustersDataType) cout << "data type is ::gkClustersDataType" <<endl;
-      if ( iter->fDataType == AliHLTPHOSDefinitions::gkVertexDataType ) cout << "data type is ::gkVertexDataType " <<endl;
-      if ( iter->fDataType == AliHLTPHOSDefinitions::gkTrackSegmentsDataType) cout << "data type is :::gkTrackSegmentsDataType" <<endl;
-
       if ( iter->fDataType != AliHLTPHOSDefinitions::gkDDLPackedRawDataType )
        {
          cout << "Warning: data type = is nOT gkDDLPackedRawDataType " << endl;
          continue;
        }
-
-     cout <<"PHOSHLT DoEvent: processing event:"<< eventCount << endl;
-     cout <<"Struct size = " << evtData.fStructSize << endl;
-     cout <<"Event ID = " <<evtData.fEventID << endl;
-     cout <<"Block count = " <<evtData.fBlockCnt << endl;
-     cout <<"Block size = " << blocks->fSize << endl;
-     cout <<"printing out start od data block" << endl;
-     //     cout << "content of data pointer =" << tmpDtaPtr << endl;  
-
-     //     UChar_t *tmpDtaPtr  = (UChar_t *)blocks->fPtr;
-     UInt_t *tmpDtaPtr  = (UInt_t *)blocks->fPtr;
-
-    
-     for(unsigned int i = 0; i < 15; i++)
-       {
-        // getc();
-        //     sleep(10);
-        //    printf("\ntype return to continue; ");
-        //     getc(stdin);
-        //    printf("\nThanks; read in \n");
-        cout << "entry:" <<i <<" =  " << *tmpDtaPtr << endl;
-        tmpDtaPtr ++;
-        //      cout << "entry:" <<i <<" =  " << *blocks << endl;
-        //      blocks ++;
-       } 
-
-
      fRawMemoryReader->SetMemory( reinterpret_cast<UChar_t*>( iter->fPtr ), iter->fSize );
-     bool readValue = true;
-     
-     cout << endl << "eventCount =" << eventCount << endl;
-    fRawMemoryReader->DumpData();
-
-     readValue = fPHOSRawStream->Next();
-     //    fPHOSRawStream->Next();  
+     fRawMemoryReader->DumpData();
+     fRawMemoryReader->RewindEvents();
 
-     while( readValue )
-       {
-        cout <<"reading value" << endl;
-        readValue = fPHOSRawStream->Next();
-       }
-     cout << "end of for lop" << endl;
-   }
-
-  eventCount++; 
-
- return 0;
-}
+     analyzerPtr->SetData(fTmpChannelData);
+      while(fPHOSRawStream->Next())
+       {
+         if (fPHOSRawStream->IsNewHWAddress())
+           {
+             if(processedChannels > 0)
+               {
+                 analyzerPtr->SetData(fTmpChannelData);
+                 analyzerPtr->Evaluate(0, 1008);
+                 fMaxValues[tmpMod][tmpRow][tmpCol][tmpGain] = analyzerPtr->GetEnergy();
+                 ResetDataPtr(); 
+               }
+
+             tmpMod  =  fPHOSRawStream->GetModule();
+             tmpRow  =  fPHOSRawStream->GetRow();
+             tmpCol  =  fPHOSRawStream->GetColumn();
+             tmpGain =  fPHOSRawStream->IsLowGain(); 
+             processedChannels ++;
+           }
+
+         fTmpChannelData[fPHOSRawStream->GetTime()] =  fPHOSRawStream->GetSignal();
+       }
+    }
+  DumpData();
+  fEventCount++; 
+  return 0;
+}//end DoEvent
 
 
 
 int
 AliHLTPHOSRawAnalyzerComponent::DoInit( int argc, const char** argv )
 {
+  cout << "DOINIT argc =" << argc << endl;
+  cout << "DOINIT argv[0] =" << argv[0] << endl;
+  cout << "DOINIT argv[1] =" << argv[1] << endl;
+  cout << "DOINIT argv[2] =" << argv[2] << endl;
+  cout << "DOINIT argv[3] =" << argv[3] << endl;
+  cout << "DOINIT argv[4] =" << argv[4] << endl;
+  cout << "DOINIT argv[5] =" << argv[5] << endl;
+  cout << "DOINIT argv[6] =" << argv[6] << endl;
+  int equippmentId = atoi(argv[6]);
+  cout << "The equipment ID was set to " <<equippmentId << endl;
+  
+ //fRawMemoryReader->SetEquipmentID(1806); 
+
+  Reset();
   cout << "AliHLTPHOSRawAnalyzerComponent::DoInit Creating new  AliRawReaderMemory()" << endl; 
+  legoPlotPtr   = new TH2S("Lego plot 1","Phi0 20Gev, High gain", 56*5, 0, 56*5, 64, 0, 64);
   fRawMemoryReader = new AliRawReaderMemory();
   fPHOSRawStream = new  AliCaloRawStream(fRawMemoryReader,"PHOS");
+  fRawMemoryReader->SetEquipmentID(equippmentId); 
+
   cout <<"AliHLTPHOSRawAnalyzerComponent::DoIni  DONE!" << endl;
   if (argc==0 && argv==NULL) {
     // this is currently just to get rid of the warning "unused parameter"
@@ -206,73 +204,54 @@ AliHLTPHOSRawAnalyzerComponent::DoInit( int argc, const char** argv )
   return 0;
 }
 
-
-
-/*
-int 
-AliHLTPHOSRawAnalyzerComponent::DoEvent(const AliHLTComponentEventData& evtDtaPtr, const AliHLTComponentBlockData* dtaPtr, AliHLTComponentTriggerData&, AliHLTUInt8_t*, AliHLTUInt32_t&, std::vector<AliHLTComponentBlockData, std::allocator<AliHLTComponentBlockData> >&)
+void
+AliHLTPHOSRawAnalyzerComponent::DumpData()
 {
-  const Bool_t skipBadEvent=kFALSE;
-  const AliHLTComponentBlockData* iter = NULL;
-
-  fRawMemoryReader->SetMemory( reinterpret_cast<UChar_t*>( dtaPtr->fPtr ), dtaPtr->fSize );
-
-  //  fPHOSRawStream = new  AliCaloRawStream(fRawMemoryReader,"PHOS");
-
-  fRawMemoryReader->DumpData();
-
-  Logging(kHLTLogInfo, "HLT", "Sample", "PhosHLTRawAnalyzerComonent, DoEvent");
-
-  //  UChar_t *tmpDtaPtr  = (UChar_t *)dtaPtr->fPtr;
-  //  UInt32_t *tmpDtaPtr  = (UInt32_t *)dtaPtr->fPtr;
-  //  unsigned long *tmpDtaPtr  = (unsigned long *)dtaPtr->fPtr;
-
-  
-  cout <<"PHOSHLT DoEvent: processing event:"<< eventCount << endl;
-  cout <<"Struct size = " <<evtDtaPtr.fStructSize << endl;
-  cout <<"Event ID = " <<evtDtaPtr.fEventID << endl;
-  cout <<"Block count = " <<evtDtaPtr.fBlockCnt << endl;
-  cout <<"Block size = " << dtaPtr->fSize << endl;
-  cout <<"printing out start od data block" << endl;
-  cout << "content of data pointer =" << tmpDtaPtr << endl;
-  
+  for(int mod = 0; mod <5; mod ++)
+    {
+      printf("\n ***********  MODULE %d ************\n", mod);
+      for(int row = 0; row < 64; row ++)
+       {
+         for(int col = 0; col < 56; col ++)
+           {
+             if( fMaxValues[mod][row][col][0] != 0)
+               { 
+                 cout << fMaxValues[mod][row][col][0] << "\t";
+               }
+           }
+       } 
+    }
+}
 
-  // UChar_t *tmpDtaPtr  = (UChar_t *)blokcs->fPtr;
 
-  //  AliCaloRawStream in(fRawMemoryReader,"PHOS");
-  //  for(unsigned int i = 0; i < tmpSize; i++)
-  for(unsigned int i = 0; i < 15; i++)
+void
+AliHLTPHOSRawAnalyzerComponent::Reset()
+{
+  for(int mod = 0; mod <5; mod ++)
     {
-      // getc();
-      //     sleep(10);
-      //    printf("\ntype return to continue; ");
-      //     getc(stdin);
-      //    printf("\nThanks; read in \n");
-      //    cout << "entry:" <<i <<" =  " << *tmpDtaPtr << endl;
-      //   tmpDtaPtr ++;
-   }
+      for(int row = 0; row < 64; row ++)
+       {
+         for(int col = 0; col < 56; col ++)
+           {
+             for(int gain = 0; gain <2; gain ++ )
+               {
+                 fMaxValues[mod][row][col][gain] = 0;
+               }
+           }
+       }
+    }
 
-  
-  
-  cout << "Entering while loop" << endl;
-  while ( fPHOSRawStream->Next() ) 
-    { 
-      cout << "Inside while loop" << endl;
-      if (fPHOSRawStream->IsNewHWAddress()) cout << endl << " New HW address: " << endl;
-      cout << "time bin=" << fPHOSRawStream->GetTime() << " of "<< fPHOSRawStream->GetTimeLength()
-          << ", amp=" <<  fPHOSRawStream->GetSignal() <<" gain="<< fPHOSRawStream->IsLowGain()
-          << " HW address="<<fPHOSRawStream->GetHWAddress()
-          << " channel=("<<fPHOSRawStream->GetModule() <<","<<fPHOSRawStream->GetColumn()<<","<<fPHOSRawStream->GetRow()<<")"<< endl;
-      
-      
-      if (skipBadEvent && (fPHOSRawStream->GetTime() < 0 || fPHOSRawStream->GetTimeLength() <=0) ) {
-       cout << "Wrong time bin or time length. Skip this event" << endl;
-       break;
-      }
+  for(int i = 0 ; i< 1008; i++)
+    {
+      fTmpChannelData[i] = 0;
     }
-  cout << "Finnsihed while loop" << endl << endl;
+} // end Reset
 
-  eventCount++;
-  return 0;
+void
+AliHLTPHOSRawAnalyzerComponent::ResetDataPtr()
+{
+  for(int i = 0 ; i< 1008; i++)
+    {
+      fTmpChannelData[i] = 0;
+    }
 }
-*/
index 4e2daa4483f5eca013616606b8f3dbb08d3df695..31301f41da6d344cd6f10151b2c412ef14bea26f 100644 (file)
@@ -11,6 +11,7 @@
 #include "AliRawReaderMemory.h"
 #include "AliCaloRawStream.h"
 #include "AliHLTPHOSDefinitions.h"
+#include "TH2.h"
 
 
 /*
@@ -41,6 +42,7 @@ class AliHLTPHOSRawAnalyzerComponent: public AliHLTProcessor
   virtual int DoInit( int argc, const char** argv );
   virtual int Deinit();
   virtual int DoDeinit();
+  void DumpData();
 
   virtual const char* GetComponentID() = 0;
 
@@ -54,12 +56,24 @@ class AliHLTPHOSRawAnalyzerComponent: public AliHLTProcessor
   // private:
  protected:
  AliHLTPHOSRawAnalyzer *analyzerPtr; 
+ void Reset();
+ void ResetDataPtr();
 
  private:
+
  int eventCount;
+
+
  //    AliRawReaderMemory *fRawMemoryReader;
  //    AliTPCRawStream *fTPCRawStream;
+ Double_t fTmpChannelData[1008];
+ // Int_t fMaxValues[5][64][56][2];
+ Double_t fMaxValues[5][64][56][2];
 
+  //  Int_t fMaxValuesLG[5][64][56][2];
+  TH2S *legoPlotPtr;
+  //  TH2S *legoPlotLgPtr;
  AliCaloRawStream *fPHOSRawStream;
  AliRawReaderMemory *fRawMemoryReader;
  static const AliHLTComponentDataType inputDataTypes[];
index 6b73da2ae2cf5908cae143d5559ae4be05112b78..b00cf827258ce55efbbdfa311654af0161389c0f 100644 (file)
@@ -63,7 +63,7 @@ AliHLTPHOSRawAnalyzerCrude::~AliHLTPHOSRawAnalyzerCrude()
 void 
 AliHLTPHOSRawAnalyzerCrude::Evaluate(int start, int length)
 {
-  printf("\nAliHLTPHOSRawAnalyzerCrude::Evaluat() from index %d to %d\n", start, start + length);
+  //  printf("\nAliHLTPHOSRawAnalyzerCrude::Evaluat() from index %d to %d\n", start, start + length);
   
   
   double tmpAmplitudeMax =0;