//--------------------------------------------------------------------- // File and Version Information: // $Id: $ // // Description: // This object constructs a list of clusters from a list of digis. // This module use a simple algorithm. // Digis which are in a Cluster are add to this cluster. // If a Digi is in more than one cluster, the clusters are merged. // Digis are added to the cluster if they have an energy above // _digiEnergyTreshold->value(). // // Environment: // Software developed for the PANDA Detector at GSI. // // Author List: // Jan Zhong //------------------------------------------------------------------------ #include "EmcMakeCluster.h" #include "EmcStructure.h" #include "EmcMapper.h" #include "TClonesArray.h" #include "CbmRootManager.h" #include "CbmRunAna.h" #include "CbmRuntimeDb.h" #include #include #include #include "EmcCluster.h" #include "EmcDigi.h" EmcMakeCluster::EmcMakeCluster(string fileGeo) { fFileGeo=fileGeo; fDigiEnergyTreshold=0.003; //GeV fDigiEnergyTresholdFS=0.015; //GeV fEmcClusterCentroidMethod="lilo"; } //-------------- // Destructor -- //-------------- EmcMakeCluster::~EmcMakeCluster() { } // ----- Public method Init ------------------------------- InitStatus EmcMakeCluster::Init() { // Get RootManager CbmRootManager* ioman = CbmRootManager::Instance(); if ( ! ioman ) { cout << "-E- EmcMakeCluster::Init: " << "RootManager not instantiated!" << endl; return kFATAL; } // Get input array fDigiArray = (TClonesArray*) ioman->GetObject("EmcDigi"); if ( ! fDigiArray ) { cout << "-W- EmcMakeCluster::Init: " << "No EmcDigi array!" << endl; return kERROR; } // Create and register output array fClusterArray = new TClonesArray("EmcCluster"); ioman->Register("EmcCluster","Emc",fClusterArray,kTRUE); // map version 1 corresponds to geometry from emc_module12345.dat // other options are not implemented yet int map_ver=0; if (!fFileGeo.compare("emc_module12345.dat")) map_ver=1; else Fatal("EmcMakeCluster::Init()", "Mapper for the given geometry file is not defined"); // Objects EmcMapper and EmcStructure are singeletons and should be instantiated first time with proper values of input parameters EmcMapper::Instance(map_ver); EmcStructure::Instance(fFileGeo); if (!fEmcClusterCentroidMethod.compare("lilo")) { EmcCluster::selectCentroidMethod(EmcCluster::lilo); } cout << "-I- EmcMakeCluster: Intialization successfull" << endl; return kSUCCESS; } void EmcMakeCluster::Exec(Option_t* opt) { // Reset output array if ( ! fClusterArray ) Fatal("Exec", "No Cluster Array"); fClusterArray->Delete(); Int_t nDigis = fDigiArray->GetEntriesFast(); cout<<"DigiList length "<At(iDigi); theDigi->ValidateTCI(); // TCI in digi is not valide after reading from file if(theDigi->GetEnergy()< fDigiEnergyTreshold) continue; bool isAdded = false; Int_t clustmarker=0; Int_t clustLength=fClusterArray->GetEntriesFast(); for(Int_t i=0;iAt(i); if(cluster->isInCluster(theDigi)) { if(!isAdded) { clustmarker=i; isAdded=true; cluster->addDigi(theDigi); } else { EmcCluster* clust_clustmarker=(EmcCluster*) fClusterArray->At(clustmarker); EmcCluster* clust_i=(EmcCluster*) fClusterArray->At(i); clust_clustmarker->addCluster(clust_i); fClusterArray->RemoveAt(i); fClusterArray->Compress(); clustLength--; i--; } } } if (!isAdded) { EmcCluster* newcluster = new((*fClusterArray)[clustLength]) EmcCluster(); newcluster->addDigi(theDigi); } totalDigiEnergy+=theDigi->GetEnergy(); } // At that moment internal state fEnergy and fWhere of Clusters are not initialized, the following make it possible to see energy and position from output root file Int_t nCluster = fClusterArray->GetEntriesFast(); for (Int_t i=0; iAt(i); tmpclust->energy(); tmpclust->where(); } } ClassImp(EmcMakeCluster)