]> git.uio.no Git - u/mrichter/AliRoot.git/blame - MUON/MUONStatusMap.C
Extacting the OCDB in a separate module. The detectors have write permission in the...
[u/mrichter/AliRoot.git] / MUON / MUONStatusMap.C
CommitLineData
d565d56c 1/**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
3 * *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
6 * *
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 **************************************************************************/
15
16/* $Id$ */
17
e54bf126 18/// \ingroup macros
19/// \file MUONStatusMap.C
20/// \brief Macro to check/test pad status and pad status map makers
3fb89a07 21///
e54bf126 22/// \author Laurent Aphecetche
d565d56c 23
24#if !defined(__CINT__) || defined(__MAKECINT__)
25#include "AliCDBManager.h"
26#include "AliMUONCalibrationData.h"
d565d56c 27#include "AliMUONPadStatusMaker.h"
28#include "AliMUONPadStatusMapMaker.h"
d565d56c 29#include "AliMUONVCalibParam.h"
7190ece1 30#include "AliMUONVStore.h"
31#include "AliMpCDB.h"
32#include "AliMpConstants.h"
33#include "AliMpDDLStore.h"
34#include "AliMpDetElement.h"
d565d56c 35#include "AliMpIntPair.h"
7190ece1 36#include "AliMpManuIterator.h"
d565d56c 37#include "Riostream.h"
38#endif
39
7190ece1 40void FindBad(AliMUONPadStatusMaker& statusMaker, Int_t mask, Int_t& nBadPads, Int_t& nPads)
d565d56c 41{
7190ece1 42 AliMpManuIterator it;
43
44 nBadPads = nPads = 0;
d565d56c 45
7190ece1 46 Int_t detElemId;
47 Int_t manuId;
48
49 while ( it.Next(detElemId,manuId) )
d565d56c 50 {
d565d56c 51 Bool_t bad(kFALSE);
7190ece1 52
53 AliMpDetElement* de = AliMpDDLStore::Instance()->GetDetElement(detElemId);
54
55 Int_t nb(0);
56 Int_t n(0);
57
58 for ( Int_t i = 0; i < AliMpConstants::ManuNofChannels(); ++i )
d565d56c 59 {
7190ece1 60 if ( de->IsConnectedChannel(manuId,i) )
61 {
62 ++n;
63 ++nPads;
64 Int_t status = statusMaker.PadStatus(detElemId,manuId,i);
65 if ( ( status & mask) || (!mask && status) )
66 {
67 bad = kTRUE;
68 ++nBadPads;
69 ++nb;
70 }
71 }
d565d56c 72 }
7190ece1 73
d565d56c 74 if (bad)
75 {
7190ece1 76 cout << Form("DE %4d ManuId %4d %2d bad pads over %2d pads",
77 detElemId,manuId,nb,n) << endl;
d565d56c 78 }
79 }
80}
81
162637e4 82AliMUONVStore* MUONStatusMap(const TString& cdbStorage = "local://$ALICE_ROOT/OCDB",
7190ece1 83 Int_t runNumber=0, Bool_t statusOnly=kFALSE,
84 Int_t mask=0x8080)
3fb89a07 85{
86 AliCDBManager::Instance()->SetDefaultStorage(cdbStorage.Data());
7190ece1 87 AliCDBManager::Instance()->SetRun(runNumber);
3fb89a07 88
7190ece1 89 AliMpCDB::LoadDDLStore();
90
d565d56c 91 AliMUONCalibrationData cd(runNumber);
92
93 AliMUONPadStatusMaker statusMaker(cd);
94
95// statusMaker.SetPedMeanLimits(50,200);
7190ece1 96// statusMaker.SetPedSigmaLimits(0.5,2);
d565d56c 97
7190ece1 98 Int_t nbad;
99 Int_t ntotal;
100
101 FindBad(statusMaker,mask,nbad,ntotal);
102
103 if (ntotal<=0)
d565d56c 104 {
7190ece1 105 cout << "Error : got no pad at all ?!" << endl;
106 return 0x0;
107 }
108
109 cout << Form("Nbad = %6d over %6d pads (%7.2f %%)",
110 nbad,ntotal,100.0*nbad/ntotal) << endl;
d565d56c 111
7190ece1 112 if ( statusOnly ) return statusMaker.StatusStore();
d565d56c 113
7190ece1 114 const Bool_t deferredInitialization = kFALSE;
d565d56c 115
7190ece1 116 AliMUONPadStatusMapMaker statusMapMaker(cd,mask,deferredInitialization);
117
118 return statusMapMaker.StatusMap();
d565d56c 119}