GSI Forum
GSI Helmholtzzentrum für Schwerionenforschung

Home » PANDA » PandaRoot » EMC » Access to clusters properties
Access to clusters properties [message #11757] Tue, 10 May 2011 08:56 Go to next message
Ronald Kunne is currently offline  Ronald Kunne
Messages: 32
Registered: October 2009
continuous participant
From: *in2p3.fr
Good morning!

I have two questions on access to clusters properties.
The PandaRoot version I use currently is 11787, dated 5/5/11.

Thanks in advance,
Ronald Kunne

1) What is the simplest way to access the contents of the individual crystals, that make up a cluster?

My goal is to distinguish between clusters consisting of one or two gammas, i.e. pizeros.

I would like to do something like this:
  TString inPidTPCFile  = "pid_tpccombi.root";

  TFile *inFile = TFile::Open(inPidTPCFile,"READ");
  TTree *lhe=(TTree *) inFile->Get("cbmsim") ;

...

  TClonesArray* cluster_array=new TClonesArray("PndEmcCluster");
  lhe->SetBranchAddress("EmcCluster",&cluster_array);

...

// loop over  events
    NTevents=lhe->GetEntriesFast();
    for (Int_t j=0; j< NTevents ; j++){
       lhe->GetEntry(j);   // kinematics

// loop over clusters
       Int_t nclusters= cluster_array->GetEntriesFast();
       for (Int_t nc = 0; nc < nclusters; nc++) {
           PndEmcCluster *cl = (PndEmcCluster *)cluster_array->At(nc);
// access to energy and moments of cluster
           Double_t Energy = cl->energy(); 
           Double_t Z20 = cl->Z20(); 
           Double_t Z53 = cl->Z53(); 
           Double_t LatMom = cl->LatMom(); 

// (hypothetical) loop over crystals in this cluster
           Int_t ncrystals= crystal_array->GetEntriesFast();
           for (Int_t nx = 0; nx < ncrystals; nx++) {

              ...etc...
           }
        }
     }


2) The above method gives me access to the moments Z20, Z53 and LatMom.
How do I get access to *all* the moments available in

/emc/EmcData/PndEmcXClMoments.h ?

Re: Access to clusters properties [message #11759 is a reply to message #11757] Tue, 10 May 2011 11:22 Go to previous messageGo to next message
Dima Melnychuk is currently offline  Dima Melnychuk
Messages: 213
Registered: April 2004
Location: National Centre for Nucle...
first-grade participant
From: *fuw.edu.pl
Hi Ronald,

My suggestions would be the following:

1) I assume that loop over crystals in individual cluster is loop over PndEmcDigi, which given cluster contain.

So instead

Int_t ncrystals= crystal_array->GetEntriesFast();
           for (Int_t nx = 0; nx < ncrystals; nx++) {

              ...etc...
}


it would be

std::vector<Int_t>::const_iterator digi_iter;

const std::vector<Int_t> digiList = cl->DigiList();

for (digi_iter=digiList.begin();digi_iter!=digiList.end(); ++digi_iter)
{
    PndEmcDigi *digi = (PndEmcDigi *) DigiArray()->At(*digi_iter); 

// Whatever operation with digi
}



2) To access other cluster properties available in /emc/EmcData/PndEmcXClMoments.h you should create object of this class and then access its methods.

In macro/emc/dedicated/reco_analys.C it is shown for PndEmcClusterEnergySums class and for PndEmcXClMoments everything is similar.

At least you should add file containing PndEmcDigi TClonesArray

lhe->AddFriend("cbmsim", "digi_emc.root");
TClonesArray* digi_array=new TClonesArray("PndEmcDigi");
lhe->SetBranchAddress("EmcDigi",&digi_array);

PndEmcXClMoments xclmoments(*cl, digiArray);

// Whatever Zernike moment you need
xclmoments.AbsZernikeMoment(1, 1);


Dima
Re: Access to clusters properties [message #11767 is a reply to message #11759] Tue, 10 May 2011 13:05 Go to previous message
Ronald Kunne is currently offline  Ronald Kunne
Messages: 32
Registered: October 2009
continuous participant
From: *in2p3.fr
Hi Dima,


Thanks for the info. I looked through your collection of macros and found an easy solution there. I got 1) to work as I described above with the following for the "hypothetical loop":
                Int_t ndigi= digi_array->GetEntriesFast();
                Double_t digiEsum=0;
		for (Int_t i=0; i<ndigi; i++) {
		  PndEmcDigi *digi=(PndEmcDigi*)digi_array->At(i);
		  Double_t digi_energy=digi->GetEnergy();
                  digiEsum+=digi_energy;
		}

After the loop the sum over the digi energies is equal to the cluster energy as it should. I found this method in your /macro/emc/dedicated/digi_analys.C

2) does work indeed for
PndEmcClusterEnergySums esum(*cl, digi_array);
(which is the example in your reco_analys.C).

But when using instead
PndEmcXClMoments mom(*cl, digi_array);
I get the error message: "gGeoManager does not exist" with root ending without a crash.

But with access to the digis I can calculate my own moments anyway.

Greetings,
Ronald Kunne
Previous Topic: Uniform particle generation in solid angle
Next Topic: New FwEndCap geometry implemented
Goto Forum:
  


Current Time: Fri Nov 22 15:47:13 CET 2024

Total time taken to generate the page: 0.00528 seconds