]> git.uio.no Git - u/mrichter/AliRoot.git/blob - MUON/MUONStatusMap.C
Updated list of MUON libraries
[u/mrichter/AliRoot.git] / MUON / MUONStatusMap.C
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
19 ///
20 // Laurent Aphecetche
21
22 #if !defined(__CINT__) || defined(__MAKECINT__)
23 #include "AliCDBManager.h"
24 #include "AliMUONCalibrationData.h"
25 #include "AliMUONObjectPair.h"
26 #include "AliMUONPadStatusMaker.h"
27 #include "AliMUONPadStatusMapMaker.h"
28 #include "AliMUONV2DStore.h"
29 #include "AliMUONVCalibParam.h"
30 #include "AliMUONVDataIterator.h"
31 #include "AliMpIntPair.h"
32 #include "Riostream.h"
33 #endif
34
35
36 void findBad(const AliMUONV2DStore& status)
37 {
38   AliMUONVDataIterator* it = status.Iterator();
39   AliMUONObjectPair* pair;
40   
41   while ( ( pair = static_cast<AliMUONObjectPair*>(it->Next()) ) )
42   {
43     AliMpIntPair* p = static_cast<AliMpIntPair*>(pair->First());
44     Int_t detElemId = p->GetFirst();
45     Int_t manuId = p->GetSecond();
46     AliMUONVCalibParam* param = static_cast<AliMUONVCalibParam*>(pair->Second());
47     Bool_t bad(kFALSE);
48     for ( Int_t i = 0; i < param->Size(); ++i ) 
49     {
50       if ( param->ValueAsInt(0) ) bad = kTRUE;
51     }
52     if (bad)
53     {
54       cout << Form("DE %4d ManuId %4d",detElemId,manuId) << endl;
55     }
56     if (it->IsOwner()) delete pair;
57   }
58 }
59
60 AliMUONV2DStore* MUONStatusMap(const TString& cdbStorage = "local://$ALICE_ROOT",
61                                Int_t runNumber=0, Bool_t statusOnly=kFALSE, Int_t mask=0)
62 {  
63   AliCDBManager::Instance()->SetDefaultStorage(cdbStorage.Data());
64
65   AliMUONCalibrationData cd(runNumber);
66   
67   AliMUONPadStatusMaker statusMaker(cd);
68   
69 //  statusMaker.SetPedMeanLimits(50,200);
70   statusMaker.SetPedSigmaLimits(0.5,2);
71   
72   AliMUONV2DStore* status = statusMaker.MakeStatus();
73  
74   if ( status )
75   {
76     findBad(*status);
77   }
78   else
79   {
80     cout << "ERROR. Could not get status from CDB" << endl;
81     return 0;
82   }
83   
84   if ( statusOnly ) return status;
85   
86   AliMUONPadStatusMapMaker statusMapMaker(cd);
87   
88   return statusMapMaker.MakePadStatusMap(*status,mask);
89 }