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 **************************************************************************/
18 #include "AliMUONTriggerIO.h"
22 #include "AliMpHelper.h"
23 #include "AliMpConstants.h"
24 #include "AliMpFiles.h"
25 #include "AliMpDDLStore.h"
26 #include "AliMpLocalBoard.h"
27 #include "AliMpTriggerCrate.h"
28 #include "AliMUONTriggerLut.h"
29 #include "AliMUONCalibParamNI.h"
30 #include "AliMUONVStore.h"
33 #include <Riostream.h>
36 /// \class AliMUONTriggerIO
38 /// Handles read/write of masks and LUT to/from online files,
39 /// to be used by Shuttle and Trigger DA.
41 /// \author Laurent Aphecetche, Christian Finck Subatech
42 /// \author Bogdan Vulpescu, LPC Clermont-Ferrand
45 ClassImp(AliMUONTriggerIO)
48 //_____________________________________________________________________________
49 AliMUONTriggerIO::AliMUONTriggerIO()
59 fTriggerCrates.SetOwner(true);
60 fTriggerCrates.SetSize(AliMpConstants::LocalBoardNofChannels());
62 fLocalBoards.SetOwner(true);
63 fLocalBoards.SetSize(AliMpConstants::NofLocalBoards()+8); // included non-notified board FIXEME should be put in AliMpConstants
66 //_____________________________________________________________________________
67 AliMUONTriggerIO::AliMUONTriggerIO(const char* regionalFileToRead)
76 ReadRegional(regionalFileToRead,0);
79 //_____________________________________________________________________________
80 AliMUONTriggerIO::~AliMUONTriggerIO()
85 //_____________________________________________________________________________
87 AliMUONTriggerIO::DeCompAddress(UChar_t &ypos, UChar_t &ytri, UChar_t &xdev, UChar_t &xpos,
88 UShort_t address) const
90 /// decompose the 15-bits address
95 // UChar_t bitsXpos = 5;
97 UShort_t maskYpos = 0x000F; // ...0 00001111
98 UShort_t maskYtri = 0x0001; // ...0 00000001
99 UShort_t maskXdev = 0x001F; // ...0 00011111
100 UShort_t maskXpos = 0x001F; // ...0 00011111
102 ypos = address & maskYpos;
103 ytri = (address >> bitsYpos) & maskYtri;
104 xdev = (address >> (bitsYpos+bitsYtri)) & maskXdev;
105 xpos = (address >> (bitsYpos+bitsYtri+bitsXdev)) & maskXpos;
108 //_____________________________________________________________________________
110 AliMUONTriggerIO::FillLut(AliMUONTriggerLut& lut,
111 Int_t icirc, UChar_t istripX, UChar_t idev,
112 Int_t lutLpt[16][2], Int_t lutHpt[16][2])
114 /// Fill the LUT histograms
116 if (icirc == 0 && istripX == 0 && idev == 0)
118 AliDebug(1,"Copy board, not filled ...");
122 Short_t iLptPlus, iLptMinu, iLptUnde;
123 Short_t iHptPlus, iHptMinu, iHptUnde;
125 iLptPlus = iLptMinu = iLptUnde = 0;
126 iHptPlus = iHptMinu = iHptUnde = 0;
128 for (Int_t istripY=0; istripY<16; istripY++)
130 if (lutLpt[istripY][1] == 0 && lutLpt[istripY][0] ==1)
131 iLptMinu=iLptMinu+(1 << istripY);
132 if (lutLpt[istripY][1] == 1 && lutLpt[istripY][0] ==0)
133 iLptPlus=iLptPlus+(1 << istripY);
134 if (lutLpt[istripY][1] == 1 && lutLpt[istripY][0] ==1)
135 iLptUnde=iLptUnde+(1 << istripY);
137 if (lutHpt[istripY][1] == 0 && lutHpt[istripY][0] ==1)
138 iHptMinu=iHptMinu+(1 << istripY);
139 if (lutHpt[istripY][1] == 1 && lutHpt[istripY][0] ==0)
140 iHptPlus=iHptPlus+(1 << istripY);
141 if (lutHpt[istripY][1] == 1 && lutHpt[istripY][0] ==1)
142 iHptUnde=iHptUnde+(1 << istripY);
146 lut.SetContent("LptMinu",icirc,istripX,idev,iLptMinu);
147 lut.SetContent("LptUnde",icirc,istripX,idev,iLptUnde);
148 lut.SetContent("LptPlus",icirc,istripX,idev,iLptPlus);
150 lut.SetContent("HptMinu",icirc,istripX,idev,iLptMinu);
151 lut.SetContent("HptUnde",icirc,istripX,idev,iLptUnde);
152 lut.SetContent("HptPlus",icirc,istripX,idev,iLptPlus);
155 //_____________________________________________________________________________
157 AliMUONTriggerIO::LocalBoardId(Int_t index) const
159 /// Return the i-th localBoardId, or -1 if index is out of bounds
160 if ( index >= 0 && index < fNofLocalBoards )
162 return fLocalBoardIds[index];
167 //_____________________________________________________________________________
169 AliMUONTriggerIO::ReadLocalMasks(const char* localFile, AliMUONVStore& localMasks) const
171 /// Fills the local masks store from file
173 if ( !NofLocalBoards() )
175 AliError("No local board to read");
179 FILE* fp = fopen(gSystem->ExpandPathName(localFile),"r");
182 AliError(Form("Could not read file %s",localFile));
186 UShort_t maskBuffer[8];
188 Int_t nLocalBoards(0);
190 while ( fread ( maskBuffer, 2, 8, fp ) )
192 Int_t localBoardId = LocalBoardId(nLocalBoards);
193 AliDebug(1,Form("LB %03d X1 %4x X2 %4x X3 %4x X4 %4x "
194 "Y1 %4x Y2 %4x Y3 %4x Y4 %4x",
207 AliMUONVCalibParam* localBoard = new AliMUONCalibParamNI(1,8,localBoardId,0,0);
208 for ( Int_t index = 0; index < 8; ++index )
210 localBoard->SetValueAsInt(index,0,maskBuffer[index]);
212 localMasks.Add(localBoard);
218 if ( nLocalBoards != NofLocalBoards() )
220 AliError(Form("Read %d out of %d local boards",
221 nLocalBoards, NofLocalBoards()));
229 //_____________________________________________________________________________
231 AliMUONTriggerIO::ReadLocalLUT(AliMUONTriggerLut& lut,
235 /// Read the LUT for one local board from an online file
240 UChar_t mask1 = 0xF0;
241 UChar_t mask2 = 0x0F;
242 UChar_t maskLpt = 0x0C;
243 UChar_t maskHpt = 0x03;
244 UChar_t lh, lpt, hpt;
246 UChar_t xpos, xdev, ypos, ytri;
248 Int_t lutLpt[16][2], lutHpt[16][2];
250 Int_t boardnr = localBoardId;
252 AliDebug(1,Form("Reading LUT values for local board %d",boardnr));
256 // create the 32767 addresses for the 4-bits lpt and hpt half-bytes
257 for (UShort_t ilut = 0; ilut < 0x7FFF; ilut += 2)
259 // read two lut addresses at once
260 fread(&buffer,1,1,flut);
262 // 1st 4-bits half-byte
264 lh = (buffer & mask1) >> 4;
266 // Lpt and Hpt response
267 lpt = (lh & maskLpt) >> 2;
270 // decompose the 15-bits address
271 DeCompAddress(ypos,ytri,xdev,xpos,address);
273 // calculate group of y-strips
276 lutLpt[ny][0] = lpt & 1;
277 lutLpt[ny][1] = (lpt & 2) >> 1;
278 lutHpt[ny][0] = hpt & 1;
279 lutHpt[ny][1] = (hpt & 2) >> 1;
284 // ytri == 1 means no trigger in y-direction
287 FillLut(lut,boardnr,xpos,xdev,lutLpt,lutHpt);
292 // 2nd 4-bits half-byte
294 lh = (buffer & mask2);
296 // Lpt and Hpt response
297 lpt = (lh & maskLpt) >> 2;
300 // decompose the 15-bits address
301 DeCompAddress(ypos,ytri,xdev,xpos,address);
303 // calculate group of y-strips
306 lutLpt[ny][0] = lpt & 1;
307 lutLpt[ny][1] = (lpt & 2) >> 1;
308 lutHpt[ny][0] = hpt & 1;
309 lutHpt[ny][1] = (hpt & 2) >> 1;
314 // ytri == 1 means no trigger in y-direction
317 FillLut(lut,boardnr,xpos,xdev,lutLpt,lutHpt);
324 //_____________________________________________________________________________
326 AliMUONTriggerIO::ReadLUT(const char* lutFileToRead, AliMUONTriggerLut& lut)
328 /// Fill the LUT object from online file
330 if ( !NofLocalBoards() )
332 AliError("No local board id defined. Must read a regional file first");
336 FILE* flut = fopen(gSystem->ExpandPathName(lutFileToRead),"rb");
339 AliError(Form("Could not read LUT file %s",lutFileToRead));
343 for ( Int_t i = 0; i < NofLocalBoards(); ++i )
345 ReadLocalLUT(lut,LocalBoardId(i),flut);
354 //_____________________________________________________________________________
356 AliMUONTriggerIO::ReadMasks(const char* localFile,
357 const char* regionalFile,
358 const char* globalFile,
359 AliMUONVStore* localMasks,
360 AliMUONVStore* regionalMasks,
361 AliMUONVCalibParam* globalMasks,
364 /// Fill the various masks store from files
368 AliError("Must have a regional file name to proceeed");
372 Int_t nCrates = ReadRegional(regionalFile,regionalMasks, warn);
374 if (!nCrates) return kFALSE;
376 if (localMasks && localFile)
378 Int_t nLocal = ReadLocalMasks(localFile,*localMasks);
379 AliDebug(1,Form("Read masks for %d local boards",nLocal));
382 Int_t nDarc = ReadGlobal(globalFile, globalMasks);
383 AliDebug(1,Form("Read disable for %d DARC boards",nDarc));
385 if (!nDarc) return kFALSE;
390 //_____________________________________________________________________________
392 AliMUONTriggerIO::ReadGlobal(const char* globalFile, AliMUONVCalibParam* globalMasks)
394 /// read the global crate file and file corresponding mask
395 /// the masks are disable bit for each crate, 8 per darc board
396 /// bit value 0 means enable, 1 means disable *
399 if (!AliMpDDLStore::ReadGlobalTrigger(fGlobalCrate, globalFile)) return 0;
401 UChar_t mask = fGlobalCrate.GetFirstDarcDisable();
402 ULong_t vmeAddr = fGlobalCrate.GetFirstDarcVmeAddr();
403 if (vmeAddr) nDarc++;
404 globalMasks->SetValueAsInt(0,0,mask);
406 mask = fGlobalCrate.GetSecondDarcDisable();
407 vmeAddr = fGlobalCrate.GetSecondDarcVmeAddr();
408 if (vmeAddr) nDarc++;
409 globalMasks->SetValueAsInt(1,0,mask);
414 //_____________________________________________________________________________
416 AliMUONTriggerIO::ReadRegional(const char* regionalFile, AliMUONVStore* regionalMasks, Bool_t warn)
418 /// Read regional file to fill the regional mask store *AND*
419 /// determine the order in which local boards will appear in local
422 fLocalBoardIds.Reset();
425 AliMpLocalBoard* board = 0x0;
426 AliMpTriggerCrate* crate = 0x0;
428 std::ifstream in(gSystem->ExpandPathName(regionalFile));
431 AliError(Form("Cannot read file %s",regionalFile));
443 if (!AliMpDDLStore::Instance(kFALSE))
445 AliMpCDB::LoadDDLStore();
453 if (!strlen(name)) break;
455 AliDebug(1,Form("Looking for crate %s",name));
459 AliMpTriggerCrate* triggerCrate = AliMpDDLStore::Instance()->GetTriggerCrate(name);
463 AliError(Form("Mapping error : could not get crate %s",name));
470 Int_t mode, coincidence;
473 sscanf(line,"%hx",&id);
476 sscanf(line,"%d",&mode);
479 sscanf(line,"%d",&coincidence);
482 sscanf(line,"%hx",&mask);
484 if (!GetTriggerCrate(name, false)) {
485 crate = new AliMpTriggerCrate(name, id, mask, mode, coincidence);
486 fTriggerCrates.Add(name, crate);
491 AliMUONVCalibParam* regionalBoard = new AliMUONCalibParamNI(1,1,id,0,0);
492 regionalBoard->SetValueAsInt(0,0,mask);
493 regionalMasks->Add(regionalBoard);
496 AliDebug(1,Form("Name %s ID %x Mode %d Coin %d Mask %x",
497 name,id,mode,coincidence,mask));
499 for ( Int_t i = 0; i < 16; ++i )
501 if ( (mask >> i ) & 0x1 )
504 Char_t localBoardName[20];
505 Int_t j,localBoardId;
507 sscanf(line,"%02d %s %03d %03x",&j,localBoardName,&localBoardId,&switches);
508 AliDebug(1,Form("%02d %s %03d %03x",j,localBoardName,localBoardId,switches));
510 // FIXEME should not need this array anymore
511 fLocalBoardIds.Set(fNofLocalBoards+1);
512 fLocalBoardIds[fNofLocalBoards] = localBoardId;
515 board = new AliMpLocalBoard(localBoardId, localBoardName, j);
516 board->SetSwitch(switches);
517 board->SetCrate(name);
518 if (localBoardId > AliMpConstants::NofLocalBoards())
519 board->SetNotified(false);
524 TString tmp(AliMpHelper::Normalize(line));
525 AliMpHelper::DecodeName(tmp,' ',list);
527 for (Int_t i = 0; i < list.GetSize(); ++i)
528 board->AddDE(list[i]);
530 // set copy number and transverse connector
532 tmp = AliMpHelper::Normalize(line);
533 AliMpHelper::DecodeName(tmp,' ',list);
535 board->SetInputXfrom(list[0]);
536 board->SetInputXto(list[1]);
538 board->SetInputYfrom(list[2]);
539 board->SetInputYto(list[3]);
541 board->SetTC(list[4]);
543 fLocalBoards.Add(localBoardId, board);
544 crate->AddLocalBoard(localBoardId);
552 //_____________________________________________________________________________
554 AliMUONTriggerIO::WriteLUT(const AliMUONTriggerLut& lut,
555 const char* lutFileToWrite)
557 /// Convert an offline lut into an online (binary) lut file
559 if ( !NofLocalBoards() )
561 AliError("No local board id defined. Must read a regional file first");
565 FILE* flut = fopen(gSystem->ExpandPathName(lutFileToWrite),"wb");
568 AliError(Form("Could not create output LUT file %s",lutFileToWrite));
572 for ( Int_t i = 0; i < NofLocalBoards(); ++i )
574 WriteLocalLUT(lut,LocalBoardId(i),flut);
582 //_____________________________________________________________________________
584 AliMUONTriggerIO::WriteMasks(const char* localFile,
585 const char* regionalFile,
586 const char* globalFile,
587 AliMUONVStore* localMasks,
588 AliMUONVStore* regionalMasks,
589 AliMUONVCalibParam* globalMasks) const
593 ok = WriteLocalMasks(localFile, *localMasks);
594 ok &= WriteRegional(regionalFile, regionalMasks);
595 ok &= WriteGlobal(globalFile, globalMasks);
600 //_____________________________________________________________________________
602 AliMUONTriggerIO::WriteGlobal(const char* globalFile, AliMUONVCalibParam* globalMasks) const
604 /// write global file
605 /// if no global masks defined take the one of configuration
610 out.open(globalFile);
613 AliError(Form("Could not create output regional file %s", globalFile));
617 out << fGlobalCrate.GetName() << endl;
620 out << fGlobalCrate.GetJtagName() << endl;
621 out << Form("0x%08x", fGlobalCrate.GetJtagVmeAddr()) << endl;
622 out << Form("%d %d %d", fGlobalCrate.GetJtagClockDiv(),
623 fGlobalCrate.GetJtagRxPhase(), fGlobalCrate.GetJtagRdDelay()) << endl;
625 for (Int_t i = 0; i < fGlobalCrate.GetJtagNofLines(); ++i)
626 out << Form("%d ", fGlobalCrate.GetEnableJtag(i));
630 for (Int_t i = 0; i < fGlobalCrate.GetJtagNofLines(); ++i)
633 for (Int_t j = 0; j < fGlobalCrate.GetJtagNofLines(); ++j)
634 out << Form(" %s", fGlobalCrate.GetJtagCrateName(i,j).Data()) << endl;
638 out << fGlobalCrate.GetFirstDarcName() << endl;
639 out << Form("0x%08x", fGlobalCrate.GetFirstDarcVmeAddr()) << endl;
640 out << fGlobalCrate.GetFirstDarcType() << endl;
641 if (globalMasks != 0x0)
642 disable = globalMasks->ValueAsInt(0);
644 disable = fGlobalCrate.GetFirstDarcDisable();
645 out << Form("0x%02x", disable) << endl;
646 out << Form("0x%x", fGlobalCrate.GetFirstDarcL0Delay()) << endl;
647 out << Form("0x%x", fGlobalCrate.GetFirstDarcL1TimeOut()) << endl;
650 out << fGlobalCrate.GetSecondDarcName() << endl;
651 out << Form("0x%08x", fGlobalCrate.GetSecondDarcVmeAddr()) << endl;
652 out << fGlobalCrate.GetSecondDarcType() << endl;
653 if (globalMasks != 0x0)
654 disable = globalMasks->ValueAsInt(1);
656 disable = fGlobalCrate.GetSecondDarcDisable();
657 out << Form("0x%02x", disable) << endl;
658 out << Form("0x%x", fGlobalCrate.GetSecondDarcL0Delay()) << endl;
659 out << Form("0x%x", fGlobalCrate.GetSecondDarcL1TimeOut()) << endl;
662 out << fGlobalCrate.GetGlobalName() << endl;
663 out << Form("0x%08x", fGlobalCrate.GetGlobalVmeAddr()) << endl;
664 for (Int_t i = 0; i < fGlobalCrate.GetGlobalNofRegisters(); ++i)
665 out << Form("0x%x", fGlobalCrate.GetGlobalRegister(i)) << endl;
668 out << fGlobalCrate.GetFetName() << endl;
669 out << Form("0x%08x", fGlobalCrate.GetFetVmeAddr()) << endl;
670 for (Int_t i = 0; i < fGlobalCrate.GetFetNofRegisters(); ++i)
671 out << Form("0x%x", fGlobalCrate.GetFetRegister(i)) << endl;
677 //_____________________________________________________________________________
679 AliMUONTriggerIO::WriteRegional(const char* regionalFile, AliMUONVStore* regionalMasks) const
682 /// write regional mask with the current configuration
683 /// if regional masks not defined, take the one from current configuration
686 out.open(regionalFile);
690 AliError(Form("Could not create output regional file %s",regionalFile));
694 for (Int_t iCrate = 0; iCrate < fTriggerCrates.GetSize(); ++iCrate)
696 AliMpTriggerCrate* crate = static_cast<AliMpTriggerCrate*>(fTriggerCrates.GetObject(iCrate));
698 out << crate->GetName() << endl;
699 out << Form("%02x", crate->GetId()) << endl;
700 out << crate->GetMode() << endl;
701 out << crate->GetCoinc() << endl;
704 if (regionalMasks != 0x0)
706 AliMUONVCalibParam* maskParam =
707 static_cast<AliMUONVCalibParam*>(regionalMasks->FindObject(crate->GetId()));
708 masks = maskParam->ValueAsInt(0,0);
712 masks = crate->GetMask();
715 out << Form("%04x", masks) << endl;
717 for (Int_t iLocal = 0; iLocal < crate->GetNofLocalBoards(); ++iLocal)
719 Int_t localBoardId = crate->GetLocalBoardId(iLocal);
721 AliMpLocalBoard* board = static_cast<AliMpLocalBoard*>(fLocalBoards.GetValue(localBoardId));
723 out << Form("%02d ", board->GetSlot())
725 << Form(" %03d ", localBoardId)
726 << Form("%03x", board->GetSwitch())
730 for (Int_t i = 0; i < board->GetNofDEs(); ++i)
731 out << Form("%4d ", board->GetDEId(i));
734 // print copy card numbers
735 out << Form(" %4d %4d", board->GetInputXfrom(), board->GetInputXto());
736 out << Form(" %4d %4d", board->GetInputYfrom(), board->GetInputYto());
737 out << Form(" %4d", board->GetTC()) << endl;
745 //_____________________________________________________________________________
747 AliMUONTriggerIO::WriteLocalMasks(const char* localFile, AliMUONVStore& localMasks) const
750 /// removing/adding enable for a local board need a update of the configuration
751 /// before calling this method
752 /// mask are written for all boards including the copy card (Ch.F.)
754 FILE* fp = fopen(gSystem->ExpandPathName(localFile),"wb");
757 AliError(Form("Could not create output local file %s",localFile));
761 UShort_t maskBuffer[8];
763 for (Int_t iCrate = 0; iCrate < fTriggerCrates.GetSize(); ++iCrate)
765 AliMpTriggerCrate* crate = static_cast<AliMpTriggerCrate*>(fTriggerCrates.GetObject(iCrate));
767 UShort_t mask = crate->GetMask(); // getting mask from current config
769 for (Int_t iLocal = 0; iLocal < crate->GetNofLocalBoards(); ++iLocal)
771 Int_t localBoardId = crate->GetLocalBoardId(iLocal);
773 if ( (mask >> iLocal ) & 0x1 )
775 AliMUONVCalibParam* localMask =
776 static_cast<AliMUONVCalibParam*>(localMasks.FindObject(localBoardId));
778 for (Int_t index = 0; index < 8; ++index)
780 maskBuffer[index] = localMask->ValueAsInt(index,0);
783 fwrite ( maskBuffer, 2, 8, fp);
795 //_____________________________________________________________________________
797 AliMUONTriggerIO::WriteLocalLUT(const AliMUONTriggerLut& lut,
801 /// loop over the address for the 4-bits lpt and hpt decisions
803 const Int_t kMaskYpos = 0x0F;
804 const Int_t kMaskYtri = 0x01;
805 const Int_t kMaskXdev = 0x1F;
806 const Int_t kMaskXpos = 0x1F;
808 for (Int_t i = 0; i < 32768; ++i)
810 Int_t lutLpt[2] = { 0 };
811 Int_t lutHpt[2] = { 0 };
814 Int_t iYpos = i & kMaskYpos;
815 Int_t iYtri = ( i >> 4 ) & kMaskYtri;
816 Int_t iXdev = ( i >> ( 4 + 1 ) ) & kMaskXdev;
817 Int_t iXpos = ( i >> ( 4 + 1 + 5 ) ) & kMaskXpos;
819 // iYtri == 1 means no trigger in y-direction
822 lut.GetLutOutput(localBoardId,iXpos,iXdev,iYpos,lutLpt,lutHpt);
832 buffer += lutLpt[1] << 7;
833 buffer += lutLpt[0] << 6;
834 buffer += lutHpt[1] << 5;
835 buffer += lutHpt[0] << 4;
838 buffer += lutLpt[1] << 3;
839 buffer += lutLpt[0] << 2;
840 buffer += lutHpt[1] << 1;
841 buffer += lutHpt[0] << 0;
842 fwrite(&buffer,1,1,flut);
847 //_____________________________________________________________________________
849 AliMUONTriggerIO::GetTriggerCrate(TString name, Bool_t warn) const
851 /// Return trigger crate with given name
853 AliMpTriggerCrate* crate
854 = (AliMpTriggerCrate*) fTriggerCrates.GetValue(name.Data());
856 if ( ! crate && warn ) {
858 << "Trigger crate with name = " << name.Data() << " not defined." << endl;
864 //_____________________________________________________________________________
866 AliMUONTriggerIO::GetLocalBoard(Int_t localBoardId, Bool_t warn) const
868 /// Return bus patch with given Id
870 AliMpLocalBoard* localBoard
871 = (AliMpLocalBoard*) fLocalBoards.GetValue(localBoardId);
873 if ( ! localBoard && warn ) {
875 << "Local board with Id = " << localBoardId << " not defined." << endl;
881 //_____________________________________________________________________________
883 AliMUONTriggerIO::UpdateMapping(Bool_t writeFile) const
885 /// check if mapping in database different from current Mtg configuration
886 /// Update mapping in databse and read regional crate file in repository (ext .out
887 /// to avoid overwriting). This case has a low probability to happen.
889 // Assuming that crates do not change
891 if (!AliMpDDLStore::Instance(kFALSE))
893 AliMpCDB::LoadDDLStore();
896 Bool_t modified = false;
898 TExMapIter itr = AliMpDDLStore::Instance()->GetLocalBoardItr();
902 while(itr.Next(key, value))
904 AliMpLocalBoard* boardMapping = reinterpret_cast<AliMpLocalBoard*>(value);
906 Int_t localBoardId = boardMapping->GetId();
907 AliMpLocalBoard* board = static_cast<AliMpLocalBoard*>(fLocalBoards.GetValue(localBoardId));
909 if (board->GetCrate().CompareTo(boardMapping->GetCrate()) != 0)
911 AliWarning(Form("Crate Name different for board %d (%s %s)", localBoardId, boardMapping->GetCrate().Data(),
912 board->GetCrate().Data()));
913 boardMapping->SetCrate( board->GetCrate() );
917 if ((board->GetSlot()) != boardMapping->GetSlot())
919 AliWarning(Form("Slot different for board %d (%d %d)", localBoardId, boardMapping->GetSlot(), board->GetSlot()+1));
920 boardMapping->SetSlot(board->GetSlot());
924 if (boardMapping->GetSwitch() != board->GetSwitch()) {
925 AliWarning(Form("Switch different for board %d (0x%x 0x%x)", localBoardId,
926 boardMapping->GetSwitch(), board->GetSwitch()));
927 boardMapping->SetSwitch(board->GetSwitch());
934 AliMpCDB::WriteDDLStore(false);
935 AliWarning("Wrote new version of mapping in databse");
938 TString file = AliMpFiles::LocalTriggerBoardMapping();
940 WriteRegional(file.Data(), 0x0);
941 AliWarning(Form("Wrote regional file %s", file.Data()));