1 // **************************************************************************
2 // * Copyright(c) 1998-1999, ALICE Experiment at CERN, All rights reserved. *
4 // * Author: The ALICE Off-line Project. *
5 // * Contributors are mentioned in the code where appropriate. *
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 // **************************************************************************
16 #include "AliHMPIDCalib.h" //class header
17 #include "TTreePlayer.h"
20 //#include "AliHMPIDDigit.h"
22 ClassImp(AliHMPIDCalib)
25 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
26 AliHMPIDCalib::AliHMPIDCalib()
33 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
34 AliHMPIDCalib::~AliHMPIDCalib()
40 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
41 void AliHMPIDCalib::Init()
46 for(Int_t iDDL=0; iDDL< AliHMPIDCalib::kNDDL; iDDL++)
49 for(Int_t row = 1; row <=AliHMPIDCalib::kNRows; row++){
50 for(Int_t dil = 1; dil <=AliHMPIDCalib::kNDILOGICAdd; dil++){
51 for(Int_t pad = 0; pad < AliHMPIDCalib::kNPadAdd; pad++){
52 fsq[iDDL][row][dil][pad]=0;
53 fsq2[iDDL][row][dil][pad]=0;
59 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
60 void AliHMPIDCalib::FillPedestal(Int_t nDDL,Int_t row, Int_t dil,Int_t adr,Int_t q)
63 //Called from the HMPIDda and fills the pedestal tree
66 fsq[nDDL][row][dil][adr]+=q;
67 fsq2[nDDL][row][dil][adr]+=(q*q);
72 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
73 Bool_t AliHMPIDCalib::CalcPedestal(Int_t nDDL, Char_t* name, Int_t nEv)
76 //Calculate pedestal for each pad
78 Float_t mean=0,sigma=0;
79 Float_t qs2m=0,qsm2=0;
80 ofstream out; //to write the pedestal text files
82 if(faddl[nDDL]==kFALSE) return kFALSE; //if ddl is missing no ped file is created (and also for LDC selection). Check with Paolo what he checks for?!
84 for(Int_t row = 1; row <= AliHMPIDCalib::kNRows; row++){
85 for(Int_t dil = 1; dil <= AliHMPIDCalib::kNDILOGICAdd; dil++){
86 for(Int_t pad = 0; pad < AliHMPIDCalib::kNPadAdd; pad++){
88 mean = fsq[nDDL][row][dil][pad]/1.0/nEv;
90 qs2m = fsq2[nDDL][row][dil][pad]/1.0/nEv;
91 qsm2 = TMath::Power(fsq[nDDL][row][dil][pad]/1.0/nEv,2);
92 sigma= TMath::Sqrt(qs2m-qsm2);
94 inhard=((Int_t(mean))<<9)+Int_t(mean+3*sigma);
95 out << Form("%2i %2i %2i %5.2f %5.2f %x\n",row,dil,pad,mean,sigma,inhard);
99 out.close(); //write pedestal file
102 //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++