33 #include "FairRootManager.h"
34 #include "FairRunAna.h"
35 #include "FairRuntimeDb.h"
37 #include "TClonesArray.h"
51 fDigiArray(NULL), fHitArray(NULL), fMCTrackArray(NULL), fClusterArray(NULL), fWriteOutArray(NULL), fDigiFunctor(NULL), fClusterList(), fDigiEnergyTresholdBarrel(0), fDigiEnergyTresholdFWD(0), fDigiEnergyTresholdBWD(0), fDigiEnergyTresholdShashlyk(0), fClusterPosParam(), fMapVersion(0), fGeoPar(new
PndEmcGeoPar()), fDigiPar(new
PndEmcDigiPar()), fRecoPar(new
PndEmcRecoPar()),
fVerbose(verbose), fStoreClusters(storeclusters)
78 FairRootManager* ioman = FairRootManager::Instance();
81 cout <<
"-E- PndEmcMakeCluster::Init: "
82 <<
"RootManager not instantiated!" << endl;
87 fDigiArray = (TClonesArray*) ioman->GetObject(
"EmcDigi");
89 fDigiArray = (TClonesArray*) ioman->GetObject(
"EmcDigiSorted");
91 cout <<
"-W- PndEmcMakeCluster::Init: "
92 <<
"No PndEmcDigi array!" << endl;
98 fHitArray = (TClonesArray*) ioman->GetObject(
"EmcHit");
100 cout <<
"-W- PndEmcMakeCluster::Init: "
101 <<
"No PndEmcHit array! Needed for MC Truth" << endl;
107 cout <<
"-W- PndEmcMakeCluster::Init: "
108 <<
"No MCTrack array! Needed for MC Truth" << endl;
117 if(FairRunAna::Instance()->IsTimeStamp()) {
142 cout<<
"Lilo cluster position method"<<endl;
148 cout <<
"-I- PndEmcMakeCluster: Intialization successfull" << endl;
174 if(FairRunAna::Instance()->IsTimeStamp()) {
182 cout<<
"DigiList length "<<nDigis<<endl;
186 for (Int_t iDigi=0; iDigi<nDigis; iDigi++)
202 bool isAdded =
false;
206 for(Int_t
i=0;
i<clustLength;
i++)
224 FairMultiLinkedData hitLinks = theDigi->GetLinksWithType(FairRootManager::Instance()->GetBranchId(
"EmcHit"));
225 for (Int_t j = 0; j < hitLinks.GetNLinks(); j++){
230 if (cluster->GetLinks().count(hitLinks.GetLink(j)) == 0){
232 cluster->AddLink(hitLinks.GetLink(j));
245 std::cout <<
"-E in PndEmcMakeCluster::Exec FairLink " << hitLinks.GetLink(j) <<
"to EmcHit delivers null" << std::endl;
267 FairMultiLinkedData hitLinks = theDigi->GetLinksWithType(FairRootManager::Instance()->GetBranchId(
"EmcHit"));
270 for (Int_t
i = 0;
i < hitLinks.GetNLinks();
i++){
278 newcluster->SetInsertHistory(kFALSE);
279 newcluster->AddLink(hitLinks.GetLink(
i));
285 std::cout <<
"-E in PndEmcMakeCluster::Exec FairLink " << hitLinks.GetLink(
i) <<
"to EmcHit delivers null" << std::endl;
379 for (Int_t
i=0;
i<nCluster;
i++) {
392 cout <<
"PndEmcMakeCluster, Real time " << rtime <<
" s, CPU time " << ctime <<
" s" << endl;
411 if(!FairRunAna::Instance()->IsTimeStamp())
return false;
434 std::vector <Int_t> tmplist;
436 std::sort( newlist.begin(), newlist.end());
438 std::unique_copy( newlist.begin(), newlist.end(), std::back_inserter( tmplist ) );
442 for(Int_t j=tmplist.size()-1; j>=0; j--){
445 pt=((
PndMCTrack*)mcTrackArray->At(tmplist[j]));
454 for(Int_t k=j-1; k>=0; k--){
456 tmplist.erase(tmplist.begin()+j);
469 FairRun*
run = FairRun::Instance();
470 if ( ! run ) Fatal(
"SetParContainers",
"No analysis run");
472 FairRuntimeDb* db = run->GetRuntimeDb();
473 if ( ! db ) Fatal(
"SetParContainers",
"No runtime database");
void SetEnergy(Double_t en)
virtual void SetParContainers()
void SetStorageOfData(Bool_t val)
Method to specify whether clusters are stored or not.
Double_t fDigiEnergyTresholdBWD
virtual void FinishClusters()
Calls FinishCluster() for each cluster.
bool isInCluster(PndEmcDigi *theDigi, const TClonesArray *digiArray)
Double_t fDigiEnergyTresholdShashlyk
static Int_t fEventCounter
Double_t fClusterActiveTime
Defines how long clusters are kept open in timebased reconstruction.
virtual Double_t GetEnergy() const
represents the reconstructed hit of one emc crystal
PndEmcMakeCluster(Int_t verbose=0, Bool_t storeclusters=kTRUE)
FairMultiLinkedData GetTrackEntering() const
TClonesArray * fClusterArray
active clusters
Double_t val[nBoxes][nFEBox]
virtual Double_t Lat() const
FairMultiLinkedData GetTrackExiting() const
void SetTrackExiting(const FairMultiLinkedData &tracks)
Double_t GetEnergyThresholdBarrel()
TVector3 Where(TString method, std::vector< Double_t > params)
void SetPersistency(Bool_t val=kTRUE)
virtual Double_t AbsZernikeMoment(int n, int m, Double_t R0=15) const
Double_t GetOffsetParmB()
Double_t GetOffsetParmC()
virtual void Exec(Option_t *opt)
Runs the task.
void AddTracksEnteringExiting(const FairMultiLinkedData &tracksEntering, const FairMultiLinkedData &tracksExiting)
Updates the links to entering and exiting tracks.
Short_t GetModule() const
void addCluster(PndEmcCluster *cluster, const TClonesArray *digiArray)
TString pt(TString pts, TString exts="px py pz")
TClonesArray * fDigiArray
void cleansortmclist(std::vector< Int_t > &newlist, TClonesArray *mcTrackArray)
Helper function, does not depend on class, identical to the one in PndEmcHitProducer.
Double_t fDigiEnergyTresholdFWD
Double_t GetClusterActiveTime()
virtual const PndEmcDigi * Maxima(const TClonesArray *digiArray) const
Double_t GetEnergyThresholdFWD()
parameter set of Emc digitisation
void FinishCluster(PndEmcCluster *tmpcluster)
Assign final parameters to cluster.
Double_t GetOffsetParmA()
a cluster (group of neighboring crystals) of hit emc crystals
std::vector< PndEmcCluster * > fClusterList
Task to cluster PndEmcDigis.
void SetZ20(Double_t z20)
represents the deposited energy of one emc crystal from simulation
std::vector< Double_t > fClusterPosParam
virtual Double_t Energy() const
void SetZ53(Double_t z53)
int hit(Int_t nEvents=0, TString inFile="sim.root", TString parFile="par.root", TString inDigi="digi.root", TString outFile="hit.root", Int_t timeBased=0)
virtual InitStatus Init()
Init Task.
Double_t fDigiEnergyTresholdBarrel
BinaryFunctor * fDigiFunctor
Double_t GetEnergyThresholdShashlyk()
void SetPosition(TVector3 pos)
virtual ~PndEmcMakeCluster()
void SetTrackEntering(const FairMultiLinkedData &tracks)
Text_t * GetEmcClusterPosMethod()
static PndEmcStructure * Instance()
Int_t GetMotherID() const
bool HasExpired(PndEmcDigi *latestDigi, PndEmcCluster *theCluster, Int_t clusterIdx)
Finishes clusters in timebased analysis.
Double_t GetEnergyThresholdBWD()
TClonesArray * fMCTrackArray
void SetLatMom(Double_t latMom)
TClonesArray * fWriteOutArray
expired clusters
FairMultiLinkedData GetTrackEntering() const
Parameter set for Emc Reco.
virtual void addDigi(const TClonesArray *digiArray, Int_t iDigi)