1 /**************************************************************************
2 * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 * Author: The ALICE Off-line Project. *
5 * Contributors are mentioned in the code where appropriate. *
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 **************************************************************************/
16 ///////////////////////////////////////////////////////////////////////////////
17 // PHOS Preprocessor class. It runs by Shuttle at the end of the run,
18 // calculates calibration coefficients and dead/bad channels
19 // to be posted in OCDB
21 // Author: Hisayuki Torii, 11 August 2009
22 ///////////////////////////////////////////////////////////////////////////////
28 #include "TObjString.h"
30 #include "AliPHOSPreprocessorPHYS.h"
32 ClassImp(AliPHOSPreprocessorPHYS)
34 //_______________________________________________________________________________________
35 AliPHOSPreprocessorPHYS::AliPHOSPreprocessorPHYS() : AliPreprocessor("PHS",0) {
38 //_______________________________________________________________________________________
39 AliPHOSPreprocessorPHYS::AliPHOSPreprocessorPHYS(AliShuttleInterface* shuttle): AliPreprocessor("PHS",shuttle) {
42 AddRunType("PHYSICS");
43 AddRunType("COSMICS"); // Does this exist??
45 //_______________________________________________________________________________________
46 UInt_t AliPHOSPreprocessorPHYS::Process(TMap* /*valueSet*/){
47 // process data retrieved by the Shuttle
50 TString runType = GetRunType();
51 Log(Form("Run type: %s",runType.Data()));
53 if( runType=="PHYSICS" || runType=="COSMICS") {
55 Bool_t calibEmc_OK = CalibratePhys();
56 if(calibEmc_OK) return 0;
59 Log(Form("Unknown run type %s. Do nothing and return OK.",runType.Data()));
62 //_______________________________________________________________________________________
63 Bool_t AliPHOSPreprocessorPHYS::CalibratePhys(){
64 //process PHYSICS event retrieved by the Shuttle
68 list = GetFileSources(kDAQ,"PHOSDApi0mip");
70 Log(Form("DAQ sources list not found!"));
73 if(!list->GetEntries()) {
74 Log(Form("Got empty sources list. It seems PHYS DA did not produce any files!"));
81 while ((source = dynamic_cast<TObjString *> (iter.Next()))) {
82 AliInfo(Form("found source %s", source->String().Data()));
84 TString fileName = GetFile(kDAQ, "PHOSDApi0mip", source->GetName());
85 AliInfo(Form("Got filename: %s",fileName.Data()));
87 TFile* file = TFile::Open(fileName);
89 Log(Form("File %s is not opened, something goes wrong!",fileName.Data()));
94 //TList * keylist = file->GetListOfKeys();
95 Int_t nkeys = file->GetNkeys();
97 Log(Form("Not enough (%d) for calibration.",nkeys));
98 return 1; // it's not fatal! May be short run..
108 //_______________________________________________________________________________________