1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
7 * Permission to use, copy, modify and distribute this software and its *
8 * documentation strictly for non-commercial purposes is hereby granted *
9 * without fee, provided that the above copyright notice appears in all *
10 * copies and that both the copyright notice and this permission notice *
11 * appear in the supporting documentation. The authors make no claims *
12 * about the suitability of this software for any purpose. It is *
13 * provided "as is" without express or implied warranty. *
14 **************************************************************************/
17 // $MpId: AliMpDDLStore.cxx,v 1.4 2006/05/24 13:58:34 ivana Exp $
18 // Category: management
20 //-----------------------------------------------------------------------------
21 // Class AliMpDDLStore
22 // --------------------
23 // The top container class for DDLs, det elements and bus patched
24 // It provides acces to DDL, det element and bus patches objects
25 // via various characteristics.
26 // Authors: Ivana Hrivnacova, IPN Orsay
27 // Christian Finck, SUBATECH Nantes
28 //-----------------------------------------------------------------------------
31 #include "AliMpDDLStore.h"
32 #include "AliMpExMapIterator.h"
33 #include "AliMpConstants.h"
34 #include "AliMpDEStore.h"
35 #include "AliMpFrtCrocusConstants.h"
37 #include "AliMpFiles.h"
38 #include "AliMpDataStreams.h"
39 #include "AliMpHelper.h"
40 #include "AliMpDEManager.h"
41 #include "AliMpManuStore.h"
42 #include "AliMpDetElement.h"
43 #include "AliMpBusPatch.h"
44 #include "AliMpTriggerCrate.h"
45 #include "AliMpLocalBoard.h"
46 #include "AliMpSegmentation.h"
47 #include "AliMpVSegmentation.h"
48 #include "AliMpStringObjMap.h"
49 #include "AliMpEncodePair.h"
50 #include "AliMpIntPair.h"
54 #include <Riostream.h>
56 #include <TObjArray.h>
58 #include <TObjString.h>
62 ClassImp(AliMpDDLStore)
65 AliMpDDLStore* AliMpDDLStore::fgInstance = 0;
66 const Int_t AliMpDDLStore::fgkNofDDLs = 20;
67 const Int_t AliMpDDLStore::fgkNofTriggerDDLs = 2;
73 //______________________________________________________________________________
74 const TString& AliMpDDLStore::GetRevertKeyword()
76 /// A keyword for ReadBusPatchSpecial()
77 static const TString kRevertKeyword = "REVERT";
78 return kRevertKeyword;
81 //______________________________________________________________________________
82 const TString& AliMpDDLStore::GetExplicitKeyword()
84 /// A keyword for ReadBusPatchSpecial()
85 static const TString kExplicitKeyword = "EXPLICIT";
86 return kExplicitKeyword;
89 //______________________________________________________________________________
90 AliMpDDLStore* AliMpDDLStore::Instance(Bool_t warn)
92 /// Create the DDL store if it does not yet exist
93 /// and return its instance
95 if ( ! fgInstance && warn ) {
96 AliWarningClass("DDL Store has not been loaded");
102 //______________________________________________________________________________
103 AliMpDDLStore* AliMpDDLStore::ReadData(const AliMpDataStreams& dataStreams,
106 /// Load the DDL store from ASCII data files
107 /// and return its instance
111 AliWarningClass("DDL Store has been already loaded");
115 if ( dataStreams.GetReadFromFiles() )
116 AliInfoClass("Reading DDL Store from ASCII files.");
118 fgInstance = new AliMpDDLStore(dataStreams);
126 //______________________________________________________________________________
127 AliMpDDLStore::AliMpDDLStore(const AliMpDataStreams& dataStreams)
129 fDDLs(fgkNofDDLs+fgkNofTriggerDDLs), // FIXEME
135 /// Standard constructor
138 fDDLs.SetOwner(true);
139 fBusPatches.SetOwner(true);
140 fBusPatches.SetSize(900);
142 // Load segmentation & DE store data
143 if ( ! AliMpSegmentation::Instance(false) )
144 AliMpSegmentation::ReadData(dataStreams, true);
146 // Create all detection elements
147 ReadDDLs(dataStreams);
148 ReadTrigger(dataStreams);
151 ReadBusPatchSpecial(dataStreams);
153 ReadBusPatchInfo(dataStreams);
156 //______________________________________________________________________________
157 AliMpDDLStore::AliMpDDLStore(TRootIOCtor* ioCtor)
161 fRegionalTrigger(ioCtor)
163 /// Constructor for I0
171 //______________________________________________________________________________
172 AliMpDDLStore::~AliMpDDLStore()
178 // DDL objects are deleted with fDDLs
179 // Bus patches objects are deleted with fBusPatches
188 //______________________________________________________________________________
189 Int_t AliMpDDLStore::GetManuListIndex(Int_t detElemId) const
191 /// Return the index of the manu list for given detElemId
193 return AliMpDEManager::GetChamberId(detElemId)*4 + (detElemId % 100);
197 //______________________________________________________________________________
198 Int_t AliMpDDLStore::GetBusPatchIndex(Int_t detElemId, Int_t manuId) const
200 /// Calculate the index of the buspatch from manuId
203 AliMp::StationType stationType = AliMpDEManager::GetStationType(detElemId);
204 static Int_t manuMask = AliMpConstants::ManuMask(AliMp::kNonBendingPlane) - 1;
206 if( stationType == AliMp::kStation345) {
207 pos = (manuId & manuMask)/100;
209 Int_t idx = GetManuListIndex(detElemId);
211 // using array defined from DetElemIdToBusPatch.dat file
212 for (pos = fManuList12[idx].GetSize()-1; pos >= 0; --pos)
213 if ( manuId >= fManuList12[idx].At(pos))
220 //______________________________________________________________________________
221 Bool_t AliMpDDLStore::ReadDDLs(const AliMpDataStreams& dataStreams)
223 /// Read ddl <-> bus patch file
227 CreateDataStream(AliMpFiles::BusPatchFilePath());
231 while ( in.getline(line,255) ) {
233 if ( line[0] == '#' )
236 TString tmp(AliMpHelper::Normalize(line));
238 TObjArray* stringList = tmp.Tokenize(TString(" "));
240 TString sDE = ((TObjString*)stringList->At(0))->GetString();
241 Int_t idDE = atoi(sDE.Data());
243 if ( ! AliMpDEManager::IsValidDetElemId(idDE, false) ) {
244 AliErrorStream() << "DetElemId "<< idDE << " not valid." << endl;
249 TString busPatch = ((TObjString*)stringList->At(1))->GetString();
252 TString sDDL = ((TObjString*)stringList->At(2))->GetString();
253 Int_t iDDL = atoi(sDDL.Data());
255 if ( iDDL < 0 || iDDL >= fgkNofDDLs ) {
256 AliErrorStream() << "DDL id "<< iDDL << " outside limits." << endl;
262 << "idDE " << idDE << " buspatch " << busPatch.Data() << " iDDL " << iDDL
265 // reading 1st manu Id for each bus patch (station 1 & 2)
266 if(AliMpDEManager::GetStationType(idDE) != AliMp::kStation345) {
268 TString sManu = ((TObjString*)stringList->At(3))->GetString();
269 AliMpHelper::DecodeName(sManu,',',fManuList12[GetManuListIndex(idDE)]);
271 if(AliMpDEManager::GetStation12Type(idDE) == AliMq::kStation2) {
272 TString sManuBridge = ((TObjString*)stringList->At(4))->GetString();
273 AliMpHelper::DecodeName(sManuBridge,',',fManuBridge2[GetManuListIndex(idDE)]);
280 AliMpDDL* ddl = GetDDL(iDDL, false);
282 ddl = new AliMpDDL(iDDL);
283 fDDLs.AddAt(ddl, iDDL);
287 TArrayI busPatchList;
288 // decoding range of buspatch
289 AliMpHelper::DecodeName(busPatch,';',busPatchList);
292 AliMpDetElement* de = AliMpDEManager::GetDetElement(idDE);
294 // filling buspatch -> idDE
295 for (Int_t i = 0; i < busPatchList.GetSize(); i++) {
296 fBusPatches.Add(busPatchList[i],
297 new AliMpBusPatch(busPatchList[i], idDE, iDDL));
298 de->AddBusPatch(busPatchList[i]);
302 // Fill bus patch Ids array in DDLs now
303 for ( Int_t i=0; i<fDDLs.GetEntriesFast(); i++ ) {
304 AliMpDDL* ddl = (AliMpDDL*) fDDLs.At(i);
305 ddl->FillBusPatchIds();
312 //______________________________________________________________________________
313 Bool_t AliMpDDLStore::ReadTrigger(const AliMpDataStreams& dataStreams)
315 /// create trigger DDL object and Global crate object
317 if ( ! fRegionalTrigger.ReadData(dataStreams) ) return false;
322 //______________________________________________________________________________
324 AliMpDDLStore::SetTriggerDDLs()
326 /// Create trigger DDLs and set DDL Ids in the regional trigger
329 TIter next(fRegionalTrigger.CreateCrateIterator());
330 AliMpTriggerCrate* crate;
332 while ( ( crate = static_cast<AliMpTriggerCrate*>(next()) ) )
334 TString crateName = crate->GetName();
336 // determine ddl number vs crate side
337 if (crateName.Contains("R"))
338 iDDL = fgkNofDDLs; // starts where tracker ends
340 iDDL = fgkNofDDLs + 1;
342 // Create DDL if it does not yet exist and set it to the crate
343 AliMpDDL* ddl = (AliMpDDL*)fDDLs.At(iDDL);
345 ddl = new AliMpDDL(iDDL);
346 fDDLs.AddAt(ddl, iDDL);
348 crate->SetDdlId(iDDL);
351 // Add trigger crate number for given ddl if not present
352 if ( !ddl->HasTriggerCrateId(crate->GetId()) )
353 ddl->AddTriggerCrate(crate->GetId());
356 // Loop over local boards in this crate
358 for ( Int_t j=0; j<crate->GetNofLocalBoards(); ++j )
360 Int_t localBoardId = crate->GetLocalBoardId(j);
361 AliMpLocalBoard* localBoard
362 = fRegionalTrigger.FindLocalBoard(localBoardId);
364 AliFatalClass("Cannot find local board.");
368 // Loop over DEs in this localBoard
370 for ( Int_t k=0; k<localBoard->GetNofDEs(); ++k )
373 Int_t deId = localBoard->GetDEId(k);
374 AliMpDetElement* de = AliMpDEManager::GetDetElement(deId);
376 if ( de->GetDdlId() == -1 ) de->SetDdlId(iDDL);
378 if ( ! ddl->HasDEId(deId) ) ddl->AddDE(deId);
385 //______________________________________________________________________________
386 Bool_t AliMpDDLStore::SetManus()
388 /// Set manus for each bus patch
390 Int_t manuMask = AliMpConstants::ManuMask(AliMp::kNonBendingPlane) - 1;
393 for (Int_t iDDL = 0; iDDL < fgkNofDDLs; ++iDDL) {
395 AliDebug(3, Form("DDL # %d\n", iDDL));
397 AliMpDDL* ddl = GetDDL(iDDL);
399 // loop over DE in the given DDL
400 for (Int_t detElemIdx = 0; detElemIdx < ddl->GetNofDEs(); ++detElemIdx) {
402 Int_t detElemId = ddl->GetDEId(detElemIdx);
404 AliMpDetElement* detElement = GetDetElement(detElemId);
406 AliMp::StationType stationType = AliMpDEManager::GetStationType(detElemId);
409 // list of manu per DE on both cathode
411 for ( Int_t cath = 0; cath < 2 ; ++cath ) {
412 const AliMpVSegmentation* seg
413 = AliMpSegmentation::Instance()->GetMpSegmentation(detElemId,AliMp::GetCathodType(cath));
415 AliMp::PlaneType planeType = detElement->GetPlaneType(AliMp::GetCathodType(cath));
418 seg->GetAllElectronicCardIDs(manus);
420 // filling TList manu
421 for ( Int_t im = 0; im < manus.GetSize(); ++im ) {
423 AliMpIntPair* manu = 0x0;
424 if( stationType == AliMp::kStation345)
425 manu = new AliMpIntPair((manus[im] & manuMask), planeType, kTRUE); //remove offset for NB
427 manu = new AliMpIntPair(manus[im], planeType, kTRUE); //keep offset for NB
431 detElement->AddManu(manus[im]);
435 manuList.Sort(); // sort regardless B or NB plane
437 // filling manu to the corresponding buspatch
438 for (Int_t iEntry = 0; iEntry < manuList.GetEntries(); ++iEntry) {
440 AliMpIntPair* manuPtr = (AliMpIntPair*)manuList.At(iEntry);
442 Int_t manuId = manuPtr->GetFirst();
443 Int_t pos = GetBusPatchIndex(detElemId, manuId);
445 if (pos > detElement->GetNofBusPatches()) {
446 AliError(Form("pos greater %d than size %d manuId %d detElemId %d \n",
447 pos, detElement->GetNofBusPatches(), manuId, detElemId));
451 // get buspatch and fill manus
452 Int_t busPatchId = detElement->GetBusPatchId(pos);
453 AliMpBusPatch* busPatch = GetBusPatch(busPatchId);
455 if( stationType == AliMp::kStation345) {
457 if (manuPtr->GetSecond())
458 busPatch->AddManu(manuId+manuMask+1); // add offset again after sorted
460 busPatch->AddManu(manuId);
464 busPatch->AddManu(manuId);
471 if (AliDebugLevel() == 3) {
473 // print out for checking
474 for(Int_t pos = 0; pos < detElement->GetNofBusPatches(); ++pos) {
475 Int_t busPatchId = detElement->GetBusPatchId(pos);
476 AliMpBusPatch* busPatch = GetBusPatch(busPatchId);
477 printf("BusPatch: %d\n", busPatch->GetId());
478 for (Int_t iEntry = 0; iEntry < busPatch->GetNofManus(); ++iEntry)
479 printf("manu Id: %d\n", busPatch->GetManuId(iEntry));
483 } // detection element loop
489 //______________________________________________________________________________
490 Bool_t AliMpDDLStore::ReadBusPatchSpecial(const AliMpDataStreams& dataStreams)
492 /// Read file with bus patches with a special order of manus
493 /// and reset the manus arrays filled via SetManu function
497 CreateDataStream(AliMpFiles::BusPatchSpecialFilePath());
501 while ( in.getline(line,255) ) {
503 if ( line[0] == '#' ) continue;
505 TString tmp(AliMpHelper::Normalize(line));
506 TObjArray* stringList = tmp.Tokenize(TString(" "));
508 TString sKey = ((TObjString*)stringList->At(0))->GetString();
510 TString sDDL = ((TObjString*)stringList->At(1))->GetString();
512 AliMpHelper::DecodeName(sDDL,';',ddlList);
514 TString sBusPatch = ((TObjString*)stringList->At(2))->GetString();
515 TArrayI busPatchList;
516 AliMpHelper::DecodeName(sBusPatch,',',busPatchList);
518 // Loop over DDL and Bus Patch
519 for (Int_t iDDL = 0; iDDL < ddlList.GetSize(); ++iDDL ) {
520 for (Int_t iBusPatch = 0; iBusPatch < busPatchList.GetSize(); ++iBusPatch) {
521 // Global bus patch ID
523 = AliMpBusPatch::GetGlobalBusID(
524 busPatchList.At(iBusPatch), ddlList.At(iDDL));
526 // Get this bus patch
527 AliMpBusPatch* busPatch = GetBusPatch(busPatchID);
529 AliErrorStream() << "Bus patch " << busPatchID << " does not exist." << endl;
534 if ( sKey == GetRevertKeyword() ) {
536 << "Reverting readout of bus patch " << busPatchID << endl;
538 // Now revert the manus in this bus patch
539 busPatch->RevertReadout();
541 else if ( sKey == GetExplicitKeyword() ) {
543 busPatch->ResetReadout();
545 TString sManus = ((TObjString*)stringList->At(3))->GetString();
547 AliMpHelper::DecodeName(sManus,',',manuList);
550 << "Reseting readout of bus patch " << busPatchID
551 << " manus: " << sManus.Data() << endl;
553 for (Int_t i = 0; i < manuList.GetSize(); i++) {
554 busPatch->AddManu(manuList.At(i));
558 AliErrorStream() << "Unrecognized key." << endl;
573 //______________________________________________________________________________
574 Bool_t AliMpDDLStore::SetPatchModules()
576 /// Compute the number of manu per PCB for each buspatch
579 Bool_t result = true;
581 for ( it.First(); !it.IsDone(); it.Next() ) {
583 AliMpDetElement* detElement = it.CurrentDE();
585 for (Int_t i = 0; i < detElement->GetNofBusPatches(); ++i) {
586 AliMpBusPatch* busPatch = GetBusPatch(detElement->GetBusPatchId(i));
587 Bool_t newResult = false;
588 Int_t idDE = busPatch->GetDEId();
590 if (AliMpDEManager::GetStation12Type(idDE) == AliMq::kStation2 )
591 newResult = busPatch->SetNofManusPerModule(fManuBridge2[GetManuListIndex(idDE)].At(i));
593 newResult = busPatch->SetNofManusPerModule();
594 result = result && newResult;
601 //______________________________________________________________________________
602 Bool_t AliMpDDLStore::ReadBusPatchInfo(const AliMpDataStreams& dataStreams)
604 /// read the buspatch info file and set buspatch info
608 CreateDataStream(AliMpFiles::BusPatchInfoFilePath());
612 for (Int_t iDDL = 0; iDDL < fgkNofDDLs; ++iDDL ) {
613 AliMpDDL* ddl = GetDDL(iDDL);
615 for (Int_t iBusPatch = 0; iBusPatch < ddl->GetNofBusPatches(); ++iBusPatch) {
618 if (!in.getline(line,255)) {
619 AliWarning(Form("Wrong size in bus patch length file; index %d DDL %d",
623 } while(line[0] == '#');
625 TString tmp(AliMpHelper::Normalize(line));
627 TObjArray* stringList = tmp.Tokenize(TString(" "));
630 TString crLabel = ((TObjString*)stringList->At(0))->GetString();
631 Int_t pos = crLabel.First('-');
632 tmp = crLabel(pos-2, crLabel.Length()-pos+2);
634 AliMpHelper::DecodeName(tmp.Data(), '-', list);
636 Int_t localDDLId = list[0];
637 Int_t frtId = list[1] - 1; // begin at zero !
638 Int_t localBusId = list[2];
640 // Add FRT number for given ddl if not present
641 if ( !ddl->HasFrtId(frtId) )
644 // BP & translator label
645 TString label = ((TObjString*)stringList->At(1))->GetString();
646 TString transLabel = ((TObjString*)stringList->At(2))->GetString();
649 TString sLength = ((TObjString*)stringList->At(3))->GetString();
650 Float_t length = sLength.Atof();
654 if (localBusId != iBusPatch + 1)
655 AliWarning(Form("Wrong local buspatch id %d instead of %d", iBusPatch+1, localBusId));
657 if(localDDLId != ddl->GetId()+1)
658 AliWarning(Form("Wrong local DDL id %d instead of %d", ddl->GetId()+1, localDDLId));
660 Int_t busPatchId = ddl->GetBusPatchId(iBusPatch);
661 AliMpBusPatch* busPatch = GetBusPatch(busPatchId);
662 busPatch->SetCableLength(length);
663 busPatch->SetCableLabel(label);
664 busPatch->SetTranslatorLabel(transLabel);
665 busPatch->SetFrtId(frtId);
676 //________________________________________________________________
677 Int_t AliMpDDLStore::GetLocalBoardId(TString name) const {
678 /// return the first board with a given side and line
680 TIter next(fRegionalTrigger.CreateLocalBoardIterator());
681 AliMpLocalBoard* local;
683 while ( ( local = static_cast<AliMpLocalBoard*>(next()) ) )
685 TString tmp(&local->GetName()[4], 2);
686 if (name.Contains(tmp))
687 if (name[0] == local->GetName()[0])
688 return local->GetId();
699 //______________________________________________________________________________
700 AliMpDDL* AliMpDDLStore::GetDDL(Int_t ddlId, Bool_t warn) const {
701 /// Return DDL for given ddlId
704 = (AliMpDDL*)fDDLs.At(ddlId);
706 if ( ! ddl && warn ) {
708 << "DDL with Id = " << ddlId << " not defined." << endl;
714 //______________________________________________________________________________
715 AliMpDetElement* AliMpDDLStore::GetDetElement(Int_t detElemId, Bool_t warn) const {
716 /// Return detection element with given detElemId
718 if ( ! AliMpDEStore::Instance() ) {
719 AliFatal("DE Store has not been loaded.");
723 return AliMpDEStore::Instance()->GetDetElement(detElemId, warn);
726 //______________________________________________________________________________
727 AliMpBusPatch* AliMpDDLStore::GetBusPatch(Int_t busPatchId, Bool_t warn) const {
728 /// Return bus patch with given Id
730 AliMpBusPatch* busPatch
731 = (AliMpBusPatch*) fBusPatches.GetValue(busPatchId);
733 if ( ! busPatch && warn ) {
735 << "Bus patch with Id = " << busPatchId << " not defined." << endl;
742 //______________________________________________________________________________
743 AliMpLocalBoard* AliMpDDLStore::GetLocalBoard(Int_t localBoardId, Bool_t warn) const {
744 /// Return bus patch with given Id
746 return fRegionalTrigger.FindLocalBoard(localBoardId, warn);
749 //______________________________________________________________________________
750 AliMpTriggerCrate* AliMpDDLStore::GetTriggerCrate(TString name, Bool_t warn) const {
751 /// Return trigger crate with given name
753 return fRegionalTrigger.FindTriggerCrate(name, warn);
756 //______________________________________________________________________________
757 AliMpTriggerCrate* AliMpDDLStore::GetTriggerCrate(Int_t ddlId, Int_t index, Bool_t warn) const {
758 /// Return trigger crate with given ddl and index crate
760 if (ddlId == 0 || ddlId == 1)
763 AliMpDDL* ddl = GetDDL(ddlId, warn);
767 if ( index >= ddl->GetNofTriggerCrates() ) {
768 AliError(Form("crate id %d greater than array[%d]", index, ddl->GetNofTriggerCrates()));
772 TString name = AliMpTriggerCrate::GenerateName(index, ddlId, fgkNofDDLs);
774 return GetTriggerCrate(name, warn);
777 //______________________________________________________________________________
778 Int_t AliMpDDLStore::GetDEfromBus(Int_t busPatchId) const {
779 /// Return detection element Id for given busPatchId
781 AliMpBusPatch* busPatch = GetBusPatch(busPatchId);
785 << "Bus patch with Id = " << busPatchId << " not defined." << endl;
789 return busPatch->GetDEId();
792 //______________________________________________________________________________
793 Int_t AliMpDDLStore::GetDEfromLocalBoard(Int_t localBoardId, Int_t chamberId) const {
794 /// Return detElemId for local board Id and chamber id.
796 AliMpLocalBoard* localBoard = GetLocalBoard(localBoardId);
798 if ( ! localBoard ) {
800 << "Loacl board with Id = " << localBoardId << " not defined." << endl;
804 return localBoard->GetDEIdByChamber(chamberId);
807 //______________________________________________________________________________
808 Int_t AliMpDDLStore::GetDDLfromBus(Int_t busPatchId) const {
809 /// Return DDL Id for given busPatchId
811 AliMpBusPatch* busPatch = GetBusPatch(busPatchId);
815 << "Bus patch with Id = " << busPatchId << " not defined." << endl;
819 return busPatch->GetDdlId();
822 //______________________________________________________________________________
823 Int_t AliMpDDLStore::GetBusPatchId(Int_t detElemId, Int_t manuId) const {
824 /// Return bus patch for a given manuId
826 AliMpDetElement* detElement = GetDetElement(detElemId);
827 Int_t pos = GetBusPatchIndex(detElemId, manuId);
829 if ( pos >= detElement->GetNofBusPatches() )
833 << " greater than the size = " << detElement->GetNofBusPatches()
834 << " for detElemId = " << detElemId
835 << " manuId = " << manuId << endl;
839 return detElement->GetBusPatchId(pos);
843 //______________________________________________________________________________
844 Long_t AliMpDDLStore::GetLinkPortId(Int_t busPatchId) const {
846 /// Get link port and DSP from busPatch id.
847 /// Return -1 if the value is not valid
848 /// (the validity has to be tested in the client code)
850 AliMpBusPatch* busPatch = GetBusPatch(busPatchId);
851 Int_t ddlId = busPatch->GetDdlId();
853 Int_t localBusPatchId = AliMpBusPatch::GetLocalBusID(busPatchId, ddlId) - 1; // begin at zero
855 Int_t pos = (localBusPatchId % AliMpFrtCrocusConstants::GetNofBusPatches());
857 return AliMpFrtCrocusConstants::GetLinkPortId(pos);
861 //______________________________________________________________________________
862 void AliMpDDLStore::PrintAllManu() const {
863 /// Print all manu Ids and their serial numbers sorted by detection element
864 /// and bus patch. \n
865 /// As serial manu numbers are filled in a different way than manu Ids this
866 /// printing allows to check that both ways are consistent
870 for ( it.First(); ! it.IsDone(); it.Next() ) {
871 AliMpDetElement* de = it.CurrentDE();
872 cout << "DE: " << de->GetId() << endl;
874 // Loop over bus patches in this DE
875 for ( Int_t i=0; i< de->GetNofBusPatches(); ++i ) {
877 AliMpBusPatch* busPatch = GetBusPatch(de->GetBusPatchId(i));
878 cout << " busPatch: " << busPatch->GetId() << endl;
881 for ( Int_t j=0; j<busPatch->GetNofManus(); ++j ) {
882 cout << std::setw(6) << busPatch->GetManuId(j) << " ";
886 if ( AliMpManuStore::Instance(kFALSE) ) {
887 cout << " Manu serial: ";
888 for ( Int_t k=0; k<busPatch->GetNofManus(); ++k ) {
890 << AliMpManuStore::Instance()
891 ->GetManuSerial(de->GetId(), busPatch->GetManuId(k)) << " ";
899 //______________________________________________________________________________
900 Int_t AliMpDDLStore::GetNextDEfromLocalBoard(Int_t localBoardId, Int_t chamberId ) const {
901 /// return the next detection element in line
903 AliMpLocalBoard* localBoard = GetLocalBoard(localBoardId);
905 TString name(localBoard->GetName());
907 Int_t line = AliMp::PairFirst(localBoard->GetPosition());
910 name.Replace(4,1,Form("%d", line));
913 if ((nextLocalId = GetLocalBoardId(name)))
914 return GetDEfromLocalBoard(nextLocalId, chamberId);
921 //______________________________________________________________________________
922 Int_t AliMpDDLStore::GetPreviousDEfromLocalBoard(Int_t localBoardId, Int_t chamberId) const {
923 /// return the previous detection element in line
925 AliMpLocalBoard* localBoard = GetLocalBoard(localBoardId);
927 TString name(localBoard->GetName());
929 Int_t line = AliMp::PairFirst(localBoard->GetPosition());
932 name.Replace(4,1,Form("%d", line));
935 if ((prevLocalId = GetLocalBoardId(name)))
936 return GetDEfromLocalBoard(prevLocalId, chamberId);
942 //______________________________________________________________________________
943 void AliMpDDLStore::SetRegionalTrigger(const AliMpRegionalTrigger& regionalTrigger)
945 /// Replace the existing regional trigger with the given one
947 fRegionalTrigger = regionalTrigger;
949 // Remove the existing trigger DDLsf
950 fDDLs.RemoveAt(fgkNofDDLs+1);
951 fDDLs.RemoveAt(fgkNofDDLs);
953 // Set new trigger DDLs from new regional trigger
958 //______________________________________________________________________________
960 AliMpDDLStore::CreateBusPatchIterator() const
962 /// Create the iterator over bus patches
964 return fBusPatches.CreateIterator();