]>
Commit | Line | Data |
---|---|---|
21f61e25 | 1 | // ************************************************************************** |
2 | // * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. * | |
3 | // * * | |
4 | // * Author: The ALICE Off-line Project. * | |
5 | // * Contributors are mentioned in the code where appropriate. * | |
6 | // * * | |
7 | // * Permission to use, copy, modify and distribute this software and its * | |
8 | // * documentation strictly for non-commercial purposes is hereby granted * | |
9 | // * without fee, provided that the above copyright notice appears in all * | |
10 | // * copies and that both the copyright notice and this permission notice * | |
11 | // * appear in the supporting documentation. The authors make no claims * | |
12 | // * about the suitability of this software for any purpose. It is * | |
13 | // * provided "as is" without express or implied warranty. * | |
14 | // ************************************************************************** | |
15 | ||
16 | #include "AliHMPIDCalib.h" //class header | |
17 | #include "TTreePlayer.h" | |
18 | #include <fstream> | |
19 | #include <TTree.h> | |
20 | //#include "AliHMPIDDigit.h" | |
21 | ||
22 | ClassImp(AliHMPIDCalib) | |
23 | ||
24 | ||
25 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
26 | AliHMPIDCalib::AliHMPIDCalib(): | |
27 | fPedTree(0x0), | |
28 | fa(-1), | |
29 | fd(-1), | |
30 | fr(-1), | |
31 | fq(-1), | |
32 | fPedHisto(0) | |
33 | { | |
34 | Init(); | |
35 | } | |
36 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
37 | AliHMPIDCalib::~AliHMPIDCalib() | |
38 | { | |
39 | //destructor | |
40 | } | |
41 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
42 | void AliHMPIDCalib::Init() | |
43 | { | |
5a7dbe51 | 44 | //.. |
21f61e25 | 45 | for(Int_t iddl=0;iddl<11;iddl++) faddl[iddl]=kFALSE; |
46 | // | |
47 | // Called to initialize the TTree in which the raw data words will be stored | |
48 | // | |
49 | fPedHisto=new TH1F("fPedHisto","Temporary pedestal",4096,-0.5,4095.5); //init pedestal histo | |
50 | fPedTree = new TTree("PedTree","HMPID Pedestal Tree"); //init pedestal tree | |
51 | fPedTree->Branch("diladd",&fa,"diladd/I"); | |
52 | fPedTree->Branch("dilnum",&fd,"dilnum/I"); | |
53 | fPedTree->Branch("dilrow",&fr,"dilrow/I"); | |
54 | fPedTree->Branch("qdc" ,&fq,"qdc/F "); | |
55 | } | |
56 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
57 | void AliHMPIDCalib::FillPedestal(Int_t ddl,Int_t row, Int_t dil,Int_t adr,Int_t q) | |
58 | { | |
59 | // | |
60 | //Called from the HMPIDda and fills the pedestal tree | |
61 | // | |
62 | fq=q; | |
63 | fr=row; | |
64 | fd=dil; | |
65 | fa=adr; | |
66 | faddl[ddl]=kTRUE; | |
67 | if(fq>-1) fPedTree->Fill(); | |
68 | }//FillPedestal() | |
69 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ | |
70 | Bool_t AliHMPIDCalib::CalcPedestal(Int_t ddl, Char_t* name) | |
71 | { | |
72 | // | |
73 | //Calculate pedestal for each pad | |
74 | // | |
75 | ||
76 | ofstream out; //to write the pedestal text files | |
77 | Double_t mean,sigma; | |
78 | Int_t inhard; | |
79 | if(faddl[ddl]==kFALSE) return kFALSE; //if ddl is missing no ped file is created (and also for LDC selection). Check with Paolo what he checks for?! | |
80 | out.open(name); | |
81 | for(Int_t row=1; row < 25; row++){ | |
82 | for(Int_t dil=1; dil < 11; dil++){ | |
83 | for(Int_t adr=0; adr < 48; adr++){ | |
84 | fPedHisto->Reset(); | |
85 | fPedTree->Draw("fq>>fPedHisto",Form("fr==%d&&fd==%d&&fa==%d",row,dil,adr)); | |
86 | mean=fPedHisto->GetMean(); | |
87 | sigma=fPedHisto->GetRMS(); | |
88 | inhard=((Int_t(mean))<<9)+Int_t(mean+3*sigma); | |
89 | out << Form("%2i %2i %2i %5.2f %5.2f %x\n",row,dil,adr,mean,sigma,inhard); | |
90 | }//adr | |
91 | }//dil | |
92 | }//row | |
93 | out.close(); //write pedestal file | |
94 | return kTRUE; | |
95 | }//CaclPedestal() | |
96 | //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ |