]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - MUON/MUONStatusMap.C
Update for 2012
[u/mrichter/AliRoot.git] / MUON / MUONStatusMap.C
index 78cfeba0e14832cc79a4bdb06105970dbfa103f7..0b19c04560b52a3a61db6439f9023281d513b479 100644 (file)
@@ -26,6 +26,7 @@
 #include "AliCDBEntry.h"
 #include "AliLog.h"
 #include "AliMpCDB.h"
+#include "AliMpDEManager.h"
 #include "AliMUONCDB.h"
 #include "AliMUONCalibrationData.h"
 #include "AliMUONPadStatusMaker.h"
@@ -103,17 +104,10 @@ void MUONStatusMap(AliMUONVStore*& vstatus,
   AliCDBManager::Instance()->SetDefaultStorage(cdbStorage);
   AliCDBManager::Instance()->SetRun(runNumber);
   
-//  AliCDBManager::Instance()->SetSpecificStorage("MUON/Calib/RecoParam","alien://folder=/alice/cern.ch/user/c/cgeuna/OCDB");
-  
   AliMUONCDB::LoadMapping();
   
   AliMUONRecoParam* recoParam = AliMUONCDB::LoadRecoParam();
   
-//  man->SetSpecificStorage("MUON/Calib/OccupancyMap","local://$ALICE_ROOT/OCDB");
-//  man->SetSpecificStorage("MUON/Calib/OccupancyMap","alien://folder=/alice/cern.ch/user/l/laphecet/OCDB");
-//  man->SetSpecificStorage("MUON/Calib/RejectList","alien://folder=/alice/cern.ch/user/l/laphecet/OCDB");
-//  man->SetSpecificStorage("MUON/Align/Data","alien://folder=/alice/cern.ch/user/l/laphecet/OCDB");
-
   AliMUONCalibrationData cd(runNumber);
   
   AliMUONPadStatusMaker statusMaker(cd);
@@ -122,8 +116,6 @@ void MUONStatusMap(AliMUONVStore*& vstatus,
   
   UInt_t mask = recoParam->PadGoodnessMask();
 
-  //  delete recoParam;
-  
   statusMaker.Report(mask);
   
   vstatus = static_cast<AliMUONVStore*>(statusMaker.StatusStore()->Clone());
@@ -142,10 +134,12 @@ Int_t GetBadChannels(Int_t runNumber,
                      Int_t& nbadgain,
                      Int_t& nbadocc,
                      Int_t& nmissing,
-                     Int_t& nreco)
+                     Int_t& nreco,
+                     Int_t chamber=-1)
 {
   if (!AliCDBManager::Instance()->IsDefaultStorageSet())
   {
+//    AliCDBManager::Instance()->SetDefaultStorage("alien://folder=/alice/data/2011/OCDB?cacheFold=/local/cdb");
     AliCDBManager::Instance()->SetDefaultStorage("raw://");
   }
   
@@ -195,6 +189,9 @@ Int_t GetBadChannels(Int_t runNumber,
   while ( it.Next(detElemId,manuId) )
   {
     AliMpDetElement* de = AliMpDDLStore::Instance()->GetDetElement(detElemId);
+    
+    if ( chamber >= 0 && AliMpDEManager::GetChamberId(detElemId) != chamber ) continue;
+    
     for ( Int_t manuChannel = 0; manuChannel < AliMpConstants::ManuNofChannels(); ++manuChannel )
     {
       if ( de->IsConnectedChannel(manuId,manuChannel) )
@@ -241,11 +238,17 @@ Int_t GetBadChannels(Int_t runNumber,
     }
   }
   
-  if (ntotal!=NTOTALNUMBEROFPADS)
+  if ( chamber<0 && ntotal!=NTOTALNUMBEROFPADS)
   {
     cerr << Form("ERROR ! NOT THE EXPECTED NUMBER OF CHANNELS (%d vs 1064008) FOR RUN %09d",
                  ntotal,runNumber) << endl;
   }
+  else
+  {
+    cout << Form("Chamber %d - %d channels",chamber,ntotal) << endl;
+    cout << Form("nbadped %5d nbadhv %5d nbadgain %5d nbadocc %5d nmissing %5d nreco %5d",
+                 nbadped,nbadhv,nbadgain,nbadocc,nmissing,nreco) << endl;
+  }
   
   AliCDBManager::Instance()->ClearCache(); 
  
@@ -292,7 +295,8 @@ void DrawPeriod(double run1, double run2, double ymin, double ymax, const char*
 //______________________________________________________________________________
 void DrawEvolution(const char* file, bool normalized=true)
 {
-  TFile* f = TFile::Open(file);
+
+  TFile* f = TFile::Open(gSystem->ExpandPathName(file));
   
   if (!f) return;
   
@@ -311,6 +315,8 @@ void DrawEvolution(const char* file, bool normalized=true)
   int runmin = TMath::Nint(g->GetX()[0]);
   int runmax = TMath::Nint(g->GetX()[g->GetN()-1]);
   
+  cout << Form("Run range found in file %s = %d - %d",file,runmin,runmax) << endl;
+  
   double ymax(0.4);
   
   TH2* h = new TH2F("hframe","hframe;Run number;Fraction of dead channels",100,runmin-200,runmax+200,100,0,ymax);
@@ -340,9 +346,19 @@ void DrawEvolution(const char* file, bool normalized=true)
 
   DrawPeriod(148370,150702,0,ymax,"11b");
 
-  DrawPeriod(155384,155384,0,ymax,"11c");
+  DrawPeriod(151566,154583,0,ymax,"11c");
+
+  DrawPeriod(158084,159606,0,ymax,"11d");
+
+  DrawPeriod(160677,162717,0,ymax,"11e");
 
-  DrawPeriod(156477,159606,0,ymax,"11d");
+  DrawPeriod(162933,165744,0,ymax,"11f");
+
+  DrawPeriod(167703,170593,0,ymax,"11h");
+
+  DrawPeriod(176661,177295,0,ymax,"12a");
+
+  DrawPeriod(177384,178053,0,ymax,"12b");
 
   Draw(f,"nbad",l,normalized);
   Draw(f,"nbadped",l,normalized);
@@ -368,6 +384,11 @@ void MUONStatusMapEvolution(const char* runlist, const char* outfile)
   //
   // output can be then plotted using the DrawEvolution function
   //
+  // Note that the output of different runlists can then be merged simply using
+  // the hadd program, and so then the DrawEvolution can be used over
+  // a huge period, e.g. a full year, while this method is better restricted
+  // to a period or even less (depending on your success of accessing the OCDB)
+  //
   
   std::vector<int> runs;
 
@@ -379,12 +400,13 @@ void MUONStatusMapEvolution(const char* runlist, const char* outfile)
     return;    
   }
   
-  int year(2011);
+  int year(2012);
   
   if ( runs[0] <= 139699 ) year=2010;
   
+  if ( runs[0] <= 176000 ) year=2011;
+      
   AliCDBManager::Instance()->SetDefaultStorage(Form("alien://folder=/alice/data/%d/OCDB?cacheFold=/local/cdb",year));
-//  AliCDBManager::Instance()->SetDefaultStorage("local:///local/cdb/alice/data/2010/OCDB");
   
   TList glist;