1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
18 ///////////////////////////////////////////////////////////////////////////
19 // Class AliCalorimeter
20 // Description of a modular calorimeter system.
21 // A matrix geometry is used in which a module is identified by (row,col).
22 // Note : First module is identified as (1,1).
24 // This is the way to define and enter signals into a calorimeter :
26 // AliCalorimeter cal(10,15); // Calorimeter of 10x15 modules
27 // // All module signals set to 0.
28 // cal.AddSignal(5,7,85.4);
29 // cal.AddSignal(5,7,25.9);
30 // cal.AddSignal(3,5,1000);
31 // cal.SetSignal(5,7,10.3);
32 // cal.Reset(3,5); // Reset module (3,5) as being 'not fired'
33 // // All module data are re-initialised.
34 // cal.SetEdgeOn(1,1); // Declare module (1,1) as an 'edge module'
36 // cal.SetGain(2,8,3.2);
38 // Float_t vec[3]={6,1,20};
39 // cal.SetPosition(2,8,vec,"car");
41 // Float_t loc[3]={-1,12,3};
42 // cal.AddVetoSignal(loc,"car"); // Associate (extrapolated) position as a veto
44 // cal.Group(2); // Group 'fired' modules into clusters
45 // // Perform grouping over 2 rings around the center
46 // cal.Reset(); // Reset the complete calorimeter
47 // // Normally to prepare for the next event data
48 // // Note : Module gain, edge and dead flags remain
50 //--- Author: Nick van Eijndhoven 13-jun-1997 UU-SAP Utrecht
51 //- Modified: NvE $Date$ UU-SAP Utrecht
52 ///////////////////////////////////////////////////////////////////////////
54 #include "AliCalorimeter.h"
56 ClassImp(AliCalorimeter) // Class implementation to enable ROOT I/O
58 AliCalorimeter::AliCalorimeter()
60 // Default constructor, all parameters set to 0
77 ///////////////////////////////////////////////////////////////////////////
78 AliCalorimeter::~AliCalorimeter()
80 // Destructor to delete memory allocated to the various arrays and matrix
109 if (fMatrix || fPositions)
111 for (Int_t i=0; i<fNrows; i++)
113 for (Int_t j=0; j<fNcolumns; j++)
116 if (fPositions[i][j]) delete fPositions[i][j];
126 delete [] fPositions;
141 ///////////////////////////////////////////////////////////////////////////
142 AliCalorimeter::AliCalorimeter(Int_t nrow,Int_t ncol)
144 // Create a calorimeter module matrix
150 fAttributes=new TMatrix(nrow,ncol);
151 fGains=new TMatrix(nrow,ncol);
152 fMatrix=new AliCalmodule**[nrow];
153 fPositions=new AliPosition**[nrow];
154 for (Int_t row=0; row<nrow; row++)
156 fMatrix[row]=new AliCalmodule*[ncol];
157 fPositions[row]=new AliPosition*[ncol];
158 // Initialise the various matrices
159 for (Int_t col=0; col<ncol; col++)
162 fPositions[row][col]=0;
163 (*fGains)(row,col)=1;
164 (*fAttributes)(row,col)=0;
168 // Mark the edge modules
169 for (Int_t j=0; j<ncol; j++)
171 (*fAttributes)(0,j)=10;
172 (*fAttributes)(nrow-1,j)=10;
174 for (Int_t i=0; i<nrow; i++)
176 (*fAttributes)(i,0)=10;
177 (*fAttributes)(i,ncol-1)=10;
180 fModules=new TObjArray(); // Default size, expanded automatically
181 fModules->SetOwner();
191 ///////////////////////////////////////////////////////////////////////////
192 Int_t AliCalorimeter::GetNrows()
194 // Provide the number of rows for the calorimeter module matrix
197 ///////////////////////////////////////////////////////////////////////////
198 Int_t AliCalorimeter::GetNcolumns()
200 // Provide the number of columns for the calorimeter module matrix
203 ///////////////////////////////////////////////////////////////////////////
204 void AliCalorimeter::SetSignal(Int_t row,Int_t col,Float_t sig)
206 // Set the signal for a certain calorimeter module
208 if (!fMatrix) LoadMatrix(); // Restore matrix data in case of reading input
210 if (row>0 && row<=fNrows && col>0 && col<=fNcolumns)
212 AliCalmodule* m=fMatrix[row-1][col-1];
213 if (!m) // only count new modules
217 AliPosition* r=fPositions[row-1][col-1];
218 if (r) m->SetPosition(*r);
220 fMatrix[row-1][col-1]=m;
222 m->SetSignal(row,col,sig);
226 cout << " *AliCalorimeter::SetSignal* row,col : " << row << "," << col
227 << " out of range." << endl;
228 cout << " Nrows,Ncols = " << fNrows << "," << fNcolumns << endl;
231 ///////////////////////////////////////////////////////////////////////////
232 void AliCalorimeter::AddSignal(Int_t row, Int_t col, Float_t sig)
234 // Add the signal to a certain calorimeter module
236 if (!fMatrix) LoadMatrix(); // Restore matrix data in case of reading input
238 if (row>0 && row<=fNrows && col>0 && col<=fNcolumns)
240 AliCalmodule* m=fMatrix[row-1][col-1];
241 if (!m) // only count new modules
243 SetSignal(row,col,sig);
247 m->AddSignal(row,col,sig);
252 cout << " *AliCalorimeter::AddSignal* row,col : " << row << "," << col
253 << " out of range." << endl;
254 cout << " Nrows,Ncols = " << fNrows << "," << fNcolumns << endl;
257 ///////////////////////////////////////////////////////////////////////////
258 void AliCalorimeter::AddSignal(AliCalmodule* mod)
260 // Add the signal of module mod to the current calorimeter data.
261 // This enables mixing of calorimeter data of various events.
263 if (!fMatrix) LoadMatrix(); // Restore matrix data in case of reading input
265 Int_t row=mod->GetRow();
266 Int_t col=mod->GetColumn();
267 Float_t sig=mod->GetSignal();
268 AliPosition r=mod->GetPosition();
270 if (row>0 && row<=fNrows && col>0 && col<=fNcolumns)
272 AliCalmodule* m=fMatrix[row-1][col-1];
273 if (!m) // No module existed yet at this position
278 fMatrix[row-1][col-1]=m;
281 m->AddSignal(row,col,sig);
282 if (!fPositions[row-1][col-1]) fPositions[row-1][col-1]=new AliPosition(r);
286 cout << " *AliCalorimeter::AddSignal* row,col : " << row << "," << col
287 << " out of range." << endl;
288 cout << " Nrows,Ncols = " << fNrows << "," << fNcolumns << endl;
291 ///////////////////////////////////////////////////////////////////////////
292 void AliCalorimeter::Reset(Int_t row,Int_t col)
294 // Reset the signal for a certain calorimeter module
296 if (!fMatrix) LoadMatrix(); // Restore matrix data in case of reading input
298 if (row>0 && row<=fNrows && col>0 && col<=fNcolumns)
300 AliCalmodule* m=fMatrix[row-1][col-1];
305 fModules->Compress();
307 fMatrix[row-1][col-1]=0;
312 cout << " *AliCalorimeter::Reset* row,col : " << row << "," << col
313 << " out of range." << endl;
314 cout << " Nrows,Ncols = " << fNrows << "," << fNcolumns << endl;
317 ///////////////////////////////////////////////////////////////////////////
318 void AliCalorimeter::Reset()
320 // Reset the signals for the complete calorimeter
321 // Normally this is done to prepare for the data of the next event
322 // Note : Module gains, edge and dead flags remain unchanged
324 if (!fMatrix) LoadMatrix(); // Restore matrix data in case of reading input
327 if (fModules) fModules->Delete();
328 for (Int_t i=0; i<fNrows; i++)
330 for (Int_t j=0; j<fNcolumns; j++)
352 ///////////////////////////////////////////////////////////////////////////
353 Float_t AliCalorimeter::GetSignal(Int_t row,Int_t col)
355 // Provide the signal of a certain calorimeter module.
356 // In case the module was marked dead, 0 is returned.
358 if (!fMatrix) LoadMatrix(); // Restore matrix data in case of reading input
360 if (row>0 && row<=fNrows && col>0 && col<=fNcolumns)
363 AliCalmodule* m=fMatrix[row-1][col-1];
366 Int_t dead=m->GetDeadValue();
367 if (!dead) signal=m->GetSignal();
373 cout << " *AliCalorimeter::GetSignal* row,col : " << row << "," << col
374 << " out of range." << endl;
375 cout << " Nrows,Ncols = " << fNrows << "," << fNcolumns << endl;
379 ///////////////////////////////////////////////////////////////////////////
380 void AliCalorimeter::SetEdgeOn(Int_t row,Int_t col)
382 // Indicate a certain calorimeter module as 'edge module'
384 if (!fMatrix) LoadMatrix(); // Restore matrix data in case of reading input
386 if (row>0 && row<=fNrows && col>0 && col<=fNcolumns)
388 Float_t word=(*fAttributes)(row-1,col-1);
389 Int_t iword=int(word+0.1);
392 (*fAttributes)(row-1,col-1)=float(dead+10*edge);
396 cout << " *AliCalorimeter::SetEdgeOn* row,col : " << row << "," << col
397 << " out of range." << endl;
398 cout << " Nrows,Ncols = " << fNrows << "," << fNcolumns << endl;
401 ///////////////////////////////////////////////////////////////////////////
402 void AliCalorimeter::SetEdgeOff(Int_t row,Int_t col)
404 // Indicate a certain calorimeter module as 'non-edge module'
406 if (!fMatrix) LoadMatrix(); // Restore matrix data in case of reading input
408 if (row>0 && row<=fNrows && col>0 && col<=fNcolumns)
410 Float_t word=(*fAttributes)(row-1,col-1);
411 Int_t iword=int(word+0.1);
414 (*fAttributes)(row-1,col-1)=float(dead+10*edge);
418 cout << " *AliCalorimeter::SetEdgeOff* row,col : " << row << "," << col
419 << " out of range." << endl;
420 cout << " Nrows,Ncols = " << fNrows << "," << fNcolumns << endl;
423 ///////////////////////////////////////////////////////////////////////////
424 void AliCalorimeter::SetDead(Int_t row,Int_t col)
426 // Indicate a certain calorimeter module as 'dead module'
428 if (!fMatrix) LoadMatrix(); // Restore matrix data in case of reading input
430 if (row>0 && row<=fNrows && col>0 && col<=fNcolumns)
432 Float_t word=(*fAttributes)(row-1,col-1);
433 Int_t iword=int(word+0.1);
436 (*fAttributes)(row-1,col-1)=float(dead+10*edge);
437 if (fMatrix[row-1][col-1]) (fMatrix[row-1][col-1])->SetDead();
439 // Increase the 'edge value' of surrounding modules
445 if (rlow < 1) rlow=row;
446 if (rup > fNrows) rup=fNrows;
447 if (clow < 1) clow=col;
448 if (cup > fNcolumns) cup=fNcolumns;
450 for (Int_t i=rlow; i<=rup; i++)
452 for (Int_t j=clow; j<=cup; j++)
454 if (i!=row || j!=col) // No increase of edge value for the dead module itself
456 word=(*fAttributes)(i-1,j-1);
461 (*fAttributes)(i-1,j-1)=float(dead+10*edge);
468 cout << " *AliCalorimeter::SetDead* row,col : " << row << "," << col
469 << " out of range." << endl;
470 cout << " Nrows,Ncols = " << fNrows << "," << fNcolumns << endl;
473 ///////////////////////////////////////////////////////////////////////////
474 void AliCalorimeter::SetAlive(Int_t row,Int_t col)
476 // Indicate a certain calorimeter module as 'active module'
478 if (!fMatrix) LoadMatrix(); // Restore matrix data in case of reading input
480 if (row>0 && row<=fNrows && col>0 && col<=fNcolumns)
482 Float_t word=(*fAttributes)(row-1,col-1);
483 Int_t iword=int(word+0.1);
486 (*fAttributes)(row-1,col-1)=float(dead+10*edge);
487 if (fMatrix[row-1][col-1]) (fMatrix[row-1][col-1])->SetAlive();
489 // Decrease the 'edge value' of surrounding modules
495 if (rlow < 1) rlow=row;
496 if (rup > fNrows) rup=fNrows;
497 if (clow < 1) clow=col;
498 if (cup > fNcolumns) cup=fNcolumns;
500 for (Int_t i=rlow; i<=rup; i++)
502 for (Int_t j=clow; j<=cup; j++)
504 if (i!=row || j!=col) // No decrease of edge value for the dead module itself
506 word=(*fAttributes)(i-1,j-1);
511 (*fAttributes)(i-1,j-1)=float(dead+10*edge);
518 cout << " *AliCalorimeter::SetAlive* row,col : " << row << "," << col
519 << " out of range." << endl;
520 cout << " Nrows,Ncols = " << fNrows << "," << fNcolumns << endl;
523 ///////////////////////////////////////////////////////////////////////////
524 void AliCalorimeter::SetGain(Int_t row,Int_t col,Float_t gain)
526 // Set the gain value for a certain calorimeter module
528 if (!fMatrix) LoadMatrix(); // Restore matrix data in case of reading input
530 if (row>0 && row<=fNrows && col>0 && col<=fNcolumns)
532 (*fGains)(row-1,col-1)=gain;
533 if (fMatrix[row-1][col-1]) (fMatrix[row-1][col-1])->SetGain(gain);
537 cout << " *AliCalorimeter::SetGain* row,col : " << row << "," << col
538 << " out of range." << endl;
539 cout << " Nrows,Ncols = " << fNrows << "," << fNcolumns << endl;
542 ///////////////////////////////////////////////////////////////////////////
543 void AliCalorimeter::SetPosition(Int_t row,Int_t col,Float_t* vec,TString f)
545 // Set the position in user coordinates for a certain calorimeter module
547 if (!fMatrix) LoadMatrix(); // Restore matrix data in case of reading input
549 if (row>0 && row<=fNrows && col>0 && col<=fNcolumns)
551 if (!fPositions[row-1][col-1]) fPositions[row-1][col-1]=new AliPosition;
552 (fPositions[row-1][col-1])->SetVector(vec,f);
553 if (fMatrix[row-1][col-1]) (fMatrix[row-1][col-1])->SetPosition(vec,f);
557 cout << " *AliCalorimeter::SetPosition* row,col : " << row << "," << col
558 << " out of range." << endl;
559 cout << " Nrows,Ncols = " << fNrows << "," << fNcolumns << endl;
562 ///////////////////////////////////////////////////////////////////////////
563 void AliCalorimeter::SetPosition(Int_t row,Int_t col,Ali3Vector& r)
565 // Set the position for a certain calorimeter module
567 if (!fMatrix) LoadMatrix(); // Restore matrix data in case of reading input
569 if (row>0 && row<=fNrows && col>0 && col<=fNcolumns)
571 if (!fPositions[row-1][col-1]) fPositions[row-1][col-1]=new AliPosition;
572 (fPositions[row-1][col-1])->SetPosition(r);
573 if (fMatrix[row-1][col-1]) (fMatrix[row-1][col-1])->SetPosition(r);
577 cout << " *AliCalorimeter::SetPosition* row,col : " << row << "," << col
578 << " out of range." << endl;
579 cout << " Nrows,Ncols = " << fNrows << "," << fNcolumns << endl;
582 ///////////////////////////////////////////////////////////////////////////
583 Int_t AliCalorimeter::GetEdgeValue(Int_t row,Int_t col)
585 // Provide the value of the edge flag of a certain module
587 if (row>0 && row<=fNrows && col>0 && col<=fNcolumns)
589 Float_t word=(*fAttributes)(row-1,col-1);
590 Int_t iword=int(word+0.1);
596 cout << " *AliCalorimeter::GetEdgeValue* row,col : " << row << "," << col
597 << " out of range." << endl;
598 cout << " Nrows,Ncols = " << fNrows << "," << fNcolumns << endl;
602 ///////////////////////////////////////////////////////////////////////////
603 Int_t AliCalorimeter::GetDeadValue(Int_t row,Int_t col)
605 // Provide the value of the dead flag of a certain module
607 if (row>0 && row<=fNrows && col>0 && col<=fNcolumns)
609 Float_t word=(*fAttributes)(row-1,col-1);
610 Int_t iword=int(word+0.1);
616 cout << " *AliCalorimeter::GetDeadValue* row,col : " << row << "," << col
617 << " out of range." << endl;
618 cout << " Nrows,Ncols = " << fNrows << "," << fNcolumns << endl;
622 ///////////////////////////////////////////////////////////////////////////
623 Float_t AliCalorimeter::GetGain(Int_t row,Int_t col)
625 // Provide the gain value of a certain module
627 if (row>0 && row<=fNrows && col>0 && col<=fNcolumns)
629 return (*fGains)(row-1,col-1);
633 cout << " *AliCalorimeter::GetGain* row,col : " << row << "," << col
634 << " out of range." << endl;
635 cout << " Nrows,Ncols = " << fNrows << "," << fNcolumns << endl;
639 ///////////////////////////////////////////////////////////////////////////
640 void AliCalorimeter::GetPosition(Int_t row,Int_t col,Float_t* vec,TString f)
642 // Return the position in user coordinates for a certain calorimeter module
644 if (!fMatrix) LoadMatrix(); // Restore matrix data in case of reading input
646 if (row>0 && row<=fNrows && col>0 && col<=fNcolumns)
648 // if (fMatrix[row-1][col-1]) (fMatrix[row-1][col-1])->GetPosition(vec,f);
649 if (fPositions[row-1][col-1]) (fPositions[row-1][col-1])->GetVector(vec,f);
653 cout << " *AliCalorimeter::GetPosition* row,col : " << row << "," << col
654 << " out of range." << endl;
655 cout << " Nrows,Ncols = " << fNrows << "," << fNcolumns << endl;
658 ///////////////////////////////////////////////////////////////////////////
659 AliPosition* AliCalorimeter::GetPosition(Int_t row,Int_t col)
661 // Access to the position of a certain calorimeter module
663 if (!fMatrix) LoadMatrix(); // Restore matrix data in case of reading input
665 if (row>0 && row<=fNrows && col>0 && col<=fNcolumns)
667 return fPositions[row-1][col-1];
671 cout << " *AliCalorimeter::GetPosition* row,col : " << row << "," << col
672 << " out of range." << endl;
673 cout << " Nrows,Ncols = " << fNrows << "," << fNcolumns << endl;
677 ///////////////////////////////////////////////////////////////////////////
678 Float_t AliCalorimeter::GetClusteredSignal(Int_t row,Int_t col)
680 // Provide the module signal after clustering
682 if (!fMatrix) LoadMatrix(); // Restore matrix data in case of reading input
684 if (row>0 && row<=fNrows && col>0 && col<=fNcolumns)
686 if (fMatrix[row-1][col-1])
688 return (fMatrix[row-1][col-1])->GetClusteredSignal();
697 cout << " *AliCalorimeter::GetClusteredSignal* row,col : " << row << "," << col
698 << " out of range." << endl;
699 cout << " Nrows,Ncols = " << fNrows << "," << fNcolumns << endl;
703 ///////////////////////////////////////////////////////////////////////////
704 Int_t AliCalorimeter::GetNsignals()
706 // Provide the number of modules that contain a signal
707 // Note : The number of modules marked 'dead' but which had a signal
711 ///////////////////////////////////////////////////////////////////////////
712 void AliCalorimeter::Group(Int_t n)
714 // Group the individual modules into clusters
715 // Module signals of n rings around the central module will be grouped
717 if (fNsignals > 0) // Directly return if no modules fired
719 if (!fMatrix) LoadMatrix(); // Restore matrix data in case of reading input
721 if (fNclusters > 0) Ungroup(); // Restore unclustered situation if needed
723 // Order the modules with decreasing signal
724 AliCalmodule** ordered=new AliCalmodule*[fNsignals]; // temp. array for ordered modules
728 // Clustering of modules. Start with the highest signal.
735 fClusters=new TObjArray();
736 fClusters->SetOwner();
742 for (Int_t i=0; i<nord; i++)
744 row=ordered[i]->GetRow(); // row number of cluster center
745 col=ordered[i]->GetColumn(); // column number of cluster center
746 if (row>0 && row<=fNrows && col>0 && col<=fNcolumns)
748 m=fMatrix[row-1][col-1];
751 // only use modules not yet used in a cluster
752 if (m->GetClusteredSignal() > 0.)
754 Int_t edge=GetEdgeValue(row,col);
756 if (!edge) c->Start(*m); // module to start the cluster if not on edge
757 if (c->GetNmodules() > 0) // cluster started successfully (no edge)
760 fNclusters++; // update cluster counter
761 AddRing(row,col,n); // add signals of n rings around the center
772 // Delete the temp. array
775 for (Int_t j=0; j<nord; j++)
783 ///////////////////////////////////////////////////////////////////////////
784 void AliCalorimeter::Sortm(AliCalmodule** ordered,Int_t& nord)
786 // Order the modules with decreasing signal
789 for (Int_t i=0; i<fNrows; i++) // loop over all modules of the matrix
791 for (Int_t ii=0; ii<fNcolumns; ii++)
793 if (GetSignal(i+1,ii+1) <= 0.) continue; // only take alive modules with a signal
795 if (nord == 0) // store the first module with a signal at the first ordered position
798 ordered[nord-1]=fMatrix[i][ii];
802 for (Int_t j=0; j<=nord; j++) // put module in the right ordered position
804 if (j == nord) // module has smallest signal seen so far
807 ordered[j]=fMatrix[i][ii]; // add module at the end
808 break; // go for next matrix module
811 if (GetSignal(i+1,ii+1) < ordered[j]->GetSignal()) continue;
814 for (Int_t k=nord-1; k>j; k--) // create empty position
816 ordered[k]=ordered[k-1];
818 ordered[j]=fMatrix[i][ii]; // put module at empty position
819 break; // go for next matrix module
824 ///////////////////////////////////////////////////////////////////////////
825 void AliCalorimeter::AddRing(Int_t row, Int_t col, Int_t n)
827 // Add module signals of 1 ring around (row,col) to current cluster
828 // n denotes the maximum number of rings around cluster center
829 // Note : This function is used recursively
831 if (n >= 1) // Check if any rings left for recursive calls
833 Float_t signal=GetSignal(row,col); // signal of (row,col) module
835 Int_t lrow=row-1; if (lrow < 1) lrow=1; // row lowerbound for ring
836 Int_t urow=row+1; if (urow > fNrows) urow=fNrows; // row upperbound for ring
837 Int_t lcol=col-1; if (lcol < 1) lcol=1; // col lowerbound for ring
838 Int_t ucol=col+1; if (ucol > fNcolumns) ucol=fNcolumns; // row upperbound for ring
840 for (Int_t i=lrow; i<=urow; i++)
842 for (Int_t j=lcol; j<=ucol; j++)
844 // add module(i,j) to cluster if the signal <= signal(row,col)
845 if (GetSignal(i,j) <= signal)
847 AliCalmodule* m=fMatrix[i-1][j-1];
848 if (m) ((AliCalcluster*)fClusters->At(fNclusters-1))->Add(*m);
850 AddRing(i,j,n-1); // Go for ring of modules around this (i,j) one
855 ///////////////////////////////////////////////////////////////////////////
856 Int_t AliCalorimeter::GetNclusters()
858 // Provide the number of clusters
861 ///////////////////////////////////////////////////////////////////////////
862 AliCalcluster* AliCalorimeter::GetCluster(Int_t j)
864 // Provide cluster number j
865 // Note : j=1 denotes the first cluster
866 if ((j >= 1) && (j <= fNclusters))
868 return (AliCalcluster*)fClusters->At(j-1);
872 cout << " *AliCalorimeter::GetCluster* cluster number : " << j
873 << " out of range." << endl;
874 cout << " -- Cluster number 1 (if any) returned " << endl;
875 return (AliCalcluster*)fClusters->At(0);
878 ///////////////////////////////////////////////////////////////////////////
879 AliCalmodule* AliCalorimeter::GetModule(Int_t j)
881 // Provide 'fired' module number j
882 // Note : j=1 denotes the first 'fired' module
883 if ((j >= 1) && (j <= fNsignals))
885 return (AliCalmodule*)fModules->At(j-1);
889 cout << " *AliCalorimeter::GetModule* module number : " << j
890 << " out of range." << endl;
891 cout << " -- Fired module number 1 (if any) returned " << endl;
892 return (AliCalmodule*)fModules->At(0);
895 ///////////////////////////////////////////////////////////////////////////
896 AliCalmodule* AliCalorimeter::GetModule(Int_t row,Int_t col)
898 // Provide access to module (row,col).
899 // Note : first module is at (1,1).
901 if (!fMatrix) LoadMatrix(); // Restore matrix data in case of reading input
903 if (row>=1 && row<=fNrows && col>=1 && col<=fNcolumns)
905 return fMatrix[row-1][col-1];
909 cout << " *AliCalorimeter::GetModule* row,col : " << row << ", " << col
910 << " out of range." << endl;
914 ///////////////////////////////////////////////////////////////////////////
915 TH2F* AliCalorimeter::DrawModules()
917 // Provide a lego plot of the module signals
925 fHmodules=new TH2F("fHmodules","Module signals",
926 fNcolumns,0.5,float(fNcolumns)+0.5,fNrows,0.5,float(fNrows)+0.5);
928 fHmodules->SetDirectory(0); // Suppress global character of histo pointer
932 Float_t row,col,signal;
934 for (Int_t i=0; i<fNsignals; i++)
936 m=(AliCalmodule*)fModules->At(i);
939 row=float(m->GetRow());
940 col=float(m->GetColumn());
941 dead=m->GetDeadValue();
943 if (!dead) signal=m->GetSignal();
944 if (signal>0.) fHmodules->Fill(col,row,signal);
948 fHmodules->Draw("lego");
951 ///////////////////////////////////////////////////////////////////////////
952 TH2F* AliCalorimeter::DrawClusters()
954 // Provide a lego plot of the cluster signals
962 fHclusters=new TH2F("fHclusters","Cluster signals",
963 fNcolumns,0.5,float(fNcolumns)+0.5,fNrows,0.5,float(fNrows)+0.5);
965 fHclusters->SetDirectory(0); // Suppress global character of histo pointer
969 Float_t row,col,signal;
970 for (Int_t i=0; i<fNclusters; i++)
972 c=(AliCalcluster*)fClusters->At(i);
975 row=float(c->GetRow());
976 col=float(c->GetColumn());
977 signal=c->GetSignal();
978 if (signal>0.) fHclusters->Fill(col,row,signal);
982 fHclusters->Draw("lego");
985 ///////////////////////////////////////////////////////////////////////////
986 void AliCalorimeter::LoadMatrix()
988 // Load the Calorimeter module matrix data back from the TObjArray
990 // Initialise the module matrix
993 fMatrix=new AliCalmodule**[fNrows];
994 for (Int_t i=0; i<fNrows; i++)
996 fMatrix[i]=new AliCalmodule*[fNcolumns];
1000 // Initialise the position matrix
1003 fPositions=new AliPosition**[fNrows];
1004 for (Int_t j=0; j<fNrows; j++)
1006 fPositions[j]=new AliPosition*[fNcolumns];
1010 for (Int_t jrow=0; jrow<fNrows; jrow++)
1012 for (Int_t jcol=0; jcol<fNcolumns; jcol++)
1014 fMatrix[jrow][jcol]=0;
1015 fPositions[jrow][jcol]=0;
1019 // Copy the module pointers back into the matrix
1024 if (fModules) nsig=fModules->GetEntries();
1025 for (Int_t j=0; j<nsig; j++)
1027 m=(AliCalmodule*)fModules->At(j);
1032 AliPosition r=m->GetPosition();
1033 fMatrix[row-1][col-1]=m;
1034 fPositions[row-1][col-1]=new AliPosition(r);
1038 ///////////////////////////////////////////////////////////////////////////
1039 void AliCalorimeter::Ungroup()
1041 // Set the module signals back to the non-clustered situation
1043 if (!fMatrix) LoadMatrix(); // Restore matrix data in case of reading input
1046 if (fModules) nsig=fModules->GetEntries();
1050 for (Int_t j=0; j<nsig; j++)
1052 m=(AliCalmodule*)fModules->At(j);
1055 signal=m->GetSignal();
1056 m->SetClusteredSignal(signal);
1060 ///////////////////////////////////////////////////////////////////////////
1061 void AliCalorimeter::AddVetoSignal(Float_t* r,TString f,Float_t s)
1063 // Associate an (extrapolated) AliSignal at location r as veto to the cal.
1064 // Note : The default signal value (s) is 0
1068 fVetos=new TObjArray();
1072 fVetos->Add(new AliSignal);
1075 ((AliSignal*)fVetos->At(fNvetos-1))->SetPosition(r,f);
1076 ((AliSignal*)fVetos->At(fNvetos-1))->SetSignal(s);
1078 ///////////////////////////////////////////////////////////////////////////
1079 Int_t AliCalorimeter::GetNvetos()
1081 // Provide the number of veto signals associated to the calorimeter
1084 ///////////////////////////////////////////////////////////////////////////
1085 AliSignal* AliCalorimeter::GetVetoSignal(Int_t i)
1087 // Provide access to the i-th veto signal of this calorimeter
1088 // Note : The first hit corresponds to i=1
1090 if (i>0 && i<=fNvetos)
1092 return (AliSignal*)fVetos->At(i-1);
1096 cout << " *AliCalorimeter::GetVetoSignal* Signal number " << i
1097 << " out of range." << endl;
1098 cout << " --- First signal (if any) returned." << endl;
1099 return (AliSignal*)fVetos->At(0);
1102 ///////////////////////////////////////////////////////////////////////////
1103 void AliCalorimeter::SetName(TString name)
1105 // Set the name of the calorimeter system.
1108 ///////////////////////////////////////////////////////////////////////////
1109 TString AliCalorimeter::GetName()
1111 // Provide the name of the calorimeter system.
1114 ///////////////////////////////////////////////////////////////////////////