+//______________________________________________________________________
+TH1F* AliITSOnlineSDDInjectors::GetMeanDriftSpeedVsPadHisto() const{
+ // Builds histogram of average drift speed vs. pad number
+ TString hisnam;
+ hisnam.Form("hdrsp%02dc%02ds%d",fDDL,fCarlos,fSide);
+ TH1F* h=new TH1F(hisnam.Data(),"",kInjPads,-0.5,kInjPads-0.5);
+ if(fNEvents>0){
+ for(Int_t i=0;i<kInjPads;i++){
+ h->SetBinContent(i+1,GetMeanDriftSpeed(i));
+ Double_t rms=GetRMSDriftSpeed(i);
+ Double_t err=0.;
+ if(rms>0.) err=rms/TMath::Sqrt(fNEventsInPad[i]);
+ h->SetBinError(i+1,err);
+ }
+ }
+ return h;
+}
+//______________________________________________________________________
+Bool_t AliITSOnlineSDDInjectors::WriteToROOT(TFile *fil) const {
+ // Writes the output histograms into a root file
+ if(fil==0){
+ AliWarning("Invalid pointer to ROOT file");
+ return kFALSE;
+ }
+ TString hisnam;
+ fil->cd();
+ hisnam.Form("hdrsp%02dc%02ds%d",fDDL,fCarlos,fSide);
+ TH1F hdsp(hisnam.Data(),"",kInjPads,-0.5,kInjPads-0.5);
+ if(fNEvents==0){
+ AliWarning("Zero analyzed events");
+ return kFALSE;
+ }
+
+ for(Int_t i=0;i<kInjPads;i++){
+ hdsp.SetBinContent(i+1,GetMeanDriftSpeed(i));
+ Double_t rms=GetRMSDriftSpeed(i);
+ Double_t err=0.;
+ if(rms>0.) err=rms/TMath::Sqrt(fNEventsInPad[i]);
+ hdsp.SetBinError(i+1,err);
+ }
+ hdsp.Write();
+ return kTRUE;
+}
+//______________________________________________________________________
+void AliITSOnlineSDDInjectors::WriteInjectorStatusToASCII(){
+ // dump status of injectors encoded into UInt_t
+ // 5 bits (value 0-31) to store number of pads with given status
+ TString outfilnam;
+ outfilnam.Form("SDDinj_ddl%02dc%02d_sid%d.data",fDDL,fCarlos,fSide);
+ FILE* outf=fopen(outfilnam.Data(),"a");
+ Int_t n[8]={0,0,0,0,0,0,0,0};
+ for(Int_t jpad=fFirstPadForFit; jpad<=fLastPadForFit; jpad++){
+ Int_t statusPad=GetInjPadStatus(jpad);
+ ++n[statusPad];
+ }
+ UInt_t statusInj=0;
+ statusInj+=(n[7]&0x1F)<<25; // bits 25-29: n. of pads with status 7
+ statusInj+=(n[6]&0x1F)<<20; // bits 20-24: n. of pads with status 6
+ statusInj+=(n[5]&0x1F)<<15; // bits 15-19: n. of pads with status 5
+ statusInj+=(n[4]&0x1F)<<10; // bits 10-14: n. of pads with status 4
+ statusInj+=(n[3]&0x1F)<<5; // bits 5- 9: n. of pads with status 3
+ statusInj+=(n[2]&0x1F); // bits 0- 4: n. of pads with status 2
+
+ fprintf(outf,"-99 %u\n",statusInj); // -99 used in preprocessor to find line
+ // with injector status info
+ fclose(outf);
+
+}