AliRoot Core  edcc906 (edcc906)
runMCHShuttleOffline.C
Go to the documentation of this file.
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 
33 
34 #include "AliCDBManager.h"
35 #include "AliCDBRunRange.h"
36 #include "AliMUON2DMap.h"
37 #include "AliMUONCDB.h"
38 #include "AliMUONTrackerIO.h"
40 #include "AliMpCDB.h"
41 #include "AliMpDDLStore.h"
42 #include "AliShuttleInterface.h"
43 #include "AliTestShuttle.h"
44 #include "TMap.h"
45 #include "TString.h"
46 #include <iostream>
47 
48 //______________________________________________________________________________
49 TString fileName(const char* dir, int runNumber, const char* da, int i, const char* type)
50 {
51  const char* format = "%s/DAQ_MCH_%6d_%s_%s-%d.shuttle";
52  return Form(format,dir,runNumber,type,da,i);
53 }
54 
55 //______________________________________________________________________________
56 void runMCHShuttleOffline(int runNumber, const char* runType,
57  const char* sourceDirectory,
58  const char* dcsmapfile,
59  int startDCStime,
60  int endDCStime)
61 {
62  AliTestShuttle shuttle(runNumber, startDCStime,endDCStime);
63 
64  const char* inputCDB = "local://$ALIROOT_OCDB_ROOT/OCDB";
65 
66  AliTestShuttle::SetMainCDB(inputCDB);
67  AliTestShuttle::SetMainRefStorage("local://$ALICE_ROOT/OCDB/SHUTTLE/TestShuttle/TestReference");
68 
69  printf("Test Shuttle temp dir: %s\n", AliShuttleInterface::GetShuttleTempDir());
70  printf("Test Shuttle log dir: %s\n", AliShuttleInterface::GetShuttleLogDir());
71  printf("Test OCDB storage Uri: %s\n", AliShuttleInterface::GetMainCDB().Data());
72  printf("Test Reference storage Uri: %s\n", AliShuttleInterface::GetMainRefStorage().Data());
73 
74  // The shuttle can process files that originate from DCS, DAQ and HLT.
75  // To test it, we provide some local files and locations where these would be found when
76  // the online machinery would be there.
77  // In real life this functions would be produces by the sub-detectors
78  // calibration programs in DCS, DAQ or HLT. These files can then be retrieved using the Shuttle.
79  //
80  // Files are added with the function AliTestShuttle::AddInputFile. The syntax is:
81  // AddInputFile(<system>, <detector>, <id>, <source>, <local-file>)
82  // In this example we add 4 files originating from different LDCs but with the same id (PEDESTALS)
83 
84  if (TString(runType)=="PEDESTAL") {
85 
86  TString da = "ldc-MUON_TRK";
87  for ( int i = 0; i < 7; ++i ) {
88  shuttle.AddInputFile(AliTestShuttle::kDAQ,"MCH","PEDESTALS",Form("LDC%d",i),fileName(sourceDirectory,runNumber,da.Data(),i,"PEDESTALS"));
89  shuttle.AddInputFile(AliTestShuttle::kDAQ,"MCH","CONFIG",Form("LDC%d",i),fileName(sourceDirectory,runNumber,da.Data(),i,"CONFIG"));
90 
91  }
92  } else if (TString(runType)=="PHYSICS") {
93  TString da = "mon-DA-MCH";
94  shuttle.AddInputFile(AliTestShuttle::kDAQ,"MCH","OCCUPANCY","mon",fileName(sourceDirectory,runNumber,da.Data(),0,"OCCUPANCY"));
95  shuttle.AddInputFile(AliTestShuttle::kDAQ,"MCH","BPEVO","mon",fileName(sourceDirectory,runNumber,da.Data(),0,"BPEVO"));
96  TFile* f = TFile::Open(dcsmapfile);
97  TMap* dcsAliasMap = static_cast<TMap*>(f->Get("DCSmap")->Clone());
98  delete f;
99  shuttle.SetDCSInput(dcsAliasMap);
100  }
101  else {
102  std::cout << "Invalid runtype " << runType << std::endl;
103  }
104  shuttle.SetInputRunType(runType);
105 
106  shuttle.AddInputRunParameter("totalEvents","20");
107 
108  // Create the preprocessor that should be tested, it registers itself automatically to the shuttle
109  new AliMUONTrackerPreprocessor(&shuttle);
110 
111  shuttle.Print();
112 
113  // Test the preprocessor
114  shuttle.Process();
115 
116 }
117 
118 //______________________________________________________________________________
120 
121  runMCHShuttleOffline(272781,"PEDESTAL","$HOME/analysis/2017/LHC17h/MCH_272781/","",0,1);
122 
123  runMCHShuttleOffline(272763,"PHYSICS","$HOME/analysis/2017/LHC17h/MCH_272763/","$HOME/analysis/2017/LHC17h/MCH_272763/testDCSMap.root_MCH_1498419754_1498425527_run272763.root",1498419754,1498425527);
124 
125  runMCHShuttleOffline(272764,"PHYSICS","$HOME/analysis/2017/LHC17h/MCH_272764/","$HOME/analysis/2017/LHC17h/MCH_272764/testDCSMap.root_MCH_1498425548_1498428314_run272764.root",1498425548,1498428314);
126 
127 }
128 
printf("Chi2/npoints = %f\n", TMath::Sqrt(chi2/npoints))
TFile * Open(const char *filename, Long64_t &nevents)
static TString GetMainRefStorage()
static TString GetMainCDB()
TString fileName(const char *dir, int runNumber, const char *da, int i, const char *type)
static const char * GetShuttleTempDir()
TF1 * f
Definition: interpolTest.C:21
static const char * GetShuttleLogDir()
void runMCHShuttleOffline(int runNumber, const char *runType, const char *sourceDirectory, const char *dcsmapfile, int startDCStime, int endDCStime)
static Int_t runNumber
Definition: pdc06_config.C:126
Shuttle preprocessor for MUON tracker.