]>
Commit | Line | Data |
---|---|---|
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 | ||
18 | /// Macro to check/test pad status and pad status map makers | |
3fb89a07 | 19 | /// |
d565d56c | 20 | // Laurent Aphecetche |
21 | ||
22 | #if !defined(__CINT__) || defined(__MAKECINT__) | |
23 | #include "AliCDBManager.h" | |
24 | #include "AliMUONCalibrationData.h" | |
d565d56c | 25 | #include "AliMUONPadStatusMaker.h" |
26 | #include "AliMUONPadStatusMapMaker.h" | |
d565d56c | 27 | #include "AliMUONVCalibParam.h" |
7190ece1 | 28 | #include "AliMUONVStore.h" |
29 | #include "AliMpCDB.h" | |
30 | #include "AliMpConstants.h" | |
31 | #include "AliMpDDLStore.h" | |
32 | #include "AliMpDetElement.h" | |
d565d56c | 33 | #include "AliMpIntPair.h" |
7190ece1 | 34 | #include "AliMpManuIterator.h" |
d565d56c | 35 | #include "Riostream.h" |
36 | #endif | |
37 | ||
7190ece1 | 38 | void FindBad(AliMUONPadStatusMaker& statusMaker, Int_t mask, Int_t& nBadPads, Int_t& nPads) |
d565d56c | 39 | { |
7190ece1 | 40 | AliMpManuIterator it; |
41 | ||
42 | nBadPads = nPads = 0; | |
d565d56c | 43 | |
7190ece1 | 44 | Int_t detElemId; |
45 | Int_t manuId; | |
46 | ||
47 | while ( it.Next(detElemId,manuId) ) | |
d565d56c | 48 | { |
d565d56c | 49 | Bool_t bad(kFALSE); |
7190ece1 | 50 | |
51 | AliMpDetElement* de = AliMpDDLStore::Instance()->GetDetElement(detElemId); | |
52 | ||
53 | Int_t nb(0); | |
54 | Int_t n(0); | |
55 | ||
56 | for ( Int_t i = 0; i < AliMpConstants::ManuNofChannels(); ++i ) | |
d565d56c | 57 | { |
7190ece1 | 58 | if ( de->IsConnectedChannel(manuId,i) ) |
59 | { | |
60 | ++n; | |
61 | ++nPads; | |
62 | Int_t status = statusMaker.PadStatus(detElemId,manuId,i); | |
63 | if ( ( status & mask) || (!mask && status) ) | |
64 | { | |
65 | bad = kTRUE; | |
66 | ++nBadPads; | |
67 | ++nb; | |
68 | } | |
69 | } | |
d565d56c | 70 | } |
7190ece1 | 71 | |
d565d56c | 72 | if (bad) |
73 | { | |
7190ece1 | 74 | cout << Form("DE %4d ManuId %4d %2d bad pads over %2d pads", |
75 | detElemId,manuId,nb,n) << endl; | |
d565d56c | 76 | } |
77 | } | |
78 | } | |
79 | ||
b1f2fbb2 | 80 | AliMUONVStore* MUONStatusMap(const TString& cdbStorage = "local://$ALICE_ROOT", |
7190ece1 | 81 | Int_t runNumber=0, Bool_t statusOnly=kFALSE, |
82 | Int_t mask=0x8080) | |
3fb89a07 | 83 | { |
84 | AliCDBManager::Instance()->SetDefaultStorage(cdbStorage.Data()); | |
7190ece1 | 85 | AliCDBManager::Instance()->SetRun(runNumber); |
3fb89a07 | 86 | |
7190ece1 | 87 | AliMpCDB::LoadDDLStore(); |
88 | ||
d565d56c | 89 | AliMUONCalibrationData cd(runNumber); |
90 | ||
91 | AliMUONPadStatusMaker statusMaker(cd); | |
92 | ||
93 | // statusMaker.SetPedMeanLimits(50,200); | |
7190ece1 | 94 | // statusMaker.SetPedSigmaLimits(0.5,2); |
d565d56c | 95 | |
7190ece1 | 96 | Int_t nbad; |
97 | Int_t ntotal; | |
98 | ||
99 | FindBad(statusMaker,mask,nbad,ntotal); | |
100 | ||
101 | if (ntotal<=0) | |
d565d56c | 102 | { |
7190ece1 | 103 | cout << "Error : got no pad at all ?!" << endl; |
104 | return 0x0; | |
105 | } | |
106 | ||
107 | cout << Form("Nbad = %6d over %6d pads (%7.2f %%)", | |
108 | nbad,ntotal,100.0*nbad/ntotal) << endl; | |
d565d56c | 109 | |
7190ece1 | 110 | if ( statusOnly ) return statusMaker.StatusStore(); |
d565d56c | 111 | |
7190ece1 | 112 | const Bool_t deferredInitialization = kFALSE; |
d565d56c | 113 | |
7190ece1 | 114 | AliMUONPadStatusMapMaker statusMapMaker(cd,mask,deferredInitialization); |
115 | ||
116 | return statusMapMaker.StatusMap(); | |
d565d56c | 117 | } |