Macros for creating OCDB
authorauras <auras@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 13 Jul 2012 10:01:20 +0000 (10:01 +0000)
committerauras <auras@f7af4fe6-9843-0410-8265-dc069ae4e863>
Fri, 13 Jul 2012 10:01:20 +0000 (10:01 +0000)
MFT/AliMuonForwardTrack.h
MFT/AliMuonForwardTrackPair.cxx
MFT/AliMuonForwardTrackPair.h
MFT/MakeMFTRecoParam.C [new file with mode: 0644]
MFT/MakeMFTZeroMisAlignment.C [new file with mode: 0644]

index 939009e..8702c9d 100644 (file)
@@ -43,6 +43,8 @@ public:
   AliMUONTrack* GetMUONTrack() { return fMUONTrack; }
   TParticle* GetMCTrackRef() { return fMCTrackRef; }
 
+  Int_t GetCharge() { return TMath::Nint(GetTrackParamAtMUONCluster(0)->GetCharge()); }
+
   AliMUONVCluster* GetMUONCluster(Int_t iMUONCluster);
   AliMFTCluster*   GetMFTCluster(Int_t iMFTCluster);
   
index 03637be..7487e3d 100644 (file)
@@ -126,8 +126,8 @@ Double_t AliMuonForwardTrackPair::GetWeightedOffset(Double_t x, Double_t y, Doub
 
   Double_t weightedOffset[2]={0};
 
-  weightedOffset[0] = ((AliMuonForwardTrack*) fMuonForwardTracks->At(0))->GetWeightedOffset(x, y, z);
-  weightedOffset[1] = ((AliMuonForwardTrack*) fMuonForwardTracks->At(1))->GetWeightedOffset(x, y, z);
+  weightedOffset[0] = GetTrack(0)->GetWeightedOffset(x, y, z);
+  weightedOffset[1] = GetTrack(1)->GetWeightedOffset(x, y, z);
 
   Double_t weightedOffsetDimuon = TMath::Sqrt(0.5 * (weightedOffset[0]*weightedOffset[0] + weightedOffset[1]*weightedOffset[1]));
 
@@ -141,18 +141,17 @@ Double_t AliMuonForwardTrackPair::GetMassWithoutMFT(Double_t x, Double_t y, Doub
 
   Int_t idCluster[2] = {0};
   if (nClusters>0) {
-    idCluster[0] = ((AliMuonForwardTrack*) fMuonForwardTracks->At(0))->GetNMUONClusters() - nClusters;
-    idCluster[1] = ((AliMuonForwardTrack*) fMuonForwardTracks->At(1))->GetNMUONClusters() - nClusters;
+    idCluster[0] = GetTrack(0)->GetNMUONClusters() - nClusters;
+    idCluster[1] = GetTrack(1)->GetNMUONClusters() - nClusters;
   }
   if (idCluster[0]<0) idCluster[0] = 0;
   if (idCluster[1]<0) idCluster[1] = 0;
 
-  AliMUONTrackParam *param0 = ((AliMuonForwardTrack*) fMuonForwardTracks->At(0))->GetTrackParamAtMUONCluster(idCluster[0]);
-  AliMUONTrackParam *param1 = ((AliMuonForwardTrack*) fMuonForwardTracks->At(1))->GetTrackParamAtMUONCluster(idCluster[1]);
+  AliMUONTrackParam *param0 = GetTrack(0)->GetTrackParamAtMUONCluster(idCluster[0]);
+  AliMUONTrackParam *param1 = GetTrack(1)->GetTrackParamAtMUONCluster(idCluster[1]);
 
   AliDebug(2, Form("MUON before extrap: 1st muon = (%f, %f, %f) 2nd muon = (%f, %f, %f)", 
-                  param0->Px(), param0->Py(), param0->Pz(), 
-                  param1->Px(), param1->Py(), param1->Pz()));
+                  param0->Px(), param0->Py(), param0->Pz(), param1->Px(), param1->Py(), param1->Pz()));
 
   AliDebug(2, Form("Extrapolating 1st muon from z = %f to z = %f", param0->GetZ(), z));
   AliMUONTrackExtrap::ExtrapToVertex(param0, x, y, z, 0., 0.);   // this should reproduce what is done in AliMUONESDInterface::MUONToESD(...) 
