52 if (fIDGlobalList && !fIDGlobalList->GetEntries())
SafeDelete(fIDGlobalList);
68 AddTGIDToGlobalList(_tgid);
98 Char_t cname[9] =
"KVTGIDZ";
101 if (buff.
Contains(
"A")) strcpy(cname,
"KVTGIDZA");
103 buff.
Form(
"_%s_%s", id_type, grid_type);
105 TIter next(&fIDList);
110 while ((tgid = (
KVTGID*)next())) {
112 if (name.
Contains(buff))
return tgid;
113 if (!tgid2 && !strcmp(tgid->
ClassName(), cname)) tgid2 = tgid;
143 fIDList.Remove(tgid);
159 if (!fIDGlobalList)
return;
166 fIDGlobalList->Remove(tgid);
168 if (!fIDGlobalList->GetEntries())
SafeDelete(fIDGlobalList);
190 TIter next_g(grid_list);
193 while ((obj = next_g())) {
197 tgid_list->
Add(tgid);
215 ifstream fitfile(filename);
216 if (!fitfile.good()) {
217 Error(
"KVRTGIDManager::ReadAsciiFile",
"File %s cannot be opened", filename);
221 while (fitfile.good()) {
225 if (
s.BeginsWith(
"#"))
continue;
226 if (
s.BeginsWith(
"++")) {
233 if (
cl &&
cl->InheritsFrom(
"KVTGID")) {
235 s.Remove(0,
s.Index(
"::") + 2);
240 AddTGIDToGlobalList(
fit);
244 if (!
fit->GetZorA()) {
247 AddTGIDToGlobalList(fitz);
278 if (!fIDGlobalList) {
279 fIDGlobalList =
new KVList;
282 fIDGlobalList->Add(tgid);
326 if (!fIDGlobalList)
return;
331 GetTGIDfromIDGridManager(&tgid_list);
336 grid_list->Disconnect(
"Modified()", gm,
"Modified()");
340 TIter next(fIDGlobalList);
341 Bool_t IDtypeOK = strcmp(idtype,
"");
343 while ((tgid = (
KVTGID*)next())) {
349 if (!idt_list)
continue;
352 if (strcmp(idtype, idt->
GetLabel()))
continue;
359 Warning(
"KVRTGIDManager::BuildGridForAllTGID",
"No grid built for %s (%s, %p) because it is a copy of %s (%s, %p)"
368 Info(
"KVRTGIDManager::BuildGridForAllTGID",
"grid built from its TGID function %s (%s, %p)"
371 if (grid_list) grid_list->Connect(
"Modified()",
"KVIDGridManager", gm,
"Modified()");
400 TIter next(fIDGlobalList);
403 while ((tgid = (
KVTGID*)next())) {
408 TCollection* lidtel = GetIDTelescopesForTGID(tgid);
409 TIter nextidt(lidtel);
413 while ((idt = nextidt())) {
415 Error(
"KVRTGIDManager::SetIDFuncInTelescopes",
"The IDtelescope %s does not inherit from KVRTGIDManager", idt->
GetName());
418 tgidm = (
KVRTGIDManager*)idt->IsA()->DynamicCast(KVRTGIDManager::Class(), idt);
439 if (!GetTGIDfromIDGridManager(&tgid_list))
return 0;
443 TIter next(&tgid_list);
446 while ((tgid = (
KVTGID*)next())) {
447 if (!fIDGlobalList) {
448 AddTGIDToGlobalList(tgid);
452 if (fIDGlobalList->FindObject(tgid))
continue;
453 AddTGIDToGlobalList(tgid);
476 if (
update) UpdateListFromIDGridManager();
477 if (!fIDGlobalList) {
478 Warning(
"KVRTGIDManager::WriteAsciiFile",
"No listed identification functions to write");
482 ofstream tgidfile(filename);
483 if (!tgidfile.is_open()) {
484 Error(
"KVRTGIDManager::WriteAsciiFile",
"No write permission for file %s", filename);
488 const TCollection* list_tgid = (selection ? selection : fIDGlobalList);
489 TIter next(list_tgid);
493 while ((tgid = (
KVTGID*)next())) {
500 Warning(
"KVRTGIDManager::WriteAsciiFile",
"The function %s (%s, %p) is not written because it is a copy of %s (%s, %p)"
506 Info(
"KVRTGIDManager::WriteAsciiFile",
"%s (%s, %p) saved", tgid->
GetName(), tgid->
ClassName(), tgid);
KVIDGridManager * gIDGridManager
KVMultiDetArray * gMultiDetArray
ClassImp(KVPartitionList) void KVPartitionList
Initialisation.
char * Form(const char *fmt,...)
Base class for KaliVeda framework.
const Char_t * GetLabel() const
void SetMassFormula(Int_t)
virtual void SetOnlyZId(Bool_t yes=kTRUE)
Handles a stock of identification grids to be used by one or more identification telescopes.
Extended TList class which owns its objects by default.
KVIDTelescope * GetIDTelescope(const Char_t *name) const
Return pointer to DeltaE-E ID Telescope with "name".
Run-dependant KVTGIDManager.
static void BuildGridForAllTGID(const Char_t *idtype="", Double_t xmin=0., Double_t xmax=4096., Int_t ID_min=0, Int_t ID_max=0, Int_t npoints=50, Bool_t logscale=kTRUE)
static void SetIDFuncInTelescopes(UInt_t run)
virtual ~KVRTGIDManager()
static Int_t WriteAsciiFile(const Char_t *filename, const TCollection *selection=0, Bool_t update=kTRUE)
static Int_t UpdateListFromIDGridManager()
virtual KVTGID * GetTGID(const Char_t *idt_name, const Char_t *id_type, const Char_t *grid_type)
static TCollection * GetIDTelescopesForTGID(KVTGID *)
static Bool_t ReadAsciiFile(const Char_t *filename)
virtual void SetTGID(KVTGID *)
Add an identification object to the local list (fIDList).
virtual void RemoveTGID(const Char_t *name)
Remove the identification object with name from the local list.
virtual void AddTGID(KVTGID *)
static Bool_t GetTGIDfromIDGridManager(TList *tgid_list)
virtual void RemoveAllTGID()
Remove all identification objects of the local list.
static void DeleteTGID(const Char_t *name)
static KVList * fIDGlobalList
Global list of TGID of all the KVRTGIDManager.
static void AddTGIDToGlobalList(KVTGID *)
----— static methods -----------------------—//
virtual void SetCleanup(Bool_t enable=kTRUE)
Extension of ROOT TString class which allows backwards compatibility with ROOT v3....
void Begin(TString delim) const
KVString Next(Bool_t strip_whitespace=kFALSE) const
Grid representing result of fit.
virtual void Generate(Double_t xmax, Double_t xmin, Int_t ID_min=0, Int_t ID_max=0, Int_t npoints=50, Bool_t logscale=kTRUE)
virtual void AddTGID(KVTGID *)
Abstract base class for charged particle Z identfication using functionals developed by L....
Abstract base class for particle identfication using functionals developed by L. Tassan-Got (IPN Orsa...
Bool_t IsValidForRun(Int_t run) const
const KVString & GetIDTelescopes() const
Double_t GetIDmax() const
void WriteToAsciiFile(std::ofstream &) const
Write parameters of LTG fit in file.
static KVTGID * ReadFromAsciiFile(const Char_t *name, std::ifstream &)
Int_t GetMassFormula() const
static TClass * GetClass(Bool_t load=kTRUE, Bool_t silent=kFALSE)
virtual void SetOwner(Bool_t enable=kTRUE)
virtual void SetTitle(const char *title="")
virtual void Add(TObject *obj)
virtual TObject * FindObject(const char *name) const
virtual const char * GetName() const
virtual const char * GetTitle() const
virtual const char * GetName() const
virtual const char * ClassName() const
virtual TObject * FindObject(const char *name) const
virtual Bool_t InheritsFrom(const char *classname) const
virtual TObject * First() const=0
const char * Data() const
void Form(const char *fmt,...)
TString & Remove(EStripType s, char c)
Bool_t Contains(const char *pat, ECaseCompare cmp=kExact) const
Ssiz_t Index(const char *pat, Ssiz_t i=0, ECaseCompare cmp=kExact) const
def fit(model, train_loader, val_loader, num_epochs, batch_size, optimizer, criterion, save_best, scheduler)
void update(const LAYERDATA &prevLayerData, LAYERDATA &currLayerData, double factorWeightDecay, EnumRegularization regularization)
Double_t Max(Double_t a, Double_t b)