]> git.uio.no Git - u/mrichter/AliRoot.git/blob - ITS/MakeITSPlaneEfficiencySPD.C
Updated geometry
[u/mrichter/AliRoot.git] / ITS / MakeITSPlaneEfficiencySPD.C
1 #if !defined(__CINT__) || defined(__MAKECINT__)
2 #include <TRandom3.h>
3 #include "AliCDBManager.h"
4 #include "AliCDBMetaData.h"
5 #include "AliCDBStorage.h"
6 #include "AliCDBRunRange.h"
7 #include "AliCDBId.h"
8 #include "AliITSPlaneEffSPD.h"
9 #endif
10
11 void MakeITSPlaneEfficiencySPD(Int_t firstRun=0, Int_t lastRun=AliCDBRunRange::Infinity(), 
12  Double_t eff=0.99, Int_t nTried=1000){
13   
14   if(eff<0 || eff > 1) {
15    printf("Efficiency must be in the range [0,1]: nothing done");
16   }
17   if(!AliCDBManager::Instance()->IsDefaultStorageSet()) {
18     AliCDBManager::Instance()->SetDefaultStorage("local://$ALICE_ROOT");
19   }
20   
21   AliCDBMetaData *md1= new AliCDBMetaData(); // metaData describing the object
22   md1->SetObjectClassName("AliITSPlaneEff");
23   md1->SetResponsible("Giuseppe Bruno");
24   md1->SetBeamPeriod(0);
25   md1->SetAliRootVersion("head 16/02/08"); //root version
26
27   AliCDBId idplaneeffSPD("ITS/PlaneEff/PlaneEffSPD",firstRun, lastRun);
28   
29   AliITSPlaneEffSPD* planeeffSPD = new AliITSPlaneEffSPD();
30   TRandom3 *gran = new TRandom3();
31
32 //  planeeffSPD->SetOwner(kFALSE);
33   
34 //  Int_t nTried=1000;
35   Double_t limit=nTried;
36   limit*=(1-eff);
37   printf("limit = %f",limit);
38   // loop over SPD chip
39   Bool_t BFound=kFALSE;
40   for(UInt_t key=0;key<planeeffSPD->Nblock();key++){
41   //for(UInt_t mod=0;mod<240;mod++){
42   //for(UInt_t chip=0;chip<5;chip++){
43   // suppose to have 1000 tracks in each chip and an average efficiency of 99%
44     for(Int_t j=0; j<nTried; j++) {
45       BFound=kFALSE;
46       //if (gRandom->Uniform(0,1000)>10) BFound=kTRUE;
47       if (nTried*gran->Uniform()>limit) BFound=kTRUE;
48       //planeeffSPD->UpDatePlaneEff(BFound,mod,chip);
49       planeeffSPD->UpDatePlaneEff(BFound,key);
50     }
51   //}}
52   }
53   if(AliCDBManager::Instance()->GetDefaultStorage()->Put(planeeffSPD, idplaneeffSPD, md1))
54   printf("Local CDB file with random SPD plane efficiencies written \n");
55  delete gran;
56  delete planeeffSPD;
57  delete md1;
58 }