]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
added HLT EMCAL online montioring component for cluster reconstruction
authorfronchet <fronchet@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 20 Jul 2011 12:26:59 +0000 (12:26 +0000)
committerfronchet <fronchet@f7af4fe6-9843-0410-8265-dc069ae4e863>
Wed, 20 Jul 2011 12:26:59 +0000 (12:26 +0000)
HLT/CMakelibAliHLTEMCAL.pkg
HLT/EMCAL/AliHLTEMCALClusterMonitor.cxx [new file with mode: 0644]
HLT/EMCAL/AliHLTEMCALClusterMonitor.h [new file with mode: 0644]
HLT/EMCAL/AliHLTEMCALClusterMonitorComponent.cxx [new file with mode: 0644]
HLT/EMCAL/AliHLTEMCALClusterMonitorComponent.h [new file with mode: 0644]

index 712c2d059988689bbb13de3229c74d3d72c1f75a..502fd4c9d0fda08ff31e778dfb549c92233a4e24 100644 (file)
@@ -43,6 +43,8 @@ set ( CLASS_HDRS
     AliHLTEMCALRecoParamHandler.h
     AliHLTEMCALClusterizerComponentNbyN.h
     AliFJWrapper.h
+    AliHLTEMCALClusterMonitorComponent.h
+    AliHLTEMCALClusterMonitor.h
     )
 
 string ( REPLACE ".h" ".cxx" MODULE_SRCS "${CLASS_HDRS}" )
