macro to generate gain and ped files
authorbnandi <bnandi@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 10 Jul 2007 13:57:34 +0000 (13:57 +0000)
committerbnandi <bnandi@f7af4fe6-9843-0410-8265-dc069ae4e863>
Tue, 10 Jul 2007 13:57:34 +0000 (13:57 +0000)
PMD/CreateGainCDB.C [new file with mode: 0644]
PMD/CreatePedCDB.C [new file with mode: 0644]

diff --git a/PMD/CreateGainCDB.C b/PMD/CreateGainCDB.C
new file mode 100644 (file)
index 0000000..edf86a5
--- /dev/null
@@ -0,0 +1,54 @@
+void CreateGainCDB(TString type){
+
+       AliCDBManager* man = AliCDBManager::Instance();
+       
+       if(type == "IDEAL"){
+               man->SetDefaultStorage("local://CDB_IDEAL");
+       }else if (type == "DECALIB"){
+               man->SetDefaultStorage("local://CDB_DECALIB");
+       }else{
+               cout << "Not a valid type!" << endl;
+               break;
+       
+       }
+       
+       AliPMDCalibData *calibda = new AliPMDCalibData();
+       
+       TRandom random;
+       AliCDBId id("PMD/Calib/Gain",0,0);
+       
+       const Int_t kDet = 2;
+       const Int_t kMod = 24;
+       const Int_t kRow = 48;
+       const Int_t kCol = 96;
+
+       if(type == "IDEAL"){
+               // SET 1 (IDEAL)        
+               for(int a=0;a<kDet;a++) 
+                       for(int b=0;b<kMod;b++) 
+                               for(int c=0;c<kRow;c++) 
+                                       for(int d=0;d<kCol;d++) 
+                                               calibda->SetGainFact(a, b, c, d, random.Gaus(15,2));
+               id.SetRunRange(0,50);
+               
+               
+               
+       } else if (type == "DECALIB"){
+               // SET 2 (DECALIB)      
+               for(int a=0;a<kDet;a++) 
+                       for(int b=0;b<kMod;b++) 
+                               for(int c=0;c<kRow;c++) 
+                                       for(int d=0;d<kCol;d++) 
+                                               calibda->SetGainFact(a, b, c, d, TMath::Abs(random.Gaus(5,0.2)));
+               id.SetRunRange(0,25);
+       }
+
+
+       
+       
+       AliCDBMetaData md;
+       
+       man->Put(calibda, id, &md);
+
+
+}
diff --git a/PMD/CreatePedCDB.C b/PMD/CreatePedCDB.C
new file mode 100644 (file)
index 0000000..475aaf4
--- /dev/null
@@ -0,0 +1,39 @@
+void CreatePedCDB(){
+
+    AliCDBManager* man = AliCDBManager::Instance();
+       
+    man->SetDefaultStorage("local://CDB_PED");
+    
+    AliPMDPedestal *pedestal = new AliPMDPedestal();
+    
+    TRandom random;
+    AliCDBId id("PMD/Calib/Ped",0,0);
+
+    const Int_t kDet = 2;
+    const Int_t kMod = 24;
+    const Int_t kRow = 48;
+    const Int_t kCol = 96;
+    
+    Float_t mean = 100.0;
+    
+    for(int idet = 0; idet < kDet; idet++)
+    {
+       for(int imod = 0; imod < kMod; imod++) 
+       {
+           for(int irow = 0; irow < kRow; irow++)
+           {
+               for(int icol = 0; icol < kCol; icol++)
+               {
+                   Float_t rms = random.Gaus(15,2);
+                   pedestal->SetPedMeanRms(idet, imod, irow, icol,
+                                           mean, rms);
+                   id.SetRunRange(0,50);
+               }
+           }
+       }
+    }
+               
+    AliCDBMetaData md;
+    
+    man->Put(pedestal, id, &md);
+}