75 #include <AliCDBManager.h>
76 #include <AliCDBEntry.h>
80 #include <AliSplineFit.h>
81 #include <AliCTPTimeParams.h>
83 #include "TGraphErrors.h"
93 #include "AliGRPObject.h"
105 #include "TGraphErrors.h"
106 #include "TGeoGlobalMagField.h"
108 #include "TObjArray.h"
109 #include "TObjString.h"
111 #include "TDirectory.h"
125 #include "AliTimeStamp.h"
126 #include "AliTriggerRunScalers.h"
127 #include "AliTriggerScalers.h"
128 #include "AliTriggerScalersRecord.h"
139 const
char*
AliTPCcalibDB::fgkGasSensorNames[
AliTPCcalibDB::kNGasSensor] = {
"TPC_GC_NEON",
"TPC_GC_ARGON",
"TPC_GC_CO2",
"TPC_GC_N2",
"TPC_An_L1Sr141_H2O"};
178 fActiveChannelMap(0),
182 fComposedCorrection(0),
183 fComposedCorrectionArray(0),
193 fGasSensorArray(0x0),
194 fMaxTimeBinAllPads(-1),
199 fRunEventSpecie(AliRecoParam::kDefault),
204 fTimeGainSplinesArray(1),
209 fTemperatureArray(1),
211 fDriftCorrectionArray(1),
213 fBHasAlignmentOCDB(kFALSE),
221 for (Int_t i=0;i<72;++i){
244 fActiveChannelMap(0),
248 fComposedCorrection(0),
249 fComposedCorrectionArray(0),
259 fGasSensorArray(0x0),
260 fMaxTimeBinAllPads(-1),
265 fRunEventSpecie(AliRecoParam::kDefault),
270 fTimeGainSplinesArray(1),
275 fTemperatureArray(0),
277 fDriftCorrectionArray(0),
279 fBHasAlignmentOCDB(kFALSE),
286 Error(
"copy constructor",
"invalid -- singleton implementation");
287 for (Int_t i=0;i<72;++i){
307 Error(
"operator =",
"assignment operator not implemented");
346 AliWarningF(
"Did not find recoparam for EventSpecie %s suggested by GRP",AliRecoParam::GetEventSpecieName(
fRunEventSpecie));
359 AliCDBEntry* entry = AliCDBManager::Instance()->Get(cdbPath,
fRun);
362 snprintf(chinfo,1000,
"AliTPCcalibDB: Failed to get entry:\t%s ", cdbPath);
387 AliCDBEntry * entry=0x0;
388 Bool_t cdbCache = AliCDBManager::Instance()->GetCacheFlag();
389 AliCDBManager::Instance()->SetCacheFlag(kTRUE);
392 fRun = AliCDBManager::Instance()->GetRun();
401 entry->SetOwner(kTRUE);
404 AliFatal(
"TPC - Missing calibration entry TPC/Calib/Parameters");
410 entry = AliCDBManager::Instance()->Get(
"GRP/GRP/Data");
412 AliInfo(
"No GRP entry found");
416 AliGRPObject* grpData =
dynamic_cast<AliGRPObject*
>(entry->GetObject());
417 if (!grpData) {
printf(
"Failed to get GRP data for run %d\n",
fRun);
return;}
418 Int_t activeDetectors = grpData->GetDetectorMask();
419 TString detStr = AliDAQ::ListOfTriggeredDetectors(activeDetectors);
421 if ( detStr.Contains(
"TPC")==0){
422 AliInfo(
"TPC not present in the run");
425 fRunEventSpecie = AliRecoParam::SuggestRunEventSpecie(grpData->GetRunType(),grpData->GetBeamType(),grpData->GetLHCState());
426 AliInfoF(
"Run-specific EventSpecie set to %s",AliRecoParam::GetEventSpecieName(
fRunEventSpecie));
432 entry->SetOwner(kTRUE);
435 AliFatal(
"TPC - Missing calibration entry TPC/Calib/PadGainFactor");
441 entry->SetOwner(kTRUE);
444 AliFatal(
"TPC - Missing calibration entry TPC/Calib/Timegain");
449 entry->SetOwner(kTRUE);
452 AliFatal(
"TPC - Missing calibration entry TPC/Calib/gainFactordEdx");
458 entry->SetOwner(kTRUE);
461 AliFatal(
"TPC - Missing calibration entry");
467 entry->SetOwner(kTRUE);
479 entry->SetOwner(kTRUE);
482 AliFatal(
"TPC - Missing calibration entry");
488 entry->SetOwner(kTRUE);
495 entry->SetOwner(kTRUE);
502 entry->SetOwner(kTRUE);
505 AliFatal(
"TPC - Missing calibration entry");
514 AliFatal(
"TPC - Missing calibration entry TPC/Calib/RecoParam");
520 entry->SetOwner(kTRUE);
523 AliWarning(
"Missing gas calibration entry");
529 entry->SetOwner(kTRUE);
532 AliFatal(
"TPC - Missing calibration entry");
538 entry->SetOwner(kTRUE);
546 entry->SetOwner(kTRUE);
554 entry->SetOwner(kTRUE);
563 entry->SetOwner(kTRUE);
565 if (array && array->GetEntriesFast()==6){
567 for (Int_t i=0; i<6; i++){
577 fCTPTimeParams=
dynamic_cast<AliCTPTimeParams*
>(entry->GetObject());
579 AliError(
"TPC - Missing calibration entry");
591 if (composedCorrection) {
592 composedCorrection->
Init();
594 if (composedCorrection->
GetCorrections()->FindObject(
"FitAlignTPC")){
602 AliError(
"TPC - Missing calibration entry- TPC/Calib/Correction");
624 AliCDBManager::Instance()->SetCacheFlag(cdbCache);
631 AliCDBEntry* entry =
GetCDBEntry(
"TPC/Calib/CorrectionMaps");
636 AliError(
"TPC - Missing calibration entry- TPC/Calib/CorrectionMaps");
646 AliCDBEntry * entry=0;
649 entry->SetOwner(kTRUE);
657 entry->SetOwner(kTRUE);
662 entry = AliCDBManager::Instance()->Get(
"TPC/Calib/HighVoltage",
fRun);
680 Int_t nominalVoltage = (sector<36) ? 1240 : 1470 ;
682 Float_t rocVoltage = nominalVoltage;
684 if ( rocVoltage < nominalVoltage/2. || rocVoltage > nominalVoltage*2. )
686 AliInfo(Form(
"rocVoltage out of range: roc: %.2f, nominal: %i", rocVoltage, nominalVoltage));
690 Int_t tempVoltage = 0;
691 Int_t trackAngle = 4;
692 TString rocType = (sector<36) ?
"iroc" :
"oroc";
696 Int_t voltages[ngraph];
697 for (Int_t i=0; i<ngraph; i++){
703 for (Int_t i=0;i<=ngraph;i++){
707 if (!objname.Contains(rocType))
continue;
709 TObjArray *objArr = objname.Tokenize(
"_");
712 if ( atoi(static_cast<TObjString*>(objArr->At(3))->GetName())==trackAngle )
715 voltages[nvoltages]=atoi(static_cast<TObjString*>(objArr->At(2))->GetName());
723 Int_t diffVoltage = TMath::Abs(rocVoltage - voltages[0]);
724 for (Int_t k=0;k<ngraph;k++) {
725 if (diffVoltage >= TMath::Abs(rocVoltage-voltages[k]) && voltages[k]!=0)
727 diffVoltage = TMath::Abs(rocVoltage-voltages[k]);
731 tempVoltage = voltages[ampIndex];
736 for (Int_t i=0; i<=ngraph; i++){
739 TGraphErrors * trfObj =
static_cast<TGraphErrors*
>(
fIonTailArray->At(i));
740 TString objname(trfObj->GetName());
741 if (!objname.Contains(rocType))
continue;
743 TObjArray *objArr1 = objname.Tokenize(
"_");
746 TObjString* angleString =
static_cast<TObjString*
>(objArr1->At(3));
747 TObjString* voltageString =
static_cast<TObjString*
>(objArr1->At(2));
749 if ((atoi(angleString->GetName())==trackAngle) && (atoi(voltageString->GetName())==tempVoltage) )
752 Int_t voltage = atoi(voltageString->GetName());
753 Double_t voltageScaled = 1;
754 if (rocVoltage>0) voltageScaled = Double_t(voltage)/Double_t(rocVoltage);
755 const Int_t nScaled = TMath::Nint(voltageScaled*trfObj->GetN())-1;
759 delete graphRes[igraph];
760 graphRes[igraph] =
new TGraphErrors(nScaled);
762 for (Int_t j=0; j<nScaled; j++){
763 x = TMath::Nint(j*(voltageScaled));
764 y = (j<trfObj->GetN()) ? (1./voltageScaled)*trfObj->GetY()[j] : 0.;
765 graphRes[igraph]->SetPoint(j,x,y);
769 TObjString* distanceToCenterOfGravity =
static_cast<TObjString*
>(objArr1->At(4));
770 indexAmpGraphs[igraph] = (distanceToCenterOfGravity->GetString().Atof())/10.;
772 for (Int_t m=1; m<nScaled;m++){
773 if (graphRes[igraph]->GetY()[m]==0) graphRes[igraph]->GetY()[m] = graphRes[igraph]->GetY()[m-1];
786 if ( calibObjects == 0x0 )
return;
789 if ( !in.is_open() ){
790 fprintf(stderr,
"Error: cannot open list file '%s'", filename);
800 TObjArray *arrFileLine = sFile.Tokenize(
"\n");
802 TIter nextLine(arrFileLine);
804 TObjString *sObjLine=0x0;
805 while ( (sObjLine = (TObjString*)nextLine()) ){
806 TString sLine(sObjLine->GetString());
808 TObjArray *arrNextCol = sLine.Tokenize(
"\t");
810 TObjString *sObjType = (TObjString*)(arrNextCol->At(0));
811 TObjString *sObjFileName = (TObjString*)(arrNextCol->At(1));
814 if ( !sObjType || ! sObjFileName )
continue;
815 TString sType(sObjType->GetString());
816 TString sFileName(sObjFileName->GetString());
821 fprintf(stderr,
"File not found: '%s'", sFileName.Data());
825 if ( sType ==
"CE" ){
829 calPad->SetNameTitle(
"CETmean",
"CETmean");
830 calibObjects->
Add(calPad);
833 calPad->SetNameTitle(
"CEQmean",
"CEQmean");
834 calibObjects->
Add(calPad);
837 calPad->SetNameTitle(
"CETrms",
"CETrms");
838 calibObjects->
Add(calPad);
840 }
else if ( sType ==
"Pulser") {
844 calPad->SetNameTitle(
"PulserTmean",
"PulserTmean");
845 calibObjects->
Add(calPad);
848 calPad->SetNameTitle(
"PulserQmean",
"PulserQmean");
849 calibObjects->
Add(calPad);
852 calPad->SetNameTitle(
"PulserTrms",
"PulserTrms");
853 calibObjects->
Add(calPad);
855 }
else if ( sType ==
"Pedestals") {
859 calPad->SetNameTitle(
"Pedestals",
"Pedestals");
860 calibObjects->
Add(calPad);
863 calPad->SetNameTitle(
"Noise",
"Noise");
864 calibObjects->
Add(calPad);
867 fprintf(stderr,
"Undefined Type: '%s'",sType.Data());
890 AliError(
"run not set in CDB manager. Cannot create active channel map");
897 if (!voltageArray && !altroMap && !mapddl) {
898 AliError(
"All necessary information to create the activate channel are map missing.");
899 AliError(
" -> Check existance of the OCDB entries: 'TPC/Calib/AltroConfig', 'TPC/Calib/HighVoltage'");
904 AliTPCmapper map(gSystem->ExpandPathName(
"$ALICE_ROOT/TPC/mapping/"));
909 Bool_t ddlMap[216]={0};
910 for (Int_t iddl=0; iddl<216; ++iddl) ddlMap[iddl]=1;
912 TObjString *s = (TObjString*)mapddl->GetValue(
"DDLArray");
914 for (Int_t iddl=0; iddl<216; ++iddl) {
915 ddlMap[iddl]=TString(s->GetString()(iddl))!=
"0";
918 AliWarning(Form(
"Inactive DDL (#%d, ROC %2d) detected based on the 'DDLArray' in 'TPC/Calib/AltroConfig'. This will deactivate many channels.", iddl, roc));
923 AliError(
"DDL map missing. ActiveChannelMap can only be created with parts of the information.");
924 AliError(
" -> Check existance of 'DDLArray' in the OCDB entry: 'TPC/Calib/AltroConfig'");
932 TBits maskedPads[72];
945 AliError(
"ALTRO dead channel map missing. ActiveChannelMap can only be created with parts of the information.");
946 AliError(
" -> Check existance of 'Masked' in the OCDB entry: 'TPC/Calib/AltroConfig'");
954 AliError(Form(
"No ROC %d in active channel map",iROC));
962 AliWarning(Form(
"Turning off all channels of ROC %2d due to a bad HV status", iROC));
963 AliWarning(
" -> Check messages in UpdateChamberHighVoltageData()");
968 if (altroMap) masked=altroMap->
GetCalROC(iROC);
970 Int_t numberOfDeactivatedChannels=0;
971 for (UInt_t irow=0; irow<roc->
GetNrows(); ++irow){
975 for (UInt_t ipad=0; ipad<roc->
GetNPads(irow); ++ipad){
983 Int_t ddlId=map.GetEquipmentID(iROC, irow, ipad)-768;
984 if (ddlId>=0 && !ddlMap[ddlId]) roc->
SetValue(irow, ipad ,0);
987 if (maskedPads[iROC].TestBitNumber(channel0+ipad)) roc->
SetValue(irow, ipad ,0);
989 if (roc->
GetValue(irow, ipad)<0.0001) {
990 ++numberOfDeactivatedChannels;
995 if (numberOfDeactivatedChannels>0) {
996 AliInfo(Form(
"Deactivated %4d channels in ROC %2d due to altro and DDL map states",
997 numberOfDeactivatedChannels, iROC));
1023 if (calPadAcqStop) {
1030 for (Int_t ichannel=0; ichannel<roc->
GetNchannels(); ++ichannel) {
1031 const Float_t val=roc->
GetValue(ichannel);
1032 if (val>maxBin) maxBin=val;
1040 AliWarning(
"Could not access 'AcqStop' map from AltroConfig or invalid max time bine. fMaxTimeBinAllPads will be set from AliTPCParam.");
1044 AliWarning(
"Could neither access 'Parameters' nor 'AcqStop' map from AltroConfig. fMaxTimeBinAllPads will be set to 1000.");
1062 TVectorF *mapIROCArray = 0;
1063 TVectorF *mapOROCArray = 0;
1064 Int_t mapEntries = 0;
1065 TString* mapNames = 0;
1068 TFile mapFile(mapFileName,
"read");
1070 TList* listOfROCs = mapFile.GetListOfKeys();
1071 mapEntries = listOfROCs->GetEntries()/2;
1074 mapIROCArray =
new TVectorF[mapEntries];
1075 mapOROCArray =
new TVectorF[mapEntries];
1077 mapNames =
new TString[mapEntries];
1078 for (Int_t ivalue = 0; ivalue < mapEntries; ivalue++) {
1079 TString nameROC(((TKey*)(listOfROCs->At(ivalue*2)))->GetName());
1080 nameROC.Remove(nameROC.Length()-4, 4);
1081 mapIROCs->AddAt((
AliTPCCalROC*)mapFile.Get((nameROC +
"IROC").Data()), ivalue);
1082 mapOROCs->AddAt((
AliTPCCalROC*)mapFile.Get((nameROC +
"OROC").Data()), ivalue);
1083 mapNames[ivalue].Append(nameROC);
1086 for (Int_t ivalue = 0; ivalue < mapEntries; ivalue++) {
1087 mapIROCArray[ivalue].ResizeTo(tpcROCinstance->
GetNChannels(0));
1088 mapOROCArray[ivalue].ResizeTo(tpcROCinstance->
GetNChannels(36));
1090 for (UInt_t ichannel = 0; ichannel < tpcROCinstance->
GetNChannels(0); ichannel++)
1091 (mapIROCArray[ivalue])[ichannel] = ((
AliTPCCalROC*)(mapIROCs->At(ivalue)))->GetValue(ichannel);
1092 for (UInt_t ichannel = 0; ichannel < tpcROCinstance->
GetNChannels(36); ichannel++)
1093 (mapOROCArray[ivalue])[ichannel] = ((
AliTPCCalROC*)(mapOROCs->At(ivalue)))->GetValue(ichannel);
1098 TTreeSRedirector cstream(fileName);
1099 Int_t arrayEntries = array->GetEntries();
1101 TString* names =
new TString[arrayEntries];
1102 for (Int_t ivalue = 0; ivalue < arrayEntries; ivalue++)
1103 names[ivalue].Append(((
AliTPCCalPad*)array->At(ivalue))->GetName());
1105 for (UInt_t isector = 0; isector < tpcROCinstance->
GetNSectors(); isector++) {
1109 TVectorF median(arrayEntries);
1110 TVectorF mean(arrayEntries);
1111 TVectorF rms(arrayEntries);
1112 TVectorF ltm(arrayEntries);
1113 TVectorF ltmrms(arrayEntries);
1114 TVectorF medianWithOut(arrayEntries);
1115 TVectorF meanWithOut(arrayEntries);
1116 TVectorF rmsWithOut(arrayEntries);
1117 TVectorF ltmWithOut(arrayEntries);
1118 TVectorF ltmrmsWithOut(arrayEntries);
1120 TVectorF *vectorArray =
new TVectorF[arrayEntries];
1121 for (Int_t ivalue = 0; ivalue < arrayEntries; ivalue++)
1122 vectorArray[ivalue].ResizeTo(tpcROCinstance->
GetNChannels(isector));
1124 for (Int_t ivalue = 0; ivalue < arrayEntries; ivalue++) {
1128 if (outlierPad) outlierROC = outlierPad->
GetCalROC(isector);
1131 mean[ivalue] = calROC->
GetMean();
1132 rms[ivalue] = calROC->
GetRMS();
1133 Double_t ltmrmsValue = 0;
1134 ltm[ivalue] = calROC->
GetLTM(<mrmsValue, ltmFraction);
1135 ltmrms[ivalue] = ltmrmsValue;
1137 medianWithOut[ivalue] = calROC->
GetMedian(outlierROC);
1138 meanWithOut[ivalue] = calROC->
GetMean(outlierROC);
1139 rmsWithOut[ivalue] = calROC->
GetRMS(outlierROC);
1141 ltmWithOut[ivalue] = calROC->
GetLTM(<mrmsValue, ltmFraction, outlierROC);
1142 ltmrmsWithOut[ivalue] = ltmrmsValue;
1146 median[ivalue] = 0.;
1150 ltmrms[ivalue] = 0.;
1151 medianWithOut[ivalue] = 0.;
1152 meanWithOut[ivalue] = 0.;
1153 rmsWithOut[ivalue] = 0.;
1154 ltmWithOut[ivalue] = 0.;
1155 ltmrmsWithOut[ivalue] = 0.;
1162 TVectorF *posArray =
new TVectorF[8];
1163 for (Int_t ivalue = 0; ivalue < 8; ivalue++)
1164 posArray[ivalue].ResizeTo(tpcROCinstance->
GetNChannels(isector));
1166 Float_t posG[3] = {0};
1167 Float_t posL[3] = {0};
1169 for (UInt_t irow = 0; irow < tpcROCinstance->
GetNRows(isector); irow++) {
1170 for (UInt_t ipad = 0; ipad < tpcROCinstance->
GetNPads(isector, irow); ipad++) {
1173 posArray[0][ichannel] = irow;
1174 posArray[1][ichannel] = ipad;
1175 posArray[2][ichannel] = posL[0];
1176 posArray[3][ichannel] = posL[1];
1177 posArray[4][ichannel] = posG[0];
1178 posArray[5][ichannel] = posG[1];
1179 posArray[6][ichannel] = (Int_t)(ipad - (Double_t)(tpcROCinstance->
GetNPads(isector, irow))/2);
1180 posArray[7][ichannel] = ichannel;
1183 for (Int_t ivalue = 0; ivalue < arrayEntries; ivalue++) {
1187 (vectorArray[ivalue])[ichannel] = calROC->
GetValue(irow, ipad);
1189 (vectorArray[ivalue])[ichannel] = 0;
1195 cstream <<
"calPads" <<
1196 "sector=" << isector;
1198 for (Int_t ivalue = 0; ivalue < arrayEntries; ivalue++) {
1199 cstream <<
"calPads" <<
1200 (Char_t*)((names[ivalue] +
"_Median=").Data()) << median[ivalue] <<
1201 (Char_t*)((names[ivalue] +
"_Mean=").Data()) << mean[ivalue] <<
1202 (Char_t*)((names[ivalue] +
"_RMS=").Data()) << rms[ivalue] <<
1203 (Char_t*)((names[ivalue] +
"_LTM=").Data()) << ltm[ivalue] <<
1204 (Char_t*)((names[ivalue] +
"_RMS_LTM=").Data()) << ltmrms[ivalue];
1206 cstream <<
"calPads" <<
1207 (Char_t*)((names[ivalue] +
"_Median_OutlierCutted=").Data()) << medianWithOut[ivalue] <<
1208 (Char_t*)((names[ivalue] +
"_Mean_OutlierCutted=").Data()) << meanWithOut[ivalue] <<
1209 (Char_t*)((names[ivalue] +
"_RMS_OutlierCutted=").Data()) << rmsWithOut[ivalue] <<
1210 (Char_t*)((names[ivalue] +
"_LTM_OutlierCutted=").Data()) << ltmWithOut[ivalue] <<
1211 (Char_t*)((names[ivalue] +
"_RMS_LTM_OutlierCutted=").Data()) << ltmrmsWithOut[ivalue];
1215 for (Int_t ivalue = 0; ivalue < arrayEntries; ivalue++) {
1216 cstream <<
"calPads" <<
1217 (Char_t*)((names[ivalue] +
".=").Data()) << &vectorArray[ivalue];
1221 for (Int_t ivalue = 0; ivalue < mapEntries; ivalue++) {
1223 cstream <<
"calPads" <<
1224 (Char_t*)((mapNames[ivalue] +
".=").Data()) << &mapIROCArray[ivalue];
1226 cstream <<
"calPads" <<
1227 (Char_t*)((mapNames[ivalue] +
".=").Data()) << &mapOROCArray[ivalue];
1231 cstream <<
"calPads" <<
1232 "row.=" << &posArray[0] <<
1233 "pad.=" << &posArray[1] <<
1234 "lx.=" << &posArray[2] <<
1235 "ly.=" << &posArray[3] <<
1236 "gx.=" << &posArray[4] <<
1237 "gy.=" << &posArray[5] <<
1238 "rpad.=" << &posArray[6] <<
1239 "channel.=" << &posArray[7];
1241 cstream <<
"calPads" <<
1245 delete[] vectorArray;
1253 delete[] mapIROCArray;
1254 delete[] mapOROCArray;
1264 if (!map)
return -1;
1265 TVectorF *v=(TVectorF*)map->GetValue(
"TRGCONF_TRG_MODE");
1267 for (Int_t i=0; i<v->GetNrows(); ++i){
1268 Float_t newmode=v->GetMatrixArray()[i];
1270 if (mode>-1&&newmode!=mode) AliWarning(
"Found different RCU trigger configurations!!!");
1281 if (
fMode<0)
return kFALSE;
1289 if (
fMode<0)
return kFALSE;
1299 Float_t factor = bz/(5.);
1302 AliMagF* bmap =
new AliMagF(
"MapsExB",
"MapsExB", factor,TMath::Sign(1.
f,factor),
AliMagF::k5kG);
1322 Int_t index = TMath::Nint(5+bz);
1349 TObjString runstr(Form(
"%i",run));
1351 AliCDBEntry * entry = 0;
1362 if (
fRunList[run]>0 &&force==kFALSE)
return;
1367 entry = AliCDBManager::Instance()->Get(
"GRP/GRP/Data",run);
1369 AliGRPObject * grpRun =
dynamic_cast<AliGRPObject*
>(entry->GetObject());
1371 TMap* map =
dynamic_cast<TMap*
>(entry->GetObject());
1377 fGRPMaps.Add(
new TObjString(runstr),map);
1380 fGRPArray.Add(
new TObjString(runstr),(AliGRPObject*)grpRun->Clone());
1382 entry = AliCDBManager::Instance()->Get(
"TPC/Calib/Goofie",run);
1384 fGoofieArray.Add(
new TObjString(runstr),entry->GetObject());
1389 entry = AliCDBManager::Instance()->Get(
"TPC/Calib/TimeGain",run);
1393 AliFatal(
"TPC - Missing calibration entry TimeGain");
1396 entry = AliCDBManager::Instance()->Get(
"TPC/Calib/TimeDrift",run);
1402 correctionTime->
Init();
1407 AliFatal(
"TPC - Missing calibration entry TimeDrift");
1410 entry = AliCDBManager::Instance()->Get(
"TPC/Calib/Temperature",run);
1416 entry = AliCDBManager::Instance()->Get(
"TPC/Calib/HighVoltage",run);
1418 fVoltageArray.Add(
new TObjString(runstr),entry->GetObject());
1428 Bool_t accept=kTRUE;
1433 const Double_t kMinP=900.;
1434 const Double_t kMaxP=1050.;
1435 const Double_t kMaxdP=10.;
1438 if (press->GetFit()==0) accept=kFALSE;
1441 if (press && temp &&accept){
1456 if (!calPad)
return 0;
1465 return dynamic_cast<AliSplineFit*
>(arr->FindObject(name));
1473 TGraph *graph=
dynamic_cast<TGraph*
>(arr->FindObject(graphName));
1474 if (!graph)
return 0;
1475 AliSplineFit *
fit =
new AliSplineFit();
1476 fit->SetGraph(graph);
1477 fit->SetMinPoints(graph->GetN()+1);
1478 fit->InitKnots(graph,2,0,0.001);
1486 AliGRPObject * grpRun =
dynamic_cast<AliGRPObject *
>((
Instance()->
fGRPArray).GetValue(Form(
"%i",run)));
1489 grpRun =
dynamic_cast<AliGRPObject *
>(
Instance()->
fGRPArray.GetValue(Form(
"%i",run)));
1490 if (!grpRun)
return 0;
1498 TMap * grpRun =
dynamic_cast<TMap *
>((
Instance()->
fGRPMaps).GetValue(Form(
"%i",run)));
1501 grpRun =
dynamic_cast<TMap *
>(
Instance()->
fGRPMaps.GetValue(Form(
"%i",run)));
1502 if (!grpRun)
return 0;
1518 AliDCSSensor * sensor = 0;
1520 if (type==0) osensor = ((*map)(
"fCavernPressure"));
1521 if (type==1) osensor = ((*map)(
"fP2Pressure"));
1522 sensor =
dynamic_cast<AliDCSSensor *
>(osensor);
1523 if (sensor)
return sensor;
1528 AliGRPObject * grpRun =
dynamic_cast<AliGRPObject *
>(
fGRPArray.GetValue(Form(
"%i",run)));
1531 grpRun =
dynamic_cast<AliGRPObject *
>(
fGRPArray.GetValue(Form(
"%i",run)));
1532 if (!grpRun)
return 0;
1534 AliDCSSensor * sensor = grpRun->GetCavernAtmosPressure();
1535 if (type==1) sensor = grpRun->GetSurfaceAtmosPressure();
1566 if (!driftSplines) {
1570 return driftSplines;
1576 AliDCSSensorArray * voltageArray = (AliDCSSensorArray *)
fVoltageArray.GetValue(Form(
"%i",run));
1577 if (!voltageArray) {
1579 voltageArray = (AliDCSSensorArray *)
fVoltageArray.GetValue(Form(
"%i",run));
1581 return voltageArray;
1587 AliDCSSensorArray * goofieArray = (AliDCSSensorArray *)
fGoofieArray.GetValue(Form(
"%i",run));
1590 goofieArray = (AliDCSSensorArray *)
fGoofieArray.GetValue(Form(
"%i",run));
1617 if (!gr||sector<0||sector>73) {
1618 if (entries) *entries=0;
1622 if (timeStamp==-1.){
1625 for (Int_t ipoint=0;ipoint<gr->GetN();++ipoint){
1627 gr->GetPoint(ipoint,x,y);
1628 if (x<timeStamp)
continue;
1643 if (!gr||sector<0||sector>71) {
1644 if (entries) *entries=0;
1648 if (timeStamp==-1.){
1651 for (Int_t ipoint=0;ipoint<gr->GetN();++ipoint){
1653 gr->GetPoint(ipoint,x,y);
1654 if (x<timeStamp)
continue;
1667 const TString sensorNameString(sensorName);
1668 AliDCSSensor *sensor = arr->GetSensor(sensorNameString);
1669 if (!sensor)
return val;
1671 const Int_t
startTime = Int_t(sensor->GetStartTime());
1672 const Int_t endTime = Int_t(sensor->GetEndTime());
1675 TGraph *
gr=sensor->GetGraph();
1677 for (Int_t ipoint=0;ipoint<gr->GetN();++ipoint){
1679 gr->GetPoint(ipoint,x,y);
1680 const Int_t time=TMath::Nint(startTime+x*3600.);
1681 if (time<=timeStamp && timeStamp<=endTime) {
1694 gr->GetPoint(0,x,y);
1695 const Int_t time=TMath::Min(TMath::Nint(startTime+x*3600.), startTime);
1696 const Int_t dtime=time-timeStamp;
1697 if ( (dtime>=0) && (dtime<5*60) ) val=y;
1702 gr->GetPoint(gr->GetN()-1,x,y);
1703 const Int_t time=TMath::Max(TMath::Nint(startTime+x*3600.), endTime);
1704 const Int_t dtime=timeStamp-time;
1705 if ( (dtime>=0) && (dtime<5*60) ) val=y;
1708 val=sensor->GetValue(timeStamp);
1711 val=(Float_t)TMath::Floor(val * TMath::Power(10., sigDigits) + .5) / TMath::Power(10., sigDigits);
1721 const TString sensorNameString(sensorName);
1722 AliDCSSensor *sensor = arr->GetSensor(sensorNameString);
1723 if (!sensor)
return val;
1726 TGraph *
gr=sensor->GetGraph();
1731 if (!sensor->GetFit())
return val;
1732 Int_t nKnots=sensor->GetFit()->GetKnots();
1733 Double_t tMid=(sensor->GetEndTime()-sensor->GetStartTime())/2.;
1734 for (Int_t iKnot=0;iKnot<nKnots;++iKnot){
1735 if (sensor->GetFit()->GetX()[iKnot]>tMid/3600.)
break;
1736 val=(Float_t)sensor->GetFit()->GetY0()[iKnot];
1741 val=(Float_t)TMath::Floor(val * TMath::Power(10., sigDigits) + .5) / TMath::Power(10., sigDigits);
1750 int nrowsMasked=0,npadsMasked=0,npadsTotMasked=0;
1752 AliInfo(
"Special reconstruction for residuals extraction, masking is disabled");
1755 AliCDBManager* man = AliCDBManager::Instance();
1756 AliMagF* fld = (AliMagF*)TGeoGlobalMagField::Instance()->GetField();
1757 if (!fld || !man->IsDefaultStorageSet() || man->GetRun()<0) {
1758 AliFatal(
"OCDB of B-field is not initialized");
1760 const int run =
GetRun();
1768 if (!param) AliFatal(
"Failed to extract recoparam");
1771 AliInfo(
"Residual correction maps are not used, no masking needed");
1776 if (!transform) AliFatal(
"Failed to extract Transform");
1786 arrMaps->SetOwner(kTRUE);
1787 if (!((
AliTPCChebCorr*)arrMaps->UncheckedAt(0))->GetTimeDependent()) {
1790 arrMaps->Remove((TObject*)mapKeep);
1792 arrMaps->Add(mapKeep);
1794 int nMaps = arrMaps->GetEntriesFast();
1797 TBits maskedRows[72];
1798 for (
int isec=72;isec--;) {
1800 for (
int imap=nMaps;imap--;) ((
AliTPCChebCorr*)arrMaps->UncheckedAt(imap))->GetNMaskedRows(isec,&maskedRows[isec]);
1801 nrowsMasked += maskedRows[isec].CountBits();
1809 time_t tGRPmin = grp->GetTimeStart();
1810 time_t tGRPmax = grp->GetTimeEnd();
1811 time_t tCentGRP = (tGRPmin+tGRPmax)/2;
1813 time_t mapsT[nMaps];
1814 for (
int i=0;i<nMaps;i++) {
1815 mapsT[i] = ((
AliTPCChebCorr*)arrMaps->At(i))->GetTimeStampCenter();
1816 if (mapsT[i]<tGRPmin || mapsT[i]>tCentGRP) mapsT[i] = tCentGRP;
1823 double testv[3]={0.};
1827 const double tbinMin=0.,tbinMax=800.0;
1828 testv[0] = 62.; testv[1] = 0.; testv[2] = tbinMin;
1830 const double ztMin = testv[2];
1831 testv[0] = 62.; testv[1] = 0.; testv[2] = tbinMax;
1833 const double ztMax = testv[2];
1834 const double tzSlope = (tbinMax-tbinMin)/(ztMax-ztMin);
1844 const double maxErrY2 = padMaxErr[0]>0 ? padMaxErr[0]*padMaxErr[0] : -1.;
1845 const double maxErrZ2 = padMaxErr[1]>0 ? padMaxErr[1]*padMaxErr[1] : -1.;
1847 const float tgLabTest = 0.2f;
1849 for (
int imap=0;imap<nMaps;imap++) {
1850 AliInfoF(
"Querying maps at time %ld",mapsT[imap]);
1853 for (
int isec=72;isec--;) {
1854 TBits& padStatus = maskedPads[isec];
1855 for (
int irow=roc->
GetNRows(isec);irow--;) {
1857 if (maskedRows[isec].TestBitNumber(irow)) {
1858 for (
int ipad=npads;ipad--;) padStatus.SetBitNumber(channel0+ipad);
1860 npadsTotMasked += npads;
1863 const double xRow = roc->
GetPadRowRadii(isec,irow), zTest = xRow*tgLabTest;
1864 const double tbinTest = tbinMin+(zTest-ztMin)*tzSlope;
1865 for (
int ipad=npads;ipad--;) {
1867 testv[1] = 0.5+ipad;
1868 testv[2] = tbinTest;
1872 Bool_t bad = kFALSE;
1875 for (
int dir=4;dir--;)
if (padMaxDist[dir]>0. && TMath::Abs(clCorr[dir])>padMaxDist[dir]) {
1884 clProbe.SetX(testv[0]);
1885 clProbe.SetY(testv[1]);
1886 clProbe.SetZ(testv[2]);
1887 clProbe.
SetDistortions(clCorr[0]-clCorrRef[0],clCorr[1]-clCorrRef[1],clCorr[2]-clCorrRef[2]);
1889 const double errY2 = transform->
ErrY2Syst(&clProbe,testv[1]/testv[0]);
1890 const double errZ2 = transform->
ErrZ2Syst(&clProbe,testv[2]/testv[0]);
1891 if ( (maxErrY2>0 && errY2>maxErrY2) || (maxErrZ2>0 && errZ2>maxErrZ2) ) {
1899 if (!padStatus.TestBitNumber(channel0+ipad)) npadsMasked++;
1900 padStatus.SetBitNumber(channel0+ipad);
1907 npadsTotMasked += npadsMasked;
1908 AliInfoF(
"masked %d pads (%d full padrows, %d individual pads)",
1909 npadsTotMasked,nrowsMasked,npadsMasked);
1911 return npadsTotMasked;
1925 Double_t time=Double_t(timeStamp);
1926 Int_t currentPoint=0;
1927 Bool_t currentVal=
fGrRunState->GetY()[currentPoint]>0.5;
1928 Bool_t retVal=currentVal;
1929 Double_t currentTime=
fGrRunState->GetX()[currentPoint];
1931 while (time>currentTime){
1961 const Int_t run=
GetRun();
1968 const Int_t startTimeGRP = grp->GetTimeStart();
1969 const Int_t stopTimeGRP = grp->GetTimeEnd();
1975 if (startTimeGRP==0 && stopTimeGRP==0) {
1976 AliWarning(
"Using a generated GRP with 'GetTimeStart()' and 'GetTimeEnd()' == 0. Cannot calculate HV information.");
1984 const char* hltMode = NULL;
1985 hltMode = gSystem->Getenv(
"HLT_ONLINE_MODE");
1987 AliCDBEntry *entry = NULL;
1988 if (!hltMode) entry =
GetCDBEntry(
"GRP/CTP/Scalers");
1991 AliTriggerRunScalers *sca = (AliTriggerRunScalers*)entry->GetObject();
1992 Int_t nchannels = sca->GetNumClasses();
1993 Int_t
npoints = sca->GetScalersRecords()->GetEntries();
2000 ULong64_t lastSum=0;
2001 Double_t timeLast=Double_t(startTimeGRP);
2002 Bool_t active=kTRUE;
2003 for (
int i=0; i<
npoints; i++) {
2004 AliTriggerScalersRecord *
rec = (AliTriggerScalersRecord *) sca->GetScalersRecord(i);
2005 Double_t time = ((AliTimeStamp*) rec->GetTimeStamp())->GetSeconds();
2007 if ( time<startTimeGRP || time>stopTimeGRP ){
2008 AliWarning(Form(
"Time of scaler record %d: %.0f is outside the GRP times (%d, %d). Skipping this record.", i, time, startTimeGRP, stopTimeGRP));
2012 for (
int j=0; j<nchannels; j++) sum += ((AliTriggerScalers*) rec->GetTriggerScalers()->At(j))->GetL2CA();
2013 if (TMath::Abs(time-timeLast)<.001 && sum==lastSum )
continue;
2014 if (active && sum==lastSum){
2018 }
else if (!active && sum>lastSum ){
2029 AliWarning(
"Only one entry found in the trigger scalers. Most probably this is a dummy entry. Scaler information will not be used!");
2035 for (Int_t iROC=0;iROC<72;++iROC) {
2043 if (!voltageArray) {
2044 AliError(
"Voltage Array missing. Cannot calculate HV information!");
2045 AliError(
" -> Check OCDB entry: 'TPC/Calib/HighVoltage'");
2054 const Int_t samplingPeriod=1;
2057 const Int_t maxSamples=(stopTimeGRP-startTimeGRP)/samplingPeriod + 10*samplingPeriod;
2058 Float_t *vSampled =
new Float_t[maxSamples];
2061 Double_t chamberMedianDeviation[72]={0.};
2063 for (Int_t iROC=0; iROC<72; ++iROC){
2064 chamberMedianDeviation[iROC]=0.;
2065 TString sensorName=
"";
2066 Char_t sideName=
'A';
2067 if ((iROC/18)%2==1) sideName=
'C';
2068 if (iROC<36) sensorName=Form(
"TPC_ANODE_I_%c%02d_VMEAS",sideName,iROC%18);
2069 else sensorName=Form(
"TPC_ANODE_O_%c%02d_0_VMEAS",sideName,iROC%18);
2071 AliDCSSensor *sensor = voltageArray->GetSensor(sensorName);
2074 if (!sensor)
continue;
2076 Int_t nPointsSampled=0;
2078 TGraph *
gr=sensor->GetGraph();
2079 if ( gr && gr->GetN()>0 ){
2085 Int_t time=startTimeGRP;
2088 const Int_t nGraph=gr->GetN();
2092 Int_t timeGraph=stopTimeGRP;
2093 if (gr->GetN()>1) timeGraph=TMath::Nint(gr->GetX()[pointGraph+1]*3600+sensor->GetStartTime());
2094 Double_t sampledHV=gr->GetY()[pointGraph++];
2096 while (time<stopTimeGRP){
2097 while (timeGraph<=time && pointGraph+1<nGraph){
2098 timeGraph=TMath::Nint(gr->GetX()[pointGraph+1]*3600+sensor->GetStartTime());
2099 sampledHV=gr->GetY()[pointGraph++];
2101 time+=samplingPeriod;
2103 vSampled[nPointsSampled++]=sampledHV;
2106 if (nPointsSampled<1)
continue;
2113 for (Int_t ipoint=0; ipoint<nPointsSampled; ++ipoint) {
2114 if (TMath::Abs(vSampled[ipoint]-
fChamberHVmedian[iROC])<maxDipVoltage) ++ngood;
2118 }
else if (!gr && !sensor->GetFit() ){
2124 AliWarning(Form(
"ROC %d detected without HV Splines and HV graph. Will set median HV to nominal voltage",iROC));
2126 AliError(Form(
"No Graph or graph without points found for HV sensor of ROC %d",iROC));
2134 const Double_t medianIROC=TMath::Median( 36, chamberMedianDeviation );
2135 const Double_t medianOROC=TMath::Median( 36, chamberMedianDeviation+36 );
2138 for (Int_t iROC=0;iROC<72;++iROC){
2139 const Float_t averageDeviation=(iROC<36)?medianIROC:medianOROC;
2147 for (Int_t iROC=0;iROC<72;++iROC){
2149 const Float_t averageDeviation=(iROC<36)?medianIROC:medianOROC;
2154 AliWarning(Form(
"Low voltage detected for ROC %2d",iROC));
2155 AliWarning(Form(
" -> Based on nominal voltage: %.2f + averge deviation: %.2f = current nominal voltage: %.2f - meadian HV: %.2f > max diff: %.2f",
2157 AliWarning(
" -> Check consistent usage of HV information in the OCDB entry: 'TPC/Calib/HighVoltage'");
2158 AliWarning(
" -> and the nominal voltages in the OCDB entry: 'TPC/Calib/Parameters'");
2164 AliWarning(Form(
"Large fraction of low HV readings detected in ROC %2d: %.2f > %.2f",
2166 AliWarning(Form(
" -> Based on HV information from OCDB entry: 'TPC/Calib/HighVoltage' with median voltage: %.2f",
fChamberHVmedian[iROC]));
2167 AliWarning(
" -> Check with experts if this chamber had HV problems in this run");
2178 AliFatal(
"Something went wrong in the chamber HV status calculation. Check warning messages above. All chambers would be deactivated!");
2194 TTimeStamp stamp(timeStamp);
2204 TString sensorName=
"";
2205 TTimeStamp stamp(timeStamp);
2207 if (!voltageArray || (sector<0) || (sector>71))
return val;
2208 Char_t sideName=
'A';
2209 if ((sector/18)%2==1) sideName=
'C';
2212 sensorName=Form(
"TPC_ANODE_I_%c%02d_VMEAS",sideName,sector%18);
2215 sensorName=Form(
"TPC_ANODE_O_%c%02d_0_VMEAS",sideName,sector%18);
2220 sensorName=Form(
"TPC_ANODE_I_%c%02d_IMEAS",sideName,sector%18);
2223 sensorName=Form(
"TPC_ANODE_O_%c%02d_0_IMEAS",sideName,sector%18);
2241 TString sensorName=
"";
2242 TTimeStamp stamp(timeStamp);
2244 if (!voltageArray || (sector<0) || (sector>71))
return val;
2245 Char_t sideName=
'A';
2246 if ((sector/18)%2==1) sideName=
'C';
2247 sensorName=Form(
"TPC_SKIRT_%c_VMEAS",sideName);
2263 TString sensorName=
"";
2264 TTimeStamp stamp(timeStamp);
2266 if (!voltageArray || (sector<0) || (sector>71))
return val;
2267 Char_t sideName=
'A';
2268 if ((sector/18)%2==1) sideName=
'C';
2271 sensorName=Form(
"TPC_COVER_I_%c_VMEAS",sideName);
2274 sensorName=Form(
"TPC_COVER_O_%c_VMEAS",sideName);
2291 TString sensorName=
"";
2292 TTimeStamp stamp(timeStamp);
2294 if (!voltageArray || (sector<0) || (sector>71))
return val;
2295 Char_t sideName=
'A';
2296 if ((sector/18)%2==1) sideName=
'C';
2299 sensorName=Form(
"TPC_GATE_I_%c_OFF_VMEAS",sideName);
2302 sensorName=Form(
"TPC_GATE_O_%c_OFF_VMEAS",sideName);
2319 TString sensorName=
"";
2320 TTimeStamp stamp(timeStamp);
2322 if (!voltageArray || (sector<0) || (sector>71))
return val;
2323 Char_t sideName=
'A';
2324 if ((sector/18)%2==1) sideName=
'C';
2327 sensorName=Form(
"TPC_GATE_I_%c_NEG_VMEAS",sideName);
2330 sensorName=Form(
"TPC_GATE_O_%c_NEG_VMEAS",sideName);
2347 TString sensorName=
"";
2348 TTimeStamp stamp(timeStamp);
2350 if (!voltageArray || (sector<0) || (sector>71))
return val;
2351 Char_t sideName=
'A';
2352 if ((sector/18)%2==1) sideName=
'C';
2355 sensorName=Form(
"TPC_GATE_I_%c_POS_VMEAS",sideName);
2358 sensorName=Form(
"TPC_GATE_O_%c_POS_VMEAS",sideName);
2371 TTimeStamp stamp(timeStamp);
2373 if (!sensor)
return 0;
2374 return sensor->GetValue(stamp);
2383 if (grp) current=grp->GetL3Current((AliGRPObject::Stats)statType);
2392 if (current>-1) bz=5*current/30000.*.1;
2401 if (grp) pol=grp->GetL3Polarity();
2410 if (grp)
return grp->GetRunType();
2417 TTimeStamp stamp(timeStamp);
2419 if (!goofieArray)
return 0;
2420 AliDCSSensor *sensor = goofieArray->GetSensor(type);
2421 return sensor->GetValue(stamp);
2432 TTimeStamp tstamp(timeStamp);
2434 if (! tempArray)
return kFALSE;
2439 fitter->GetParameters(fit);
2443 if (!fitter)
return kFALSE;
2470 if (!vdrift)
return 0;
2480 AliDCSSensor * sensor = 0;
2482 osensor = ((*map)(
"fP2Pressure"));
2483 sensor =
dynamic_cast<AliDCSSensor *
>(osensor);
2485 if (!sensor)
return 0;
2487 AliDCSSensor * sensor2 =
new AliDCSSensor(*sensor);
2488 osensor = ((*map)(
"fCavernPressure"));
2489 TGraph *
gr =
new TGraph(2);
2490 gr->GetX()[0]= -100000.;
2491 gr->GetX()[1]= 1000000.;
2492 gr->GetY()[0]= atof(osensor->GetName());
2493 gr->GetY()[1]= atof(osensor->GetName());
2494 sensor2->SetGraph(gr);
2498 AliGRPObject *grpRun =
new AliGRPObject;
2499 grpRun->ReadValuesFromMap(map);
2500 grpRun->SetCavernAtmosPressure(sensor2);
2501 grpRun->SetCavernAtmosPressure(sensor2);
2502 grpRun->SetSurfaceAtmosPressure(sensor);
2510 if (!AliCDBManager::Instance()->GetDefaultStorage()){
2511 AliLog::Message(AliLog::kError,
"Default Storage not set. Cannot create Calibration Tree!",
2512 MODULENAME(),
"AliTPCcalibDB", FUNCTIONNAME(), __FILE__, __LINE__);
2526 if (!AliCDBManager::Instance()->GetDefaultStorage()){
2527 AliError(
"Default Storage not set. Cannot create calibration Tree!");
2574 TString file(filename);
2575 if (file.IsNull()) file=Form(
"guiTreeRun_%i.root",
fRun);
2584 if (!AliCDBManager::Instance()->GetDefaultStorage()){
2585 AliLog::Message(AliLog::kError,
"Default Storage not set. Cannot create Calibration Tree!",
2586 MODULENAME(),
"AliTPCcalibDB", FUNCTIONNAME(), __FILE__, __LINE__);
2589 TString file(filename);
2590 if (file.IsNull()) file=Form(
"RefCalPads_%d.root",run);
2591 TDirectory *currDir=gDirectory;
2597 TFile
f(file.Data(),
"recreate");
2637 Double_t deltaP=0, driftP=0, wP = 0.;
2638 Double_t deltaITS=0,driftITS=0, wITS= 0.;
2639 Double_t deltaLT=0, driftLT=0, wLT = 0.;
2640 Double_t deltaCE=0, driftCE=0, wCE = 0.;
2645 deltaITS = TMath::Abs(deltaITS);
2646 deltaP = TMath::Abs(deltaP);
2647 deltaLT = TMath::Abs(deltaLT);
2648 deltaCE = TMath::Abs(deltaCE);
2650 const Double_t
kEpsilon=0.00000000001;
2651 const Double_t kdeltaT=360.;
2652 if(TMath::Abs(deltaITS) < 12*kdeltaT) {
2655 wITS = 64.*kdeltaT/(deltaITS +kdeltaT);
2656 wLT = 16.*kdeltaT/(deltaLT +kdeltaT);
2657 wP = 0. *kdeltaT/(deltaP +kdeltaT);
2658 wCE = 1. *kdeltaT/(deltaCE +kdeltaT);
2661 if (TMath::Abs(driftP)<
kEpsilon) wP=0;
2662 if (TMath::Abs(driftITS)<
kEpsilon)wITS=0;
2663 if (TMath::Abs(driftLT)<
kEpsilon) wLT=0;
2664 if (TMath::Abs(driftCE)<
kEpsilon) wCE=0;
2665 if (wP+wITS+wLT+wCE<kEpsilon)
return 0;
2666 result = (driftP*wP+driftITS*wITS+driftLT*wLT+driftCE*wCE)/(wP+wITS+wLT+wCE);
2720 if (!array)
return 0;
2724 TGraphErrors *
gr= (TGraphErrors*)array->FindObject(
"ALIGN_ITSB_TPC_VDGY");
2725 if (!gr) gr = (TGraphErrors*)array->FindObject(
"ALIGN_TOFB_TPC_VDGY");
2738 TGraphErrors *laserA= (TGraphErrors*)array->FindObject(
"GRAPH_MEAN_GLOBALYGRADIENT_LASER_ALL_A");
2739 TGraphErrors *laserC= (TGraphErrors*)array->FindObject(
"GRAPH_MEAN_GLOBALYGRADIENT_LASER_ALL_C");
2741 if (laserA && laserC){
2742 result= (laserA->Eval(timeStamp)+laserC->Eval(timeStamp))*0.5;
2744 if (laserA && side==0){
2745 result = (laserA->Eval(timeStamp));
2747 if (laserC &&side==1){
2748 result = (laserC->Eval(timeStamp));
2752 return -result/250.;
2769 if (!array)
return 0;
2773 TGraphErrors *
gr= (TGraphErrors*)array->FindObject(
"ALIGN_ITSB_TPC_DELTAZ");
2775 result = TMath::Mean(gr->GetN(), gr->GetY());
2793 TFile *fileMapping =
new TFile(nameMappingFile,
"read");
2796 snprintf(chinfo,1000,
"Failed to get mapping object from %s. ...\n", nameMappingFile);
2803 AliError(
"Failed to allocate dead map AliTPCCalPad");
2810 AliError(
"No ALTRO config OCDB entry available");
2814 TObjString *ddlArray=0;
2816 ddlArray = (TObjString*)activeDDL->GetValue(
"DDLArray");
2818 AliError(
"Empty list of active DDLs in OCDB entry");
2822 AliError(
"List of active DDLs not available in OCDB entry");
2825 TString arrDDL=ddlArray->GetString();
2828 for (Int_t i=0; i<mapping->
GetNumDdl(); i++) {
2830 if (idDDL<0)
continue;
2832 if (patch<0)
continue;
2834 if (roc<0)
continue;
2837 for ( Int_t branch = 0; branch < 2; branch++ ) {
2838 for ( Int_t fec = 0; fec < mapping->
GetNfec(patch, branch); fec++ ) {
2839 for ( Int_t altro = 0; altro < 8; altro++ ) {
2840 for ( Int_t channel = 0; channel < 16; channel++ ) {
2841 Int_t hwadd = mapping->
CodeHWAddress(branch, fec, altro, channel);
2842 Int_t row = mapping->
GetPadRow(patch, hwadd);
2844 Int_t pad = mapping->
GetPad(patch, hwadd);
2845 if (!TString(arrDDL[i]).IsDigit()) {
2848 active=TString(arrDDL[i]).Atof();
2872 if (field<-0.1 &&fComposedCorrectionArray->At(2)) {
2885 if (
fRun<0)
return 0;
2891 if (correctionTime){
2892 correctionTime->
Init();
2918 static Float_t gGainCorrection[72];
2919 static Float_t gGainCorrectionPT[72];
2920 static Float_t gGainCorrectionHV[72];
2921 static Int_t gTimeStamp=-99999999;
2922 static Bool_t hasTimeDependent=kFALSE;
2923 if ( TMath::Abs(timeStamp-gTimeStamp)> deltaCache){
2925 TGraphErrors * graphGHV = 0;
2926 TGraphErrors * graphGPT = 0;
2928 if (timeGainSplines){
2929 graphGHV = (TGraphErrors*) timeGainSplines->FindObject(
"GainSlopesHV");
2930 graphGPT = (TGraphErrors*) timeGainSplines->FindObject(
"GainSlopesPT");
2931 if (graphGHV) hasTimeDependent=kTRUE;
2936 for (Int_t isec=0; isec<72; isec++){
2940 AliWarningF(
"Could not get proper HV for run,sec,time (%d, %2d, %d), using current nominal voltage: %.2f", run, isec, timeStamp, HV);
2947 Double_t deltaGHV=0;
2948 Double_t deltaGPT=0;
2949 if (graphGHV) deltaGHV = graphGHV->GetY()[isec]*deltaHV;
2950 if (graphGPT) deltaGPT = graphGPT->GetY()[isec]*
GetPTRelative(timeStamp,run,0);
2951 gGainCorrection[isec]=(1.+deltaGHV)*(1.+deltaGPT);
2952 gGainCorrectionPT[isec]=1+deltaGPT;
2953 gGainCorrectionHV[isec]=1+deltaGHV;
2955 gTimeStamp=timeStamp;
2958 if (hasTimeDependent)
return gGainCorrection[sector];
2959 if (!hasTimeDependent)
return 1;
2961 if (mode==1)
return gGainCorrection[sector];
2962 if (mode==2)
return gGainCorrectionPT[sector];
2963 if (mode==3)
return gGainCorrectionHV[sector];
static AliTPCcalibDB * Instance()
static Float_t GetGain(Int_t sector, Int_t row, Int_t pad)
static Double_t EvalGraphConst(TGraph *const graph, Double_t xref)
TMap fDriftCorrectionArray
! array of drift correction
static void CreateObjectList(const Char_t *filename, TObjArray *calibObjects)
static Float_t GetBz(Int_t run)
printf("Chi2/npoints = %f\n", TMath::Sqrt(chi2/npoints))
UInt_t GetNPads(UInt_t sector, UInt_t row) const
Float_t GetMaxDipVoltage() const
Double_t GetTime0CorrectionTime(Int_t timeStamp, Int_t run, Int_t side, Int_t mode)
TFile * Open(const char *filename, Long64_t &nevents)
const TObjArray * GetCalPadRMS() const
Bool_t fBHasAlignmentOCDB
Flag - alignment from the Transformation class.
static Char_t GetL3Polarity(Int_t run)
AliTPCCalROC * GetCalROC(Int_t sector) const
AliTPCRecoParam * GetRecoParamFromGRP() const
const TObjArray * GetCalPadRMS() const
static Double_t GetPTRelative(UInt_t timeSec, Int_t run, Int_t side)
AliTPCCalPad * fPadTime0
Time0 calibration entry.
AliTPCCalPad * GetMaxCharge() const
TObjArray * fIonTailArray
array of graphs with the ion tail
static Double_t GetVDriftTPC(Double_t &dist, Int_t run, Int_t timeStamp, Double_t deltaT=86400, Double_t deltaTLaser=3600, Int_t valType=0)
Float_t GetGasSensorValue(EDcsGasSensor type, Int_t timeStamp=-1, Int_t sigDigits=-1)
TMap * GetRCUconfig() const
TMap fTimeGainSplinesArray
! array Array of AliSplineFits: at 0 MIP position in time ; at 1 Fermi Plateau from cosmics ...
Double_t GetMedian(AliTPCCalROC *const outlierROC=0, EPadType padType=kAll) const
Double_t GetRMS(AliTPCCalROC *const outlierROC=0, EPadType padType=kAll) const
AliDCSSensor * fHVsensors[72]
HV sensors.
Int_t fMaxTimeBinAllPads
Maximum Time bin in whole TPC extracted from AltroConfig.
void SetExBField(Float_t bz)
Class providing the calibration parameters by accessing the CDB.
TGraph * fGrRunState
store information if run is active or paused
void UpdateChamberHighVoltageData()
Manager and of geomety classes for set: TPC.
static void FilterTracks(Int_t run, Double_t cutSigma=20., TTreeSRedirector *const pcstream=0)
AliTPCCalPad * GetALTROFPED() const
static Float_t GetGGoffsetVoltage(Int_t run, Int_t sector, Int_t timeStamp=-1, Int_t sigDigits=0)
UInt_t GetNRows(UInt_t sector) const
TObjArray * fComposedCorrectionArray
space point corrections for different field setting
Float_t GetDriftV() const
Float_t GetMaxFractionHVbad() const
static Float_t GetValueGoofie(Int_t timeStamp, Int_t run, Int_t type)
TFile f("CalibObjects.root")
Float_t GetMaxVoltageDeviation() const
Float_t GetValue(UInt_t row, UInt_t pad) const
Implementation of the TPC pedestal calibration.
void Multiply(Float_t c1)
AliTPCTransform * fTransform
object responsible for spacial corrections
TMap fGoofieArray
! array of GOOFIE values -per run
static const char * fgkGasSensorNames[kNGasSensor]
DCS gas sensor names.
const TObjArray * GetCalPadT0() const
Int_t GetPad(Int_t patch, Int_t hwAddress) const
AliDCSSensor * GetPressureSensor(Int_t run, Int_t type=0)
AliTPCCalPad * fPadNoise
Noise calibration entry.
static Float_t FilterSensor(AliDCSSensor *sensor, Double_t ymin, Double_t ymax, Double_t maxdy, Double_t sigmaCut)
TPC calibration class for temperature maps and tendencies.
UInt_t GetNChannels(UInt_t sector) const
static Double_t GetVDriftTPCCE(Double_t &dist, Int_t run, Int_t timeStamp, Double_t deltaT=43200, Int_t side=2)
TMap fVoltageArray
! array of Chamber HV values -per run
AliTPCExB * GetExB() const
void GetPositionLocal(UInt_t sector, UInt_t row, UInt_t pad, Float_t *pos)
AliTPCCalPad * GetPedestals() const
AliTPCCalPad * fPadGainFactor
Gain calibration entry.
TObjArray * GetTimeGainSplinesRun(Int_t run)
AliTPCCalPad * fActiveChannelMap
Map of active channels calculated on the fly.
static void FilterCE(Double_t deltaT=100, Double_t cutAbs=10, Double_t cutSigma=4., TTreeSRedirector *const pcstream=0)
AliTPCCalPad * GetNTimeBins() const
TGraph * GetCErocQgraph(const Int_t roc) const
static Float_t GetChamberHighVoltage(Int_t run, Int_t sector, Int_t timeStamp=-1, Int_t sigDigits=0, Bool_t current=kFALSE)
AliTPCCalPad * GetTimePosition() const
static Bool_t fgTerminated
termination control
TMap fTemperatureArray
! array of temperature sensors - per run
Int_t GetNfec(Int_t patch, Int_t branch) const
Float_t fChamberHVgoodFraction[72]
fraction of time the chamber has a good HV (wrt. robust median)
AliTPCdataQA * GetDataQA() const
Int_t CodeHWAddress(Int_t branch, Int_t fec, Int_t chip, Int_t channel) const
static Double_t GetTime0TPCITS(Double_t &dist, Int_t run, Int_t timeStamp)
const TObjArray * GetCalPadRMS() const
Class providing the calculation of derived quantities (mean,rms,fits,...) of calibration entries...
AliDCSSensorArray * GetVoltageSensors(Int_t run)
static Float_t GetPressure(Int_t timeStamp, Int_t run, Int_t type=0)
AliTPCCorrection * fComposedCorrection
general space point corrections
static void SetInstance(AliTPCExB *const param)
const Double_t * GetBadPadMaxDistXYZD() const
Int_t GetRCUTriggerConfig() const
static TString GetRunType(Int_t run)
TMap fGRPMaps
! array of GRPs maps - per run - old data
Implementation of the TPC pulser calibration.
static Float_t GetSkirtVoltage(Int_t run, Int_t sector, Int_t timeStamp=-1, Int_t sigDigits=0)
Bool_t GetTailcancelationGraphs(Int_t sector, TGraphErrors **graphRes, Float_t *indexAmpGraphs)
static Float_t FilterTemperature(AliTPCSensorTempArray *tempArray, Double_t ymin=15, Double_t ymax=22, Double_t sigmaCut=5)
UInt_t GetNPads(UInt_t row) const
TPC cluster error, shape and charge parameterization as function of drift length and inclination angl...
TLinearFitter * GetLinearFitter(Int_t type, Int_t side, UInt_t timeSec)
Bool_t CreateGUITree(const char *filename="")
AliGRPObject * MakeGRPObjectFromMap(TMap *map)
AliTPCSensorTempArray * GetTemperature() const
Float_t fChamberHVmedian[72]
median chamber high voltage
AliTPCCalPad * GetCEQmean() const
const Double_t * GetBadClusMaxErrYZ() const
AliTPCComposedCorrection class.
static Float_t GetL3Current(Int_t run, Int_t statType=0)
Implementation of the TPC cluser.
AliTPCCalPad * fDedxGainFactor
Gain calibration entry - for dEdx.
void SetDistortions(float dx, float dy, float dz)
Float_t fCurrentNominalVoltage[72]
current nominal voltages
AliTPCSensorTempArray * fTemperature
Temperature calibration entry.
AliTPCTransform * GetTransform() const
TTimeStamp startTime(2009, 8, 7, 0, 0, 0)
AliTPCcalibDB & operator=(const AliTPCcalibDB &)
Double_t GetMean(AliTPCCalROC *const outlierROC=0, EPadType padType=kAll) const
AliCTPTimeParams * fCTPTimeParams
CTP timing parameters.
void GetPositionGlobal(UInt_t sector, UInt_t row, UInt_t pad, Float_t *pos)
void UpdateRunInformations(Int_t run, Bool_t force=kFALSE)
static void MakeTree(const char *fileName, TObjArray *array, const char *mapFileName=0, AliTPCCalPad *outlierPad=0, Float_t ltmFraction=0.9)
virtual void SetDetector(Int_t detector)
Int_t fMode
RCU trigger config mode.
const UInt_t * GetRowIndexes(UInt_t sector) const
TObjArray * fPulserData
Calibration Pulser data.
const TObjArray * GetCalPadT0() const
Int_t GetNMaskedRows(int sector72, TBits *masked=0) const
Geometry class for a single ROC.
AliTPCCalPad * GetPulserQmean() const
AliTPCCalPad * GetALTROAcqStop() const
void SetValue(UInt_t row, UInt_t pad, Float_t vd)
TObjArray * fDistortionMap
distortion map
Int_t GetPadRow(Int_t patch, Int_t hwAddress) const
TObjArray * fCEData
CE data.
AliTPCCalPad * GetCETmean() const
void LoadCorrectionMaps()
AliTPCCalPad * GetPadNoise() const
AliTPCCalPad * GetPulserTmean() const
static Float_t GetGGnegVoltage(Int_t run, Int_t sector, Int_t timeStamp=-1, Int_t sigDigits=0)
AliTPCCalPad * GetPulserTrms() const
static void RegisterField(Int_t index, AliMagF *magf)
Double_t GetVDriftCorrectionGy(Int_t timeStamp, Int_t run, Int_t side, Int_t mode)
static Float_t GetDCSSensorMeanValue(AliDCSSensorArray *arr, const char *sensorName, Int_t sigDigits=-1)
AliTPCdataQA * fDataQA
qa object
void rec(const char *filename="raw.root")
Bool_t IsDataTakingActive(time_t timeStamp)
TObjArray * GetTimeVdriftSplineRun(Int_t run)
AliCDBEntry * GetCDBEntry(const char *cdbPath)
AliTPCClusterParam * fClusterParam
TPC cluster error, shape and Q parameterization.
Int_t GetPatchFromEquipmentID(Int_t equipmentID) const
Int_t GetTpcDdlOffset() const
Bool_t fChamberHVStatus[72]
Status of the Chamber, HV wise (on/off)
TPC calibration base class for one ROC.
AliTPCParam * fParam
TPC parameters.
AliTPCCalPad * GetNPads() const
const TObjArray * GetCalPadPedestal() const
static const Double_t * GetPrimaryDCACut()
Int_t fRun
current run number
Float_t GetNominalVoltage(UInt_t i) const
TObjArray * fALTROConfigData
ALTRO configuration data.
Bool_t GetUseCorrectionMap() const
static TObjArray fgExBArray
array of ExB corrections
static TMap * GetGRPMap(Int_t run)
TGraphErrors * GetGainSlopesPT() const
AliTPCCorrection * GetTPCComposedCorrectionDelta() const
static Float_t GetCoverVoltage(Int_t run, Int_t sector, Int_t timeStamp=-1, Int_t sigDigits=0)
AliTPCCalPad * GetMeanCharge() const
AliSplineFit * GetVdriftSplineFit(const char *name, Int_t run)
TCollection * GetCorrections() const
TGraphErrors * GetGainSlopesHV() const
static Float_t GetGGposVoltage(Int_t run, Int_t sector, Int_t timeStamp=-1, Int_t sigDigits=0)
UInt_t GetNchannels() const
AliTPCCorrection * GetTPCComposedCorrection() const
void SetRun(Long64_t run)
static void RegisterExB(Int_t index, Float_t bz, Bool_t bdelete)
AliDCSSensorArray * GetGoofieSensors(Int_t run)
void DumpToFile(const char *fileName)
AliDCSSensorArray * fGasSensorArray
Gas sensors.
static AliGRPObject * GetGRP(Int_t run)
AliTPCExB * fExB
ExB correction factor.
AliTPCCalPad * GetActiveChannelMap() const
Preprocessor class for HLT and DAQ.
Double_t GetGainCorrectionHVandPT(Int_t timeStamp, Int_t run, Int_t sector, Int_t deltaCache, Int_t mode)
AliTPCCalPad * GetALTROAcqStart() const
TPC calibration class for parameters which saved per pad.
Int_t grp(UInt_t run, TString &gdc)
const TObjArray * GetCalPadQ() const
AliSplineFit * CreateVdriftSplineFit(const char *graphName, Int_t run)
static Double_t GetVDriftTPCITS(Double_t &dist, Int_t run, Int_t timeStamp)
TGraph * GetCErocTgraph(const Int_t roc) const
AliTPCCalPad * GetNLocalMaxima() const
Int_t GetRocFromEquipmentID(Int_t equipmentID) const
void SetDistortionDispersion(float d)
AliTPCCalPad * GetDedxGainFactor() const
static Double_t GetVDriftTPCLaserTracks(Double_t &dist, Int_t run, Int_t timeStamp, Double_t deltaT=43200, Int_t side=2)
Double_t GetVDriftCorrectionDeltaZ(Int_t timeStamp, Int_t run, Int_t side, Int_t mode)
TObjArray * fCorrectionMaps
RS: new fast Chebyshev parameterization maps.
static AliTPCcalibDB * fgInstance
singleton control
static Bool_t CreateRefFile(Int_t run, const char *filename="")
TMap fVdriftArray
! array of v drift interfaces
static Float_t GetDCSSensorValue(AliDCSSensorArray *arr, Int_t timeStamp, const char *sensorName, Int_t sigDigits=-1)
static Float_t GetCEdriftTime(Int_t run, Int_t sector, Double_t timeStamp=-1., Int_t *entries=0)
static AliTPCROC * Instance()
Implementation of the TPC Central Electrode calibration.
AliTPCCalibVdrift * GetVdrift(Int_t run)
Class with TPC reconstruction parameters.
void AddComponent(TObject *obj)
AliTPCCalibRaw * fCalibRaw
raw data calibration entry
TArrayI fRunList
! run list - indicates try to get the run param
TObjArray * fRecoParamList
List of TPC reco param objects.
AliTPCAltroMapping ** fMapping
Altro mapping.
Float_t GetZLength(Int_t sector=0) const
static Bool_t GetTemperatureFit(Int_t timeStamp, Int_t run, Int_t side, TVectorD &fit)
AliTPCCalPad * GetNoThreshold() const
UInt_t GetNSectors() const
TObjArray * fTimeGainSplines
Array of AliSplineFits: at 0 MIP position in time ; at 1 Fermi Plateau from cosmics.
AliTPCCalPad * GetALTROZsThr() const
static Float_t GetCEchargeTime(Int_t run, Int_t sector, Double_t timeStamp=-1., Int_t *entries=0)
Double_t GetLTM(Double_t *const sigma=0, Double_t fraction=0.9, AliTPCCalROC *const outlierROC=0, EPadType padType=kAll)
AliTPCCalPad * GetDistortionMap(Int_t i) const
AliTPCCalPad * GetALTROMasked() const
AliRecoParam::EventSpecie_t fRunEventSpecie
Event specie suggested for the run according to GRP.
Double_t GetVDriftCorrectionTime(Int_t timeStamp, Int_t run, Int_t side, Int_t mode)
Float_t GetPadRowRadii(UInt_t isec, UInt_t irow) const
Abstract class for ExB effect parameterization.
AliTPCcalibDButil * fDButil
utility class
const TObjArray * GetCalPadQ() const
Int_t GetMaskedChannelsFromCorrectionMaps(TBits maskedPads[72])
AliTPCCalPad * GetCETrms() const
AliTPCCalPad * MakeDeadMap(Double_t notInMap=1, const char *nameMappingFile="$ALICE_ROOT/TPC/Calib/tpcMapping.root")
This implementation AliTPCExB is using an aproximate calculation of the ExB effect.
AliTPCRecoParam * GetRecoParam(Int_t i) const
Double_t GetPTRelative(UInt_t absTimeSec, Int_t side)
Float_t GetChamberCurrentNominalHighVoltage(UInt_t roc) const
AliTPCCalPad * fPedestals
Pedestal calibration entry.
AliTPCSensorTempArray * GetTemperatureSensor(Int_t run)
TMap fGRPArray
! array of GRPs - per run
Implementation of the TPC Raw drift velocity and Altro L1 Phase calibration.
static Double_t GetTriggerOffsetTPC(Int_t run, Int_t timeStamp, Double_t deltaT=86400, Double_t deltaTLaser=3600, Int_t valType=0)