178 for (Int_t i=1; i<=ndevs; i++)
231 cout <<
" *" << ClassName() <<
"::SetDevCopy* Invalid argument : " << j << endl;
236 cout <<
" *" << ClassName() <<
"::SetDevCopy* Storage already contained devices."
237 <<
" ==> DevCopy mode not changed." << endl;
411 ndevs=devs.GetEntries();
439 if (classname==
"*") classname=
"NcDevice";
447 ndevs=devs.GetEntries();
451 Int_t nh=hits->GetEntries();
459 for (Int_t ih=0; ih<nh; ih++)
461 TObject* obj=hits->At(ih);
465 if (obj->InheritsFrom(
"NcSignal")) sx=(
NcSignal*)obj;
470 if (!(dev->InheritsFrom(classname)))
continue;
473 jdev=dev->GetUniqueID();
476 for (Int_t idx=0; idx<idxmax; idx++)
478 if (jdev==devids.At(idx))
487 devids.AddAt(jdev,ndevs-1);
513 cout <<
" *" << ClassName() <<
"::GetDevice* Invalid argument i : " << i
514 <<
" ndevs = " << ndevs << endl;
544 Int_t ndevs=devs.GetEntries();
545 for (Int_t i=0; i<ndevs; i++)
551 if (s==name)
return dev;
591 if (!arr ||
id<0)
return 0;
594 for (Int_t i=0; i<arr->GetSize(); i++)
596 TObject* obj=arr->At(i);
601 if (obj->InheritsFrom(
"NcDevice")) dev=(
NcDevice*)obj;
604 idx=dev->GetUniqueID();
605 if (idx==
id)
return dev;
628 if (classname==
"*") classname=
"NcDevice";
640 for (Int_t i=0; i<arr->GetEntries(); i++)
645 idx=dev->GetUniqueID();
646 if (idx==
id && dev->InheritsFrom(classname))
return dev;
676 if (classname==
"*") classname=
"NcDevice";
693 fDevs=
new TObjArray();
730 Int_t ndevs=devs.GetEntries();
731 for (Int_t i=0; i<ndevs; i++)
736 if (!(dev->InheritsFrom(
"NcDetectorUnit")))
continue;
778 if (!arr ||
id<0)
return 0;
781 for (Int_t i=0; i<arr->GetSize(); i++)
783 TObject* obj=arr->At(i);
788 if (obj->InheritsFrom(
"NcDetectorUnit")) dev=(
NcDetectorUnit*)obj;
791 idx=dev->GetUniqueID();
792 if (idx==
id)
return dev;
815 if (classname==
"*") classname=
"NcDetectorUnit";
827 for (Int_t i=0; i<arr->GetEntries(); i++)
832 if (!(dev->InheritsFrom(
"NcDetectorUnit")))
continue;
833 idx=dev->GetUniqueID();
834 if (idx==
id && dev->InheritsFrom(classname))
return (
NcDetectorUnit*)dev;
855 const char* name=GetName();
856 const char* title=GetTitle();
857 cout <<
" *" << ClassName() <<
"::Data* Id : " << GetUniqueID();
858 if (strlen(name)) cout <<
" Name : " << GetName();
859 if (strlen(title)) cout <<
" Title : " << GetTitle();
866 cout <<
" More detailed info may be obtained by invokation of ShowDevices()." << endl;
867 cout <<
" For the data of these contained devices, please use the corresponding investigation tools." << endl;
870 cout <<
" === Data of the current detector unit object ===" << endl;
880 const char* devname=
fDevice->GetName();
881 const char* devtitle=
fDevice->GetTitle();
882 cout <<
" Owned by device : " <<
fDevice->ClassName() <<
" Id : " <<
fDevice->GetUniqueID();
883 if (strlen(devname)) cout <<
" Name : " << devname;
884 if (strlen(devtitle)) cout <<
" Title : " << devtitle;
904 cout <<
" The following " << nhits <<
" hits are registered for this object : " << endl;
909 cout <<
" No hits have been registered for this object." << endl;
949 Bool_t follow=kFALSE;
950 if (mode==2) follow=kTRUE;
956 cout <<
" *" << ClassName() <<
"::ShowDevices* For mode=" << mode <<
" there are in total " << ndevs;
957 if (classname!=
"*") cout <<
" " << classname <<
" (derived)";
958 cout <<
" devices found." << endl;
961 if (classname==
"*") classname=
"NcDevice";
984 if (classname==
"*") classname=
"NcDevice";
986 if (!unit) unit=
this;
990 TString name=unit->GetName();
992 TString type=
"NcDetectorUnit";
993 if (unit->InheritsFrom(
"NcDetector")) type=
"NcDetector";
998 cout <<
" No devices present for " << type <<
" : " << name << endl;
1006 cout <<
" There are " << ndevs2;
1007 if (classname!=
"NcDevice") cout <<
" " << classname <<
" (derived)";
1008 cout <<
" devices available for the " << type <<
" : " << name << endl;
1014 cout <<
" === The following " << ndevs2;
1015 if (classname!=
"NcDevice") cout <<
" " << classname <<
" (derived)";
1016 cout <<
" devices are available for the " << type <<
" : " << name << endl;
1025 for (Int_t i=1; i<=ndevs; i++)
1031 if (dev->InheritsFrom(classname))
1034 if (dev->InheritsFrom(
"NcDetectorUnit")) type=
"NcDetectorUnit";
1035 if (dev->InheritsFrom(
"NcDetector")) type=
"NcDetector";
1036 name=dev->GetName();
1037 cout <<
" Device number : " << i;
1038 cout <<
" Class : " << dev->ClassName();
1039 if (type!=(dev->ClassName())) cout <<
" (" << type <<
")";
1040 cout <<
" Id : " << dev->GetUniqueID();
1041 if (name!=
"") cout <<
" Name : " << name;
1043 if (dev->InheritsFrom(
"NcDetectorUnit"))
1047 if (nd) cout <<
" Ndevices : " << nd;
1050 if (nh) cout <<
" Nhits : " << nh;
1052 if (nw) cout <<
" Nwaveforms : " << nw;
1054 if (ns) cout <<
" Nsamples : " << ns;
1058 if (mode==2 && dev->InheritsFrom(
"NcDetectorUnit")) units.Add(dev);
1062 for (Int_t i=0; i<units.GetEntries(); i++)
1090 if (classname==
"*") classname=
"NcDevice";
1094 Int_t nhits=hits.GetEntries();
1145 if (classname==
"*") classname=
"NcDevice";
1147 LoadHits(classname,follow,inc,hits);
1152 TObjArray* selected=hits;
1153 if (!selected) selected=
fThits;
1154 TObjArray ahits(*selected);
1155 GetHits(*selected,name,mode,opt,&ahits);
1186 if (classname==
"*") classname=
"NcDevice";
1189 LoadHits(classname,follow,inc,&hits);
1191 Int_t nhits=hits.GetEntries();
1193 if (!nhits)
return 0;
1197 for (Int_t i=0; i<nhits; i++)
1202 sid=sx->GetUniqueID();
1203 if (
id==sid)
return sx;
1236 if (classname==
"*") classname=
"NcDevice";
1239 LoadHits(classname,follow,inc,&hits);
1241 Int_t nhits=hits.GetEntries();
1243 cout <<
" *" << ClassName() <<
"::ShowHits* There are " << nhits
1244 <<
" hits recorded for device class " << classname << endl;
1246 if (!nhits || !mode)
return;
1249 for (Int_t i=0; i<hits.GetEntries(); i++)
1252 if (sx) sx->
Data(f,u);
1258 cout <<
" Device Position";
1264TObjArray*
NcDetectorUnit::SortHits(TString classname,Bool_t follow,Bool_t inc,Int_t idx,Int_t mode,Int_t mcal,Int_t deadcheck,TObjArray* ordered)
1314 if (classname==
"*") classname=
"NcDevice";
1316 if (ordered) ordered->Clear();
1318 if (idx<=0 || abs(mode)!=1)
return 0;
1321 LoadHits(classname,follow,inc,&hits);
1323 TObjArray* arr=
SortHits(idx,mode,&hits,mcal,deadcheck,ordered);
1325 if (ordered)
return 0;
1332 if (arr)
fThits=
new TObjArray(*arr);
1336TObjArray*
NcDetectorUnit::SortHits(TString classname,Bool_t follow,Bool_t inc,TString name,Int_t mode,Int_t mcal,Int_t deadcheck,TObjArray* ordered)
1386 if (classname==
"*") classname=
"NcDevice";
1388 if (ordered) ordered->Clear();
1390 if (abs(mode)!=1)
return 0;
1393 LoadHits(classname,follow,inc,&hits);
1395 TObjArray* arr=
SortHits(name,mode,&hits,mcal,deadcheck,ordered);
1397 if (ordered)
return 0;
1404 if (arr)
fThits=
new TObjArray(*arr);
1454 if (classname==
"*") classname=
"NcDevice";
1516 if (classname==
"*") classname=
"NcDevice";
1532TObjArray*
NcDetectorUnit::SortDevices(TString classname,Bool_t follow,Bool_t inc,TString name,Int_t mode,Int_t mcal,Int_t deadcheck,TObjArray* ordered)
1580 if (classname==
"*") classname=
"NcDevice";
1582 if (ordered) ordered->Clear();
1585 SortHits(classname,follow,inc,name,mode,mcal,deadcheck,&hits);
1587 TObjArray* devs=
SortDevices(&hits,
"*",0,mcal,deadcheck,ordered);
1647 if (ordered) ordered->Clear();
1649 if (classname==
"*") classname=
"NcDevice";
1652 SortHits(classname,follow,inc,idx,mode,mcal,deadcheck,&hits);
1654 TObjArray* devs=
SortDevices(&hits,0,0,mcal,deadcheck,ordered);
1724 if (!hits)
return 0;
1726 TObjArray* sorthits=
new TObjArray(*hits);
1727 if (mode)
SortHits(name,mode,hits,mcal,deadcheck,sorthits);
1740 Int_t nhits=sorthits->GetEntries();
1742 for (Int_t ih=0; ih<nhits; ih++)
1748 for (Int_t
id=0;
id<arr->GetEntries();
id++)
1757 if (!exist) arr->Add(dx);
1830 if (!hits)
return 0;
1832 TObjArray* sorthits=
new TObjArray(*hits);
1833 if (mode)
SortHits(idx,mode,hits,mcal,deadcheck,sorthits);
1846 Int_t nhits=sorthits->GetEntries();
1848 for (Int_t ih=0; ih<nhits; ih++)
1854 for (Int_t
id=0;
id<arr->GetEntries();
id++)
1863 if (!exist) arr->Add(dx);
1907 if (classname==
"*") classname=
"NcDevice";
1931 if (inc && unit->InheritsFrom(classname))
1933 for (Int_t ih=1; ih<=unit->
GetNhits(); ih++)
1952 for (Int_t idev=1; idev<=unit->
GetNdevices(kFALSE); idev++)
1957 if (follow && dev->InheritsFrom(
"NcDetectorUnit")) units.Add(dev);
1959 if (!(unit->InheritsFrom(classname)) && !(dev->InheritsFrom(classname)))
continue;
1961 for (Int_t ih=1; ih<=dev->
GetNhits(); ih++)
1977 for (Int_t i=0; i<units.GetEntries(); i++)
1980 if (du)
LoadHits(classname,follow,inc,hits,du);
2009 if (classname==
"*") classname=
"NcDevice";
2027 fDevs=
new TObjArray();
2040 for (Int_t i=1; i<=ndevs; i++)
2046 if (follow && dev->InheritsFrom(
"NcDetectorUnit")) units.Add(dev);
2048 if (dev->InheritsFrom(classname))
2062 for (Int_t i=0; i<units.GetEntries(); i++)
2087 if (strlen(name)) q->SetName(name);
Handling of a collection of generic devices.
TObject * fDisplay
! Temp. pointer to hold objects which serve event displays
NcDetectorUnit(const char *name="", const char *title="")
void DisplayHits(TString classname, Bool_t follow, Bool_t inc, TString name, Float_t scale=-1, Int_t dp=0, Int_t mode=1, Int_t mcol=4)
void ShowDevicesTree(TString classname, Int_t mode=1, NcDetectorUnit *unit=0)
Int_t GetNdevices(Bool_t follow)
void LoadHits(TString classname, Bool_t follow, Bool_t inc, TObjArray *hits=0, NcDetectorUnit *unit=0)
NcDevice * GetDevice(Int_t i) const
TObjArray * fThits
! Temp. array to hold references to the registered NcDevice hits
void AddDevice(NcDevice &d)
TObjArray * GetDevices(TString classname, Bool_t follow, TObjArray *devices=0)
Int_t GetNhitsDevices(TString classname, Bool_t follow, Bool_t inc)
virtual void Reset(Int_t mode=0)
NcDetectorUnit * GetIdDetectorUnit(Int_t id, Bool_t follow, TObjArray *devs=0)
void RemoveDevice(NcDevice *d)
TObjArray * SortDevices(TString classname, Bool_t follow, Bool_t inc, TString name, Int_t mode=-1, Int_t mcal=1, Int_t deadcheck=1, TObjArray *ordered=0)
virtual TObject * Clone(const char *name="") const
TObjArray * GetHitsDevices(TString classname, Bool_t follow, Bool_t inc, TObjArray *hits=0, TString name="none", Int_t mode=0, Int_t opt=0)
virtual void SetOwner(Bool_t own=kTRUE)
virtual void Data(TString f="car", TString u="rad")
NcSignal * GetIdHit(Int_t id, TString classname, Bool_t follow, Bool_t inc)
TObjArray * fDevs
! Temp. array to hold references to user selected devices
TObjArray * fOrdered
! Temp. array to hold references to various ordered objects
TObjArray * SortHits(TString classname, Bool_t follow, Bool_t inc, TString name, Int_t mode=-1, Int_t mcal=1, Int_t deadcheck=1, TObjArray *ordered=0)
void LoadDevices(TString classname, Bool_t follow, TObjArray *hits=0, NcDetectorUnit *unit=0)
void ShowHits(TString classname, Bool_t follow, Bool_t inc, Int_t mode=1, TString f="car", TString u="rad")
NcDetectorUnit * GetDetectorUnit(TString name, Bool_t follow)
NcDevice * GetIdDevice(Int_t id, Bool_t follow, TObjArray *devs=0)
void ShowDevices(Int_t mode=1, Bool_t header=kTRUE)
virtual ~NcDetectorUnit()
NcDevice(const char *name="", const char *title="")
virtual TObject * Clone(const char *name="") const
void DisplayHits(TString name, Float_t scale=-1, TObjArray *hits=0, Int_t dp=0, Int_t mode=1, Int_t mcol=4)
virtual void SetOwner(Bool_t own=kTRUE)
NcSignal * GetHit(Int_t j) const
void ShowHit(Int_t j=0, TString f="car", TString u="rad") const
virtual void Reset(Int_t mode=0)
void GetPosition(Double_t *r, TString f, TString u="rad", Float_t s=-1) const
virtual void Data(TString f="car", TString u="rad") const
Int_t GetNwaveforms() const
virtual void List(Int_t j=0) const
NcDevice * GetDevice() const
void ListWaveform(Int_t j=0) const
void ListSample(Int_t j=0) const
NcSignal(const char *name="", const char *title="")
void ListTrack(Int_t j=0) const
Int_t GetNsamples() const
virtual void Data(TString f="car", TString u="rad") const