+ while((source = dynamic_cast<TObjString*> (iter.Next())))
+ {
+ nameOfFile = GetFile(kDAQ, "PMD_HOT.root", source->GetName());
+ if(nameOfFile.Length() == 0)
+ {
+ Log(Form("PMDHOT: Error retrieving file from source %s failed!", source->GetName()));
+ delete fsPmdHot;
+ return kFALSE;
+ }
+
+ Log(Form("PMDHOT: File with id PMD_HOT.root got from %s", source->GetName()));
+
+ Int_t det, sm, row, col;
+ Float_t flag;
+
+ TFile *opnFile = new TFile(nameOfFile.Data());
+ if(!opnFile || !opnFile->IsOpen())
+ {
+ Log(Form("PMDHOT: Error opening file with Id PMD_HOT.root from source %s!", source->GetName()));
+ return kFALSE;
+ }
+
+ TTree *tree = dynamic_cast<TTree *> (opnFile->Get("hot"));
+ if (!tree)
+ {
+ Log("PMDHOT: Could not find object \"hot\" in DAQ file!");
+ return kFALSE;
+ }
+
+ tree->SetBranchAddress("det", &det);
+ tree->SetBranchAddress("sm", &sm);
+ tree->SetBranchAddress("row", &row);
+ tree->SetBranchAddress("col", &col);
+ tree->SetBranchAddress("flag", &flag);
+
+ Int_t nEntries = (Int_t) tree->GetEntries();
+ for(Int_t j = 0; j < nEntries; j++)
+ {
+ tree->GetEntry(j);
+ hotda->SetHotChannel(det,sm,row,col,flag);
+ }
+ opnFile->Close();
+ delete opnFile;
+ }
+
+ AliCDBMetaData metaData;
+ metaData.SetBeamPeriod(0);
+ metaData.SetResponsible("Satyajit Jena");
+ metaData.SetComment("PMDHOT: PMD preprocessor");
+ hotresult = Store("Calib","Hot", hotda, &metaData);
+ delete hotda;
+ if(hotresult==0)
+ {
+ Log("PMDHOT: Error storing");
+ return kFALSE;
+ }
+ else
+ {
+ return kTRUE;
+ }
+
+ }
+}
+
+//________________________________________________________
+Bool_t AliPMDPreprocessor::StorePmdMEAN()
+{
+ AliPMDMeanSm *smmeanda = new AliPMDMeanSm();
+ TList* gfsPmdMean = GetFileSources(kDAQ, "PMD_MEAN_SM.root");
+
+ if(!gfsPmdMean)
+ {
+ Log(Form("PMDMEAN: No sources found for PMD_MEAN_SM.root!"));
+ return kFALSE;
+ }
+ else
+ {
+ AliInfo("PMDMEAN: Here's the list of sources for PMD_MEAN_SM.root");
+ gfsPmdMean->Print();
+
+ TIter iter(gfsPmdMean);
+ TObjString* sourc;
+ UInt_t storeMeanData = 0;
+ TString filenam;
+
+ while((sourc=dynamic_cast<TObjString*> (iter.Next())))
+ {
+ filenam = GetFile(kDAQ, "PMD_MEAN_SM.root", sourc->GetName());
+ if(filenam.Length() == 0)
+ {
+ Log(Form("PMDMEAN: Error retrieving file from source %s failed!", sourc->GetName()));
+ delete gfsPmdMean;
+ return kFALSE;
+ }
+
+ Log(Form("PMDMEAN: File with id PMD_MEAN_SM.root got from %s", sourc->GetName()));
+
+ Int_t det = 0, sm = 0;
+ Float_t smmean = 0.;
+
+ TFile *opnFile = new TFile(filenam.Data());
+ if(!opnFile || !opnFile->IsOpen())
+ {
+ Log(Form("PMDMEAN: Error opening file with Id PMD_MEAN_SM.root from source %s!", sourc->GetName()));
+ return kFALSE;
+ }
+
+ TTree *tree = dynamic_cast<TTree *> (opnFile->Get("mean"));
+ if (!tree)
+ {
+ Log("PMDMEAN: Could not find object \"hot\" in DAQ file!");
+ return kFALSE;
+ }
+
+ tree->SetBranchAddress("det", &det);
+ tree->SetBranchAddress("sm", &sm);
+ tree->SetBranchAddress("smmean", &smmean);
+
+ Int_t nEntries = (Int_t) tree->GetEntries();
+ for(Int_t j = 0; j < nEntries; j++)
+ {
+ tree->GetEntry(j);
+ smmeanda->SetMeanSm(det,sm,smmean);
+ }
+ opnFile->Close();
+ delete opnFile;
+ }
+
+ AliCDBMetaData mdMEAN;
+ mdMEAN.SetBeamPeriod(0);
+ mdMEAN.SetResponsible("Satyajit Jena");
+ mdMEAN.SetComment("PMDMEAN: PMD preprocessor");
+
+ storeMeanData = Store("Calib","SMMEAN", smmeanda, &mdMEAN);
+ delete smmeanda;
+
+ if(storeMeanData==0)
+ {
+ Log("PMDMEAN: Error storing");
+ return kFALSE;
+ }
+ else
+ {
+ return kTRUE;
+ }
+ }
+
+}
+
+//_____________________________________________________________
+Bool_t AliPMDPreprocessor::StorePmdDCS(TMap *sDaqAM)
+{
+
+ AliCDBMetaData mdDCS;
+ mdDCS.SetResponsible("Satyajit Jena");
+ mdDCS.SetComment("DCS data for PMD");
+
+ Bool_t resStore = kFALSE;
+ resStore = StoreReferenceData("DCS","Data",sDaqAM,&mdDCS);
+
+ if(resStore == 0)
+ {
+ Log("PMDDP: Error storing");
+ return kFALSE;
+ }
+ else
+ {
+ return kTRUE;
+ }
+
+}
+
+//_____________________________________________________________________
+
+UInt_t AliPMDPreprocessor::Process(TMap* pmdDaqAliasMap)
+{
+
+ if(!pmdDaqAliasMap)
+ {
+ return 1;
+ }
+
+ TString runType = GetRunType();
+
+ if(runType == "PEDESTAL")
+ {
+
+ Log(Form("------------------ PMD Pedestal --------------"));
+ Bool_t pmdPed = StorePmdPED();
+ if(!pmdPed)
+ {
+ Log(Form("ERROR: Couldn't write PMD pedestal file"));
+ return 1;
+ }
+ else
+ {
+ Log(Form("Storing of PMD Pedestal File is Successful"));
+ return 0;
+ }
+ }
+
+ else if (runType == "PHYSICS")
+ {
+ Log(Form("------------------- PMD GAIN----------------"));
+ Bool_t pmdGAIN = StorePmdGAIN();
+ if (!pmdGAIN)
+ {
+ Log(Form("ERROR: Couldn't write PMD GAIN file"));
+
+ }
+ else
+ {
+ Log(Form("Storing of PMD GAIN File is Successful"));
+
+ }