54 #include <Riostream.h>
56 #include <TObjArray.h>
58 #include <TObjString.h>
77 static const TString kRevertKeyword =
"REVERT";
78 return kRevertKeyword;
85 static const TString kExplicitKeyword =
"EXPLICIT";
86 return kExplicitKeyword;
96 AliWarningClass(
"DDL Store has not been loaded");
111 AliWarningClass(
"DDL Store has been already loaded");
116 AliInfoClass(
"Reading DDL Store from ASCII files.");
129 fDDLs(fgkNofDDLs+fgkNofTriggerDDLs),
138 fDDLs.SetOwner(
true);
161 fRegionalTrigger(ioCtor)
207 pos = (manuId & manuMask)/100;
212 for (pos =
fManuList12[idx].GetSize()-1; pos >= 0; --pos)
231 while ( in.getline(line,255) ) {
233 if ( line[0] ==
'#' )
238 TObjArray* stringList = tmp.Tokenize(TString(
" "));
240 TString sDE = ((TObjString*)stringList->At(0))->GetString();
241 Int_t idDE = atoi(sDE.Data());
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());
256 AliErrorStream() <<
"DDL id "<< iDDL <<
" outside limits." << endl;
262 <<
"idDE " << idDE <<
" buspatch " << busPatch.Data() <<
" iDDL " << iDDL
268 TString sManu = ((TObjString*)stringList->At(3))->GetString();
272 TString sManuBridge = ((TObjString*)stringList->At(4))->GetString();
283 fDDLs.AddAt(ddl, iDDL);
287 TArrayI busPatchList;
295 for (Int_t i = 0; i < busPatchList.GetSize(); i++) {
303 for ( Int_t i=0; i<
fDDLs.GetEntriesFast(); i++ ) {
332 while ( ( crate = static_cast<AliMpTriggerCrate*>(next()) ) )
334 TString crateName = crate->GetName();
337 if (crateName.Contains(
"R"))
346 fDDLs.AddAt(ddl, iDDL);
348 crate->SetDdlId(iDDL);
358 for ( Int_t j=0; j<crate->GetNofLocalBoards(); ++j )
360 Int_t localBoardId = crate->GetLocalBoardId(j);
364 AliFatalClass(
"Cannot find local board.");
370 for ( Int_t k=0; k<localBoard->
GetNofDEs(); ++k )
373 Int_t deId = localBoard->
GetDEId(k);
393 for (Int_t iDDL = 0; iDDL <
fgkNofDDLs; ++iDDL) {
395 AliDebug(3, Form(
"DDL # %d\n", iDDL));
400 for (Int_t detElemIdx = 0; detElemIdx < ddl->
GetNofDEs(); ++detElemIdx) {
402 Int_t detElemId = ddl->
GetDEId(detElemIdx);
411 for ( Int_t cath = 0; cath < 2 ; ++cath ) {
421 for ( Int_t im = 0; im < manus.GetSize(); ++im ) {
431 detElement->
AddManu(manus[im]);
438 for (Int_t iEntry = 0; iEntry < manuList.GetEntries(); ++iEntry) {
446 AliError(Form(
"pos greater %d than size %d manuId %d detElemId %d \n",
458 busPatch->
AddManu(manuId+manuMask+1);
478 for (Int_t iEntry = 0; iEntry < busPatch->
GetNofManus(); ++iEntry)
501 while ( in.getline(line,255) ) {
503 if ( line[0] ==
'#' )
continue;
506 TObjArray* stringList = tmp.Tokenize(TString(
" "));
508 TString sKey = ((TObjString*)stringList->At(0))->GetString();
510 TString sDDL = ((TObjString*)stringList->At(1))->GetString();
514 TString sBusPatch = ((TObjString*)stringList->At(2))->GetString();
515 TArrayI busPatchList;
519 for (Int_t iDDL = 0; iDDL < ddlList.GetSize(); ++iDDL ) {
520 for (Int_t iBusPatch = 0; iBusPatch < busPatchList.GetSize(); ++iBusPatch) {
524 busPatchList.At(iBusPatch), ddlList.At(iDDL));
529 AliErrorStream() <<
"Bus patch " << busPatchID <<
" does not exist." << endl;
536 <<
"Reverting readout of bus patch " << busPatchID << endl;
539 busPatch->RevertReadout();
543 busPatch->ResetReadout();
545 TString sManus = ((TObjString*)stringList->At(3))->GetString();
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;
579 Bool_t result =
true;
587 Bool_t newResult =
false;
588 Int_t idDE = busPatch->
GetDEId();
594 result = result && newResult;
612 for (Int_t iDDL = 0; iDDL <
fgkNofDDLs; ++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] ==
'#');
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);
636 Int_t localDDLId = list[0];
637 Int_t frtId = list[1] - 1;
638 Int_t localBusId = list[2];
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));
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();
706 if ( ! ddl && warn ) {
708 <<
"DDL with Id = " << ddlId <<
" not defined." << endl;
719 AliFatal(
"DE Store has not been loaded.");
733 if ( ! busPatch && warn ) {
735 <<
"Bus patch with Id = " << busPatchId <<
" not defined." << endl;
760 if (ddlId == 0 || ddlId == 1)
785 <<
"Bus patch with Id = " << busPatchId <<
" not defined." << endl;
798 if ( ! localBoard ) {
800 <<
"Loacl board with Id = " << localBoardId <<
" not defined." << endl;
815 <<
"Bus patch with Id = " << busPatchId <<
" not defined." << endl;
834 <<
" for detElemId = " << detElemId
835 <<
" manuId = " << manuId << endl;
872 cout <<
"DE: " << de->
GetId() << endl;
878 cout <<
" busPatch: " << busPatch->
GetId() << endl;
881 for ( Int_t j=0; j<busPatch->
GetNofManus(); ++j ) {
882 cout << std::setw(6) << busPatch->
GetManuId(j) <<
" ";
887 cout <<
" Manu serial: ";
888 for ( Int_t k=0; k<busPatch->
GetNofManus(); ++k ) {
905 TString name(localBoard->GetName());
910 name.Replace(4,1,Form(
"%d", line));
927 TString name(localBoard->GetName());
932 name.Replace(4,1,Form(
"%d", line));
Int_t GetNofManus() const
void SetTranslatorLabel(TString label)
Set label of translator.
Bool_t HasTriggerCrateId(Int_t crateId) const
static AliMq::Station12Type GetStation12Type(Int_t detElemId)
Long_t GetLinkPortId(Int_t busPatchId) const
Bool_t ReadTrigger(const AliMpDataStreams &dataStreams)
printf("Chi2/npoints = %f\n", TMath::Sqrt(chi2/npoints))
Int_t GetFirst() const
Return first value.
The iterator over detection elements.
const AliMpVSegmentation * GetMpSegmentation(Int_t detElemId, AliMp::CathodType cath, Bool_t warn=true) const
AliMpLocalBoard * FindLocalBoard(Int_t localBoardId, Bool_t warn=true) const
TArrayI fManuBridge2[16]
Arrays of manu number before the bridge in buspatch.
void SetRegionalTrigger(const AliMpRegionalTrigger ®ionalTrigger)
Bool_t ReadData(const TString &fileName)
AliMpLocalBoard * GetLocalBoard(Int_t localBoardId, Bool_t warn=true) const
static MpPair_t GetLinkPortId(Int_t index)
static AliMpDEStore * Instance(Bool_t warn=true)
Int_t GetDEfromLocalBoard(Int_t localBoardId, Int_t chamberId) const
Int_t GetId() const
Return the identifier (unique)
The class defines the properties of trigger crate.
static AliMpSegmentation * Instance(Bool_t warn=true)
static TString Normalize(const char *line)
void SetCableLabel(TString label)
Set label of buspatch.
The top container class for DDLs, det elements and bus patched.
TObjArray fDDLs
Array of DDL objects.
static const Int_t fgkNofDDLs
Total number of DDLs.
Bool_t ReadDDLs(const AliMpDataStreams &dataStreams)
Bool_t AddTriggerCrate(Int_t crateId)
static AliMpSegmentation * ReadData(const AliMpDataStreams &dataStreams, Bool_t warn=true)
Int_t GetDEfromBus(Int_t busPatchId) const
TIterator * CreateBusPatchIterator() const
Int_t GetPreviousDEfromLocalBoard(Int_t localBoardId, Int_t chamberId) const
Int_t GetDEId() const
Return the Detection element Id.
AliMpDetElement * GetDetElement(Int_t detElemId, Bool_t warn=true) const
AliMpDDLStore()
Not implemented.
AliMpDetElement * CurrentDE() const
AliMpDetElement * GetDetElement(Int_t detElemId, Bool_t warn=true) const
Int_t GetManuId(Int_t index) const
static AliMpManuStore * Instance(Bool_t warn=true)
Class that manages the properties of the local board.
Bool_t HasFrtId(Int_t frtId) const
The class defines the electronics properties of detection element.
AliMpRegionalTrigger fRegionalTrigger
Regional trigger.
static TString BusPatchSpecialFilePath()
Int_t GetDEId(Int_t index) const
Bool_t ReadBusPatchSpecial(const AliMpDataStreams &dataStreams)
The class defined electronics properties of DDL.
TIterator * CreateLocalBoardIterator() const
Bool_t AddFrt(Int_t frtId)
Bool_t AddBusPatch(Int_t busPatchId)
static AliMpDDLStore * Instance(Bool_t warn=true)
void SetDdlId(Int_t ddlId)
Set DDL Id.
static Int_t GetChamberId(Int_t detElemId, Bool_t warn=true)
AliMpExMap fBusPatches
The map of bus patches per their IDs.
Int_t GetNofBusPatches() const
static Int_t GetGlobalBusID(Int_t localID, Int_t ddlID)
Int_t GetBusPatchId(Int_t detElemId, Int_t manuId) const
static Int_t GetNofBusPatches()
Int_t GetManuSerial(Int_t detElemId, Int_t manuId) const
Int_t GetBusPatchIndex(Int_t detElemId, Int_t manuId) const
static TString GenerateName(Int_t crateId, Int_t ddlId, Int_t nodDdls)
AliMpDDL * GetDDL(Int_t ddlId, Bool_t warn=true) const
Int_t GetId() const
Return the unique Id.
Bool_t SetNofManusPerModule(Int_t manuNumber=0)
Int_t GetDEId(Int_t index) const
static AliMpDDLStore * fgInstance
Singleton instance.
Int_t GetNextDEfromLocalBoard(Int_t localBoardId, Int_t chamberId) const
MpPair_t GetPosition() const
given position (line, col)
void SetCableLength(Float_t length)
Set length of buspatch.
static const TString & GetExplicitKeyword()
static AliMp::StationType GetStationType(Int_t detElemId)
AliMp::PlaneType GetPlaneType(AliMp::CathodType cath) const
Int_t GetDEIdByChamber(Int_t chamberId) const
AliMpBusPatch * GetBusPatch(Int_t busPatchId, Bool_t warn=true) const
AliMpTriggerCrate * FindTriggerCrate(TString crateName, Bool_t warn=true) const
TObject * GetValue(Int_t keyFirst, Int_t keySecond) const
Int_t GetDdlId() const
Return the Ddl Id.
Int_t GetId() const
Return the unique Id.
static AliMpDDLStore * ReadData(const AliMpDataStreams &dataStreams, Bool_t warn=true)
static TString BusPatchInfoFilePath()
AliMp::CathodType GetCathodType(Int_t cathodNumber)
Convert integer number in enum;.
The class defines the properties of regional trigger crate.
Bool_t HasDEId(Int_t detElemId) const
void Add(Int_t keyFirst, Int_t keySecond, TObject *object)
static const TString & GetRevertKeyword()
Int_t GetDdlId() const
Return DDL Id.
void SetOwner(Bool_t owner)
static Int_t GetLocalBusID(Int_t globalID, Int_t ddlID)
Int_t GetNofBusPatches() const
The class defines the properties of BusPatch.
TArrayI fManuList12[16]
Arrays of 1st manu in bus.
AliMpTriggerCrate * GetTriggerCrate(TString crateName, Bool_t warn=true) const
The abstract base class for the segmentation.
Bool_t AddDE(Int_t detElemId)
Int_t GetBusPatchId(Int_t index) const
Int_t PairFirst(MpPair_t pair)
Decode the first integer from encoded pair.
void SetFrtId(Int_t id)
Set FRT id for buspatch.
Int_t GetManuListIndex(Int_t detElemId) const
void PrintAllManu() const
Print info of all manus.
static AliMpDetElement * GetDetElement(Int_t detElemId, Bool_t warn=true)
Int_t GetBusPatchId(Int_t index) const
Bool_t ReadBusPatchInfo(const AliMpDataStreams &dataStreams)
Int_t GetSecond() const
Return second value.
Int_t GetLocalBoardId(TString name) const
Bool_t AddManu(Int_t manuId)
void AddManu(Int_t manuId)
TIterator * CreateCrateIterator() const
Int_t GetId() const
Return Id.
static Bool_t IsValidDetElemId(Int_t detElemId, Bool_t warn=false)
Int_t GetDDLfromBus(Int_t busPatchId) const
Bool_t GetReadFromFiles() const
static Int_t ManuMask(AliMp::PlaneType planeType)
AliMpExMapIterator * CreateIterator() const
Mapping data streams provider.
static void DecodeName(const char *manus, char sep, TArrayI &theList)
virtual void GetAllElectronicCardIDs(TArrayI &ecn) const =0
Fill the given array with the electronic card IDs.
Int_t GetNofTriggerCrates() const
static TString BusPatchFilePath()