+ //
+ // Detector specific actions at end of cycle
+ //
+ //TStopwatch watch;
+ //watch.Start();
+ ResetEventTrigClasses();
+ //
+ //AliDebug(AliQAv1::GetQADebugLevel(), Form("EndOfCycle", "Fitting RecPoints %d", task))
+ TH1F *hist = new TH1F("fitHist", "", 200, -0.5, 199.5);
+ //
+ // RS Add a loop over species
+ for (Int_t specie = 0 ; specie < AliRecoParam::kNSpecies ; specie++) {
+ if ( !AliQAv1::Instance()->IsEventSpecieSet(specie) ) continue ;
+ SetEventSpecie(specie);
+ //
+ for (int itc=-1;itc<GetNTrigClasses();itc++) { // RS: loop over eventual clones per trigger class
+ //
+ if (task == AliQAv1::kRECPOINTS) {
+
+ //list->Print();
+ TObjArray& arrRP = *GetRecPointsDataOfTrigClass(itc); // RS Histos matching to trigger class
+ // Rec points full chambers
+ TH2* h2tmp = (TH2*) arrRP[1];
+ if (h2tmp) {
+ for (Int_t i=0; i<540; i++) {
+ hist->Reset();
+ for(Int_t b=1; b<hist->GetXaxis()->GetNbins()-1; b++) {
+ Double_t xvalue = hist->GetBinCenter(b);
+ Int_t bin = h2tmp->FindBin(i,xvalue);
+ Double_t value = h2tmp->GetBinContent(bin);
+ hist->SetBinContent(b, value);
+ }
+ //printf("Sum = %d %f\n", i, hist->GetSum());
+ if (hist->GetSum() < 100) continue; // chamber not present
+ //
+ hist->Fit("landau", "q0", "goff", 10, 180);
+ TF1 *fit = hist->GetFunction("landau");
+ if (arrRP[12]) ((TH1*)arrRP[12])->Fill(fit->GetParameter(1));
+ if (arrRP[13]) ((TH1*)arrRP[13])->Fill(fit->GetParameter(2));
+ }
+ }
+ //
+ // time-bin by time-bin
+ TH3* h3tmp = (TH3*) arrRP[10];
+ if (h3tmp) {
+ for (Int_t i=0; i<540; i++) {
+ for(Int_t j=0; j<35; j++) {
+ hist->Reset();
+ for(Int_t b=1; b<hist->GetXaxis()->GetNbins()-1; b++) {
+ Double_t xvalue = hist->GetBinCenter(b);
+ Int_t bin = h3tmp->FindBin(i,j,xvalue);
+ Double_t value = h2tmp->GetBinContent(bin);
+ //printf("v = %f\n", value);
+ hist->SetBinContent(b, value);
+ }
+ if (hist->GetSum() < 100) continue;
+ //printf("fitting %d %d %f\n", i, j, hist->GetSum());
+ hist->Fit("landau", "q0", "goff", 10, 180);
+ TF1 *fit = hist->GetFunction("landau");
+ //
+ Int_t sm = i/18;
+ Int_t det = i%18;
+ TH2* h2 = (TH2*)arrRP[14+sm];
+ if (!h2) continie;
+ Int_t bin = h2->FindBin(det,j);
+ // printf("%d %d %d\n", det, j, bin);
+ h2->SetBinContent(bin, fit->GetParameter(1));
+ }
+ }
+ } // h3tmp
+ } // RESPOINTS
+ } // RS: loop over eventual clones per trigger class
+ } // loop over species
+
+
+ delete hist;