@@ -160,8 +159,7 @@ Double_t AliMuonForwardTrackPair::GetMassWithoutMFT(Double_t x, Double_t y, Doub
   AliMUONTrackExtrap::ExtrapToVertex(param1, x, y, z, 0., 0.);   // this should reproduce what is done in AliMUONESDInterface::MUONToESD(...) 
 
   AliDebug(2, Form("MUON after extrap: 1st muon = (%f, %f, %f) 2nd muon = (%f, %f, %f)", 
-                  param0->Px(), param0->Py(), param0->Pz(), 
-                  param1->Px(), param1->Py(), param1->Pz()));
+                  param0->Px(), param0->Py(), param0->Pz(), param1->Px(), param1->Py(), param1->Pz()));
 
   Double_t momentum[2] = {0}; 
 
@@ -186,28 +184,17 @@ Double_t AliMuonForwardTrackPair::GetMassWithoutMFT(Double_t x, Double_t y, Doub
 
 void AliMuonForwardTrackPair::SetKinemMC() {
 
-  if ( !(((AliMuonForwardTrack*) fMuonForwardTracks->At(0))->GetMCTrackRef()) || 
-       !(((AliMuonForwardTrack*) fMuonForwardTracks->At(1))->GetMCTrackRef()) ) return;
+  if ( !(GetTrack(0)->GetMCTrackRef()) || !(GetTrack(1)->GetMCTrackRef()) ) return;
 
   AliDebug(2, Form("MC: 1st muon = (%f, %f, %f) 2nd muon = (%f, %f, %f)", 
-                  ((AliMuonForwardTrack*) fMuonForwardTracks->At(0))->GetMCTrackRef()->Px(),
-                  ((AliMuonForwardTrack*) fMuonForwardTracks->At(0))->GetMCTrackRef()->Py(),
-                  ((AliMuonForwardTrack*) fMuonForwardTracks->At(0))->GetMCTrackRef()->Pz(),
-                  ((AliMuonForwardTrack*) fMuonForwardTracks->At(1))->GetMCTrackRef()->Px(),
-                  ((AliMuonForwardTrack*) fMuonForwardTracks->At(1))->GetMCTrackRef()->Py(),
-                  ((AliMuonForwardTrack*) fMuonForwardTracks->At(1))->GetMCTrackRef()->Pz()));
-
-  fKinemMC.SetE(((AliMuonForwardTrack*) fMuonForwardTracks->At(0))->GetMCTrackRef()->Energy() +
-               ((AliMuonForwardTrack*) fMuonForwardTracks->At(1))->GetMCTrackRef()->Energy());
-  
-  fKinemMC.SetPx(((AliMuonForwardTrack*) fMuonForwardTracks->At(0))->GetMCTrackRef()->Px() +
-                ((AliMuonForwardTrack*) fMuonForwardTracks->At(1))->GetMCTrackRef()->Px());
-  
-  fKinemMC.SetPy(((AliMuonForwardTrack*) fMuonForwardTracks->At(0))->GetMCTrackRef()->Py() +
-                ((AliMuonForwardTrack*) fMuonForwardTracks->At(1))->GetMCTrackRef()->Py());
+                  GetTrack(0)->GetMCTrackRef()->Px(), GetTrack(0)->GetMCTrackRef()->Py(), GetTrack(0)->GetMCTrackRef()->Pz(),
+                  GetTrack(1)->GetMCTrackRef()->Px(), GetTrack(1)->GetMCTrackRef()->Py(), GetTrack(1)->GetMCTrackRef()->Pz()));
+
+  fKinemMC.SetE(GetTrack(0)->GetMCTrackRef()->Energy() + GetTrack(1)->GetMCTrackRef()->Energy());
   
-  fKinemMC.SetPz(((AliMuonForwardTrack*) fMuonForwardTracks->At(0))->GetMCTrackRef()->Pz() +
-                ((AliMuonForwardTrack*) fMuonForwardTracks->At(1))->GetMCTrackRef()->Pz());
+  fKinemMC.SetPx(GetTrack(0)->GetMCTrackRef()->Px() + GetTrack(1)->GetMCTrackRef()->Px());
+  fKinemMC.SetPy(GetTrack(0)->GetMCTrackRef()->Py() + GetTrack(1)->GetMCTrackRef()->Py());
+  fKinemMC.SetPz(GetTrack(0)->GetMCTrackRef()->Pz() + GetTrack(1)->GetMCTrackRef()->Pz());
 
 }
 
