41 #include <Riostream.h>
44 #include <TObjString.h>
45 #include <TObjArray.h>
68 if ( ! fgInstance && warn ) {
69 AliWarningClass(
"Manu Store has not been loaded");
84 AliWarningClass(
"Manu Store has been already loaded");
89 AliInfoClass(
"Reading Manu Store from ASCII files.");
115 <<
"Mapping segmentation has not be loaded. Cannont load Manu store"
157 Int_t deId = de->
GetId();
180 while ( in.getline(line,80) ) {
182 if ( line[0] ==
'#' )
continue;
186 TObjArray* stringList = tmp.Tokenize(TString(
" "));
188 Int_t manuId = atoi( ((TObjString*)stringList->At(0))->GetName());
189 Int_t manuSerial = atoi( ((TObjString*)stringList->At(2))->GetName());
191 TString sPlane = ((TObjString*)stringList->At(1))->GetString();
195 AddManu(deId, manuId, manuSerial);
197 AddManu(deId, manuId + manuMask, manuSerial);
224 Bool_t result =
ReadData(dataStreams, detElement, nofManus);
229 <<
"Adding " << nofManus <<
" manus for de "
230 << detElement->
GetId() << endl;
232 isOk = isOk && result;
247 TExMap newManuToSerialNbs;
251 #if (defined(ROOT_VERSION_CODE) && ROOT_VERSION_CODE >= 334082) || \
252 (defined(ROOT_SVN_REVISION) && ROOT_SVN_REVISION >= 29598)
259 while ( ( it.Next(key, value) ) ) {
262 newManuToSerialNbs.Add(key, value);
264 newManuToSerialNbs.Add(index, Long_t(serialNb));
267 TExMap newSerialNbToManus;
270 while ( ( it2.Next(key, value) ) ) {
272 if ( value != index )
273 newSerialNbToManus.Add(key, value);
275 newSerialNbToManus.Add(Long_t(serialNb), index);
291 TString curDir = gSystem->pwd();
295 if ( gSystem->OpenDirectory(outDir.Data()) ) {
297 <<
"Directory " << outDir.Data() <<
" already exists" << endl;
301 AliDebugStream(2) <<
"Making directory " << outDir.Data() << endl;
302 gSystem->mkdir(outDir.Data());
310 Int_t detElemId = detElement->
GetId();
311 TString deName = detElement->
GetDEName();
322 if ( ! gSystem->OpenDirectory(dirPath.Data()) ) {
323 AliDebugStream(2) <<
"Making directory " << dirPath.Data() << endl;
324 gSystem->mkdir(dirPath.Data());
331 if ( dataPath.find(top) != string::npos ) dataPath.erase(0, top.size()+1);
332 dataPath.erase(0,dataPath.find(
'/')+1);
333 TString dataPath1 = dataPath;
334 TString filePath = outDir +
"/" + dataPath1;
338 ofstream out(filePath.Data());
339 if ( ! out.good() ) {
341 <<
"Cannot open output file " << filePath.Data() << endl;
347 #if (defined(ROOT_SVN_REVISION) && ROOT_SVN_REVISION >= 29598) || \
348 (defined(ROOT_VERSION_CODE) && ROOT_VERSION_CODE >= ROOT_VERSION(5,25,02))
355 while ( ( it2.Next(key, value) ) ) {
358 if ( pairFirst != detElemId )
continue;
363 <<
"Go to write " << key <<
" "
364 << pairFirst <<
" " << manuId <<
" " << value << endl;
369 if ( manuId> manuMask ) {
373 out << manuId <<
" " << planeName.Data() <<
" " << value << endl;
376 << manuId <<
" " << planeName.Data() <<
" " << value << endl;
416 <<
"Adding (" << detElemId <<
"," << manuId
417 <<
") as index=" << index <<
" and serialNb=" << serialNb << endl;
425 <<
"Serial number " << serialNb
426 <<
" already present for (detElemId, manuId) = " ;
static AliMq::Station12Type GetStation12Type(Int_t detElemId)
static AliMpManuStore * ReadData(const AliMpDataStreams &dataStreams, Bool_t warn=true)
The iterator over detection elements.
static AliMpDEStore * Instance(Bool_t warn=true)
AliMpManuStore()
Not implemented.
static TString Normalize(const char *line)
TString GetDEName() const
Return name.
TExMap fSerialNbToManus
Map manu serial # to manuId.
static TString ManuToSerialPath(const TString &deName, AliMp::StationType station, AliMq::Station12Type station12Type)
MpPair_t Pair(Int_t first, Int_t second)
Encode the pair of integers to another integer.
TExMap fNofManusInDE
Number of manus with serial nbs in DE.
AliMpDetElement * CurrentDE() const
Bool_t WriteData(const TString &outDir="data_run_out")
The class defines the electronics properties of detection element.
Int_t fNofManus
Total number of manus.
static TString StationDataDir(AliMp::StationType station, AliMq::Station12Type station12Type)
MpPair_t GetDetElemIdManu(Int_t manuSerial) const
Int_t GetManuSerial(Int_t detElemId, Int_t manuId) const
static Bool_t fgWarnIfDoublon
Option to warn about doublons.
The container class for manu serial numbers.
TString PlaneTypeName(AliMp::PlaneType planeType)
Return name for given planeType.
static AliMp::StationType GetStationType(Int_t detElemId)
Bool_t ReadManuSerial(const AliMpDataStreams &dataStreams)
Bool_t AddManu(Int_t detElemId, Int_t manuId, Int_t serialNb)
void ReplaceManu(Int_t detElemId, Int_t manuId, Int_t serialNb)
virtual ~AliMpManuStore()
static AliMpManuStore * fgInstance
Singleton instance.
Int_t PairFirst(MpPair_t pair)
Decode the first integer from encoded pair.
Int_t PairSecond(MpPair_t pair)
Decode the second integer from encoded pair.
ostream & PairPut(ostream &s, MpPair_t pair)
A special printing for encoded pair.
Int_t GetId() const
Return Id.
static Bool_t IsValidDetElemId(Int_t detElemId, Bool_t warn=false)
Bool_t GetReadFromFiles() const
TExMap fManuToSerialNbs
Map from manuId to serial #.
static Int_t ManuMask(AliMp::PlaneType planeType)
Mapping data streams provider.