//_______________________________________________________________________________ KVBase *KVRList::FindObjectByLabel(const Char_t * type) const { // // Find an object in this list using its label. Requires a sequential // scan till the object has been found. Returns 0 if object with specified // label is not found. // if (type) { if (GetSize()) //make sure list contains some objects { for (Int_t i = 0; i < GetSize(); i++) { KVBase *obj = (KVBase *) At(i); if (obj->GetLabel() && !strcmp(type, obj->GetLabel())) return obj; } } } // Warning("GetObjectByType",KVRLIST_NOT_WITH_THIS_TYPE,type); return 0; }
void KVLVContainer::OpenContextMenu(TGFrame* f, Int_t but, Int_t x, Int_t y) { // Open context menu when user right-clicks an object in the list. // Calling AllowContextMenu(kFALSE) will disable this. // We also fill the list fPickOrderedObjects with the selected objects // in the order of clicking // // if fUseObjLabelAsRealClass=kTRUE (and if objects inherit from KVBase) // then the context menu opened will be that of the class given by // KVBase::GetLabel. The object's KVBase::GetObject() method must // return the real object to use. if (but == kButton1) { TGLVEntry* el = (TGLVEntry*)f; TObject* ob = (TObject*)el->GetUserData(); if (!fControlClick || !GetMultipleSelection()) fPickOrderedObjects->Clear(); if (ob) { Bool_t in_list = fPickOrderedObjects->FindObject(ob); if (in_list) fPickOrderedObjects->Remove(ob); else fPickOrderedObjects->AddLast(ob); } return; } // context menus globally disabled and no exceptions defined if (!fAllowContextMenu && !fContextMenuClassExceptions) return; if (but == kButton3) { // Error("OpenContextMenu","x=%d y=%d",x,y); // fContextMenu->Popup(x,y,this); return; TGLVEntry* el = (TGLVEntry*)f; TObject* ob = (TObject*)el->GetUserData(); if (ob) { TObject* CMob = ob; TString CMobClass = ob->ClassName(); if (fUseObjLabelAsRealClass && ob->TestBit(KVBase::kIsKaliVedaObject)) { KVBase* bob = dynamic_cast<KVBase*>(ob); CMobClass = bob->GetLabel(); CMob = bob->GetObject(); } // check class context menu status if (fContextMenuClassExceptions) { if ((!fAllowContextMenu && fContextMenuClassExceptions->FindObject(CMobClass)) || (fAllowContextMenu && !fContextMenuClassExceptions->FindObject(CMobClass))) fContextMenu->Popup(x, y, CMob); } else if (fAllowContextMenu) fContextMenu->Popup(x, y, CMob); } } }
void KVRTGIDManager::BuildGridForAllTGID(const Char_t *idtype, Double_t xmin, Double_t xmax, Int_t ID_min, Int_t ID_max, Int_t npoints, Bool_t logscale){ // Build a grid (KVTGIDGrid) for all the identification functions // of the global list. The new grids are automatically loaded in // gIDGridManager and are visible in the Grid Manager GUI. // If a function is already associated to a grid then a new grid // is not built. No grid is built for copies of KVTGID's made in // the method ReadAsciiFile(...). // // Inputs: idtype - type of the identification for which the // grids will be built (CI-SI, SI-CSI, CI-CSI, // SI75-SILI, ...). By default, all grids are // built // xmin // xmax // ID_min // ID_max // npoints // logscale - see KVTGIDGrid::Generate(...) if( !fIDGlobalList ) return; // First make a sublist of TGID found in object inheriting // from KVTGIDGrid in gIDGridManager TList tgid_list; GetTGIDfromIDGridManager(&tgid_list); KVIDGridManager *gm = gIDGridManager; KVList *grid_list = NULL; if(gm){ grid_list = gm->GetGrids(); grid_list->Disconnect("Modified()",gm,"Modified()"); } // If the TGID of the global list is not in the sublist then // build grid TIter next(fIDGlobalList); Bool_t IDtypeOK = strcmp(idtype,""); KVTGID *tgid = NULL; while( (tgid = (KVTGID *)next()) ){ if(tgid_list.FindObject(tgid)) continue; if(IDtypeOK){ KVBase *idt = NULL; TSeqCollection *idt_list = (TSeqCollection* )GetIDTelescopesForTGID(tgid); if(!idt_list) continue; if( !(idt = (KVBase *)idt_list->First()) ) continue; SafeDelete(idt_list); if( strcmp(idtype,idt->GetLabel()) ) continue; } // Not built grid for a KVTGID copy TString tmp = tgid->GetTitle(); if(tmp.Contains("COPY")){ tmp.Remove(0, tmp.Index("0x")); KVTGID *tmp_tgid = reinterpret_cast<KVTGID *>((Int_t)tmp.Atof()); Warning("KVRTGIDManager::BuildGridForAllTGID","No grid built for %s (%s, %p) because it is a copy of %s (%s, %p)" , tgid->GetName(), tgid->ClassName(), tgid , tmp_tgid->GetName(), tmp_tgid->ClassName(), tmp_tgid); continue; } KVTGIDGrid *grid = new KVTGIDGrid(tgid); grid->SetOnlyZId((Bool_t)tgid->GetZorA()); if(tgid->GetZorA()) grid->SetMassFormula(tgid->GetMassFormula()); grid->Generate(xmax, xmin, ID_min, ID_max, npoints, logscale); Info("KVRTGIDManager::BuildGridForAllTGID","grid built from its TGID function %s (%s, %p)" , tgid->GetName(), tgid->ClassName(), tgid); } if( grid_list ) grid_list->Connect("Modified()","KVIDGridManager",gm,"Modified()"); gm->Modified(); }