+
+AliTPCCalPad* AliTPCcalibDB::MakeDeadMap(Double_t notInMap, const char* nameMappingFile) {
+//
+// Read list of active DDLs from OCDB entry
+// Generate and return AliTPCCalPad containing 1 for all pads in active DDLs,
+// 0 for all pads in non-active DDLs.
+// For DDLs with missing status information (no DCS input point to Shuttle),
+// the value of the AliTPCCalPad entry is determined by the parameter
+// notInMap (default value 1)
+//
+ char chinfo[1000];
+
+ TFile *fileMapping = new TFile(nameMappingFile, "read");
+ AliTPCmapper *mapping = (AliTPCmapper*) fileMapping->Get("tpcMapping");
+ if (!mapping) {
+ snprintf(chinfo,1000,"Failed to get mapping object from %s. ...\n", nameMappingFile);
+ AliError (chinfo);
+ return 0;
+ }
+
+ AliTPCCalPad *deadMap = new AliTPCCalPad("deadMap","deadMap");
+ if (!deadMap) {
+ AliError("Failed to allocate dead map AliTPCCalPad");
+ return 0;
+ }
+
+ /// get list of active DDLs from OCDB entry
+ Int_t idDDL=0;
+ if (!fALTROConfigData ) {
+ AliError("No ALTRO config OCDB entry available");
+ return 0;
+ }
+ TMap *activeDDL = (TMap*)fALTROConfigData->FindObject("DDLArray");
+ TObjString *ddlArray=0;
+ if (activeDDL) {
+ ddlArray = (TObjString*)activeDDL->GetValue("DDLArray");
+ if (!ddlArray) {
+ AliError("Empty list of active DDLs in OCDB entry");
+ return 0;
+ }
+ } else {
+ AliError("List of active DDLs not available in OCDB entry");
+ return 0;
+ }
+ TString arrDDL=ddlArray->GetString();
+ Int_t offset = mapping->GetTpcDdlOffset();
+ Double_t active;
+ for (Int_t i=0; i<mapping->GetNumDdl(); i++) {
+ idDDL= i+offset;
+ if (idDDL<0) continue;
+ Int_t patch = mapping->GetPatchFromEquipmentID(idDDL);
+ if (patch<0) continue;
+ Int_t roc=mapping->GetRocFromEquipmentID(idDDL);
+ if (roc<0) continue;
+ AliTPCCalROC *calRoc=deadMap->GetCalROC(roc);
+ if (calRoc) {
+ for ( Int_t branch = 0; branch < 2; branch++ ) {
+ for ( Int_t fec = 0; fec < mapping->GetNfec(patch, branch); fec++ ) {
+ for ( Int_t altro = 0; altro < 8; altro++ ) {
+ for ( Int_t channel = 0; channel < 16; channel++ ) {
+ Int_t hwadd = mapping->CodeHWAddress(branch, fec, altro, channel);
+ Int_t row = mapping->GetPadRow(patch, hwadd); // row in a ROC (IROC or OROC)
+// Int_t globalrow = mapping.GetGlobalPadRow(patch, hwadd); // row in full sector (IROC plus OROC)
+ Int_t pad = mapping->GetPad(patch, hwadd);
+ if (!TString(arrDDL[i]).IsDigit()) {
+ active = notInMap;
+ } else {
+ active=TString(arrDDL[i]).Atof();
+ }
+ calRoc->SetValue(row,pad,active);
+ } // end channel for loop
+ } // end altro for loop
+ } // end fec for loop
+ } // end branch for loop
+ } // valid calROC
+ } // end loop on active DDLs
+ return deadMap;
+}
+
+
+
+AliTPCCorrection * AliTPCcalibDB::GetTPCComposedCorrection(Float_t field) const{
+ //
+ // GetComposed correction for given field setting
+ // If not specific correction for field used return correction for all field
+ // - Complication needed to gaurantee OCDB back compatibility
+ // - Not neeeded for the new space point correction
+ if (!fComposedCorrectionArray) return 0;
+ if (field>0.1 && fComposedCorrectionArray->At(1)) {
+ return (AliTPCCorrection *)fComposedCorrectionArray->At(1);
+ }
+ if (field<-0.1 &&fComposedCorrectionArray->At(2)) {
+ return (AliTPCCorrection *)fComposedCorrectionArray->At(2);
+ }
+ return (AliTPCCorrection *)fComposedCorrectionArray->At(0);
+
+}
+
+
+AliTPCCorrection * AliTPCcalibDB::GetTPCComposedCorrectionDelta() const{
+ //
+ // GetComposedCorrection delta
+ // Delta is time dependent - taken form the CalibTime OCDB entry
+ //
+ if (!fComposedCorrectionArray) return 0;
+ if (fRun<0) return 0;
+ if (fDriftCorrectionArray.GetEntriesFast()<=fRun) return 0;
+ if (fDriftCorrectionArray.At(fRun)==0) return 0;
+ if (fComposedCorrectionArray->GetEntriesFast()<=4) {
+ fComposedCorrectionArray->Expand(5);
+ TObjArray * timeArray =(TObjArray*)(fDriftCorrectionArray.At(fRun));
+ AliTPCCorrection * correctionTime = (AliTPCCorrection *)timeArray->FindObject("FitCorrectionTime");
+ if (correctionTime){
+ correctionTime->Init();
+ fComposedCorrectionArray->AddAt(correctionTime,4); //add time dependent c
+ }
+ }
+ return (AliTPCCorrection *)fComposedCorrectionArray->At(4); //
+}
+