34 #include "FairRootManager.h"
35 #include "FairRunAna.h"
36 #include "FairRuntimeDb.h"
38 #include "TClonesArray.h"
51 PndEmc2DLocMaxFinder::PndEmc2DLocMaxFinder(Int_t
verbose):
PndPersistencyTask(
"PndEmc2DLocMaxFinder", verbose),fClusterArray(0), fDigiArray(0), fGeoPar(new
PndEmcGeoPar()), fDigiPar(new
PndEmcDigiPar()), fRecoPar(new
PndEmcRecoPar()), fMaxECut(0), fNeighbourECut(0), fCutSlope(0), fCutOffset(0), fERatioCorr(0), fTheNeighbourLevel(0)
78 FairRootManager* ioman = FairRootManager::Instance();
80 cout <<
"-E- PndEmcMakeBump::Init: "
81 <<
"RootManager not instantiated!" << endl;
90 if(FairRunAna::Instance()->IsTimeStamp()) {
91 fDigiArray = (TClonesArray*) ioman->GetObject(
"EmcDigiClusterBase");
93 fDigiArray = (TClonesArray*) ioman->GetObject(
"EmcDigi");
96 cout <<
"-W- PndEmc2DLocMaxFinder::Init: "
97 <<
"No PndEmcDigi array!" << endl;
101 fClusterArray = (TClonesArray*) ioman->GetObject(
"EmcCluster");
103 cout <<
"-W- PndEmc2DLocMaxFinder::Init: "
104 <<
"No PndEmcCluster array!" << endl;
139 cout <<
"-I- PndEmc2DLocMaxFinder: Intialization successfull" << endl;
159 for (Int_t iCluster = 0; iCluster < nClusters; iCluster++){
163 std::map<Int_t, Int_t> theClustersDigis = theCluster->
MemberDigiMap();
164 std::map<Int_t, Int_t>::iterator theDigiIterator = theClustersDigis.begin();
169 if (theClustersDigis.size()==1){
170 while( theDigiIterator != theClustersDigis.end() ){
176 while( theDigiIterator != theClustersDigis.end() ){
177 Int_t detId = theDigiIterator->first;
180 allTheNeighbours.clear();
181 theNewNeighbours.clear();
186 theNewNeighbours.insert(theTCI);
191 if (
isALocalMax(theDigi, theCluster, allTheNeighbours)){
234 PndEmcCoordIndexSet::const_iterator theNeighbourIterator = amongstTheseNeighbours.begin();
236 const std::map<Int_t, Int_t> theClustersDigis = theCluster->
MemberDigiMap();
241 while( (theNeighbourIterator != amongstTheseNeighbours.end()) && result ){
243 std::map<Int_t, Int_t>::const_iterator position = theClustersDigis.find((*theNeighbourIterator)->Index());
245 if (position != theClustersDigis.end()) {
248 if(digiE>theDigiEnergy)
250 if(digiE>=neighbourMaxE)
253 numberOFneighbours+=1.0;
255 ++theNeighbourIterator;
258 if(numberOFneighbours==0.0)
262 std::cout<<
"Hi this is warning from your PndEmc2DLocMaxFinder,\n"
263 <<
" please choose a smaller value for fERatioCorr (EmcMakeBump)"
276 std::cout <<
" Digi at (" << theDigi->
GetThetaInt() <<
", "
277 << theDigi->
GetPhiInt() <<
") was a local max. Energy = "<<theDigi->
GetEnergy()<< std::endl;
294 std::map<Int_t,Int_t> theClusterDigis )
const
299 currentDigiNeighbours.clear();
300 PndEmcCoordIndexSet::iterator theCurrentDigiIterator = currentDigisCopy.begin();
303 while ( theCurrentDigiIterator != currentDigisCopy.end() ) {
306 std::map<Int_t, Int_t>::const_iterator theDigiIterator = theClusterDigis.begin();
307 while( theDigiIterator != theClusterDigis.end() ) {
308 Int_t detId = theDigiIterator->first;
310 bool isneighbour= theCurrentTCI->
IsNeighbour(theTCI);
312 allDigiNeighbours.insert(theTCI);
315 ++theCurrentDigiIterator;}
321 FairRun*
run = FairRun::Instance();
322 if ( ! run ) Fatal(
"SetParContainers",
"No analysis run");
324 FairRuntimeDb* db = run->GetRuntimeDb();
325 if ( ! db ) Fatal(
"SetParContainers",
"No runtime database");
PndEmcGeoPar * fGeoPar
Geometry parameter container.
virtual InitStatus Init()
Init Task.
Double_t GetNeighbourECut()
virtual Double_t GetEnergy() const
represents the reconstructed hit of one emc crystal
virtual ~PndEmc2DLocMaxFinder()
Int_t GetThetaInt() const
void getNeighbourDigis(PndEmcCoordIndexSet &, PndEmcCoordIndexSet &, int, std::map< Int_t, Int_t >) const
Get the TCIs of neighbor digis.
void SetPersistency(Bool_t val=kTRUE)
stores crystal index coordinates (x,y) or (theta,phi)
PndEmcTwoCoordIndex * GetTCI(Int_t DetectorId)
PndEmcDigiPar * fDigiPar
Digitisation parameter container.
virtual void Exec(Option_t *opt)
Runs the task.
virtual void SetParContainers()
Int_t GetTheNeighbourLevel()
std::set< PndEmcTwoCoordIndex * > PndEmcCoordIndexSet
virtual const PndEmcDigi * Maxima(const TClonesArray *digiArray) const
const std::map< Int_t, Int_t > & LocalMaxMap() const
parameter set of Emc digitisation
bool IsNeighbour(PndEmcTwoCoordIndex *_tci)
PndEmc2DLocMaxFinder(Int_t verbose=0)
a cluster (group of neighboring crystals) of hit emc crystals
TClonesArray * fDigiArray
const std::map< Int_t, Int_t > & MemberDigiMap() const
PndEmcRecoPar * fRecoPar
Reconstruction parameter container.
TClonesArray * fClusterArray
virtual void addLocalMax(const TClonesArray *digiArray, Int_t iDigi)
static PndEmcStructure * Instance()
Searches for local maxima in a cluster.
static PndEmcMapper * Instance()
virtual bool isALocalMax(const PndEmcDigi *const, const PndEmcCluster *const, const PndEmcCoordIndexSet &amongstTheseNeighbours) const
Check if digi is a local maximum in its cluster.
Parameter set for Emc Reco.