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