]> git.uio.no Git - u/mrichter/AliRoot.git/blobdiff - TRD/AliTRDalignment.cxx
Add new online gain tables
[u/mrichter/AliRoot.git] / TRD / AliTRDalignment.cxx
index 316abbb2bc1ec9f4004c72d885395a09e992c07c..80e511f5c341725ec4121f8a9c53b15705f8a0ec 100644 (file)
@@ -91,6 +91,8 @@
 
 void trdAlignmentFcn(Int_t &npar, Double_t *gin, Double_t &f, Double_t *x, Int_t iflag);
 
+using std::ostream;
+using std::fstream;
 ClassImp(AliTRDalignment)
 
 //_____________________________________________________________________________
@@ -146,6 +148,11 @@ AliTRDalignment::AliTRDalignment()
     fSurveyZ0[j][k][l] = z[k];
   }
 
+  for (int i=0; i<1000; i++) {
+    fIbuffer[i] = 0;
+    fDbuffer[i] = 0.0;
+  }
+
 }
 
 //_____________________________________________________________________________
@@ -173,6 +180,10 @@ AliTRDalignment::AliTRDalignment(const AliTRDalignment& source)
     fSurveyY0[j][k][l] = source.fSurveyY0[j][k][l];
     fSurveyZ0[j][k][l] = source.fSurveyZ0[j][k][l];
   }
+  for (int i=0; i<1000; i++) {
+    fIbuffer[i] = 0;
+    fDbuffer[i] = 0.0;
+  }
 
 }
 
@@ -859,10 +870,14 @@ double AliTRDalignment::SurveyChi2(int i, const double * const a) {
   if (!IsGeoLoaded()) return 0;
   printf("Survey of supermodule %d\n",i);
   AliAlignObjParams al(GetSmName(i),0,a[0],a[1],a[2],a[3],a[4],a[5],0);
+
   TGeoPNEntry      *pne  = gGeoManager->GetAlignableEntry(GetSmName(i));
   if (!pne) AliError(Form("no such physical node entry: %s",GetSmName(i)));
   TGeoPhysicalNode *node = pne->GetPhysicalNode();
-  if (!node) AliError(Form("physical node entry %s has no physical node",GetSmName(i))); 
+  if (!node) {
+    AliWarning(Form("physical node entry %s has no physical node; making a new one",GetSmName(i))); 
+    node = gGeoManager->MakeAlignablePN(pne);
+  }
 
   //  al.ApplyToGeometry();    
   //  node = pne->GetPhysicalNode(); // changed in the meantime
@@ -1023,7 +1038,7 @@ void AliTRDalignment::WriteRoot(const char * const filename)
 }
 
 //_____________________________________________________________________________
-void AliTRDalignment::WriteDB(const char * const filename, int run0, int run1) 
+void AliTRDalignment::WriteDB(const char * const filename, int run0, int run1, int ver, int subver
 {
   //
   // dumping on a DB-like file
@@ -1036,7 +1051,9 @@ void AliTRDalignment::WriteDB(const char * const filename, int run0, int run1)
   AliCDBMetaData *md = new AliCDBMetaData();
   md->SetResponsible("Dariusz Miskowiec");
   md->SetComment(fComment.GetString().Data());
-  AliCDBEntry    *e  = new AliCDBEntry(ar, id, md);
+  AliCDBEntry *e  = new AliCDBEntry(ar, id, md);
+  e->SetVersion(ver);
+  e->SetSubVersion(subver);
   TFile fi(filename,"RECREATE");
   if (fi.IsOpen()) {
     e->Write();