#include "AliHLTCaloHistoMatchedTracks.h"
#include "AliESDEvent.h"
#include "TRefArray.h"
+#include "AliHLTCaloClusterDataStruct.h"
+#include "AliHLTCaloClusterReader.h"
+
// see below for class documentation
// or
fPhosInvariantMassHistProducer(NULL),
fEmcalInvariantMassHistProducer(NULL),
fPhosMatchedTracksHistProducer(NULL),
- fEmcalMatchedTracksHistProducer(NULL)
+ fEmcalMatchedTracksHistProducer(NULL),
+ fClusterReader(NULL)
{
//see header file for documentation
}
}
+ fClusterReader = new AliHLTCaloClusterReader();
+
return 0;
}
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;
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");
+ }
+
}
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);
}
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);
}
#include "AliHLTCaloHistoInvMass.h"
#include "AliESDCaloCluster.h"
-#include "TMath.h"
+//#include "TMath.h"
// #include "AliHLTCaloClusterDataStruct.h"
// #include "AliHLTCaloClusterReader.h"
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) {
//#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;
* @ingroup alihlt_phos
*/
+using std::vector;
+
class AliHLTCaloHistoInvMass {
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:
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