diff --git a/HLT/EMCAL/AliHLTEMCALClusterMonitor.cxx b/HLT/EMCAL/AliHLTEMCALClusterMonitor.cxx
new file mode 100644 (file)
index 0000000..c7c1eed
--- /dev/null
@@ -0,0 +1,115 @@
+/**************************************************************************
+ * This file is property of and copyright by the ALICE HLT Project        * 
+ * All rights reserved.                                                   *
+ *                                                                        *
+ * Primary Authors: Francesco Blanco                                      *
+ *                                                                        *
+ * Permission to use, copy, modify and distribute this software and its   *
+ * documentation strictly for non-commercial purposes is hereby granted   *
+ * without fee, provided that the above copyright notice appears in all   *
+ * copies and that both the copyright notice and this permission notice   *
+ * appear in the supporting documentation. The authors make no claims     *
+ * about the suitability of this software for any purpose. It is          * 
+ * provided "as is" without express or implied warranty.                  *
+ **************************************************************************/
+
+/**
+ * @file   AliHLTEMCALClusterMonitor.cxx
+ * @author Francesco Blanco
+ * @date 
+ * @brief  Online Monitoring Histogram maker for EMCAL  
+ */
+  
+
+#include "AliHLTEMCALClusterMonitor.h"
+#include "AliHLTCaloSharedMemoryInterfacev2.h"
+#include "TMath.h"
+
+ClassImp(AliHLTEMCALClusterMonitor);
+
+AliHLTEMCALClusterMonitor::AliHLTEMCALClusterMonitor():
+  fClusterReaderPtr(0),
+  hList(0),
+       hClusterEne(0),
+       hClusterEneVsTime(0),
+       hClusterCells(0),
+       hClusterEneVsCells(0),
+       hClusterEtaVsPhi(0)
+
+{
+  // See header file for documentation
+
+  fClusterReaderPtr = new AliHLTCaloClusterReader();
+
+  // Booking histograms
+  hList = new TObjArray;
+
+       hClusterEne = new TH1F("hClusterEne", "ClusterEnergy (GeV)", 200, 0, 100);
+       hList->Add(hClusterEne);
+
+       hClusterEneVsTime = new TH2F("hClusterEneVsTime", "ClusterEnergy vs Time", 200, 0, 100, 40, -0.5, 39.5);
+       hList->Add(hClusterEneVsTime);
+       
+       hClusterCells = new TH1I("hClusterCells", "# of cells per cluster", 50, -0.5, 49.5);
+       hList->Add(hClusterCells);
+
+       hClusterEneVsCells = new TH2F("hClusterEneCells", "# of cells per cluster vs cluster energy", 200, 0, 100, 50, -0.5, 49.5);
+       hList->Add(hClusterEneVsCells);
+
+       hClusterEtaVsPhi = new TH2F("hClusterEtaVsPhi", "Cluster position in #eta#phi", 100, -0.7, 0.7, 100, 1.38, 3.15);
+       hClusterEtaVsPhi->GetXaxis()->SetTitle("#eta");
+       hClusterEtaVsPhi->GetYaxis()->SetTitle("#phi");
+       hList->Add(hClusterEtaVsPhi);
+       
+       
+}
+
+AliHLTEMCALClusterMonitor::~AliHLTEMCALClusterMonitor() 
+{
+  //See header file for documentation
+}
+
+// Pointer to histograms objects
+TObjArray* AliHLTEMCALClusterMonitor::GetHistograms()
+{
+  return hList;
+}
+
+
+Int_t AliHLTEMCALClusterMonitor::MakeHisto(AliHLTCaloClusterHeaderStruct *caloClusterHeaderPtr)
+{
+
+       // Cluster variables
+       // Pointer to Cluster struture
+       AliHLTCaloClusterDataStruct* caloClusterStructPtr = 0;
+
+       float clusterEne, clusterTime, clusterEta, clusterPhi, clusterX, clusterY, clusterZ;
+       int nCells;
+       if (caloClusterHeaderPtr) {
+         
+         // stuff to handle clusters here
+         fClusterReaderPtr->SetMemory(caloClusterHeaderPtr);
+         
+         while((caloClusterStructPtr = fClusterReaderPtr->NextCluster()) != 0) {
+                       clusterX = caloClusterStructPtr->fGlobalPos[0];
+                       clusterY = caloClusterStructPtr->fGlobalPos[1];
+                       clusterZ = caloClusterStructPtr->fGlobalPos[2];
+
+                       nCells = caloClusterStructPtr->fNCells;
+                       clusterEne = caloClusterStructPtr->fEnergy;
+                       clusterTime = caloClusterStructPtr->fTOF;
+               hClusterEne->Fill(clusterEne);
+               hClusterEneVsTime->Fill(clusterEne, clusterTime);
+               hClusterCells->Fill(nCells);
+               hClusterEneVsCells->Fill(clusterEne, nCells);
+                       float r = TMath::Sqrt(clusterX*clusterX + clusterY*clusterY + clusterZ*clusterZ);
+                       clusterEta = 0.5*TMath::Log( (r+clusterZ)/(r-clusterZ) );
+                       clusterPhi = TMath::ATan2(clusterY, clusterX);
+               hClusterEtaVsPhi->Fill(clusterEta, clusterPhi);
+
+           }
+         
+       }
+
+return 0; 
+}
diff --git a/HLT/EMCAL/AliHLTEMCALClusterMonitor.h b/HLT/EMCAL/AliHLTEMCALClusterMonitor.h
new file mode 100644 (file)
index 0000000..d9f18ab
--- /dev/null
@@ -0,0 +1,72 @@
+/**************************************************************************
+ * This file is property of and copyright by the ALICE HLT Project        *
+ * All rights reserved.                                                   *
+ *                                                                        *
+ * Primary Authors: Francesco Blanco                                      *
+ *                                                                        *
+ * Permission to use, copy, modify and distribute this software and its   *
+ * documentation strictly for non-commercial purposes is hereby granted   *
+ * without fee, provided that the above copyright notice appears in all   *
+ * copies and that both the copyright notice and this permission notice   *
+ * appear in the supporting documentation. The authors make no claims     *
+ * about the suitability of this software for any purpose. It is          *
+ * provided "as is" without express or implied warranty.                  *
+ **************************************************************************/
+#ifndef ALIHLTEMCALCLUSTERMONITOR_H
+#define ALIHLTEMCALCLUSTERMONITOR_H
+
+/**
+ * Class makes histograms from information from raw data
+ *
+ * @file   AliHLTEMCALClusterMonitor.h
+ * @author Francesco Blanco
+ * @date
+ * @brief  Histo maker for EMCAL HLT
+ */
+
+
+#include "AliHLTCaloClusterDataStruct.h"
+#include "AliHLTCaloClusterReader.h"
+
+
+#include "TH1F.h"
+#include "TH2F.h"
+#include "TH1I.h"
+#include "TObjArray.h"
+#include "TString.h"
+
+class AliHLTEMCALClusterMonitor : public TObject
+{
+
+public:
+  /** Constructor */
+  AliHLTEMCALClusterMonitor();
+
+  /** Destructor */
+  virtual ~AliHLTEMCALClusterMonitor();
+
+  Int_t MakeHisto(AliHLTCaloClusterHeaderStruct *caloClusterHeaderPtr);
+
+  TObjArray * GetHistograms();
+
+private:
+
+  AliHLTCaloClusterReader* fClusterReaderPtr; // !transient The reader
+
+  TObjArray *hList;
+       TH1F *hClusterEne;
+       TH2F *hClusterEneVsTime;
+       TH1I *hClusterCells;
+       TH2F *hClusterEneVsCells;
+       TH2F *hClusterEtaVsPhi;
+
+  AliHLTEMCALClusterMonitor(const AliHLTEMCALClusterMonitor &);
+  AliHLTEMCALClusterMonitor & operator = (const AliHLTEMCALClusterMonitor &);
+  
+  ClassDef(AliHLTEMCALClusterMonitor, 0); 
+
+};
+
+
+#endif
diff --git a/HLT/EMCAL/AliHLTEMCALClusterMonitorComponent.cxx b/HLT/EMCAL/AliHLTEMCALClusterMonitorComponent.cxx
new file mode 100644 (file)
index 0000000..c3ab542
--- /dev/null
@@ -0,0 +1,177 @@
+/**************************************************************************
+ * This file is property of and copyright by the ALICE HLT Project        *
+ * All rights reserved.                                                   *
+ *                                                                        *
+ * Primary Authors: Freancesco Blanco                                     *
+ *                                                                        *
+ * Permission to use, copy, modify and distribute this software and its   *
+ * documentation strictly for non-commercial purposes is hereby granted   *
+ * without fee, provided that the above copyright notice appears in all   *
+ * copies and that both the copyright notice and this permission notice   *
+ * appear in the supporting documentation. The authors make no claims     *
+ * about the suitability of this software for any purpose. It is          *
+ * provided "as is" without express or implied warranty.                  *
+ **************************************************************************/
+
+#include "AliHLTEMCALClusterMonitorComponent.h"
+#include "AliHLTEMCALClusterMonitor.h"
+
+#include "TFile.h"
+#include "TString.h"
+
+
+
+/** 
+ * @file   AliHLTEMCALClusterMonitorComponent.cxx
+ * @author Francesco Blanco
+ * @date   
+ * @brief  A component to pusk back histograms for EMCAL HLT
+ */
+
+//FIXME
+AliHLTEMCALClusterMonitorComponent gAliHLTEMCALClusterMonitorComponent;
+
+AliHLTEMCALClusterMonitorComponent::AliHLTEMCALClusterMonitorComponent() :
+                                 AliHLTCaloProcessor(),
+                                 fRootFileName("histofile_local.root"),
+                                 fPushFraction(10),
+                                 fLocalEventCount(0),
+                                 fBeVerbose(0),
+                                 fHistoMakerPtr(0)
+{
+       //see header file for documentation
+}
+
+
+AliHLTEMCALClusterMonitorComponent::~AliHLTEMCALClusterMonitorComponent()
+{
+       //see header file for documentation
+}
+
+
+int
+AliHLTEMCALClusterMonitorComponent::DoInit(int argc, const char** argv )
+{
+       //see header file for documentation
+
+       fHistoMakerPtr = new AliHLTEMCALClusterMonitor();
+       SetupCTPData();
+       for(int i = 0; i < argc; i++)
+       {
+               if(!strcmp("-roothistofilename", argv[i]))
+                       fRootFileName = argv[i+1];
+
+               if(!strcmp("-pushfraction", argv[i]))
+                       fPushFraction = atoi(argv[i+1]);
+
+               if(!strcmp("-beverbose", argv[i]))
+                       fBeVerbose = atoi(argv[i+1]);
+
+       }
+
+       if (fBeVerbose) cout << "\nI-CLUSTERMONITORCOMPONENT: local root file name is: " << fRootFileName << endl;
+
+       return 0;
+}
+
+
+int 
+AliHLTEMCALClusterMonitorComponent::Deinit()
+{ 
+       //see header file for documentation
+       if(fHistoMakerPtr)
+       {
+               delete fHistoMakerPtr;
+               fHistoMakerPtr = 0;
+       }
+
+       return 0;
+}
+
+const char*
+AliHLTEMCALClusterMonitorComponent::GetComponentID()
+{
+       //see header file for documentation
+       return "EmcalClusterMonitor";
+}
+
+
+void
+AliHLTEMCALClusterMonitorComponent::GetInputDataTypes(vector<AliHLTComponentDataType>& list)
+{ 
+       //see header file for documentation
+       list.clear();
+       list.push_back(kAliHLTDataTypeCaloCluster);
+}
+
+AliHLTComponentDataType 
+AliHLTEMCALClusterMonitorComponent::GetOutputDataType()
+{
+       //see header file for documentation
+       return kAliHLTDataTypeHistogram | kAliHLTDataOriginEMCAL;
+}
+
+void 
+AliHLTEMCALClusterMonitorComponent::GetOutputDataSize(unsigned long& constBase, double& inputMultiplier)
+{
+       //see header file for documentation
+       constBase = 0;
+       // to be reviewed later
+       inputMultiplier = 100;
+}
+
+int 
+AliHLTEMCALClusterMonitorComponent::DoEvent(const AliHLTComponentEventData& evtData, const AliHLTComponentBlockData* blocks,
+               AliHLTComponentTriggerData& /*trigData*/, AliHLTUInt8_t* /*outputPtr*/, AliHLTUInt32_t& /*size*/,
+               std::vector<AliHLTComponentBlockData>& /*outputBlocks*/)
+{
+
+
+       const AliHLTComponentBlockData* iter = 0;
+       unsigned long ndx;
+
+       UInt_t specification = 0;
+       for( ndx = 0; ndx < evtData.fBlockCnt; ndx++ )
+       {
+         
+               AliHLTCaloClusterHeaderStruct *caloClusterHeaderPtr = 0;
+
+               iter = blocks+ndx;
+               
+               if (fBeVerbose) PrintComponentDataTypeInfo(iter->fDataType);
+
+               if (iter->fDataType == kAliHLTDataTypeCaloCluster) caloClusterHeaderPtr = reinterpret_cast<AliHLTCaloClusterHeaderStruct*>(iter->fPtr);
+               else {
+                       if(fBeVerbose) HLTWarning("\nI-CLUSTERMONITORCOMPONENT: Data block does not contain cluster type \n");
+               }
+
+       
+               specification |= iter->fSpecification;
+               fHistoMakerPtr->MakeHisto(caloClusterHeaderPtr);
+
+       }
+
+
+       fLocalEventCount++;
+
+       TFile rootHistFile(fRootFileName,"recreate");
+       
+       fHistoMakerPtr->GetHistograms()->Write();
+       
+       if (fLocalEventCount%fPushFraction == 0) {
+         
+         if (fBeVerbose) cout << "\nI-CLUSTERMONITORCOMPONENT: pushback done at " << fLocalEventCount << " events " << endl;
+         
+         PushBack(fHistoMakerPtr->GetHistograms(), kAliHLTDataTypeTObjArray | kAliHLTDataOriginEMCAL , specification);
+       }
+       
+       return 0;
+}
+
+
+AliHLTComponent*
+AliHLTEMCALClusterMonitorComponent::Spawn()
+{
+       //see header file for documentation
+       return new AliHLTEMCALClusterMonitorComponent();
+}
diff --git a/HLT/EMCAL/AliHLTEMCALClusterMonitorComponent.h b/HLT/EMCAL/AliHLTEMCALClusterMonitorComponent.h
new file mode 100644 (file)
index 0000000..5f5b67b
--- /dev/null
@@ -0,0 +1,91 @@
+/**************************************************************************
+ * This file is property of and copyright by the ALICE HLT Project        *
+ * All rights reserved.                                                   *
+ * INFN, Laboratori Nazionali di Frascati                                 *
+ * Primary Authors: Federico Ronchetti                                    *
+ *                                                                        *
+ * Permission to use, copy, modify and distribute this software and its   *
+ * documentation strictly for non-commercial purposes is hereby granted   *
+ * without fee, provided that the above copyright notice appears in all   *
+ * copies and that both the copyright notice and this permission notice   *
+ * appear in the supporting documentation. The authors make no claims     *
+ * about the suitability of this software for any purpose. It is          *
+ * provided "as is" without express or implied warranty.                  *
+ **************************************************************************/
+#ifndef ALIHLTEMCALCLUSTERMONITORCOMPONENT_H
+#define ALIHLTEMCALCLUSTERMONITORCOMPONENT_H
+
+/** @file   AliHLTEMCALClusterMonitorComponent.h
+    @author Francesco Blanco
+    @date   
+    @brief  A histo maker component for EMCAL HLT
+ */
+
+
+
+#include "AliHLTCaloProcessor.h"
+
+
+class AliHLTEMCALClusterMonitor;
+
+class AliHLTEMCALClusterMonitorComponent : public AliHLTCaloProcessor
+{
+public:
+
+       /** Constructor */
+       AliHLTEMCALClusterMonitorComponent();
+
+       /** Destructor */
+       virtual ~AliHLTEMCALClusterMonitorComponent();
+
+
+       /** interface function, see @ref AliHLTComponent for description */
+       const char* GetComponentID();
+
+       /** interface function, see @ref AliHLTComponent for description */
+       void GetInputDataTypes(std::vector<AliHLTComponentDataType>& list);
+
+       /** interface function, see @ref AliHLTComponent for description */
+       AliHLTComponentDataType GetOutputDataType();
+
+       /** interface function, see @ref AliHLTComponent for description */
+       void GetOutputDataSize(unsigned long& constBase, double& inputMultiplier);
+
+       /** interface function, see @ref AliHLTComponent for description */
+       int DoEvent(const AliHLTComponentEventData& evtData, const AliHLTComponentBlockData* blocks,
+                       AliHLTComponentTriggerData& /*trigData*/, AliHLTUInt8_t* /*outputPtr*/, AliHLTUInt32_t& /*size*/,
+                       std::vector<AliHLTComponentBlockData>& /*outputBlocks*/);
+
+       /** interface function, see @ref AliHLTComponent for description */
+       AliHLTComponent* Spawn();
+
+protected:
+
+       /** interface function, see @ref AliHLTComponent for description */
+
+       int DoInit(int argc, const char** argv);
+       int DoDeinit() {return 0;};
+
+       using AliHLTCaloProcessor::DoEvent;
+
+       /** interface function, see @ref AliHLTComponent for description */
+       virtual int Deinit(); ////////// PTH WARNING
+
+       
+
+private:
+       TString fRootFileName;
+       int fPushFraction;
+       int fLocalEventCount;
+       int fBeVerbose;
+
+       /** Pointer to the histo maker itself */
+       AliHLTEMCALClusterMonitor *fHistoMakerPtr;                    //! transient
+
+       
+       AliHLTEMCALClusterMonitorComponent(const AliHLTEMCALClusterMonitorComponent & );
+       AliHLTEMCALClusterMonitorComponent & operator = (const AliHLTEMCALClusterMonitorComponent &);
+};
+
+#endif
+