+//______________________________________________________________________________
+void GenerateConfig()
+{
+ /// Generate "fake" configuration files for the tracker. One per LDC.
+
+ Bool_t undefStorage(kFALSE);
+
+ AliCDBManager* man = AliCDBManager::Instance();
+ if (!man->IsDefaultStorageSet())
+ {
+ undefStorage = kTRUE;
+ man->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
+ man->SetRun(0);
+ }
+
+ // Load mapping
+ Bool_t ok = AliMpCDB::LoadDDLStore();
+
+ if (undefStorage)
+ {
+ man->UnsetDefaultStorage();
+ }
+
+ if (!ok)
+ {
+ AliErrorGeneral("GenerateConfig","Could not load DDLStore from OCDB");
+ return;
+ }
+
+ ofstream* files[5];
+ for ( Int_t i = 0; i < 5; ++i )
+ {
+ files[i]=0;
+ }
+
+ TIter next(AliMpDDLStore::Instance()->CreateBusPatchIterator());
+ AliMpBusPatch* bp;
+
+ while ( ( bp = static_cast<AliMpBusPatch*>(next()) ) )
+ {
+ Int_t ddl = bp->GetDdlId();
+
+ Int_t ldc = ddl/4;
+
+ if (!files[ldc])
+ {
+ files[ldc] = new ofstream(Form("LDC%d.conf",ldc));
+ *(files[ldc]) << "# changed" << endl;
+ }
+
+ for ( Int_t imanu = 0; imanu < bp->GetNofManus(); ++imanu )
+ {
+ *(files[ldc]) << bp->GetId() << " " << bp->GetManuId(imanu) << endl;
+ }
+ }
+
+ for ( Int_t i = 0; i < 5; ++i )
+ {
+ if ( files[i] ) files[i]->close();
+ delete files[i];
+ }
+}
+
+//______________________________________________________________________________