@@ -220,20 +207,19 @@ void AliMuonForwardTrackPair::SetKinem(Double_t z, Int_t nClusters) {
 
   Int_t idCluster[2] = {0};
   if (nClusters>0) {
-    idCluster[0] = ((AliMuonForwardTrack*) fMuonForwardTracks->At(0))->GetNMFTClusters() - nClusters;
-    idCluster[1] = ((AliMuonForwardTrack*) fMuonForwardTracks->At(1))->GetNMFTClusters() - nClusters;
+    idCluster[0] = GetTrack(0)->GetNMFTClusters() - nClusters;
+    idCluster[1] = GetTrack(1)->GetNMFTClusters() - nClusters;
   }
   if (idCluster[0]<0) idCluster[0] = 0;
   if (idCluster[1]<0) idCluster[1] = 0;
 
   Double_t momentum[2] = {0};
   
-  AliMUONTrackParam *param0 = ((AliMuonForwardTrack*) fMuonForwardTracks->At(0))->GetTrackParamAtMFTCluster(idCluster[0]);
-  AliMUONTrackParam *param1 = ((AliMuonForwardTrack*) fMuonForwardTracks->At(1))->GetTrackParamAtMFTCluster(idCluster[1]);
+  AliMUONTrackParam *param0 = GetTrack(0)->GetTrackParamAtMFTCluster(idCluster[0]);
+  AliMUONTrackParam *param1 = GetTrack(1)->GetTrackParamAtMFTCluster(idCluster[1]);
 
   AliDebug(2, Form("MFT before extrap: 1st muon = (%f, %f, %f) 2nd muon = (%f, %f, %f)", 
-                  param0->Px(), param0->Py(), param0->Pz(), 
-                  param1->Px(), param1->Py(), param1->Pz()));
+                  param0->Px(), param0->Py(), param0->Pz(), param1->Px(), param1->Py(), param1->Pz()));
 
   if (TMath::Abs(z)<1e6) {
     AliDebug(2, Form("Extrapolating 1st muon from z = %f to z = %f", param0->GetZ(), z));
@@ -243,8 +229,7 @@ void AliMuonForwardTrackPair::SetKinem(Double_t z, Int_t nClusters) {
   }
 
   AliDebug(2, Form("MFT after extrap: 1st muon = (%f, %f, %f) 2nd muon = (%f, %f, %f)", 
-                  param0->Px(), param0->Py(), param0->Pz(), 
-                  param1->Px(), param1->Py(), param1->Pz()));
+                  param0->Px(), param0->Py(), param0->Pz(), param1->Px(), param1->Py(), param1->Pz()));
 
   momentum[0] = (param0->P());
   momentum[1] = (param1->P());
