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 ///////////////////////////////////////////////////////////////////////////
20 // Generic handling of (extrapolated) detector signals.
24 // Signal positions (r) and reference frames (f) are specified via
25 // SetPosition(r,f) under the following conventions :
27 // f="car" ==> r is Cartesian (x,y,z)
28 // f="sph" ==> r is Spherical (r,theta,phi)
29 // f="cyl" ==> r is Cylindrical (rho,phi,z)
31 // The same holds for SetPositionErrors().
33 // All angles are in radians.
39 // s.SetName("Start counter");
40 // Float_t pos[3]={-1,25,7};
41 // Float_t err[3]={0.03,0.7,0.18};
42 // Float_t signal=120.8;
43 // Float_t error=1.73;
44 // Float_t offset=-12.78;
46 // s.SetPosition(pos,"car");
47 // s.SetPositionErrors(err,"car");
48 // s.SetSignal(signal);
49 // s.SetSignalError(error);
50 // s.SetOffset(offset);
52 // Float_t loc[3],dr[3],sigma;
53 // s.GetPosition(loc,"sph");
54 // s.GetPositionErrors(dr,"sph");
55 // Float_t adc=s.GetSignal();
56 // Float_t sigma=s.GetSignalError();
58 // AliSignal q; // In the example below a signal contains the
59 // // following data : timing, ADC and dE/dx
60 // q.SetName("TOF hit");
61 // q.SetPosition(pos,"car");
62 // q.SetPositionErrors(err,"car");
63 // signal=82.5; // e.g. signal time in ns
66 // q.SetSignal(signal,1);
67 // q.SetSignalError(error,1);
68 // q.SetOffset(offset,1);
69 // signal=268.1; // e.g. ADC value of signal
72 // q.SetSignal(signal,2);
73 // q.SetSignalError(error,2);
75 // signal=23.7; // e.g. corresponding dE/dx value
79 // q.SetSignal(signal,3);
80 // q.SetSignalError(error,3);
81 // q.SetOffset(offset,3);
84 //--- Author: Nick van Eijndhoven 23-jan-1999 UU-SAP Utrecht
85 //- Modified: NvE $Date$ UU-SAP Utrecht
86 ///////////////////////////////////////////////////////////////////////////
88 #include "AliSignal.h"
90 #include "Riostream.h"
92 ClassImp(AliSignal) // Class implementation to enable ROOT I/O
94 AliSignal::AliSignal() : TNamed(),AliPosition(),AliAttrib()
96 // Creation of an AliSignal object and initialisation of parameters.
97 // Several signal values (with errors) can be stored in different slots.
98 // If needed, the storage for values (and errors) will be expanded automatically
99 // when entering values and/or errors.
105 ///////////////////////////////////////////////////////////////////////////
106 AliSignal::~AliSignal()
108 // Destructor to delete dynamically allocated memory
130 ///////////////////////////////////////////////////////////////////////////
131 AliSignal::AliSignal(AliSignal& s) : TNamed(s),AliPosition(s),AliAttrib(s)
139 Int_t n=s.GetNvalues();
141 for (Int_t i=1; i<=n; i++)
148 for (Int_t j=1; j<=n; j++)
150 val=s.GetSignalError(j);
151 SetSignalError(val,j);
155 for (Int_t k=1; k<=n; k++)
157 TH1F* hist=s.GetWaveform(k);
158 if (hist) SetWaveform(hist,k);
164 n=s.GetIndices(dum,slotarr,posarr);
166 for (Int_t idx=0; idx<n; idx++)
168 slot=slotarr.At(idx);
170 TObject* obj=s.GetLink(slot,pos);
171 if (obj) SetLink(obj,slot,pos);
174 ///////////////////////////////////////////////////////////////////////////
175 void AliSignal::Reset(Int_t mode)
177 // Reset all signal and position values and errors to 0.
179 // mode = 0 Reset position and all signal values and their errors to 0.
180 // The waveform histograms are reset, but the calibration
181 // constants (i.e. gains and offsets) are kept.
182 // 1 Reset position and delete the signal and error storage arrays.
183 // Also the waveform histograms, gains and offset arrays are deleted.
185 // The default when invoking Reset() corresponds to mode=0.
187 // Note : In all cases the storage of the various links will be reset.
189 // The usage of mode=0 allows to re-use the allocated memory for new
190 // signal (and error) values. This behaviour is preferable (i.e. faster)
191 // in case the various signals always contain the same number of values
192 // and have the same calibration constants.
193 // The usage of mode=1 is slower, but allows a more efficient memory
194 // occupation (and smaller output file size) in case the different
195 // signals have a variable number of values.
197 // For more specific actions see ResetPosition(), ResetSignals(),
198 // DeleteSignals(), ResetGain(), ResetOffset(), ResetLink(), ResetWaveform(),
199 // DeleteWaveform() and DeleteCalibrations().
202 if (mode<0 || mode>1)
204 cout << " *AliSignal::Reset* Invalid argument mode = " << mode << endl;
205 cout << " Default mode=0 will be used." << endl;
217 DeleteCalibrations();
220 if (fLinks) fLinks->Reset();
222 ///////////////////////////////////////////////////////////////////////////
223 void AliSignal::ResetSignals(Int_t mode)
225 // Reset various signal data according to user selection.
227 // mode = 0 Reset all signal values and their errors to 0.
228 // 1 Reset only signal values
229 // 2 Reset only signal errors
231 // The default when invoking ResetSignals() corresponds to mode=0.
233 // Irrespective of the mode, the waveform histograms are reset.
235 if (mode<0 || mode>2)
237 cout << " *AliSignal::ResetSignals* Invalid argument mode = " << mode << endl;
238 cout << " Default mode=0 will be used." << endl;
242 if (fSignals && (mode==0 || mode==1))
244 for (Int_t i=0; i<fSignals->GetSize(); i++)
246 fSignals->AddAt(0,i);
250 if (fDsignals && (mode==0 || mode==2))
252 for (Int_t j=0; j<fDsignals->GetSize(); j++)
254 fDsignals->AddAt(0,j);
260 ///////////////////////////////////////////////////////////////////////////
261 void AliSignal::DeleteSignals(Int_t mode)
263 // Delete storage arrays of various signal data according to user selection.
265 // mode = 0 Delete arrays of both signal values and their errors.
266 // 1 Delete only signal values array
267 // 2 Delete only signal errors array
269 // The default when invoking DeleteSignals() corresponds to mode=0.
271 // Irrespective of the mode, the waveform histograms are deleted.
273 if (mode<0 || mode>2)
275 cout << " *AliSignal::DeleteSignals* Invalid argument mode = " << mode << endl;
276 cout << " Default mode=0 will be used." << endl;
280 if (fSignals && (mode==0 || mode==1))
286 if (fDsignals && (mode==0 || mode==2))
294 ///////////////////////////////////////////////////////////////////////////
295 void AliSignal::SetSignal(Double_t sig,Int_t j)
297 // Store value in the j-th (default j=1) signal slot.
298 // Note : The first signal slot is at j=1.
299 // In case the value of the index j exceeds the maximum number of reserved
300 // slots for signal values, the number of reserved slots for the
301 // signal values is increased automatically.
305 fSignals=new TArrayF(j);
309 Int_t size=fSignals->GetSize();
316 fSignals->AddAt(float(sig),j-1);
318 ///////////////////////////////////////////////////////////////////////////
319 void AliSignal::AddSignal(Double_t sig,Int_t j)
321 // Add value to the j-th (default j=1) signal slot.
322 // Note : The first signal slot is at j=1.
323 // In case the value of the index j exceeds the maximum number of reserved
324 // slots for signal values, the number of reserved slots for the
325 // signal values is increased automatically.
329 fSignals=new TArrayF(j);
333 Int_t size=fSignals->GetSize();
340 Float_t sum=(fSignals->At(j-1))+sig;
341 fSignals->AddAt(sum,j-1);
343 ///////////////////////////////////////////////////////////////////////////
344 Float_t AliSignal::GetSignal(Int_t j,Int_t mode)
346 // Provide value of the j-th (default j=1) signal slot.
347 // Note : The first signal slot is at j=1.
348 // In case no signal is present or the argument j is invalid, 0 is returned.
349 // The parameter "mode" allows for automatic gain etc... correction of the signal.
351 // mode = 0 : Just the j-th signal is returned.
352 // 1 : The j-th signal is corrected for the gain, offset, dead flag etc...
353 // In case the gain value was not set, gain=1 will be assumed.
354 // In case the gain value was 0, a signal value of 0 is returned.
355 // In case the offset value was not set, offset=0 will be assumed.
356 // In case the j-th slot was marked dead, 0 is returned.
358 // The corrected signal (sigc) is determined as follows :
360 // sigc=(signal/gain)-offset
362 // The default is mode=0.
369 if (j>0 && j<=(fSignals->GetSize()))
371 sig=fSignals->At(j-1);
373 if (mode==0) return sig;
375 // Correct the signal for the gain, offset, dead flag etc...
376 if (GetDeadValue(j)) return 0;
378 if (GetGainFlag(j)) gain=GetGain(j);
379 if (GetOffsetFlag(j)) offset=GetOffset(j);
383 sig=(sig/gain)-offset;
392 cout << " *AliSignal::GetSignal* Index j = " << j << " invalid." << endl;
397 ///////////////////////////////////////////////////////////////////////////
398 void AliSignal::SetSignalError(Double_t dsig,Int_t j)
400 // Store error for the j-th (default j=1) signal slot.
401 // Note : The first signal slot is at j=1.
402 // In case the value of the index j exceeds the maximum number of reserved
403 // slots for signal error values, the number of reserved slots for the
404 // signal errors is increased automatically.
408 fDsignals=new TArrayF(j);
412 Int_t size=fDsignals->GetSize();
419 fDsignals->AddAt(float(dsig),j-1);
421 ///////////////////////////////////////////////////////////////////////////
422 Float_t AliSignal::GetSignalError(Int_t j)
424 // Provide error of the j-th (default j=1) signal slot.
425 // Note : The first signal slot is at j=1.
426 // In case no signal is present or the argument j is invalid, 0 is returned.
430 if (j>0 && j<=(fDsignals->GetSize()))
432 err=fDsignals->At(j-1);
436 cout << " *AliSignal::GetSignalError* Index j = " << j << " invalid." << endl;
441 ///////////////////////////////////////////////////////////////////////////
442 void AliSignal::Data(TString f)
444 // Provide all signal information within the coordinate frame f.
446 const char* name=GetName();
447 const char* title=GetTitle();
449 cout << " *" << ClassName() << "::Data*";
450 if (strlen(name)) cout << " Name : " << name;
451 if (strlen(title)) cout << " Title : " << title;
458 ///////////////////////////////////////////////////////////////////////////
459 void AliSignal::List(Int_t j)
461 // Provide signal information for the j-th slot.
462 // The first slot is at j=1.
463 // In case j=0 (default) the data of all slots will be listed.
464 // In case j=-1 the data of all slots will be listed, but the header
465 // information will be suppressed.
469 cout << " *AliSignal::List* Invalid argument j = " << j << endl;
475 const char* name=GetName();
476 const char* title=GetTitle();
478 cout << " *" << ClassName() << "::Data*";
479 if (strlen(name)) cout << " Name : " << name;
480 if (strlen(title)) cout << " Title : " << title;
484 Int_t nvalues=GetNvalues();
485 Int_t nerrors=GetNerrors();
486 Int_t nwforms=GetNwaveforms();
488 if (fLinks) nlinkslots=fLinks->GetMaxColumn();
490 if (nerrors>n) n=nerrors;
491 if (nwforms>n) n=nwforms;
492 if (nlinkslots>n) n=nlinkslots;
501 for (Int_t i=1; i<=n; i++)
503 cout << " Slot : " << i;
504 if (i<=nvalues) cout << " Signal value : " << GetSignal(i);
505 if (i<=nerrors) cout << " error : " << GetSignalError(i);
511 const char* wfname=obj->GetName();
512 const char* wftitle=obj->GetTitle();
513 cout << " Waveform : " << obj->ClassName();
514 if (strlen(wfname)) cout << " Name : " << wfname;
515 if (strlen(wftitle)) cout << " Title : " << wftitle;
519 nrefs=GetIndices(obj,i,posarr);
520 for (Int_t k=0; k<nrefs; k++)
526 cout << " Link at position " << pos << " to : " << obj->ClassName();
527 if (obj->InheritsFrom("TNamed"))
529 const char* lname=obj->GetName();
530 const char* ltitle=obj->GetTitle();
531 if (strlen(lname)) cout << " Name : " << lname;
532 if (strlen(ltitle)) cout << " Title : " << ltitle;
543 cout << " Slot : " << j;
544 if (j<=nvalues) cout << " Signal value : " << GetSignal(j);
545 if (j<=nerrors) cout << " error : " << GetSignalError(j);
551 const char* wfnamej=obj->GetName();
552 const char* wftitlej=obj->GetTitle();
553 cout << " Waveform : " << obj->ClassName();
554 if (strlen(wfnamej)) cout << " Name : " << wfnamej;
555 if (strlen(wftitlej)) cout << " Title : " << wftitlej;
559 nrefs=GetIndices(obj,j,posarr);
560 for (Int_t kj=0; kj<nrefs; kj++)
566 cout << " Link at position " << pos << " to : " << obj->ClassName();
567 if (obj->InheritsFrom("TNamed"))
569 const char* lnamej=obj->GetName();
570 const char* ltitlej=obj->GetTitle();
571 if (strlen(lnamej)) cout << " Name : " << lnamej;
572 if (strlen(ltitlej)) cout << " Title : " << ltitlej;
580 ///////////////////////////////////////////////////////////////////////////
581 Int_t AliSignal::GetNvalues()
583 // Provide the number of values for this signal.
585 if (fSignals) n=fSignals->GetSize();
588 ///////////////////////////////////////////////////////////////////////////
589 Int_t AliSignal::GetNerrors()
591 // Provide the number specified errors on the values for this signal.
593 if (fDsignals) n=fDsignals->GetSize();
596 ///////////////////////////////////////////////////////////////////////////
597 Int_t AliSignal::GetNwaveforms()
599 // Provide the number specified waveforms for this signal.
601 if (fWaveforms) n=fWaveforms->GetSize();
604 ///////////////////////////////////////////////////////////////////////////
605 TH1F* AliSignal::GetWaveform(Int_t j)
607 // Provide pointer to the j-th waveform histogram.
609 if (j <= GetNwaveforms()) waveform=(TH1F*)fWaveforms->At(j-1);
612 ///////////////////////////////////////////////////////////////////////////
613 void AliSignal::SetWaveform(TH1F* waveform,Int_t j)
615 // Set the 1D waveform histogram corresponding to the j-th signal value.
618 // The waveform of the first signal value is at j=1.
619 // j=1 is the default value.
621 // In case the value of the index j exceeds the maximum number of reserved
622 // slots for the waveforms, the number of reserved slots for the waveforms
623 // is increased automatically.
625 // In case the histo pointer argument has the same value as the current waveform
626 // histogram pointer value, no action is taken since the user has already
627 // modified the actual histogram.
629 // In case the histo pointer argument is zero, the current waveform histogram
630 // is deleted and the pointer set to zero.
632 // In all other cases the current waveform histogram is deleted and a new
633 // copy of the input histogram is created which becomes the current waveform
638 fWaveforms=new TObjArray(j);
639 fWaveforms->SetOwner();
642 if (j > fWaveforms->GetSize()) fWaveforms->Expand(j);
644 TH1F* hcur=(TH1F*)fWaveforms->At(j-1);
645 if (waveform != hcur)
649 fWaveforms->Remove(hcur);
655 hcur=new TH1F(*waveform);
656 fWaveforms->AddAt(hcur,j-1);
660 ///////////////////////////////////////////////////////////////////////////
661 void AliSignal::ResetWaveform(Int_t j)
663 // Reset the waveform of the j-th (default j=1) signal value.
664 // This memberfunction invokes TH1F::Reset() for the corresponding waveform(s).
665 // To actually delete the histograms from memory, use DeleteWaveform().
666 // Notes : The first signal value is at j=1.
667 // j=0 ==> All waveforms will be reset.
669 if (!fWaveforms) return;
671 Int_t size=fWaveforms->GetSize();
673 if ((j>=0) && (j<=size))
677 TH1F* hwave=(TH1F*)fWaveforms->At(j-1);
678 if (hwave) hwave->Reset();
682 for (Int_t i=0; i<size; i++)
684 TH1F* hwave=(TH1F*)fWaveforms->At(i);
685 if (hwave) hwave->Reset();
691 cout << " *AliSignal::ResetWaveform* Index j = " << j << " invalid." << endl;
695 ///////////////////////////////////////////////////////////////////////////
696 void AliSignal::DeleteWaveform(Int_t j)
698 // Delete the waveform of the j-th (default j=1) signal value.
699 // Notes : The first signal value is at j=1.
700 // j=0 ==> All waveforms will be deleted.
702 if (!fWaveforms) return;
704 Int_t size=fWaveforms->GetSize();
706 if ((j>=0) && (j<=size))
710 TH1F* hwave=(TH1F*)fWaveforms->At(j-1);
713 fWaveforms->Remove(hwave);
725 cout << " *AliSignal::DeleteWaveform* Index j = " << j << " invalid." << endl;
729 ///////////////////////////////////////////////////////////////////////////
730 Int_t AliSignal::GetNlinks(TObject* obj,Int_t j)
732 // Provide the number of links to the specified object for the j-th slot.
733 // If j=0 (default) all slots will be scanned for the specified object.
734 // If obj=0 (default) all encountered objects for the specified slot will be counted.
735 // So, invokation of the default GetNlinks() will return the total number of
736 // all references to all sorts of stored objects.
739 cout << " *AliSignal::GetNlinks* Index j = " << j << " invalid." << endl;
746 n=fLinks->GetNrefs(obj);
751 n=GetIndices(obj,j,posarr);
755 ///////////////////////////////////////////////////////////////////////////
756 TObject* AliSignal::GetLink(Int_t j,Int_t k)
758 // Provide pointer of the object linked to the j-th slot at position k.
761 // Note : In the internal storage matrix slots=columns positions=rows
762 if (fLinks) obj=fLinks->GetObject(k,j);
765 ///////////////////////////////////////////////////////////////////////////
766 void AliSignal::SetLink(TObject* obj,Int_t j,Int_t k)
768 // Introduce a link (=pointer) to an object for the j-th slot at position k.
769 // Only the pointer values are stored for (backward) reference, meaning
770 // that the objects of which the pointers are stored are NOT owned
771 // by the AliSignal object.
774 // The first slot is at j=1 and the first position is at k=1.
775 // j=1 and k=1 are the default values.
777 // If needed, the storage area for the links is increased automatically.
779 // In case the pointer argument is zero, indeed a value of zero will be
780 // stored at the specified position (k) for the specified slot (j).
782 // In principle any object derived from TObject can be referred to by this
784 // However, this "linking back" facility was introduced to enable AliSignal slots
785 // to refer directly to the various AliTracks to which the AliSignal object itself
786 // is related (see AliTrack::AddSignal).
787 // Therefore, in case the input argument "obj" points to an AliTrack (or derived)
788 // object, the current signal is automatically related to this AliTrack
789 // (or derived) object.
791 // Please also have a look at the docs of the memberfunction ResetLink()
792 // to prevent the situation of stored pointers to non-existent object.
794 if (!fLinks && obj) fLinks=new AliObjMatrix();
798 // Note : In the internal storage matrix slots=columns positions=rows
799 fLinks->EnterObject(k,j,obj);
802 if (obj->InheritsFrom("AliTrack"))
804 AliTrack* t=(AliTrack*)obj;
809 ///////////////////////////////////////////////////////////////////////////
810 void AliSignal::AddLink(TObject* obj,Int_t j)
812 // Introduce a link (=pointer) to an object for the j-th slot at the first
814 // Only the pointer values are stored for (backward) reference, meaning
815 // that the objects of which the pointers are stored are NOT owned
816 // by the AliSignal object.
819 // The first slot is at j=1 and the first position is at k=1.
820 // j=1 is the default value.
822 // If needed, the storage area for the links is increased automatically.
824 // In case the pointer argument is zero, no link will be added.
826 // In principle any object derived from TObject can be referred to by this
828 // However, this "linking back" facility was introduced to enable AliSignal slots
829 // to refer directly to the various AliTracks to which the AliSignal object itself
830 // is related (see AliTrack::AddSignal).
831 // Therefore, in case the input argument "obj" points to an AliTrack (or derived)
832 // object, the current signal is automatically related to this AliTrack
833 // (or derived) object.
835 // Please also have a look at the docs of the memberfunction ResetLink()
836 // to prevent the situation of stored pointers to non-existent object.
838 if (!obj || j<=0) return;
840 if (!fLinks) fLinks=new AliObjMatrix();
843 Int_t n=GetNlinks(dum,j);
845 for (Int_t k=1; k<=n; k++)
854 ///////////////////////////////////////////////////////////////////////////
855 void AliSignal::ResetLink(Int_t j,Int_t k)
857 // Reset the link of the j-th slot at position k.
860 // The first slot is at j=1 and the first position is at k=1.
861 // j=1 and k=1 are the default values.
863 // This memberfunction is intended to reset only 1 specified link location.
864 // For extended functionality, please refer to the memberfuction ResetLinks().
866 // In general the user should take care of properly clearing the corresponding
867 // pointer here when the referred object is deleted.
868 // However, this "linking back" facility was introduced to enable AliSignal slots
869 // to refer directly to the various AliTracks to which the AliSignal object itself
870 // is related (see AliTrack::AddSignal).
871 // As such, the AliTrack destructor already takes care of clearing the corresponding
872 // links from the various AliSignal slots for all the AliSignal objects that were
873 // related to that AliTrack.
874 // So, in case the link introduced via SetLink() is the pointer of an AliTrack object,
875 // the user doesn't have to worry about clearing the corresponding AliTrack link from
876 // the AliSignal object when the corresponding AliTrack object is deleted.
878 // Note : In the internal storage matrix slots=columns positions=rows
879 if (fLinks) fLinks->RemoveObject(k,j);
881 ///////////////////////////////////////////////////////////////////////////
882 void AliSignal::ResetLinks(TObject* obj,Int_t j,Int_t k)
884 // Reset single or multiple link(s) according to user specified selections.
886 // A link is only reset if the stored reference matches the argument "obj".
887 // In case obj=0 no check on the matching of the stored reference is performed
888 // and the stored link is always reset in accordance with the other
889 // selection criteria.
891 // In case the slot argument "j" is specified, only the links from that
892 // specified slot will be deleted.
893 // In case j=0 (default) no checking on the slot index is performed.
895 // In case the position argument "k" is specified, only the links from that
896 // specified position will be deleted.
897 // In case k=0 (default) no checking on the position index is performed.
899 // So, invokation of ResetLinks(obj) will remove all references to the
900 // object "obj" from the total AliSignal, whereas ResetLinks(obj,j)
901 // will remove all references to the object "obj" only from slot "j".
905 // The first slot is indicated as j=1, whereas the first position is at k=1.
907 // Invokation of ResetLinks(0,row,col) is equivalent to invoking the
908 // memberfunction ResetLink(row,col).
909 // Invoking the latter directly is slightly faster.
911 // Invokation of ResetLinks(0) will reset all stored references in this AliSignal.
913 // In general the user should take care of properly clearing the corresponding
914 // pointer here when the referred object is deleted.
915 // However, this "linking back" facility was introduced to enable AliSignal slots
916 // to refer directly to the various AliTracks to which the AliSignal object itself
917 // is related (see AliTrack::AddSignal).
918 // As such, the AliTrack destructor already takes care of clearing the corresponding
919 // links from the various AliSignal slots for all the AliSignal objects that were
920 // related to that AliTrack.
921 // So, in case the link introduced via SetLink() is the pointer of an AliTrack object,
922 // the user doesn't have to worry about clearing the corresponding AliTrack link from
923 // the AliSignal object when the corresponding AliTrack object is deleted.
927 if (!obj && !j && !k)
933 // Note : In the internal storage matrix slots=columns positions=rows
934 fLinks->RemoveObjects(obj,k,j);
937 ///////////////////////////////////////////////////////////////////////////
938 Int_t AliSignal::GetIndices(TObject* obj,TArrayI& js,TArrayI& ks)
940 // Provide the slot and position indices of all the storage locations
941 // of the specified object.
942 // The slot (j) and pos. (k) indices are returned in the two separate TArrayI arrays
943 // from which the (j,k) pairs can be obtained from the corresponding
944 // array indices like (j,k)=(js.At(i),ks.At(i)).
945 // The integer return argument represents the number of (j,k) pairs which
946 // were encountered for the specified object.
948 // If obj=0 no object selection is performed and all (j,k) indices
949 // of the stored references for all objects are returned.
953 // As usual the convention is that slot and position numbering starts at 1.
955 // This memberfunction always resets the two TArrayI arrays at the start.
957 // This memberfunction can only be used to obtain the (j,k) indices
958 // of the object as stored via the SetLink() or AddLink() memberfunction.
959 // This means that in case the user has entered a TObjArray as object
960 // (to increase the dimension of the resulting structure), the (j,k)
961 // indices of that TObjArray are obtained and NOT the indices of the
962 // actual objects contained in that TObjArray structure.
967 // Note : In the internal storage matrix slots=columns positions=rows
968 if (fLinks) nrefs=fLinks->GetIndices(obj,ks,js);
971 ///////////////////////////////////////////////////////////////////////////
972 Int_t AliSignal::GetIndices(TObject* obj,Int_t j,TArrayI& ks)
974 // Provide the position indices of all the storage locations of the
975 // specified object in the j-th slot of this AliSignal.
976 // The position indices are returned in the TArrayI array.
977 // The integer return argument represents the number of storage locations which
978 // were encountered for the specified object in the j-th slot.
980 // If obj=0 no object selection is performed and all position indices
981 // of the stored references for all objects of the j-th slot are returned.
983 // If j=0 all slots will be scanned and all position indices matching the
984 // object selection are returned.
985 // Note that in this case multiple appearances of the same position index
986 // will only be recorded once in the returned TArrayI array.
990 // As usual the convention is that slot and position numbering starts at 1.
992 // This memberfunction always resets the TArrayI array at the start.
994 // This memberfunction can only be used to obtain the position indices
995 // of the object as stored via the SetLink() or AddLink() memberfunction.
996 // This means that in case the user has entered a TObjArray as object
997 // (to increase the dimension of the resulting structure), the position
998 // indices of that TObjArray are obtained and NOT the indices of the
999 // actual objects contained in that TObjArray structure.
1003 // Note : In the internal storage matrix slots=columns positions=rows
1004 if (fLinks) nrefs=fLinks->GetIndices(obj,ks,j);
1007 ///////////////////////////////////////////////////////////////////////////
1008 Int_t AliSignal::GetIndices(TObject* obj,TArrayI& js,Int_t k)
1010 // Provide the slot indices of all the storage locations of the
1011 // specified object for the k-th position in this AliSignal.
1012 // The slot indices are returned in the TArrayI array.
1013 // The integer return argument represents the number of storage locations which
1014 // were encountered for the specified object in the k-th position.
1016 // If obj=0 no object selection is performed and all slot indices
1017 // of the stored references for all objects in the k-th position are returned.
1019 // If k=0 all positions will be scanned and all slot indices matching the
1020 // object selection are returned.
1021 // Note that in this case multiple appearances of the same slot index
1022 // will only be recorded once in the returned TArrayI array.
1026 // As usual the convention is that slot and position numbering starts at 1.
1028 // This memberfunction always resets the TArrayI array at the start.
1030 // This memberfunction can only be used to obtain the slot indices
1031 // of the object as stored via the SetLink() or AddLink() memberfunction.
1032 // This means that in case the user has entered a TObjArray as object
1033 // (to increase the dimension of the resulting structure), the slot
1034 // indices of that TObjArray are obtained and NOT the indices of the
1035 // actual objects contained in that TObjArray structure.
1039 // Note : In the internal storage matrix slots=columns positions=rows
1040 if (fLinks) nrefs=fLinks->GetIndices(obj,k,js);
1043 ///////////////////////////////////////////////////////////////////////////
1044 void AliSignal::SetSwapMode(Int_t swap)
1046 // Set swapmode flag for the internal link storage.
1047 // In case for the stored links the maximum slot number differs considerably
1048 // from the maximum position number, it might be more efficient
1049 // (w.r.t. memory usage and/or output file size) to internally store the
1050 // link reference matrix with the rows and colums swapped.
1051 // This swapping is only related with the internal storage and as such
1052 // is completely hidden for the user.
1053 // At invokation of this memberfunction the default argument is swap=1.
1055 // Note : The swap mode can only be set as long as no links are
1056 // stored in the AliSignal (i.e. a new instance of AliSignal
1057 // or after invokation of the Reset() or ResetLinks() function).
1059 if (!fLinks) fLinks=new AliObjMatrix();
1060 fLinks->SetSwapMode(swap);
1062 ///////////////////////////////////////////////////////////////////////////
1063 Int_t AliSignal::GetSwapMode()
1065 // Provide swapmode flag of the link storage.
1067 if (fLinks) swap=fLinks->GetSwapMode();
1070 ///////////////////////////////////////////////////////////////////////////
1071 TObject* AliSignal::Clone(const char* name)
1073 // Make a deep copy of the current object and provide the pointer to the copy.
1074 // This memberfunction enables automatic creation of new objects of the
1075 // correct type depending on the object type, a feature which may be very useful
1076 // for containers when adding objects in case the container owns the objects.
1077 // This feature allows e.g. AliTrack to store either AliSignal objects or
1078 // objects derived from AliSignal via the AddSignal memberfunction, provided
1079 // these derived classes also have a proper Clone memberfunction.
1081 AliSignal* sig=new AliSignal(*this);
1084 if (strlen(name)) sig->SetName(name);
1088 ///////////////////////////////////////////////////////////////////////////