36 #include <Riostream.h> 70 void MarkForDeletion(Int_t* indices, Int_t first, Int_t last)
72 for ( Int_t i = first; i <= last; ++i )
81 Bool_t deferredInitialization)
84 fRunNumber(runNumber),
88 fLocalTriggerBoardMasks(0x0),
89 fRegionalTriggerConfig(0x0),
90 fGlobalTriggerCrateConfig(0x0),
92 fTriggerEfficiency(0x0),
109 if ( deferredInitialization == kFALSE )
112 AliWarning(
"Using immediate initialization, which might cause some issue with old OCDBs...");
158 if ( last < first )
return kFALSE;
159 if ( last - first < 2 )
return kFALSE;
169 Int_t deltaHV = TMath::Nint(TMath::Abs(vfirst->
GetFloat()-vlast->
GetFloat()));
171 if ( deltaHV < HVSAME )
return kFALSE;
173 for ( Int_t i = first; i <= last; ++i )
185 slope = value > 0 ? 1 : -1;
186 value = TMath::Abs(value);
192 if (slope>0) (*msg) = Form(
"RU%d[%d:%d](%d)",TMath::Nint(value),first,last,deltaTime);
193 if (slope<0) (*msg) = Form(
"RD%d[%d:%d](%d)",TMath::Nint(value),first,last,deltaTime);
195 if ( TMath::Nint(value) == 0 )
206 *msg = Form(
"FLUCT%d[%d:%d]",TMath::Nint(value),first,last);
233 UInt_t DELTATIME(60);
239 Bool_t gather(kFALSE);
243 groups.SetOwner(kTRUE);
245 for ( Int_t i = values.GetLast(); i > 0; --i )
276 TIter nextGroup(&groups,kIterBackward);
284 Int_t nEndAndShortRU(0);
289 trips.SetOwner(kTRUE);
291 while ( ( p = static_cast<AliMpIntPair*>(nextGroup()) ) )
313 else if ( p->
GetSecond() == values.GetLast() && TMath::Nint(value) < IENDRU )
323 else if ( slope < 0 )
325 if ( p->
GetSecond() == values.GetLast() )
350 internalMsg += groupMsg;
402 AliDebugClass(1,Form(
"msg=%s ngroupds=%d",internalMsg.Data(),ngroups));
403 AliDebugClass(1,Form(
"nRU %d nRD %d nStartRU %d nEndRD %d nTripRD %d nFluct %d",
404 nRU,nRD,nStartRU,nEndRD,nTripRD,nFluct));
406 TString hvCase(
"OTHER");
407 int dummy(0),a(-1),
b(-1);
409 Int_t nvalues = values.GetSize();
410 Int_t* indices =
new Int_t[nvalues];
411 memset(indices,0,nvalues*
sizeof(Int_t));
422 else if ( nTripRD > 0 )
424 const Double_t HVLOWTRIP(600);
427 internalMsg += Form(
"NT:%d ",nTripRD);
429 if ( nRU > 0 && nRD > 0 )
438 for ( Int_t iTrip = 0; iTrip <= trips.GetLast(); ++iTrip )
441 TString tripType(
"TRIP");
444 tripType =
"LOWTRIP";
447 internalMsg += Form(
"%s SV:%d TS:%d ",tripType.Data(),tripPair->
GetSecond(),tripPair->
GetFirst());
456 MarkForDeletion(indices,0,values.GetLast());
457 values.Add(
new AliDCSValue(static_cast<Float_t>(0),meanTimeStamp));
460 else if ( nStartRU > 0 && nRU == 0 && nRD == 0 && nEndRD == 0 )
465 sscanf(internalMsg.Data(),
"RU%10d[%10d:%10d]%80s",&dummy,&a,&
b,r);
466 MarkForDeletion(indices,a,b);
469 else if ( nStartRU > 0 && nEndRD > 0 && nRD == 0 && nRU == 0 )
474 sscanf(internalMsg.Data(),
"RU%10d[%10d:%10d]%80s",&dummy,&a,&
b,r);
475 MarkForDeletion(indices,a,b-1);
476 Int_t i = internalMsg.Index(
"RD",strlen(
"RD"),0,TString::kExact);
477 sscanf(internalMsg(i,internalMsg.Length()-i).Data(),
478 "RD%10d[%10d:%10d]%80s",&dummy,&a,&
b,r);
479 MarkForDeletion(indices,a+1,b);
482 else if ( nEndRD > 0 && nStartRU == 0 && nRU == 0 && nRD == 0 )
487 Int_t i = internalMsg.Index(
"RD",strlen(
"RD"),0,TString::kExact);
488 sscanf(internalMsg(i,internalMsg.Length()-i).Data(),
489 "RD%10d[%10d:%10d]%80s",&dummy,&a,&
b,r);
490 MarkForDeletion(indices,a,b);
493 else if ( nFluct > 0 )
501 while ( ( str = static_cast<TObjString*>(next()) ) )
503 TString s(str->String());
504 if ( s.BeginsWith(
"FLUCT") )
506 sscanf(s.Data(),
"FLUCT%d[%d:%d]",&dummy,&a,&
b);
507 MarkForDeletion(indices,a,b);
513 else if ( nEndAndShortRU > 0 && nStartRU == 0 && nRU == 0 && nRD == 0 && nEndRD == 0 )
518 sscanf(internalMsg.Data(),
"RU%10d[%10d:%10d]%80s",&dummy,&a,&
b,r);
519 MarkForDeletion(indices,a,b);
528 const Double_t HVFLUCT(20);
536 MarkForDeletion(indices,1,nvalues-1);
542 for ( Int_t i = 0; i < nvalues; ++i )
555 if ( !values.GetEntries() )
557 AliErrorClass(Form(
"No value left after patch... Check that !!! initial # of values=%d msg=%s",
558 nvalues,internalMsg.Data()));
565 TIter nextA(&values);
567 Float_t maxval(-9999);
569 while ( ( val = static_cast<AliDCSValue*>(nextA()) ) )
586 internalMsg += Form(
"CASE:%s",hvCase.Data());
588 if (msg) *msg = internalMsg.Data();
590 return hvCase==
"OTHER" ? kFALSE : kTRUE;
604 newkey.ReplaceAll(source,dest);
606 TPair* pair =
static_cast<TPair*
>(sourceMap.FindObject(key.Data()));
608 destMap.Add(
new TObjString(newkey.Data()),pair->Value());
626 AliWarningClass(
"Patching already done for St1 DCS aliases on this map. Not doing it again.");
633 TObjString* hvChannelName;
636 newmap.SetOwnerKeyValue(kTRUE,kFALSE);
638 while ( ( hvChannelName = static_cast<TObjString*>(next()) ) )
640 TString name(hvChannelName->String());
641 TString newname(name);
646 if ( name.Contains(
"Chamber00Left") )
648 if (name.Contains(
"Quad1Sect0"))
AddToMap(hvMap,newmap,name,
"Quad1Sect0",
"Quad2Sect0");
650 if (name.Contains(
"Quad1Sect1"))
AddToMap(hvMap,newmap,name,
"Quad1Sect1",
"Quad2Sect1");
651 if (name.Contains(
"Quad1Sect2"))
AddToMap(hvMap,newmap,name,
"Quad1Sect2",
"Quad2Sect2");
653 if (name.Contains(
"Quad2Sect2"))
AddToMap(hvMap,newmap,name,
"Quad2Sect2",
"Quad1Sect0");
654 if (name.Contains(
"Quad2Sect1"))
AddToMap(hvMap,newmap,name,
"Quad2Sect1",
"Quad1Sect1");
655 if (name.Contains(
"Quad2Sect0"))
AddToMap(hvMap,newmap,name,
"Quad2Sect0",
"Quad1Sect2");
657 else if ( name.Contains(
"Chamber01Left"))
659 if (name.Contains(
"Quad2Sect2"))
AddToMap(hvMap,newmap,name,
"Quad2Sect2",
"Quad2Sect0");
660 if (name.Contains(
"Quad2Sect0"))
AddToMap(hvMap,newmap,name,
"Quad2Sect0",
"Quad2Sect2");
664 AddToMap(hvMap,newmap,name,name,name);
670 TIter nextNewMap(&newmap);
671 while ( ( hvChannelName = static_cast<TObjString*>(nextNewMap()) ) )
673 TPair* oldPair =
static_cast<TPair*
>(hvMap.FindObject(hvChannelName->String().Data()));
674 TPair* newPair =
static_cast<TPair*
>(newmap.FindObject(hvChannelName->String().Data()));
678 oldPair->SetValue(newValues);
690 Int_t* startOfValidity,
702 TMap* hvMap =
dynamic_cast<TMap*
>(
CreateObject(runNumber,
"MUON/Calib/HV",startOfValidity));
704 if (!hvMap)
return 0x0;
715 AliWarningClass(
"Patching already done for HV channels on this map. Not doing it again.");
720 TObjString* hvChannelName;
722 while ( ( hvChannelName = static_cast<TObjString*>(next()) ) )
724 TString name(hvChannelName->String());
726 if ( name.Contains(
"sw") )
continue;
728 if ( name.Contains(
"iMon") )
continue;
730 TPair* hvPair =
static_cast<TPair*
>(hvMap->FindObject(name.Data()));
734 AliErrorClass(Form(
"Could not get values for alias %s",name.Data()));
745 messages->Add(
new TObjString(Form(
"%s %s",hvChannelName->String().Data(),msg.Data())));
750 AliErrorClass(Form(
"PatchHVValue was not successfull ! This is serious ! " 751 "You'll have to check the logic for channel %s in run %09d",
762 Int_t a(0),
b(0),c(0),d(0),e(0),
f(0),g(0),h(0),u(0),z(0);
763 TIter next(messages);
767 while ( ( msg = static_cast<TObjString*>(next()) ) )
769 Int_t i = msg->String().Index(
"CASE",strlen(
"CASE"),0,TString::kExact);
773 sscanf(msg->String()(i,msg->String().Length()-i).Data(),
"CASE:%10c",&hvCase);
778 case 'A': ++a;
break;
779 case 'B': ++
b;
break;
780 case 'C': ++c;
break;
781 case 'D': ++d;
break;
782 case 'E': ++e;
break;
783 case 'F': ++
f;
break;
784 case 'G': ++g;
break;
785 case 'H': ++h;
break;
786 case 'Z': ++z;
break;
791 messages->Add(
new TObjString(Form(
"SUMMARY : # of cases A(%3d) B(%3d) C(%3d) D(%3d) E(%3d) F(%3d) G(%3d) H(%3d) Z(%3d) OTHER(%3d)",
792 a,
b,c,d,e,
f,g,h,z,u)));
803 return dynamic_cast<TMap*
>(
CreateObject(runNumber,
"MUON/Calib/LV",startOfValidity));
811 return dynamic_cast<TMap*
>(
CreateObject(runNumber,
"MUON/Calib/TriggerDCS",startOfValidity));
1017 AliError(Form(
"Could not get mask for localBoardNumber=%d",localBoardNumber));
TMap * LV() const
Get the MCH LV.
static UInt_t PatchHVDCSAliasesSt1WasAppliedMask()
TMap * TriggerDCS() const
Get the Trigger HV and current values.
Int_t GetFirst() const
Return first value.
The class defines the configuration of global crate.
AliMUONRegionalTriggerConfig * RegionalTriggerConfig() const
Get the config for regional trigger.
AliMUONRejectList * fRejectList
! reject list
static AliMUONVStore * CreateOccupancyMap(Int_t runNumber, Int_t *startOfValidity=0)
Create an occupancy map store (which must be deleted) from OCDB for the given run.
static AliMUONVStore * CreateLocalTriggerBoardMasks(Int_t runNumber, Int_t *startOfValidity=0)
Create a local trigger mask store (which must be deleted) for a given run.
AliMUONVStore * fConfig
! configuration of the tracker
TMap * HV(Bool_t patched=kTRUE) const
Get the HV values. Use patched=kFALSE to get unprocessed (i.e. "raw") values as they are in the OCDB...
AliMUONVStore * fLocalTriggerBoardMasks
! Local trigger board maska
AliMUONVStore * Neighbours() const
Get the neighbours store.
static void AddToMap(const TMap &sourceMap, TMap &destMap, const TString &key, const char *source, const char *dest)
static Float_t TrackerHVOFF()
AliMUONVStore * fNeighbours
! list of neighbours for all channels
Int_t fRunNumber
The run number for which we hold calibrations.
AliMUONCalibrationData(Int_t runNumber=-1, Bool_t deferredInitialization=kTRUE)
static void Check(Int_t runNumber)
AliMUONTriggerEfficiencyCells * fTriggerEfficiency
! Trigger efficiency cells
Store and give access to the trigger chamber efficiency.
static AliMUONTriggerEfficiencyCells * CreateTriggerEfficiency(Int_t runNumber, Int_t *startOfValidity=0)
Create a trigger efficiency map (which must be deleted) for a given run.
#define AliCodeTimerAutoClass(message, counter)
virtual void Print(Option_t *opt="") const
Dump to screen.
AliMUONVStore * Config() const
Get the config store.
static AliMUONVStore * CreateConfig(Int_t runNumber, Int_t *startOfValidity=0)
Create a configuration store (which must be deleted) from OCDB for the given run. ...
AliMUONVCalibParam * LocalTriggerBoardMasks(Int_t localBoardNumber) const
Get the mask for a given local trigger board.
static void BypassStores(AliMUONVStore *ped)
Int_t RunNumber() const
The runnumber used by this object.
virtual ~AliMUONCalibrationData()
#define AliInfoClass(message)
AliMUONGlobalCrateConfig * fGlobalTriggerCrateConfig
! Global trigger crate config
AliMUONTriggerLut * TriggerLut() const
Get the trigger Look Up Table.
#define AliWarning(message)
AliCDBEntry * Get(const AliCDBId &query, Bool_t forceCaching=kFALSE)
static UInt_t PatchHVAllWasAppliedMask()
Container of calibration values for a given number of channels.
#define AliErrorClass(message)
static AliMUONGlobalCrateConfig * CreateGlobalTriggerCrateConfig(Int_t runNumber, Int_t *startOfValidity=0)
Create a global trigger mask (which must be deleted) from OCDB for the given run. ...
#define AliDebugClass(logLevel, message)
AliMUONVStore * fPedestals
! Pedestals
Bool_t GetCacheFlag() const
AliMUONVStore * fOccupancyMap
! occupancy map
AliMUONGlobalCrateConfig * GlobalTriggerCrateConfig() const
Get the configuration for the global trigger board.
static AliMUONVStore * CreateNeighbours(Int_t runNumber, Int_t *startOfValidity=0)
Create a neighbours store (which must be deleted) from OCDB for the given run.
#define AliCodeTimerAuto(message, counter)
static Bool_t PatchHVValues(TObjArray &values, TString *msg=0x0, Bool_t dryRun=kFALSE)
#define AliWarningClass(message)
static TMap * CreateTriggerDCS(Int_t runNumber, Int_t *startOfValidity=0)
Create a Trigger HV and current map (which must be deleted) from OCDB for the given run...
AliMUONVStore * Pedestals() const
Get the pedestal store.
static Bool_t CheckHVGroup(TObjArray &values, Int_t first, Int_t last, Double_t &value, Int_t &slope, TString *msg)
AliMUONTriggerEfficiencyCells * TriggerEfficiency() const
Get the trigger efficiency map.
static AliMUONVStore * fgBypassPedestals
AliMUONTriggerLut * fTriggerLut
! TRigger LUTs
AliMUONRegionalTriggerConfig * fRegionalTriggerConfig
! Regional trigger config
static AliMUONRegionalTriggerConfig * CreateRegionalTriggerConfig(Int_t runNumber, Int_t *startOfValidity=0)
Create a regional trigger mask store (which must be deleted) for a given run.
Single entry point to access MUON calibration data.
static void PatchSt1DCSAliases(TMap &hvMap)
static TMap * CreateLV(Int_t runNumber, Int_t *startOfValidity=0)
Create a MCH LV map (which must be deleted) from OCDB for the given run.
static TObject * CreateObject(Int_t runNumber, const char *path, Int_t *startOfValidity=0x0)
TMap * fTriggerDCS
! Trigger HV and Currents
Object to hold the list of elements we want to reject from the reconstruction.
UInt_t GetTimeStamp() const
AliMUONVStore * OccupancyMap() const
Get the occupancy map store.
static TMap * CreateHV(Int_t runNumber, Int_t *startOfValidity=0, Bool_t patched=kTRUE, TList *messages=0x0, Bool_t dryRun=kFALSE)
Create a hv map (which must be deleted) from OCDB for the given run.
void SetOwner(Bool_t owner)
#define AliError(message)
Int_t GetSecond() const
Return second value.
static AliMUONTriggerLut * CreateTriggerLut(Int_t runNumber, Int_t *startOfValidity=0)
Create a trigger Look Up Table (which must be deleted) for a given run.
static AliCDBManager * Instance(TMap *entryCache=NULL, Int_t run=-1)
Base class for MUON data stores.
AliMUONRejectList * RejectList() const
Get the reject list store.
MUON trigger look up table class.
Int_t GetFirstRun() const
The class defines the properties of regional trigger crate.
static AliMUONRejectList * CreateRejectList(Int_t runNumber, Int_t *startOfValidity=0)
Create a rejectlist store (which must be deleted) from OCDB for the given run.
static AliMUONVStore * CreatePedestals(Int_t runNumber, Int_t *startOfValidity=0)
Create a pedestal store (which must be deleted) from OCDB for the given run.
virtual TObject * FindObject(const char *name) const
Find an object by name.