LCOV - code coverage report
Current view: top level - HLT/EMCAL - AliHLTEMCALRawHistoMaker.cxx (source / functions) Hit Total Coverage
Test: coverage.info Lines: 1 77 1.3 %
Date: 2016-06-14 17:26:59 Functions: 1 8 12.5 %

          Line data    Source code
       1             : /**************************************************************************
       2             :  * This file is property of and copyright by the ALICE HLT Project        * 
       3             :  * All rights reserved.                                                   *
       4             :  * INFN Laboratori Nazionali di Frascati                                  *
       5             :  * Primary Authors: Federico Ronchetti                                    *
       6             :  *                                                                        *
       7             :  * Permission to use, copy, modify and distribute this software and its   *
       8             :  * documentation strictly for non-commercial purposes is hereby granted   *
       9             :  * without fee, provided that the above copyright notice appears in all   *
      10             :  * copies and that both the copyright notice and this permission notice   *
      11             :  * appear in the supporting documentation. The authors make no claims     *
      12             :  * about the suitability of this software for any purpose. It is          * 
      13             :  * provided "as is" without express or implied warranty.                  *
      14             :  **************************************************************************/
      15             : 
      16             : /**
      17             :  * @file   AliHLTEMCALRawHistoMaker.cxx
      18             :  * @author Federico Ronchetti
      19             :  * @date 
      20             :  * @brief  Online Monitoring Histogram maker for EMCAL  
      21             :  */
      22             :   
      23             : 
      24             : #include "AliHLTEMCALRawHistoMaker.h"
      25             : #include "AliHLTEMCALConstants.h"
      26             : #include "AliHLTEMCALMapper.h"
      27             : //#include "AliHLTCaloChannelDataStruct.h"
      28             : 
      29             : #include "AliHLTCaloChannelDataHeaderStruct.h"
      30             : #include "AliHLTCaloSharedMemoryInterfacev2.h"
      31             : 
      32             : //#include "AliCaloRawAnalyzer.h"
      33             : //#include "AliCaloBunchInfo.h"
      34             : //#include "AliCaloFitResults.h"
      35             : 
      36             : 
      37             : 
      38             : 
      39           6 : ClassImp(AliHLTEMCALRawHistoMaker);
      40             : 
      41             : AliHLTEMCALRawHistoMaker::AliHLTEMCALRawHistoMaker():
      42           0 :   AliHLTCaloConstantsHandler("EMCAL"),
      43           0 :   fShmPtr(0),
      44           0 :   fMapperPtr(0),
      45             :   //  fRawCounterMemoryPtr(0),
      46             :   //fAltroRawStreamPtr(0),
      47             :   //fRawStreamPtr(0),
      48             :   //fSTURawStreamPtr(0),
      49             :   //fAnalyzerPtr(0),
      50           0 :   fEMCALConstants(NULL),
      51           0 :   hList(0),
      52           0 :   fAmp(0), fTime(0), fAT(0), fCellVsEne(0),
      53           0 :   fClusterReaderPtr(0)
      54             : 
      55           0 : {
      56             :   // See header file for documentation
      57             : 
      58           0 :   fShmPtr = new AliHLTCaloSharedMemoryInterfacev2("EMCAL");
      59             : 
      60             :   //fRawCounterMemoryPtr = new AliRawReaderMemory();
      61             : 
      62             :   //fAltroRawStreamPtr = new AliAltroRawStreamV3(fRawCounterMemoryPtr);
      63             : 
      64             :   //fRawStreamPtr = new AliCaloRawStreamV3(fRawCounterMemoryPtr, "EMCAL");
      65             : 
      66             :   //fSTURawStreamPtr = new AliEMCALTriggerSTURawStream(fRawCounterMemoryPtr);
      67             : 
      68           0 :   fEMCALConstants = new AliHLTEMCALConstants();
      69             : 
      70           0 :   fClusterReaderPtr = new AliHLTCaloClusterReader();
      71             : 
      72             :   // Booking histograms
      73             : 
      74           0 :   char id[100];
      75           0 :   char title[100];
      76             :  
      77           0 :   hList = new TObjArray;
      78             : 
      79             :   // channel histograms
      80           0 :   fAmp = new TProfile2D *[fCaloConstants->GetNMODULES()];
      81           0 :   fTime = new TProfile2D *[fCaloConstants->GetNMODULES()];
      82           0 :   fAT = new TH2F *[fCaloConstants->GetNMODULES()];
      83             :   
      84             :   // cluster histograms
      85           0 :   fCellVsEne = new TH2F  *[fCaloConstants->GetNMODULES()];
      86             : 
      87             :   //  fCellVsClus = new TH1F ("fCellVsClus","",100,0,50);
      88             :   //hList->Add(fCellVsClus);
      89             : 
      90             : 
      91           0 :   for (int i=0; i<fCaloConstants->GetNMODULES(); i++) {
      92             : 
      93             : 
      94             : 
      95             :     //sprintf(title, "Row vs Col : SM %d ", i);
      96             :     //sprintf(id, "hAmp%d", i);
      97             :     //hAmp[i] = new TProfile2D(id,title, 48, -0.5, 47.5, 24, -0.5, 23.5); 
      98             :     //sprintf(id, "hTime%d", i);
      99             :     //hTime[i] = new TProfile2D(id,title, 48, -0.5, 47.5, 24, -0.5, 23.5); 
     100             : 
     101             : 
     102           0 :     sprintf(title, "X_Z AMP: SM %d ", i);
     103           0 :     sprintf(id, "fAmp%d", i);
     104           0 :     fAmp[i] = new TProfile2D(id,title, 48, -0.5, 47.5, 24, -0.5, 23.5); 
     105             :     
     106           0 :     hList->Add(fAmp[i]);
     107             :     
     108           0 :     sprintf(title, "X_Z TIME: SM %d ", i);
     109           0 :     sprintf(id, "fTime%d", i);
     110           0 :     fTime[i] = new TProfile2D(id,title, 48, -0.5, 47.5, 24, -0.5, 23.5); 
     111             : 
     112           0 :     hList->Add(fTime[i]);
     113             : 
     114           0 :     sprintf(title, "AMP_TIME: SM %d ", i);
     115           0 :     sprintf(id, "fAT%d", i);
     116           0 :     fAT[i] = new TH2F(id,title, 1024, -0.5, 1023.5, 200, -0.5, 199.5);
     117             :     
     118           0 :     hList->Add(fAT[i]);
     119             : 
     120           0 :     sprintf(title, "Cell_Energy: SM %d ", i);
     121           0 :     sprintf(id, "fCellVsEne%d", i);
     122           0 :     fCellVsEne[i] = new TH2F(id,title,50 ,0, 50, 10, 0, 10);
     123             :     
     124           0 :     hList->Add(fCellVsEne[i]);
     125             : 
     126             :   }
     127             :   
     128             :   
     129           0 : }
     130             : 
     131             : AliHLTEMCALRawHistoMaker::~AliHLTEMCALRawHistoMaker() 
     132           0 : {
     133             :   //See header file for documentation
     134           0 : }
     135             : 
     136             : // Pointer to histograms objects
     137             : TObjArray* AliHLTEMCALRawHistoMaker::GetHistograms()
     138             : {
     139           0 :   return hList;
     140             : }
     141             : 
     142             : 
     143             : Int_t
     144             : AliHLTEMCALRawHistoMaker::MakeHisto(AliHLTCaloChannelDataHeaderStruct* channelDataHeader,  
     145             :                                     AliHLTCaloClusterHeaderStruct *caloClusterHeaderPtr, 
     146             :                                     int beverbose)
     147             : {
     148             :         //int tmpsize =  0;
     149             :         Int_t crazyness          = 0;
     150             :         Int_t nSamples           = 0;
     151             :         Short_t channelCount     = 0;
     152             : 
     153             : 
     154             :         // Channel variables
     155           0 :         AliHLTCaloCoordinate coord;
     156             :         AliHLTCaloChannelDataStruct* currentchannel = 0;
     157             : 
     158             : 
     159             :         // Cluster variables
     160             :         // Pointer to Cluster struture
     161             :         AliHLTCaloClusterDataStruct* caloClusterStructPtr = 0;
     162             :         Int_t nClusters = 0;
     163             : 
     164           0 :         if (!caloClusterHeaderPtr) {
     165             :                   
     166             :         } else {
     167             :           
     168             :           // stuff to handle clusters here
     169             : 
     170           0 :           fClusterReaderPtr->SetMemory(caloClusterHeaderPtr);
     171             :           
     172           0 :           while((caloClusterStructPtr = fClusterReaderPtr->NextCluster()) != 0)
     173             :           
     174             :             { 
     175             :                
     176           0 :               cout << "cluster type: " << caloClusterStructPtr->fClusterType << endl;
     177             :                
     178           0 :               cout << " COORDINATES FROM HISTOMAKER: " << 
     179           0 :                 " fX:" << caloClusterStructPtr->fGlobalPos[0] <<
     180           0 :                 " fY:" << caloClusterStructPtr->fGlobalPos[1] <<
     181           0 :                 " fZ:" << caloClusterStructPtr->fGlobalPos[2] <<
     182           0 :                 " fModule: " << caloClusterStructPtr->fModule << 
     183           0 :                 " fCell: " << caloClusterStructPtr->fNCells   <<
     184           0 :                 " fEnergy " << caloClusterStructPtr->fEnergy << endl;
     185             :              
     186           0 :               fCellVsEne[caloClusterStructPtr->fModule]->Fill(caloClusterStructPtr->fNCells, caloClusterStructPtr->fEnergy);
     187             :                   
     188             : 
     189           0 :               UShort_t *idArrayPtr = new UShort_t[caloClusterStructPtr->fNCells];
     190           0 :               Double32_t *ampFracArrayPtr = new Double32_t[caloClusterStructPtr->fNCells];
     191             :       
     192           0 :               for(UInt_t index = 0; index < caloClusterStructPtr->fNCells; index++)
     193             :                 {
     194           0 :                   fClusterReaderPtr->GetCell(caloClusterStructPtr, idArrayPtr[index], ampFracArrayPtr[index], index);
     195           0 :                   printf("EM: cellId: %d\n", idArrayPtr[index]);;
     196             :                 }
     197             : 
     198           0 :               delete [] idArrayPtr;
     199           0 :               delete [] ampFracArrayPtr;
     200             : 
     201           0 :               nClusters++;
     202             : 
     203             :             }
     204             :           
     205             :         }
     206             : 
     207             : 
     208             : 
     209             :         // begin scan channel data and fill histograms
     210             : 
     211             : 
     212           0 :         if (channelDataHeader) {
     213             :          
     214           0 :           fShmPtr->SetMemory(channelDataHeader);
     215             : 
     216           0 :           currentchannel = fShmPtr->NextChannel();
     217             : 
     218           0 :           while(currentchannel != 0) {
     219             :           
     220           0 :             fMapperPtr->ChannelId2Coordinate(currentchannel->fChannelID, coord);
     221             :             //fMapperPtr->FixCoordinate(coord);
     222             :             
     223           0 :             cout << " from histo maker ->>>>>>>>>>>>>>>>>>>>>>>>>>>>>> " << endl;
     224           0 :             cout << " fX: " << coord.fX << " fZ: " << coord.fZ << endl;
     225           0 :             cout << " channel ID: " << currentchannel->fChannelID << endl;
     226           0 :             cout << " channel AMPLITUDE (called energy): " << currentchannel->fEnergy << endl;
     227           0 :             cout << " channel time: " << currentchannel->fTime << endl;
     228             :             
     229             :             
     230           0 :             fTime[coord.fModuleId]->Fill( coord.fZ,  coord.fX , currentchannel->fTime);
     231           0 :             fAmp[coord.fModuleId]->Fill( coord.fZ,  coord.fX , currentchannel->fEnergy);
     232           0 :             fAT[coord.fModuleId]->Fill(currentchannel->fEnergy, currentchannel->fTime);
     233             :             
     234           0 :             currentchannel = fShmPtr->NextChannel(); // Get the next channel
     235             :             
     236             :           }
     237             :         }
     238             :         
     239             : 
     240           0 : return (0); 
     241           0 : }

Generated by: LCOV version 1.11