]> git.uio.no Git - u/mrichter/AliRoot.git/commitdiff
Changed CaloHistoComponent to take caloCluster struct input
authorslindal <slindal@f7af4fe6-9843-0410-8265-dc069ae4e863>
Sun, 21 Feb 2010 11:02:28 +0000 (11:02 +0000)
committerslindal <slindal@f7af4fe6-9843-0410-8265-dc069ae4e863>
Sun, 21 Feb 2010 11:02:28 +0000 (11:02 +0000)
HLT/global/AliHLTGlobalTrackMatcherComponent.cxx
HLT/global/physics/AliHLTCaloHistoComponent.cxx
HLT/global/physics/AliHLTCaloHistoComponent.h
HLT/global/physics/AliHLTCaloHistoInvMass.cxx
HLT/global/physics/AliHLTCaloHistoInvMass.h

index b9ae3e2700a4233726c407b6c030bad0e8565b7c..1570b7548d932076f287d2edeb11594c55d5a392 100644 (file)
@@ -218,7 +218,8 @@ int AliHLTGlobalTrackMatcherComponent::DoEvent(const AliHLTComponentEventData& /
      if(iResult <0) {
        HLTWarning("Error in track matcher");
      }
-    PushBack(pBlock->fPtr, pBlock->fSize, kAliHLTDataTypeCaloCluster | kAliHLTDataOriginAny );
+     PushBack(pBlock->fPtr, pBlock->fSize, pBlock->fDataType, pBlock->fSpecification);
+     //PushBack(pBlock->fPtr, pBlock->fSize, kAliHLTDataTypeCaloCluster | kAliHLTDataOriginAny );
   }
 
 
index 96be55cd8ef34beb3740f60e19a1f49c780ec0d3..01184e574d385184491e3dcdae31a84a0c744a22 100644 (file)
@@ -32,6 +32,9 @@ using namespace std;
 #include "AliHLTCaloHistoMatchedTracks.h"
 #include "AliESDEvent.h"
 #include "TRefArray.h"
+#include "AliHLTCaloClusterDataStruct.h"
+#include "AliHLTCaloClusterReader.h"
+
 
 // see below for class documentation
 // or
@@ -59,7 +62,8 @@ AliHLTCaloHistoComponent::AliHLTCaloHistoComponent() :
   fPhosInvariantMassHistProducer(NULL),
   fEmcalInvariantMassHistProducer(NULL),
   fPhosMatchedTracksHistProducer(NULL),
-  fEmcalMatchedTracksHistProducer(NULL)
+  fEmcalMatchedTracksHistProducer(NULL),
+  fClusterReader(NULL)
 {
   //see header file for documentation
 }
@@ -132,6 +136,8 @@ Int_t AliHLTCaloHistoComponent::DoInit(int argc, const char** argv ) {
     
   }
   
+  fClusterReader = new AliHLTCaloClusterReader();
+
   return 0;
 }
 
