1 /**************************************************************************
2 * Copyright(c) 2007-2009, 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 "AliITSOnlineSDDInjectors.h"
20 #include <TGraphErrors.h>
25 ///////////////////////////////////////////////////////////////////
27 // Implementation of the class used for SDD injector analysis //
28 // Origin: F.Prino, Torino, prino@to.infn.it //
30 ///////////////////////////////////////////////////////////////////
32 ClassImp(AliITSOnlineSDDInjectors)
34 const Float_t AliITSOnlineSDDInjectors::fgkSaturation = 1008.;
35 const Float_t AliITSOnlineSDDInjectors::fgkDefaultLThreshold = 5.;
36 const Float_t AliITSOnlineSDDInjectors::fgkDefaultHThreshold = 25.;
37 const Float_t AliITSOnlineSDDInjectors::fgkDefaultMinSpeed = 5.5;
38 const Float_t AliITSOnlineSDDInjectors::fgkDefaultMaxSpeed = 9.0;
39 const Float_t AliITSOnlineSDDInjectors::fgkDefaultMaxErr = 1.5;
40 const Int_t AliITSOnlineSDDInjectors::fgkDefaultPolDegree = 3;
41 const Float_t AliITSOnlineSDDInjectors::fgkDefaultTimeStep = 50.;
42 const UShort_t AliITSOnlineSDDInjectors::fgkDefaultTbMin[kInjLines] = {10,50,100};
43 const UShort_t AliITSOnlineSDDInjectors::fgkDefaultTbMax[kInjLines] = {20,70,120};
45 //______________________________________________________________________
46 AliITSOnlineSDDInjectors::AliITSOnlineSDDInjectors():AliITSOnlineSDD(),fHisto(),fTbZero(0.),fRMSTbZero(0.),fNEvents(0),fParam(),fPolDegree(0),fActualPolDegree(0),fMinDriftSpeed(0.),fMaxDriftSpeed(0.),fMaxDriftSpeedErr(0.),fLowThreshold(0.),fHighThreshold(0.),fFirstPadForFit(0),fLastPadForFit(0),fPadStatusCutForFit(0),fTimeStep(0.),fUseTimeZeroSignal(kFALSE)
48 // default constructor
51 SetTimeStep(fgkDefaultTimeStep);
53 //______________________________________________________________________
54 AliITSOnlineSDDInjectors::AliITSOnlineSDDInjectors(Int_t nddl, Int_t ncarlos, Int_t sid):AliITSOnlineSDD(nddl,ncarlos,sid),fHisto(),fTbZero(0.),fRMSTbZero(0.),fNEvents(0),fParam(),fPolDegree(0),fActualPolDegree(0),fMinDriftSpeed(0.),fMaxDriftSpeed(0.),fMaxDriftSpeedErr(0.),fLowThreshold(0.),fHighThreshold(0.),fFirstPadForFit(0),fLastPadForFit(0),fPadStatusCutForFit(0),fTimeStep(0.),fUseTimeZeroSignal(kFALSE)
56 // standard constructor
59 SetTimeStep(fgkDefaultTimeStep);
61 //______________________________________________________________________
62 AliITSOnlineSDDInjectors::~AliITSOnlineSDDInjectors(){
64 // fHisto should not be deleted here because it points to an histo created
65 // by the external code which calls the method AnalyzeEvent
66 // if(fHisto) delete fHisto;
67 if(fParam) delete [] fParam;
69 //______________________________________________________________________
70 void AliITSOnlineSDDInjectors::SetDefaults(){
71 for(Int_t i=0;i<kInjLines;i++) {
72 SetInjLineRange(i,fgkDefaultTbMin[i],fgkDefaultTbMax[i]);
75 SetThresholds(fgkDefaultLThreshold,fgkDefaultHThreshold);
76 SetPolDegree(fgkDefaultPolDegree);
77 SetMinDriftSpeed(fgkDefaultMinSpeed);
78 SetMaxDriftSpeed(fgkDefaultMaxSpeed);
79 SetMaxDriftSpeedErr(fgkDefaultMaxErr);
80 SetFitLimits(1,kInjPads-2); // exclude first and last pad
81 SetPadStatusCutForFit();
83 //______________________________________________________________________
84 void AliITSOnlineSDDInjectors::SetPositions(){
86 Double_t xLinFromCenterUm[kInjLines]={31860.,17460.,660.};
87 Double_t xAnodeFromCenterUm=35085;
88 for(Int_t i=0;i<kInjLines;i++){
89 fPosition[i]=xAnodeFromCenterUm-xLinFromCenterUm[i];
90 fPosition[i]/=10000.; // from microns to cm
93 //______________________________________________________________________
94 void AliITSOnlineSDDInjectors::Reset(){
96 for(Int_t i=0;i<kInjPads;i++){
100 for(Int_t i=0;i<kInjPads;i++){
101 for(Int_t j=0;j<kInjLines;j++){
104 fRMSCentroid[i][j]=0.;
108 //______________________________________________________________________
109 void AliITSOnlineSDDInjectors::AnalyzeEvent(TH2F* his){
112 FitDriftSpeedVsAnode();
114 //______________________________________________________________________
115 void AliITSOnlineSDDInjectors::AddEvent(TH2F* his){
116 // Add the drift speed from current event to the average value
118 for(Int_t i=0;i<kInjPads;i++){
119 fSumDriftSpeed[i]=0.;
120 fSumSqDriftSpeed[i]=0.;
122 fSumPadStatusCut[i]=0;
131 for(Int_t j=0;j<kInjPads;j++){
133 Int_t padStatus=GetInjPadStatus(j);
134 fSumPadStatus[j]+=padStatus;
135 if(padStatus>fPadStatusCutForFit){
136 fSumDriftSpeed[j]+=fDriftSpeed[j];
137 fSumSqDriftSpeed[j]+=fDriftSpeed[j]*fDriftSpeed[j];
138 fSumPadStatusCut[j]+=padStatus;
144 //______________________________________________________________________
145 Double_t AliITSOnlineSDDInjectors::GetRMSDriftSpeed(Int_t ipad) const {
147 if(fNEventsInPad[ipad]<=1) return 0.;
148 Double_t mean=fSumDriftSpeed[ipad]/(Double_t)fNEventsInPad[ipad];
149 Double_t diff=fSumSqDriftSpeed[ipad]/(Double_t)fNEventsInPad[ipad]-mean*mean;
151 return TMath::Sqrt(diff);
154 //______________________________________________________________________
155 void AliITSOnlineSDDInjectors::FitMeanDriftSpeedVsAnode(){
157 if(fNEvents==0) return;
158 for(Int_t i=0;i<kInjPads;i++){
159 fDriftSpeed[i]=GetMeanDriftSpeed(i);
160 Int_t padStatusCut=(Int_t)(GetMeanPadStatusCut(i)+0.5);
161 for(Int_t ilin=0; ilin<kInjLines ; ilin++) fGoodInj[i][ilin]=(padStatusCut&1<<ilin)>>ilin;
162 if(fNEventsInPad[i]>1){
163 Double_t rms=GetRMSDriftSpeed(i);
164 if(rms>0.) fDriftSpeedErr[i]=rms/TMath::Sqrt(fNEventsInPad[i]);
166 for(Int_t ilin=0; ilin<kInjLines ; ilin++) fGoodInj[i][ilin]=0;
169 FitDriftSpeedVsAnode();
170 for(Int_t i=0;i<kInjPads;i++){
171 Int_t padStatus=(Int_t)(GetMeanPadStatusCut(i)+0.5);
172 for(Int_t ilin=0; ilin<kInjLines ; ilin++) fGoodInj[i][ilin]=(padStatus&1<<ilin)>>ilin;
175 //______________________________________________________________________
176 TGraphErrors* AliITSOnlineSDDInjectors::GetTimeVsDistGraph(Int_t jpad) const{
178 const Int_t kPts=kInjLines+1;
179 Float_t x[kPts],y[kPts],ex[kPts],ey[kPts];
184 for(Int_t i=0;i<kInjLines;i++){
187 y[i+1]=fCentroid[jpad][i];
188 ey[i+1]=fRMSCentroid[jpad][i];
190 TGraphErrors *g=new TGraphErrors(4,x,y,ex,ey);
194 //______________________________________________________________________
195 TGraphErrors* AliITSOnlineSDDInjectors::GetDriftSpeedGraph() const{
198 TGraphErrors *g=new TGraphErrors(0);
199 for(Int_t i=0;i<kInjPads;i++){
200 if(fDriftSpeed[i]>0){
201 g->SetPoint(ipt,GetAnodeNumber(i),fDriftSpeed[i]);
202 g->SetPointError(ipt,0,fDriftSpeedErr[i]);
208 //______________________________________________________________________
209 TGraphErrors* AliITSOnlineSDDInjectors::GetSelectedDriftSpeedGraph(Int_t minAcceptStatus) const{
210 // TGraphErrors with only pads with status of injector >= minAcceptStatus
212 TGraphErrors *g=new TGraphErrors(0);
213 for(Int_t i=0;i<kInjPads;i++){
214 Int_t padStatus = GetInjPadStatus(i);
215 if(fDriftSpeed[i]>0 && padStatus >= minAcceptStatus ){
216 g->SetPoint(ipt,GetAnodeNumber(i),fDriftSpeed[i]);
217 g->SetPointError(ipt,0,fDriftSpeedErr[i]);
223 //______________________________________________________________________
224 void AliITSOnlineSDDInjectors::CalcTimeBinZero(){
225 // Get time zero from trigger signal
226 Double_t tzero=0.,intCont=0.,rmsPeak=0.;
227 Bool_t isTbUsed[256];
229 for(Int_t i=0;i<256;i++) isTbUsed[i]=0;
230 for(Int_t ian=0;ian<fgkNAnodes;ian++){
231 for(Int_t itb=1;itb<fTbMin[0];itb++){
232 Double_t cont=fHisto->GetBinContent(itb,ian+1);
233 Double_t contm1=fHisto->GetBinContent(itb+1,ian+1);
234 Double_t contp1=fHisto->GetBinContent(itb-1,ian+1);
235 if(cont>fLowThreshold){
236 if(contm1>fHighThreshold || cont>fHighThreshold || contp1>fHighThreshold){
237 tzero+=cont*float(itb);
238 rmsPeak+=cont*float(itb)*float(itb);
249 fTbZero=tzero/intCont;
250 fRMSTbZero=TMath::Sqrt(rmsPeak/intCont-fTbZero*fTbZero);
252 if(nTbUsed==1) fRMSTbZero=0.5;
255 //______________________________________________________________________
256 void AliITSOnlineSDDInjectors::FitDriftSpeedVsAnode(){
257 // fits the anode dependence of drift speed
259 Float_t rangeForMax[2]={78.,178.};
261 fActualPolDegree=fPolDegree;
263 Double_t deltasq=fParam[2]*fParam[2]-3*fParam[1]*fParam[3];
264 Double_t zero1=-999.;
265 Double_t zero2=-999.;
266 if(deltasq>=0. && TMath::Abs(fParam[3])>0.){
267 Double_t delta=TMath::Sqrt(deltasq);
268 zero1=(-fParam[2]+delta)/3./fParam[3];
269 zero2=(-fParam[2]-delta)/3./fParam[3];
271 Bool_t twoZeroes=kFALSE;
272 Bool_t oneZero=kFALSE;
273 if(zero1>0. && zero1<256. && zero2>0. && zero2<256.) twoZeroes=kTRUE;
274 if(zero1>rangeForMax[0] && zero1<rangeForMax[1]) oneZero=kTRUE;
275 if(zero2>rangeForMax[0] && zero2<rangeForMax[1]) oneZero=kTRUE;
276 if(!oneZero || twoZeroes){
279 if(fParam[2]<0.) xmax=-fParam[1]/2./fParam[2];
280 if(xmax>rangeForMax[0] && xmax<rangeForMax[1]){
283 Double_t averSpeed=0.;
286 for(Int_t jpad=fFirstPadForFit; jpad<=fLastPadForFit; jpad++){
287 if(fDriftSpeed[jpad]>0 && GetInjPadStatus(jpad)>fPadStatusCutForFit){
288 Double_t wei=1./fDriftSpeedErr[jpad]/fDriftSpeedErr[jpad];
289 averSpeed+=wei*fDriftSpeed[jpad];
294 if(sumWei>0.) averSpeed/=sumWei;
295 if(nUsedPts<fPolDegree+1) averSpeed=0;
297 for(Int_t i=1; i < fPolDegree+1; i++) fParam[i]=0.;
303 //______________________________________________________________________
304 void AliITSOnlineSDDInjectors::PolyFit(Int_t degree){
305 // fits the anode dependence of drift speed with a polynomial function
306 const Int_t kNn=degree+1;
307 const Int_t kDimens=fPolDegree+1;
309 Double_t **mat = new Double_t*[kNn];
310 for(Int_t i=0; i < kNn; i++) mat[i] = new Double_t[kNn];
311 Double_t *vect = new Double_t[kNn];
313 for(Int_t k1=0;k1<kNn;k1++){
315 for(Int_t k2=0;k2<kNn;k2++){
320 for(Int_t k1=0;k1<kNn;k1++){
321 for(Int_t jpad=fFirstPadForFit; jpad<=fLastPadForFit; jpad++){
322 Double_t x=(Double_t)GetAnodeNumber(jpad);
323 if(fDriftSpeed[jpad]>0 && GetInjPadStatus(jpad)>fPadStatusCutForFit){
324 vect[k1]+=fDriftSpeed[jpad]*TMath::Power(x,k1)/TMath::Power(fDriftSpeedErr[jpad],2);
326 for(Int_t k2=0;k2<kNn;k2++){
327 mat[k1][k2]+=TMath::Power(x,k1+k2)/TMath::Power(fDriftSpeedErr[jpad],2);
332 if(npts<fPolDegree+1){
333 if(fParam) delete [] fParam;
334 fParam=new Double_t[kDimens];
335 for(Int_t i=0; i<kDimens;i++)fParam[i]=0;
337 Int_t *iPivot = new Int_t[kNn];
338 Int_t *indxR = new Int_t[kNn];
339 Int_t *indxC = new Int_t[kNn];
340 for(Int_t i=0;i<kNn;i++) iPivot[i]=0;
341 Int_t iCol=-1,iRow=-1;
342 for(Int_t i=0;i<kNn;i++){
344 for(Int_t j=0;j<kNn;j++){
346 for(Int_t k=0;k<kNn;k++){
348 if(TMath::Abs(mat[j][k])>=big){
349 big=TMath::Abs(mat[j][k]);
360 for(Int_t l=0;l<kNn;l++){
362 mat[iRow][l]=mat[iCol][l];
366 vect[iRow]=vect[iCol];
371 if(mat[iCol][iCol]==0) break;
372 Double_t pivinv=1./mat[iCol][iCol];
374 for(Int_t l=0;l<kNn;l++) mat[iCol][l]*=pivinv;
376 for(Int_t m=0;m<kNn;m++){
380 for(Int_t n=0;n<kNn;n++) mat[m][n]-=mat[iCol][n]*aux;
381 vect[m]-=vect[iCol]*aux;
390 if(fParam) delete [] fParam;
391 fParam=new Double_t[kDimens];
392 for(Int_t i=0; i<kNn;i++)fParam[i]=vect[i];
393 if(degree<fPolDegree) for(Int_t i=kNn; i<kDimens;i++)fParam[i]=0.;
396 for(Int_t i=0; i < kNn; i++) delete [] mat[i];
400 //______________________________________________________________________
401 void AliITSOnlineSDDInjectors::CalcDriftSpeed(Int_t jpad){
403 Double_t sumY=0,sumX=0,sumXX=0,sumYY=0.,sumXY=0,sumWEI=0.;
405 Double_t y[kInjLines],ey[kInjLines];
406 Double_t tzero=0,erry=0;
407 for(Int_t i=0;i<kInjLines;i++){
408 y[i]=fCentroid[jpad][i];
409 ey[i]=fRMSCentroid[jpad][i];
411 for(Int_t i=0;i<kInjLines;i++){
412 if(!fUseLine[i]) continue;
413 if(fGoodInj[jpad][i] && ey[i]!=0){
414 sumY+=y[i]/ey[i]/ey[i];
415 sumX+=fPosition[i]/ey[i]/ey[i];
416 sumXX+=fPosition[i]*fPosition[i]/ey[i]/ey[i];
417 sumYY+=y[i]*y[i]/ey[i]/ey[i];
418 sumXY+=fPosition[i]*y[i]/ey[i]/ey[i];
419 sumWEI+=1./ey[i]/ey[i];
420 tzero=fTbZero/ey[i]/ey[i];
421 erry=ey[i]/ey[i]/ey[i];
425 Double_t slope=0.,eslope=0.;
427 slope=(sumY-tzero)/sumX;
431 if(fUseTimeZeroSignal){
432 sumY+=fTbZero/fRMSTbZero/fRMSTbZero;
435 sumYY+=fTbZero*fTbZero/fRMSTbZero/fRMSTbZero;
437 sumWEI+=1./fRMSTbZero/fRMSTbZero;
439 slope=(sumWEI*sumXY-sumY*sumX)/(sumWEI*sumXX-sumX*sumX);
440 eslope=TMath::Sqrt(sumWEI/(sumWEI*sumXX-sumX*sumX));
443 Double_t vel=0,evel=0;
444 if(slope!=0. && fTimeStep>0.){
445 vel=1./slope*10000./fTimeStep;// micron/ns
446 evel=eslope/slope/slope*10000./fTimeStep;// micron/ns
448 if(vel>fMaxDriftSpeed||vel<fMinDriftSpeed || evel>fMaxDriftSpeedErr){
452 fDriftSpeed[jpad]=vel;
453 fDriftSpeedErr[jpad]=evel;
455 //______________________________________________________________________
456 Int_t AliITSOnlineSDDInjectors::GetAnodeNumber(Int_t iInjPad) const{
457 // Injectors location along anodes:
458 // Side left (UP) - channel 0: injectors on anodes 0,7,15,...,247,255
459 // Side right (DOWN) - channel 1: injectors on anodes 0,8,16,...,248,255
461 if(iInjPad>=kInjPads) return ian;
462 if(fSide==1){ // right side
464 if(iInjPad==32) ian--;
467 if(iInjPad==0) ian=0;
471 //______________________________________________________________________
472 Int_t AliITSOnlineSDDInjectors::GetInjPadNumberFromAnode(Int_t nAnode) const{
475 if(fSide==1){ // right side
476 if(nAnode%8==0) iInjPad=nAnode/8;
477 if(nAnode==255) iInjPad=32;
479 if(nAnode%8==7) iInjPad=1+nAnode/8;
480 if(nAnode==0) iInjPad=0;
482 if(nAnode>=256) iInjPad=-1;
485 //______________________________________________________________________
486 Int_t AliITSOnlineSDDInjectors::GetInjPadStatus(Int_t jpad) const{
487 // returns an integer value with status of injector lines for given pad/anode
488 // status=7 --> 111 all injector are good
489 // status=6 --> 110 1st line (close to anodes) is bad, other two are good
491 // status=1 --> 001 only 1st line (close to anodes) good
492 // status=0 --> 000 all lines are bad
494 if(jpad>=0 && jpad<kInjPads){
495 for(Int_t jlin=0;jlin<kInjLines;jlin++) istatus+=fGoodInj[jpad][jlin]<<jlin;
499 //______________________________________________________________________
500 void AliITSOnlineSDDInjectors::FindGoodInjectors(){
502 for(Int_t jpad=0;jpad<kInjPads;jpad++){
503 Int_t ian=GetAnodeNumber(jpad);
504 for(Int_t jlin=0;jlin<kInjLines;jlin++){
505 for(Int_t jjj=fTbMin[jlin];jjj<fTbMax[jlin];jjj++){
506 Float_t c1=fHisto->GetBinContent(jjj,ian+1);
507 Float_t c2=fHisto->GetBinContent(jjj+1,ian+1);
508 // Float_t c3=fHisto->GetBinContent(jjj+2,ian+1);
509 if(c1>fLowThreshold && c2>fLowThreshold){
510 if(c1>fHighThreshold || c2>fHighThreshold){
511 fGoodInj[jpad][jlin]=1;
519 //______________________________________________________________________
520 void AliITSOnlineSDDInjectors::FindCentroids(){
522 for(Int_t jpad=0;jpad<kInjPads;jpad++){
523 Int_t ian=GetAnodeNumber(jpad);
524 for(Int_t jlin=0;jlin<kInjLines;jlin++){
525 if(!fGoodInj[jpad][jlin]) continue;
528 for(Int_t jjj=fTbMin[jlin];jjj<fTbMax[jlin];jjj++){
529 Double_t cont=fHisto->GetBinContent(jjj,ian+1);
538 Double_t cont=fHisto->GetBinContent(jjj,ian+1);
539 if(cont<fLowThreshold) break;
540 if(cont<fgkSaturation){
541 fCentroid[jpad][jlin]+=cont*(Double_t)jjj;
542 fRMSCentroid[jpad][jlin]+=cont*(Double_t)jjj*(Double_t)jjj;
549 Double_t cont=fHisto->GetBinContent(jjj,ian+1);
550 if(cont<fLowThreshold) break;
551 if(cont<fgkSaturation){
552 fCentroid[jpad][jlin]+=cont*float(jjj);
553 fRMSCentroid[jpad][jlin]+=cont*(Double_t)jjj*(Double_t)jjj;
559 fCentroid[jpad][jlin]/=intCont;
560 fRMSCentroid[jpad][jlin]=TMath::Sqrt(fRMSCentroid[jpad][jlin]/intCont-fCentroid[jpad][jlin]*fCentroid[jpad][jlin])/TMath::Sqrt(intCont);
563 fCentroid[jpad][jlin]=0.;
564 fRMSCentroid[jpad][jlin]=0.;
565 fGoodInj[jpad][jlin]=0;
567 if(fRMSCentroid[jpad][jlin]==0) fGoodInj[jpad][jlin]=0;
571 //______________________________________________________________________
572 void AliITSOnlineSDDInjectors::PrintInjectorStatus(){
574 for(Int_t jpad=0;jpad<kInjPads;jpad++){
575 printf("Line%d-Anode%d: %d %d %d\n",jpad,GetAnodeNumber(jpad),fGoodInj[jpad][0],fGoodInj[jpad][1],fGoodInj[jpad][2]);
578 //______________________________________________________________________
579 void AliITSOnlineSDDInjectors::PrintCentroids(){
581 for(Int_t jpad=0;jpad<kInjPads;jpad++){
582 printf("Line%d-Anode%d: %f+-%f %f+-%f %f+-%f\n",jpad,GetAnodeNumber(jpad),fCentroid[jpad][0],fRMSCentroid[jpad][0],fCentroid[jpad][1],fRMSCentroid[jpad][1],fCentroid[jpad][2],fRMSCentroid[jpad][2]);
585 //______________________________________________________________________
586 void AliITSOnlineSDDInjectors::WriteToASCII(Int_t evNumb, UInt_t timeStamp, Int_t optAppend){
588 Char_t outfilnam[100];
589 sprintf(outfilnam,"SDDinj_ddl%02dc%02d_sid%d.data",fDDL,fCarlos,fSide);
592 outf=fopen(outfilnam,"w");
593 fprintf(outf,"%d\n",fActualPolDegree);
595 else outf=fopen(outfilnam,"a");
596 fprintf(outf,"%d %d ",evNumb,timeStamp);
597 for(Int_t ic=0;ic<fPolDegree+1;ic++){
598 fprintf(outf,"%G ",fParam[ic]);
603 //______________________________________________________________________
604 TH1F* AliITSOnlineSDDInjectors::GetMeanDriftSpeedVsPadHisto() const{
606 sprintf(hisnam,"hdrsp%02dc%02ds%d",fDDL,fCarlos,fSide);
607 TH1F* h=new TH1F(hisnam,"",kInjPads,-0.5,kInjPads-0.5);
609 for(Int_t i=0;i<kInjPads;i++){
610 h->SetBinContent(i+1,GetMeanDriftSpeed(i));
611 Double_t rms=GetRMSDriftSpeed(i);
613 if(rms>0.) err=rms/TMath::Sqrt(fNEventsInPad[i]);
614 h->SetBinError(i+1,err);
619 //______________________________________________________________________
620 Bool_t AliITSOnlineSDDInjectors::WriteToROOT(TFile *fil) const {
623 AliWarning("Invalid pointer to ROOT file");
628 sprintf(hisnam,"hdrsp%02dc%02ds%d",fDDL,fCarlos,fSide);
629 TH1F hdsp(hisnam,"",kInjPads,-0.5,kInjPads-0.5);
631 AliWarning("Zero analyzed events");
635 for(Int_t i=0;i<kInjPads;i++){
636 hdsp.SetBinContent(i+1,GetMeanDriftSpeed(i));
637 Double_t rms=GetRMSDriftSpeed(i);
639 if(rms>0.) err=rms/TMath::Sqrt(fNEventsInPad[i]);
640 hdsp.SetBinError(i+1,err);
645 //______________________________________________________________________
646 void AliITSOnlineSDDInjectors::WriteInjectorStatusToASCII(){
647 // dump status of injectors encoded into UInt_t
648 // 5 bits (value 0-31) to store number of pads with given status
649 Char_t outfilnam[100];
650 sprintf(outfilnam,"SDDinj_ddl%02dc%02d_sid%d.data",fDDL,fCarlos,fSide);
651 FILE* outf=fopen(outfilnam,"a");
652 Int_t n[8]={0,0,0,0,0,0,0,0};
653 for(Int_t jpad=fFirstPadForFit; jpad<=fLastPadForFit; jpad++){
654 Int_t statusPad=GetInjPadStatus(jpad);
658 statusInj+=(n[7]&0x1F)<<25; // bits 25-29: n. of pads with status 7
659 statusInj+=(n[6]&0x1F)<<20; // bits 20-24: n. of pads with status 6
660 statusInj+=(n[5]&0x1F)<<15; // bits 15-19: n. of pads with status 5
661 statusInj+=(n[4]&0x1F)<<10; // bits 10-14: n. of pads with status 4
662 statusInj+=(n[3]&0x1F)<<5; // bits 5- 9: n. of pads with status 3
663 statusInj+=(n[2]&0x1F); // bits 0- 4: n. of pads with status 2
665 fprintf(outf,"-99 %u\n",statusInj); // -99 used in preprocessor to find line
666 // with injector status info