]> git.uio.no Git - u/mrichter/AliRoot.git/blame - ITS/MakeITSPlaneEfficiencySPD.C
Decreased verbosity...
[u/mrichter/AliRoot.git] / ITS / MakeITSPlaneEfficiencySPD.C
CommitLineData
7167ae53 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
11void MakeITSPlaneEfficiencySPD(Int_t firstRun=0, Int_t lastRun=AliCDBRunRange::Infinity(),
12 Double_t eff=0.99, Int_t nTried=1000){
4a66240a 13
7167ae53 14 if(eff<0 || eff > 1) {
15 printf("Efficiency must be in the range [0,1]: nothing done");
16 }
4a66240a 17 if(!AliCDBManager::Instance()->IsDefaultStorageSet()) {
162637e4 18 AliCDBManager::Instance()->SetDefaultStorage("local://$ALICE_ROOT/OCDB");
4a66240a 19 }
20
21 AliCDBMetaData *md1= new AliCDBMetaData(); // metaData describing the object
22 md1->SetObjectClassName("AliITSPlaneEff");
23 md1->SetResponsible("Giuseppe Bruno");
24 md1->SetBeamPeriod(0);
7167ae53 25 md1->SetAliRootVersion("head 16/02/08"); //root version
4a66240a 26
27 AliCDBId idplaneeffSPD("ITS/PlaneEff/PlaneEffSPD",firstRun, lastRun);
28
29 AliITSPlaneEffSPD* planeeffSPD = new AliITSPlaneEffSPD();
7167ae53 30 TRandom3 *gran = new TRandom3();
4a66240a 31
32// planeeffSPD->SetOwner(kFALSE);
33
7167ae53 34// Int_t nTried=1000;
35 Double_t limit=nTried;
36 limit*=(1-eff);
37 printf("limit = %f",limit);
4a66240a 38 // loop over SPD chip
39 Bool_t BFound=kFALSE;
7167ae53 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++){
4a66240a 43 // suppose to have 1000 tracks in each chip and an average efficiency of 99%
7167ae53 44 for(Int_t j=0; j<nTried; j++) {
4a66240a 45 BFound=kFALSE;
7167ae53 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);
4a66240a 50 }
7167ae53 51 //}}
52 }
4a66240a 53 if(AliCDBManager::Instance()->GetDefaultStorage()->Put(planeeffSPD, idplaneeffSPD, md1))
7167ae53 54 printf("Local CDB file with random SPD plane efficiencies written \n");
55 delete gran;
56 delete planeeffSPD;
57 delete md1;
58}