+
+//_____________________________________________________________________________
+Int_t
+AliMUONTrackerIO::DecodeConfig(const char* data, AliMUONVStore& confStore)
+{
+ /// Read config data (produced by the MUONTRKda.exe program for instance)
+ /// and append the read values into the given VStore
+ /// To be used when the input is a TString (for instance when getting data
+ /// from AMORE DB).
+
+ char line[1024];
+ Int_t busPatchID, manuID;
+ Int_t n(0);
+ istringstream in(data);
+
+ while ( in.getline(line,1024) )
+ {
+ AliDebugClass(3,Form("line=%s",line));
+ if ( line[0] == '#' )
+ {
+ continue;
+ }
+ std::istringstream sin(line);
+ sin >> busPatchID >> manuID;
+
+ Int_t detElemID = AliMpDDLStore::Instance()->GetDEfromBus(busPatchID);
+
+ if ( !AliMpDEManager::IsValidDetElemId(detElemID) )
+ {
+ AliErrorClass(Form("Got an invalid DE = %d from busPatchId=%d manuId=%d",
+ detElemID,busPatchID,manuID));
+ continue;
+ }
+
+ AliMUONVCalibParam* conf =
+ static_cast<AliMUONVCalibParam*>(confStore.FindObject(detElemID,manuID));
+ if (!conf)
+ {
+ conf = new AliMUONCalibParamNF(1,1,detElemID,manuID,1);
+ confStore.Add(conf);
+ }
+ ++n;
+ }
+
+ return n;
+}
+
+//_____________________________________________________________________________
+Int_t
+AliMUONTrackerIO::WriteConfig(ofstream& out, const AliMUONVStore& confStore)
+{
+ /// Write the conf store as an ASCII file
+ /// Note that we are converting (back) the detElemId into a busPatchId
+ /// Return the number of lines written
+
+ if ( !AliMpDDLStore::Instance() )
+ {
+ cout << "ERROR: mapping not loaded. Cannot work" << endl;
+ return 0;
+ }
+
+ TIter next(confStore.CreateIterator());
+ AliMUONVCalibParam* param;
+ Int_t n(0);
+
+ while ( (param=static_cast<AliMUONVCalibParam*>(next())) )
+ {
+ Int_t detElemId = param->ID0();
+ Int_t manuId = param->ID1();
+
+ Int_t busPatchId = AliMpDDLStore::Instance()->GetBusPatchId(detElemId,manuId);
+ ++n;
+
+ out << busPatchId << " " << manuId << endl;
+ }
+ return n;
+}
+