X-Git-Url: http://git.uio.no/git/?a=blobdiff_plain;f=FMD%2FAliFMDPreprocessor.cxx;h=98654f22e94702eb18279ddc9030ee4311705220;hb=571a7b22b6b43e9984892e2fec4e272b73c5c39b;hp=388611ce4750b1ac0c0bf771f65540939ec3150d;hpb=2f7fce12576762cd1125fc51d609f29e5ed707fa;p=u%2Fmrichter%2FAliRoot.git diff --git a/FMD/AliFMDPreprocessor.cxx b/FMD/AliFMDPreprocessor.cxx index 388611ce475..98654f22e94 100644 --- a/FMD/AliFMDPreprocessor.cxx +++ b/FMD/AliFMDPreprocessor.cxx @@ -115,7 +115,7 @@ Bool_t AliFMDPreprocessor::GetAndCheckFileSources(TList*& list, case kDCS: sys = "DCS"; break; default: sys = "unknown"; break; } - Log(Form("Failed to get file sources for %s/%s", sys.Data(), system)); + Log(Form("Failed to get file sources for %s/%d", sys.Data(), system)); return kFALSE; } return kTRUE; @@ -143,15 +143,26 @@ UInt_t AliFMDPreprocessor::Process(TMap* /* dcsAliasMap */) Bool_t resultRate = kTRUE; Bool_t resultZero = kTRUE; Bool_t infoCalib = kTRUE; + Bool_t resultDead = kTRUE; // Do we need this ? // if(!dcsAliasMap) return 1; // // Invoking the cdb manager and the FMD parameters class // AliCDBManager* cdb = AliCDBManager::Instance(); - // cdb->SetDefaultStorage("local://$ALICE_ROOT"); + // cdb->SetDefaultStorage("local://$ALICE_ROOT/OCDB"); // cdb->SetRun(0); + + // Get the run type + TString runType(GetRunType()); + AliFMDParameters* pars = AliFMDParameters::Instance(); - pars->Init(this, false, AliFMDParameters::kAltroMap); + if(runType.Contains("PEDESTAL", TString::kIgnoreCase)) + pars->Init(this, false, AliFMDParameters::kAltroMap|AliFMDParameters::kPulseGain); + else if(runType.Contains("GAIN", TString::kIgnoreCase)) + pars->Init(this, false, AliFMDParameters::kAltroMap|AliFMDParameters::kPedestal); + else + pars->Init(this, false, AliFMDParameters::kAltroMap); + // This is if the SOR contains Fee parameters, and we run a DA to // extract these parameters. The same code could work if we get // the information from DCS via the FXS @@ -159,7 +170,7 @@ UInt_t AliFMDPreprocessor::Process(TMap* /* dcsAliasMap */) AliFMDCalibSampleRate* calibRate = 0; AliFMDCalibStripRange* calibRange = 0; AliFMDCalibZeroSuppression* calibZero = 0; - + if (GetAndCheckFileSources(files, kDAQ,pars->GetConditionsShuttleID())) infoCalib = GetInfoCalibration(files, calibRate, calibRange, calibZero); @@ -168,12 +179,11 @@ UInt_t AliFMDPreprocessor::Process(TMap* /* dcsAliasMap */) resultZero = (!calibZero ? kFALSE : kTRUE); - // Get the run type - TString runType(GetRunType()); - + //Creating calibration objects AliFMDCalibPedestal* calibPed = 0; AliFMDCalibGain* calibGain = 0; + AliFMDCalibDeadMap* calibDead = 0; if (runType.Contains("PEDESTAL", TString::kIgnoreCase)) { if (GetAndCheckFileSources(files, kDAQ, pars->GetPedestalShuttleID())) { if(files->GetSize()) @@ -188,6 +198,8 @@ UInt_t AliFMDPreprocessor::Process(TMap* /* dcsAliasMap */) } resultGain = (calibGain ? kTRUE : kFALSE); } + if(runType.Contains("PEDESTAL", TString::kIgnoreCase) || runType.Contains("GAIN", TString::kIgnoreCase)) + calibDead = GetDeadChannelMap(calibPed,calibGain); //Storing Calibration objects AliCDBMetaData metaData; @@ -215,9 +227,13 @@ UInt_t AliFMDPreprocessor::Process(TMap* /* dcsAliasMap */) resultZero = Store("Calib","ZeroSuppression", calibZero,&metaData,0,kTRUE); delete calibZero; } + if(calibDead) { + resultDead = Store("Calib","Dead", calibDead,&metaData,0,kTRUE); + delete calibDead; + } Bool_t success = (resultPed && resultGain && resultRange && - resultRate && resultZero && infoCalib); + resultRate && resultZero && resultDead && infoCalib); Log(Form("FMD preprocessor was %s", (success ? "successful" : "failed"))); return (success ? 0 : 1); @@ -265,7 +281,7 @@ AliFMDPreprocessor::GetInfoCalibration(TList* files, //____________________________________________________________________ AliFMDCalibPedestal* -AliFMDPreprocessor::GetPedestalCalibration(TList* pedFiles) +AliFMDPreprocessor::GetPedestalCalibration(const TList* pedFiles) { // Read DAQ DA produced CSV files of pedestals, and return a // calibration object. @@ -282,33 +298,35 @@ AliFMDPreprocessor::GetPedestalCalibration(TList* pedFiles) TObjString* fileSource; while((fileSource = dynamic_cast(iter.Next()))) { - const Char_t* filename = GetFile(kDAQ, pars->GetPedestalShuttleID(), fileSource->GetName()); + const Char_t* filename = GetFile(kDAQ, pars->GetPedestalShuttleID(), + fileSource->GetName()); std::ifstream in(filename); if(!in) { Log(Form("File %s not found!", filename)); continue; } - - // Get header (how long is it ?) - TString header; - header.ReadLine(in); - header.ToLower(); - if(!header.Contains(pars->GetPedestalShuttleID())) { - Log("File header is not from pedestal!"); - continue; - } - Log("File contains data from pedestals"); - - // Read columns line - int lineno = 2; - header.ReadLine(in); - // Loop until EOF - while(in.peek()!=EOF) { + int lineno = 0; + char cc; + while((cc = in.peek())!=EOF) { if(in.bad()) { Log(Form("Bad read at line %d in %s", lineno, filename)); break; } + if (cc == '#') { + TString line; + line.ReadLine(in); + lineno++; + if (lineno == 1) { + line.ToLower(); + if(!line.Contains(pars->GetPedestalShuttleID())) { + Log(Form("File header is not from pedestal!: %s", line.Data())); + break; + } + Log("File contains data from pedestals"); + } + continue; + } UShort_t det, sec, strip; Char_t ring; Float_t ped, noise, mu, sigma, chi2ndf; @@ -346,7 +364,7 @@ AliFMDPreprocessor::GetPedestalCalibration(TList* pedFiles) //____________________________________________________________________ AliFMDCalibGain* -AliFMDPreprocessor::GetGainCalibration(TList* gainFiles) +AliFMDPreprocessor::GetGainCalibration(const TList* gainFiles) { // Read DAQ DA produced CSV files of pedestals, and return a // calibration object. @@ -362,32 +380,34 @@ AliFMDPreprocessor::GetGainCalibration(TList* gainFiles) TIter iter(gainFiles); TObjString* fileSource; while((fileSource = dynamic_cast(iter.Next()))) { - const Char_t* filename = GetFile(kDAQ, pars->GetGainShuttleID(), fileSource->GetName()); + const Char_t* filename = GetFile(kDAQ, pars->GetGainShuttleID(), + fileSource->GetName()); std::ifstream in(filename); if(!in) { Log(Form("File %s not found!", filename)); continue; } - - //Get header (how long is it ?) - TString header; - header.ReadLine(in); - header.ToLower(); - if(!header.Contains(pars->GetGainShuttleID())) { - Log("File header is not from gain!"); - continue; - } - Log("File contains data from pulse gain"); - - // Read column headers - header.ReadLine(in); - - int lineno = 2; - // Read until EOF - while(in.peek()!=EOF) { - if(in.bad()) { - Log(Form("Bad read at line %d in %s", lineno, filename)); - break; + // Loop until EOF + int lineno = 0; + char cc; + while((cc = in.peek())!=EOF) { + if(in.bad()) { + Log(Form("Bad read at line %d in %s", lineno, filename)); + break; + } + if (cc == '#') { + TString line; + line.ReadLine(in); + lineno++; + if (lineno == 1) { + line.ToLower(); + if(!line.Contains(pars->GetGainShuttleID())) { + Log(Form("File header is not from gains!: %s", line.Data())); + break; + } + Log("File contains data from gains"); + } + continue; } UShort_t det, sec, strip; Char_t ring; @@ -418,7 +438,51 @@ AliFMDPreprocessor::GetGainCalibration(TList* gainFiles) } return calibGain; } +//____________________________________________________________________ +AliFMDCalibDeadMap* +AliFMDPreprocessor::GetDeadChannelMap(AliFMDCalibPedestal* pedcalib, + AliFMDCalibGain* gaincalib) { + //creating dead channel map. '0' means 51200 entries + AliFMDCalibDeadMap* deadmap = new AliFMDCalibDeadMap(0); + //deadmap->Reset(kTRUE); + Float_t noise = 0; + Float_t gain = 0; + + AliFMDParameters* pars = AliFMDParameters::Instance(); + //Looping over the channels. + for(UShort_t det=1;det<=3;det++) { + Int_t nRings = (det==1 ? 1 : 2); + for (UShort_t ir = 0; ir < nRings; ir++) { + Char_t ring = (ir == 0 ? 'I' : 'O'); + UShort_t nsec = (ir == 0 ? 20 : 40); + UShort_t nstr = (ir == 0 ? 512 : 256); + + for(UShort_t sec =0; sec < nsec; sec++) { + + for(UShort_t strip = 0; strip < nstr; strip++) { + + Bool_t isDead = kFALSE; + if(pedcalib) + noise = pedcalib->Width(det, ring, sec, strip); + else + noise = pars->GetPedestalWidth(det, ring, sec, strip); + + if(gaincalib) + gain = gaincalib->Value(det, ring, sec, strip); + else + gain = pars->GetPulseGain(det, ring, sec, strip); + + //marking these channels dead. + if (gain < 0.5 || gain > 5 || noise > 10 || noise == 0) isDead = kTRUE; + + deadmap->operator()(det, ring, sec, strip) = isDead; + } + } + } + } + return deadmap; +} //____________________________________________________________________ // // EOF