@@ -239,6 +245,9 @@ AliHLTComponent* AliHLTCaloHistoComponent::Spawn() {
 Int_t AliHLTCaloHistoComponent::DoEvent(const AliHLTComponentEventData& /*evtData*/, AliHLTComponentTriggerData& /*trigData*/) {
 
   //see header file for documentation
+  Int_t iResult = 0;
+
+
   if ( GetFirstInputBlock( kAliHLTDataTypeSOR ) || GetFirstInputBlock( kAliHLTDataTypeEOR ) )
     return 0;
 
@@ -249,33 +258,95 @@ Int_t AliHLTCaloHistoComponent::DoEvent(const AliHLTComponentEventData& /*evtDat
   vector<AliHLTCaloClusterDataStruct*> clustersVector;
   
   if (fDoEmcal) {
-   for (const AliHLTComponentBlockData* pBlock=GetFirstInputBlock( kAliHLTDataTypeCaloCluster | kAliHLTDataOriginAny ); pBlock!=NULL; pBlock=GetNextInputBlock()) {
+    for (const AliHLTComponentBlockData* pBlock=GetFirstInputBlock( kAliHLTDataTypeCaloCluster | kAliHLTDataOriginEMCAL ); pBlock!=NULL; pBlock=GetNextInputBlock()) {
+
+      //Check for origin and continue if not do this detector
+
+      AliHLTCaloClusterHeaderStruct *clusterHeader = reinterpret_cast<AliHLTCaloClusterHeaderStruct*>(pBlock->fPtr);
+      fClusterReader->SetMemory(clusterHeader);
+     
+      if ( (clusterHeader->fNClusters) < 0) {
+       HLTWarning("Event has negative number of clusters: %d! Very bad for vector resizing", (Int_t) (clusterHeader->fNClusters));
+      } else {    
+       HLTInfo("Event has positive number of clusters: %d", (Int_t ) (clusterHeader->fNClusters));
+
+       //BALLE, TODO, make it able to do EMCAL as well!!!
+       clustersVector.resize((int) (clusterHeader->fNClusters)); 
+       Int_t nClusters = 0;
+       while( (clusterStruct = fClusterReader->NextCluster()) != 0) {
+         clustersVector[nClusters++] = clusterStruct;  
+       }
+      
+       nClusters = clusterHeader->fNClusters;
+
+       //      if(fDoMatchedTracks)
+         //      fEmcalMatchedTracksHistProducer->FillHistograms(nClusters, clustersVector);
+       
+       if(fDoInvariantMass)
+         fEmcalInvariantMassHistProducer->FillHistograms(nClusters, clustersVector);
+       
+       //      if(fDoClusterEnergy)
+         //fEmcalClusterEnergyHistProducer->FillHistograms(nClusters, clustersVector);
+       
+       //if(fDoCellEnergy)
+         //fEmcalCellEnergyHistProducer->FillHistograms(nClusters, clustersVector);
+       
+      }
+      PushBack(pBlock->fPtr, pBlock->fSize, pBlock->fDataType, pBlock->fSpecification);
+      //PushBack(pBlock->fPtr, pBlock->fSize, kAliHLTDataTypeCaloCluster | kAliHLTDataOriginAny );
+    }
+     
+    if(iResult <0) {
+      HLTWarning("Error in track matcher");
+    }
+  }
 
-     //Check for origin and continue if not do this detector
 
-     AliHLTCaloClusterHeaderStruct *clusterHeader = reinterpret_cast<AliHLTCaloClusterHeaderStruct*>(pBlock->fPtr);
-     fClusterReader->SetMemory(clusterHeader);
+  clustersVector.clear();
+  if (fDoPhos) {
+    for (const AliHLTComponentBlockData* pBlock=GetFirstInputBlock( kAliHLTDataTypeCaloCluster | kAliHLTDataOriginPHOS ); pBlock!=NULL; pBlock=GetNextInputBlock()) {
+
+      //Check for origin and continue if not do this detector
+
+      AliHLTCaloClusterHeaderStruct *clusterHeader = reinterpret_cast<AliHLTCaloClusterHeaderStruct*>(pBlock->fPtr);
+      fClusterReader->SetMemory(clusterHeader);
      
-     if ( (clusterHeader->fNClusters) < 0) {
-       HLTWarning("Event has negative number of clusters: %d! Very bad for vector resizing", (Int_t) (clusterHeader->fNClusters));
-     } else {    
-       HLTInfo("Event has positive number of clusters: %d", (Int_t ) (clusterHeader->fNClusters));
-
-       //BALLE, TODO, make it able to do EMCAL as well!!!
-       clustersVector.resize((int) (clusterHeader->fNClusters)); 
-       Int_t nClusters = 0;
-       cout << "nclustes " << clusterHeader->fNClusters << endl;
-       while( (clusterStruct = fClusterReader->NextCluster()) != 0) {
-        phosClustersVector[nClusters++] = clusterStruct;  
-       }
+      if ( (clusterHeader->fNClusters) < 0) {
+       HLTWarning("Event has negative number of clusters: %d! Very bad for vector resizing", (Int_t) (clusterHeader->fNClusters));
+      } else {    
+       HLTInfo("Event has positive number of clusters: %d", (Int_t ) (clusterHeader->fNClusters));
+
+       //BALLE, TODO, make it able to do PHOS as well!!!
+       clustersVector.resize((int) (clusterHeader->fNClusters)); 
+       Int_t nClusters = 0;
+       while( (clusterStruct = fClusterReader->NextCluster()) != 0) {
+         clustersVector[nClusters++] = clusterStruct;  
+       }
+      
+       nClusters = clusterHeader->fNClusters;
+
+       //      if(fDoMatchedTracks)
+       //fPhosMatchedTracksHistProducer->FillHistograms(nClusters, clustersVector);
+       
+       if(fDoInvariantMass)
+         fPhosInvariantMassHistProducer->FillHistograms(nClusters, clustersVector);
+       
+//     if(fDoClusterEnergy)
+//       fPhosClusterEnergyHistProducer->FillHistograms(nClusters, clustersVector);
        
-       iResult = fTrackMatcher->Match(fTrackArray, phosClustersVector, fBz);
-     }
+//     if(fDoCellEnergy)
+//       fPhosCellEnergyHistProducer->FillHistograms(nClusters, clustersVector);
+       
+      }
+      PushBack(pBlock->fPtr, pBlock->fSize, pBlock->fDataType, pBlock->fSpecification);
+    }
      
-     if(iResult <0) {
-       HLTWarning("Error in track matcher");
-     }
-     //PushBack(pBlock->fPtr, pBlock->fSize, kAliHLTDataTypeCaloCluster | kAliHLTDataOriginAny );
+    if(iResult <0) {
+      HLTWarning("Error in track matcher");
+    }
+    
   }
 
 
@@ -352,16 +423,16 @@ Int_t AliHLTCaloHistoComponent::DoEvent(const AliHLTComponentEventData& /*evtDat
   if(fDoPhos){
     
     if(fDoInvariantMass)
-      PushBack(fPhosInvariantMassHistProducer->GetHistograms(), kAliHLTDataTypeHistogram);
+      PushBack(fPhosInvariantMassHistProducer->GetHistograms(), kAliHLTDataTypeHistogram|kAliHLTDataOriginPHOS);
     
-    if(fDoMatchedTracks)
-      PushBack(fPhosMatchedTracksHistProducer->GetHistograms(), kAliHLTDataTypeHistogram);
+//     if(fDoMatchedTracks)
+//       PushBack(fPhosMatchedTracksHistProducer->GetHistograms(), kAliHLTDataTypeHistogram, kAliHLTDataOriginPHOS);
     
-    if(fDoClusterEnergy) 
-      PushBack(fPhosClusterEnergyHistProducer->GetHistograms(), kAliHLTDataTypeHistogram);
+//     if(fDoClusterEnergy) 
+//       PushBack(fPhosClusterEnergyHistProducer->GetHistograms(), kAliHLTDataTypeHistogram, kAliHLTDataOriginPHOS);
     
-    if(fDoCellEnergy)
-      PushBack(fPhosCellEnergyHistProducer->GetHistograms(), kAliHLTDataTypeHistogram);
+//     if(fDoCellEnergy)
+//       PushBack(fPhosCellEnergyHistProducer->GetHistograms(), kAliHLTDataTypeHistogram, kAliHLTDataOriginPHOS);
     
   }
 
@@ -371,14 +442,14 @@ Int_t AliHLTCaloHistoComponent::DoEvent(const AliHLTComponentEventData& /*evtDat
     if(fDoInvariantMass) 
       PushBack(fEmcalInvariantMassHistProducer->GetHistograms(), kAliHLTDataTypeHistogram);
         
-    if(fDoMatchedTracks) 
-      PushBack(fEmcalMatchedTracksHistProducer->GetHistograms(), kAliHLTDataTypeHistogram);
+//     if(fDoMatchedTracks) 
+//       PushBack(fEmcalMatchedTracksHistProducer->GetHistograms(), kAliHLTDataOriginEMCALHLTDataTypeHistogram, kAliHLTDataOriginEMCAL);
   
-    if(fDoClusterEnergy) 
-      PushBack(fEmcalClusterEnergyHistProducer->GetHistograms(), kAliHLTDataTypeHistogram);
+//     if(fDoClusterEnergy) 
+//       PushBack(fEmcalClusterEnergyHistProducer->GetHistograms(), kAliHLTDataOriginEMCALHLTDataTypeHistogram, kAliHLTDataOriginEMCAL);
     
-    if(fDoCellEnergy)
-      PushBack(fEmcalCellEnergyHistProducer->GetHistograms(), kAliHLTDataTypeHistogram);
+//     if(fDoCellEnergy)
+//       PushBack(fEmcalCellEnergyHistProducer->GetHistograms(), kAliHLTDataOriginEMCALHLTDataTypeHistogram, kAliHLTDataOriginEMCAL);
     
   }
 
index a773559a658541006348f79c296baa92253ae076..5d28d3e25d0cef1c444cf628855989a12f6bed0d 100644 (file)
@@ -42,7 +42,7 @@ class AliHLTCaloHistoClusterEnergy;
 class AliHLTCaloHistoInvMass;
 class AliHLTCaloHistoMatchedTracks;
 class TRefArray;
-
+class AliHLTCaloClusterReader;
 /**
  * @class AliHLTPHOSHistogramProducerComponent
  *
@@ -115,6 +115,8 @@ protected:
   AliHLTCaloHistoMatchedTracks *fPhosMatchedTracksHistProducer; // PHOS matched tracks histogram producer
   AliHLTCaloHistoMatchedTracks *fEmcalMatchedTracksHistProducer; // EMCAL matched tracks histogram producer
 
+  AliHLTCaloClusterReader * fClusterReader; //Class to read cluster data structs
+
   ClassDef(AliHLTCaloHistoComponent, 1);
 
 };
index 5dee6b2dae2aca47547f2f72db0e12b1e1cc65b5..4ab74aaf6319119e9b6255458a73d968b4c3ed15 100644 (file)
@@ -29,7 +29,7 @@
 
 #include "AliHLTCaloHistoInvMass.h"
 #include "AliESDCaloCluster.h"
-#include "TMath.h"
+//#include "TMath.h"
 
 // #include "AliHLTCaloClusterDataStruct.h"
 // #include "AliHLTCaloClusterReader.h"
@@ -74,32 +74,34 @@ TObjArray* AliHLTCaloHistoInvMass::GetHistograms()
   return fHistArrayPtr;
 }
 
-Int_t AliHLTCaloHistoInvMass::FillHistograms(Int_t nc, TRefArray * clustersArray) {
-  //See header file for documentation
+// Int_t AliHLTCaloHistoInvMass::FillHistograms(Int_t nc, TRefArray * clustersArray) {
+//   //See header file for documentation
   
-  Float_t cPos[nc][3];
-  Float_t cEnergy[nc];
-
-  for(int ic = 0; ic < nc; ic++) {
-    AliESDCaloCluster * cluster = static_cast<AliESDCaloCluster*>(clustersArray->At(ic));
-    cluster->GetPosition(cPos[ic]);
-    cEnergy[ic] = cluster->E();
-  }
-
-  for(Int_t ipho = 0; ipho<(nc-1); ipho++) { 
-    for(Int_t jpho = ipho+1; jpho<nc; jpho++) { 
-      // Calculate the theta angle between two photons
-      Double_t theta = (2* asin(0.5*TMath::Sqrt((cPos[ipho][0]-cPos[jpho][0])*(cPos[ipho][0]-cPos[jpho][0]) +(cPos[ipho][1]-cPos[jpho][1])*(cPos[ipho][1]-cPos[jpho][1]))/460));
+//   Float_t cPos[nc][3];
+//   Float_t cEnergy[nc];
+
+//   for(int ic = 0; ic < nc; ic++) {
+//     AliESDCaloCluster * cluster = static_cast<AliESDCaloCluster*>(clustersArray->At(ic));
+//     cluster->GetPosition(cPos[ic]);
+//     cEnergy[ic] = cluster->E();
+//   }
+
+//   for(Int_t ipho = 0; ipho<(nc-1); ipho++) { 
+//     for(Int_t jpho = ipho+1; jpho<nc; jpho++) { 
+//       // Calculate the theta angle between two photons
+//       Double_t theta = (2* asin(0.5*TMath::Sqrt((cPos[ipho][0]-cPos[jpho][0])*(cPos[ipho][0]-cPos[jpho][0]) +(cPos[ipho][1]-cPos[jpho][1])*(cPos[ipho][1]-cPos[jpho][1]))/460));
       
-      // Calculate the mass m of the pion candidate
-      Double_t m =(TMath::Sqrt(2 * cEnergy[ipho]* cEnergy[jpho]*(1-TMath::Cos(theta))));
+//       // Calculate the mass m of the pion candidate
+//       Double_t m =(TMath::Sqrt(2 * cEnergy[ipho]* cEnergy[jpho]*(1-TMath::Cos(theta))));
       
-      fHistTwoClusterInvMass->Fill(m);
-    }
-  }
+//       fHistTwoClusterInvMass->Fill(m);
+//     }
+//   }
+
+//   return 0;
+// }
+
 
-  return 0;
-}
 
 // Int_t AliHLTCaloHistoInvMass::DoEvent(AliHLTCaloClusterHeaderStruct* cHeader) {   
   
index c9328d11342c7cfe635ec57c4379bb75d328f13b..3c001d4e34985ade041a08bf9fa96e1e845119e3 100644 (file)
 //#include "AliHLTPHOSBase.h"
 
 #include "Rtypes.h"
+#include "TMath.h"
+#include "TH1F.h"
+#include "vector"
+
 //#include "PHOS/AliHLTPHOSConstants.h" 
 
 class TObjArray;
-class TH1F;
 class AliHLTCaloClusterReader;
 class AliESDEvent;
 class TRefArray;
@@ -56,6 +59,8 @@ class TRefArray;
  * @ingroup alihlt_phos
  */
 
+using std::vector;
+
 class AliHLTCaloHistoInvMass {
 
 public:
@@ -70,7 +75,9 @@ public:
   TObjArray *GetHistograms();
 
   //** Loops of the calo clusters and fills histos
-  Int_t FillHistograms(Int_t nc, TRefArray * clustersArray);
+  //  Int_t FillHistograms(Int_t nc, TRefArray * clustersArray);
+  template <class T>
+  Int_t FillHistograms(Int_t nc, vector<T*> &cVec);
   
 private:
 
@@ -95,5 +102,36 @@ private:
   ClassDef(AliHLTCaloHistoInvMass, 0);
 
 };
+
+
+
+template <class T>
+Int_t AliHLTCaloHistoInvMass::FillHistograms(Int_t nc, vector<T*> &cVec) {
+  //See header file for documentation
+  
+  Float_t cPos[nc][3];
+  Float_t cEnergy[nc];
+
+  for(int ic = 0; ic < nc; ic++) {
+    T * cluster = cVec.at(ic);
+    cluster->GetPosition(cPos[ic]);
+    cEnergy[ic] = cluster->E();
+  }
+
+  for(Int_t ipho = 0; ipho<(nc-1); ipho++) { 
+    for(Int_t jpho = ipho+1; jpho<nc; jpho++) { 
+      // Calculate the theta angle between two photons
+      Double_t theta = (2* asin(0.5*TMath::Sqrt((cPos[ipho][0]-cPos[jpho][0])*(cPos[ipho][0]-cPos[jpho][0]) +(cPos[ipho][1]-cPos[jpho][1])*(cPos[ipho][1]-cPos[jpho][1]))/460));
+      
+      // Calculate the mass m of the pion candidate
+      Double_t m =(TMath::Sqrt(2 * cEnergy[ipho]* cEnergy[jpho]*(1-TMath::Cos(theta))));
+      
+      fHistTwoClusterInvMass->Fill(m);
+    }
+  }
+
+  return 0;
+}
+
  
 #endif