FairRoot/PandaRoot
Public Member Functions | Private Member Functions | Private Attributes | List of all members
PndEmcClusterRemoveDuplCrys Class Reference

Task to remove duplicate crystals. More...

#include <PndEmcClusterRemoveDuplCrys.h>

Inheritance diagram for PndEmcClusterRemoveDuplCrys:

Public Member Functions

 PndEmcClusterRemoveDuplCrys (Int_t verbose=0)
 
virtual ~PndEmcClusterRemoveDuplCrys ()
 
virtual InitStatus Init ()
 
virtual void Exec (Option_t *opt)
 

Private Member Functions

 PndEmcClusterRemoveDuplCrys (const PndEmcClusterRemoveDuplCrys &)
 
PndEmcClusterRemoveDuplCrysoperator= (const PndEmcClusterRemoveDuplCrys &)
 

Private Attributes

TClonesArray * fClusterArray
 
TClonesArray * fDigiArray
 

Detailed Description

Task to remove duplicate crystals.

In timebased cluster reconstruction, same detectorId might appear multiple times in the same cluster, which could cause undefined behavior in classical (eventbased) routines. The class provides a workaround, adding up the energies of all digis with the same origin (=crystal, detectorId). (One could also think off dumping the second hit, etc...)

Author
Ph. Mahlberg mahlb.nosp@m.erg@.nosp@m.hiskp.nosp@m..uni.nosp@m.-bonn.nosp@m..de

Definition at line 26 of file PndEmcClusterRemoveDuplCrys.h.

Constructor & Destructor Documentation

PndEmcClusterRemoveDuplCrys::PndEmcClusterRemoveDuplCrys ( Int_t  verbose = 0)

Definition at line 14 of file PndEmcClusterRemoveDuplCrys.cxx.

14  :
15  FairTask("PndEmcClusterRemoveDuplCrys", verbose) {
16 }
#define verbose
virtual PndEmcClusterRemoveDuplCrys::~PndEmcClusterRemoveDuplCrys ( )
inlinevirtual

Definition at line 36 of file PndEmcClusterRemoveDuplCrys.h.

36 {};
PndEmcClusterRemoveDuplCrys::PndEmcClusterRemoveDuplCrys ( const PndEmcClusterRemoveDuplCrys )
private

Member Function Documentation

void PndEmcClusterRemoveDuplCrys::Exec ( Option_t *  opt)
virtual

Virtual method Exec

Definition at line 49 of file PndEmcClusterRemoveDuplCrys.cxx.

References PndEmcDigi::AbsorbEnergy(), PndEmcCluster::DigiList(), fClusterArray, fDigiArray, PndEmcDigi::GetDetectorId(), PndEmcCluster::MemberDigiMap(), and PndEmcCluster::removeDigi().

49  {
50 
51  for(Int_t iClu=0; iClu<fClusterArray->GetEntriesFast(); ++iClu) {
52  PndEmcCluster* theCluster = static_cast<PndEmcCluster*>(fClusterArray->UncheckedAt(iClu));
53 
54  for(std::vector<Int_t>::reverse_iterator rit = theCluster->DigiList().rbegin(); rit!=theCluster->DigiList().rend(); ) {
55 
56  PndEmcDigi* theDigi = static_cast<PndEmcDigi*>(fDigiArray->UncheckedAt(*rit));
57  Int_t detId = theDigi->GetDetectorId();
58 
59  //check wether other digi with same detector Id was already included in cluster
60  //..we do a reverse iteration here, because only the first (i.e. with the smallest idx) digi out of all digis with same detId in fDigiArry will be seen in the MemberDigiMap
61  //(cf PndEmcMakeCluster::addDigi...)
62 
63  Int_t tmp_pos = theCluster->MemberDigiMap().find(detId)->second;
64  if(tmp_pos != *rit) { //in Member Map ..other digi is related to this detId...add digis up
65  PndEmcDigi* oldDigi = static_cast<PndEmcDigi*>(fDigiArray->UncheckedAt(tmp_pos));
66  oldDigi->AbsorbEnergy(*theDigi);
67 
68  //std::cerr << "Absorbing energy (ptr|detId): (" << oldDigi << " | "<< oldDigi->GetDetectorId() << ")" << std::flush;
69  theCluster->removeDigi(fDigiArray, (++rit).base()); //remove theDigi from cluster
70  } else {
71  ++rit;
72  }
73  }
74  }
75 }
represents the reconstructed hit of one emc crystal
Definition: PndEmcDigi.h:40
Int_t GetDetectorId() const
Definition: PndEmcDigi.h:97
const std::vector< Int_t > & DigiList() const
Definition: PndEmcCluster.h:40
virtual void removeDigi(const TClonesArray *digiArray, Int_t iDigi)
a cluster (group of neighboring crystals) of hit emc crystals
Definition: PndEmcCluster.h:29
const std::map< Int_t, Int_t > & MemberDigiMap() const
Definition: PndEmcCluster.h:43
virtual void AbsorbEnergy(PndEmcDigi &otherDigi)
Definition: PndEmcDigi.cxx:118
InitStatus PndEmcClusterRemoveDuplCrys::Init ( )
virtual

Virtual method Init

Definition at line 19 of file PndEmcClusterRemoveDuplCrys.cxx.

References fClusterArray, and fDigiArray.

19  {
20 
21  FairRootManager* ioman = FairRootManager::Instance();
22  if (!ioman) {
23  cout << "-E- PndEmcClusterRemoveDuplCrys::Init: "
24  << "RootManager not instantiated!" << endl;
25  return kFATAL;
26  }
27 
28  // Get inputarray
29  fClusterArray = (TClonesArray*) ioman->GetObject("EmcCluster");
30  if (!fClusterArray) {
31  cout << "-W- PndEmcClusterRemoveDuplCrys::Init: "
32  << "No PndEmcHit array! Needed for MC Truth" << endl;
33  }
34 
35  // Get input/output array
36  fDigiArray = FairRunAna::Instance()->IsTimeStamp() ? (TClonesArray*) ioman->GetObject("EmcDigiClusterBase") : (TClonesArray*) ioman->GetObject("EmcDigi");
37  if (!fDigiArray) {
38  cout << "-W- PndEmcClusterRemoveDuplCrys::Init: "
39  << "No PndEmcDigi array!" << endl;
40  return kERROR;
41  }
42 
43  cout <<"-I- PndEmcClusterRemoveDuplCrys: "
44  << "Got both arrays" << endl;
45 
46  return kSUCCESS;
47 }
PndEmcClusterRemoveDuplCrys& PndEmcClusterRemoveDuplCrys::operator= ( const PndEmcClusterRemoveDuplCrys )
private

Member Data Documentation

TClonesArray* PndEmcClusterRemoveDuplCrys::fClusterArray
private

Get parameter containers Verbosity level

Definition at line 61 of file PndEmcClusterRemoveDuplCrys.h.

Referenced by Exec(), and Init().

TClonesArray* PndEmcClusterRemoveDuplCrys::fDigiArray
private

Definition at line 62 of file PndEmcClusterRemoveDuplCrys.h.

Referenced by Exec(), and Init().


The documentation for this class was generated from the following files: