25 #include <TClonesArray.h>
27 #include "digparticle.h"
28 #include "digcluster.h"
29 #include "digreadoutmap.h"
43 fDIGParticleArray =
new TClonesArray(
"DIGParticle", 10);
46 fDIGClusterArray =
new TClonesArray(
"DIGCluster", 10);
51 DIGEvent::DIGEvent(
DIGEvent & adigevent) : TObject()
55 TClonesArray *particleArray2 = adigevent.GetParticle();
56 Int_t npart =adigevent.GetNParticles();
57 for (Int_t ipart = 0; ipart < npart ; ipart++){
64 TClonesArray *clusterArray2 = adigevent.GetCluster();
65 Int_t nclus =adigevent.GetNClusters();
66 for (Int_t iclus = 0; iclus < nclus ; iclus++){
79 fConfigurationNumber =adigevent.GetConfigurationNumber();
83 DIGEvent::~DIGEvent() {
87 fDIGParticleArray->Clear(
"C");
88 delete fDIGReadoutmap;
92 fDIGClusterArray->Clear(
"C");
98 void DIGEvent::Clear(
const Option_t *)
100 fDIGParticleArray->Clear(
"C");
101 delete fDIGReadoutmap;
103 fDIGClusterArray->Clear(
"C");
110 void DIGEvent::PrintInfo() {
111 std::cout<<
"---------------------------Event properties------------- "<<endl;
112 TClonesArray *particules = GetParticle();
114 std::cout<<
" number of particles "<<fNParticles<<
" "<<particules->GetLast()+1<<endl;
115 for (Int_t i=0 ; i<(particules->GetLast()+1) ; i++){
119 if( fNParticles != (particules->GetLast()+1)){
120 cout<<
"DIGEvent::PrintInfo WARNING PROBLEM IN PARTICLES RECORDING "<<fNParticles<<
" != "<<particules->GetLast()+1<<endl;
123 TClonesArray *clusters = GetCluster();
125 std::cout<<
" number of clusters "<<fNClusters<<
" "<<clusters->GetLast()+1<<endl;
126 for (Int_t i=0 ; i<(clusters->GetLast()+1) ; i++){
128 acluster->PrintInfo();
130 if( fNClusters != (clusters->GetLast()+1)){
131 cout<<
"DIGEvent::PrintInfo WARNING PROBLEM IN CLUSTERS RECORDING "<<fNClusters<<
" != "<<clusters->GetLast()+1<<endl;
134 GetReadoutmap()->PrintInfo();
138 void DIGEvent::SetNParticles(Int_t Nparticles){
139 fNParticles = Nparticles;
143 void DIGEvent::SetNClusters(Int_t NClusters){
144 fNClusters=NClusters;
148 void DIGEvent::SetConfigurationNumber(Int_t ConfigurationNumber){
149 fConfigurationNumber = ConfigurationNumber;
156 TClonesArray &particleArray = *fDIGParticleArray;
157 new(particleArray[fNParticles++])
DIGParticle(particle);
164 void DIGEvent::AddCluster(
DIGCluster& cluster)
166 TClonesArray &clusterArray = *fDIGClusterArray;
167 new(clusterArray[fNClusters++])
DIGCluster(cluster);
171 void DIGEvent::BuildTrueClusters(
DIGPlane *myDIGPlane){
176 TClonesArray *particules = GetParticle();
177 if( GetNParticles() != (particules->GetLast()+1)){
178 cout<<
"DIGEvent::BuildTrueClusters WARNING PROBLEM IN PARTICLES RECORDING"<<endl;
184 TClonesArray *particleArray = GetParticle();
186 for (Int_t i = 0; i < fNParticles ; i++){
190 for (Int_t npix = 0; npix < myparticle->GetNpixels() ; npix++){
191 if(myparticle->GetDigitalCharge()[npix]>0){
192 mycluster->AddPixel(myparticle->GetDigitalCharge()[npix],myparticle->GetPixelMap()[npix]);
195 mycluster->Compute_CoG(myDIGPlane);
196 mycluster->Compute_SeedPixel(myDIGPlane);
198 if(mycluster->GetNpixels()>0){
200 AddCluster(*mycluster);
204 TClonesArray *aclusterArray = GetCluster();
205 if(GetNClusters() != aclusterArray->GetLast()+1){
206 cout<<
" TEST cluster number "<<GetNClusters()<<
" "<<aclusterArray->GetLast()+1<<endl;