@@ -264,8 +249,8 @@ void AliMuonForwardTrackPair::SetKinem(Double_t z, Int_t nClusters) {
 
 void AliMuonForwardTrackPair::SetPointOfClosestApproach() {
   
-  AliMUONTrackParam *param0 = ((AliMuonForwardTrack*) fMuonForwardTracks->At(0))->GetTrackParamAtMFTCluster(0);
-  AliMUONTrackParam *param1 = ((AliMuonForwardTrack*) fMuonForwardTracks->At(1))->GetTrackParamAtMFTCluster(0);
+  AliMUONTrackParam *param0 = GetTrack(0)->GetTrackParamAtMFTCluster(0);
+  AliMUONTrackParam *param1 = GetTrack(1)->GetTrackParamAtMFTCluster(0);
   
   Double_t step = 1.;  // in cm
   Double_t startPoint = 0.;
@@ -354,8 +339,8 @@ Bool_t AliMuonForwardTrackPair::IsResonance() {
   Int_t codePDG[2] = {0};
   
   for (Int_t iTrack=0; iTrack<2; iTrack++) {
-    labelMC[iTrack] = ((AliMuonForwardTrack*) fMuonForwardTracks->At(iTrack))->GetParentMCLabel(0);
-    codePDG[iTrack] = ((AliMuonForwardTrack*) fMuonForwardTracks->At(iTrack))->GetParentPDGCode(0);
+    labelMC[iTrack] = GetTrack(iTrack)->GetParentMCLabel(0);
+    codePDG[iTrack] = GetTrack(iTrack)->GetParentPDGCode(0);
   }
 
   AliDebug(1, Form("Muons' mothers: (%d, %d)", labelMC[0], labelMC[1]));
index 20126cb..ca7466a 100644 (file)
@@ -40,6 +40,8 @@ public:
     else return NULL; 
   }
 
+  Int_t GetCharge() { return GetTrack(0)->GetCharge() + GetTrack(1)->GetCharge(); }
+
   void SetKinemMC();
   void SetKinem(Double_t z, Int_t nClusters=-1);
   Bool_t IsKinemSet() { return fIsKinemSet; }
diff --git a/MFT/MakeMFTRecoParam.C b/MFT/MakeMFTRecoParam.C
new file mode 100644 (file)
index 0000000..7c49315
--- /dev/null
@@ -0,0 +1,29 @@
+void MakeMFTRecoParam(TString Storage = "alien://folder=/alice/cern.ch/user/a/auras/OCDB/") {
+  
+  const char* macroname = "MakeMFTRecoParam.C";
+
+  TObjArray *obj = new TObjArray();
+  AliMFTRecoParam *param = new AliMFTRecoParam();
+  obj -> AddAt(param, 0);
+  
+  // save in CDB storage
+  if(!Storage.BeginsWith("local://") && !Storage.BeginsWith("alien://")) {
+    Error(macroname,"STORAGE variable set to %s is not valid. Exiting\n",Storage.Data());
+    return;
+  }
+  Info(macroname,"Saving Reconstruction Parameters objects in CDB storage %s", Storage.Data());
+  AliCDBManager* cdb = AliCDBManager::Instance();
+  AliCDBStorage* storage = cdb->GetStorage(Storage.Data());
+  if(!storage){
+    Error(macroname,"Unable to open storage %s\n",Storage.Data());
+    return;
+  }
+  AliCDBMetaData* md = new AliCDBMetaData();
+  md->SetResponsible("Antonio Uras");
+  md->SetComment("MFT Calibration Data");
+  md->SetAliRootVersion(gROOT->GetVersion());
+  AliCDBId id("MFT/Calib/Data",0,AliCDBRunRange::Infinity());
+  //  AliCDBId id("MFT/Calib/RecoParam",0,AliCDBRunRange::Infinity());
+  storage->Put(obj,id,md);
+
+}
diff --git a/MFT/MakeMFTZeroMisAlignment.C b/MFT/MakeMFTZeroMisAlignment.C
new file mode 100644 (file)
index 0000000..019ae64
--- /dev/null
@@ -0,0 +1,41 @@
+void MakeMFTZeroMisAlignment(TString Storage = "alien://folder=/alice/cern.ch/user/a/auras/OCDB/") {
+
+  // Create TClonesArray of zero misalignment objects for MFT
+
+  const char* macroname = "MakeMFTZeroMisAlignment.C";
+
+  TClonesArray *array = new TClonesArray("AliAlignObjParams",10);
+  TClonesArray &alobj = *array;
+
+  Double_t dx=0, dy=0, dz=0, dpsi=0, dtheta=0, dphi=0;
+
+  Int_t iIndex=0;
+  AliGeomManager::ELayerID iLayer = AliGeomManager::kInvalidLayer;
+  UShort_t volid = AliGeomManager::LayerToVolUID(iLayer,iIndex);
+
+  TString MFT("MFT");
+  new (alobj[0]) AliAlignObjParams(MFT.Data(), volid, dx, dy, dz, dpsi, dtheta, dphi, kTRUE);
+
+  // save in CDB storage
+  if(!Storage.BeginsWith("local://") && !Storage.BeginsWith("alien://")) {
+    Error(macroname,"STORAGE variable set to %s is not valid. Exiting\n",Storage.Data());
+    return;
+  }
+  Info(macroname,"Saving alignment objects in CDB storage %s", Storage.Data());
+  AliCDBManager* cdb = AliCDBManager::Instance();
+  AliCDBStorage* storage = cdb->GetStorage(Storage.Data());
+  if(!storage){
+    Error(macroname,"Unable to open storage %s\n",Storage.Data());
+    return;
+  }
+  AliCDBMetaData* md = new AliCDBMetaData();
+  md->SetResponsible("Antonio Uras");
+  md->SetComment("Alignment objects for MFT zero-misalignment");
+  md->SetAliRootVersion(gROOT->GetVersion());
+  AliCDBId id("MFT/Align/Data",0,AliCDBRunRange::Infinity());
+  storage->Put(array,id,md);
+
+  array->Delete();
+
+}
+