#include "ClusterSystem.h"
#include "CalHit.h"
ClassImp(ClusterSystem)
//////////////////////////////////////////////////////////////////////////
// //
// ClusterSystem //
// //
// The ClusterSystem class is used to extract cluster information //
// from the GISMO ascii output file and use it to fill the Cluster //
// class. //
// //
//////////////////////////////////////////////////////////////////////////
///_________________________________________________________________________
ClusterSystem::ClusterSystem(GetParameters* gp) {
// Default constructor
m_event = 0;
m_parameters = gp;
m_hitEscale = new Float_t(4);
m_hitEscale[0] = gp->getEMEnergyScale();
m_hitEscale[1] = gp->getHADEnergyScale();
m_hitEscale[2] = gp->getMUEnergyScale();
m_hitEscale[3] = gp->getLUMEnergyScale();
CalHit::energyScale = m_hitEscale;
m_hitcosThetaSeg = new Float_t(4);
m_hitcosThetaSeg[0] = gp->getEMcosThetaSeg();
m_hitcosThetaSeg[1] = gp->getHADcosThetaSeg();
m_hitcosThetaSeg[2] = gp->getMUcosThetaSeg();
m_hitcosThetaSeg[3] = gp->getLUMcosThetaSeg();
CalHit::cosThetaSeg = m_hitcosThetaSeg;
m_hitphiSeg = new Float_t(4);
m_hitphiSeg[0] = gp->getEMphiSeg();
m_hitphiSeg[1] = gp->getHADphiSeg();
m_hitphiSeg[2] = gp->getMUphiSeg();
m_hitphiSeg[3] = gp->getLUMphiSeg();
CalHit::phiSeg = m_hitphiSeg;
}
///_________________________________________________________________________
void ClusterSystem::FillClusters(TObjArray* cal_digi){
// Gets the cluster information from the ascii file
Int_t nhits = cal_digi->GetEntries();
TMap* reference = new TMap(17,0);
for(Int_t i=0; i<nhits; i++){
TObjArray* list = ((CalHit*)cal_digi->At(i))->GetMCE();
Int_t nparts = list->GetEntries();
for(Int_t j=0; j<nparts; j++){
Int_t partindex = ((EDeposit*)list->At(j))->GetPart();
McPart* part = (McPart*)m_event->MCparticles()->At(partindex);
if( reference->FindObject(part)){// Does cluster exist?
Cluster* clust = (Cluster*)(reference->GetValue(part));
clust->IndexList()->Add(new IntObj(i));
clust->HitList()->Add((towerID*)((CalHit*)cal_digi->At(i))->GetTower());
clust->MCEList()->Add((EDeposit*)list->At(j));
}
else{
Cluster* clust = new Cluster(cal_digi);
clust->McList()->Add(new IntObj(partindex));
clust->IndexList()->Add(new IntObj(i));
clust->HitList()->Add((towerID*)((CalHit*)cal_digi->At(i))->GetTower());
clust->MCEList()->Add((EDeposit*)list->At(j));
reference->Add(part,clust);
m_event->ClusterLst()->Add(clust);
}
}
}
}
///_______________________________________________________________________
void ClusterSystem::doit(Event* event){
// This function executes cluster cheat system
m_event = event;
FillClusters(m_event->EMCAL());
FillClusters(m_event->HADCAL());
FillClusters(m_event->MUCAL());
Int_t nCluster = m_event->ClusterLst()->GetEntries();
for (int i=0; i<nCluster; i++) {
Cluster* cls = (Cluster*)m_event->ClusterLst()->At(i);
cls->CalcProperties();
};
}
///______________________________________________________________________
void ClusterSystem::spew(FILE* ofile)const{
// Output function
Int_t num = m_event->ClusterLst()->GetEntries();
fprintf(ofile,"Clustersn %in",num);
for(Int_t i=0; i<num; i++){
Cluster* clust = (Cluster*)m_event->ClusterLst()->At(i);
clust->Spew(ofile);
}
fprintf(ofile,"endn");
}
///______________________________________________________________________
void ClusterSystem::cleanup(){
// Cleans up loose ends. There aren't any right now.
m_event = 0;
}
ROOT page - Class index - Top of the page
This page has been automatically generated. If you have any comments or suggestions about the page layout send a mail to ROOT support, or contact the developers with any questions or problems regarding ROOT.