TList* KVGroup::GetAlignedDetectors(KVDetector* det, UChar_t dir) { //Fill TList with all detectors aligned with "det" which are closer to the target. //These are the detectors through which any particle stopping in "det" will have //to pass. By default (dir=KVGroup::kBackwards) the list starts with "det" and //goes towards the target. Use dir=KVGroup::kForwards to have the list in the //order seen by an impinging particle. // //Delete TList after use. TList* tmp = new TList; while (det) { tmp->Add(det); KVGeoDetectorNode* node = det->GetNode(); KVSeqCollection* infront = node->GetDetectorsInFront(); if (!infront) break; if (infront->GetEntries() > 1) { Warning("GetAlignedDetectors", "No unique solution. There are %d detectors in front of %s.", infront->GetEntries(), det->GetName()); infront->ls(); } det = (KVDetector*)infront->First(); } if (dir == kForwards) { TIter next(tmp, kIterBackward); TList* tmp2 = new TList; while ((det = (KVDetector*)next())) tmp2->Add(det); delete tmp; tmp = tmp2; } return tmp; }
//________________________________________________________________________________________ TGraph* KVINDRA::GetPedestals(const Char_t* det_signal, const Char_t* det_type, Int_t ring_number, Int_t run_number) { //Renvoie sous forme de TGraph (en fonction du numero de module) //les piedestaux du signal (det_signal) asssocies aux detecteurs de type (det_type) //qui sont presents dans la couronne ring_number pour un numero de run donne (si run_number==-1) //on suppose que gIndra->SetParameters(xxx) a ete fait en amont //L'utilisateur doit effacer ce TGraph tout seul comme un grand apres usage //Une recherche sur l existence ou non du graph permet d eviter des boucles inutiles //Si l appel est reitere if (run_number != -1 || run_number != Int_t(GetCurrentRunNumber())) SetParameters(run_number); KVSeqCollection* sltype = 0; KVSeqCollection* slring = 0; TGraph* gr_ped = 0; KVString sgraph; sgraph.Form("KVPed_%s_%s_%d_%d", det_signal, det_type, ring_number, GetCurrentRunNumber()); if ((gr_ped = (TGraph*)gROOT->FindObject(sgraph.Data()))) return gr_ped; if ((sltype = GetDetectors()->GetSubListWithMethod(det_type, "GetType"))) { KVString sring; sring.Form("%d", ring_number); if ((slring = sltype->GetSubListWithMethod(sring, "GetRingNumber"))) { gr_ped = new TGraph(); gr_ped->SetName(sgraph.Data()); for (Int_t mm = 0; mm < slring->GetEntries(); mm += 1) { gr_ped->SetPoint(gr_ped->GetN(), ((KVINDRADetector*)slring->At(mm))->GetModuleNumber(), ((KVDetector*)slring->At(mm))->GetPedestal(det_signal)); } delete slring; return gr_ped; } delete sltype; } return 0; }