X-Git-Url: http://git.uio.no/git/?a=blobdiff_plain;f=TRD%2FAliTRDQADataMakerSim.cxx;h=e8d548f802af19c9e893609fbaa4600ae302b16e;hb=6e05de7534f432aa964cafe641d20ea9797d0e28;hp=8945f4acb63e3fd60758ab0ce0fc835cf4a613a0;hpb=3590bda87aa57a61c7bf9e54279e9ae76ae1bd4b;p=u%2Fmrichter%2FAliRoot.git diff --git a/TRD/AliTRDQADataMakerSim.cxx b/TRD/AliTRDQADataMakerSim.cxx index 8945f4acb63..e8d548f802a 100644 --- a/TRD/AliTRDQADataMakerSim.cxx +++ b/TRD/AliTRDQADataMakerSim.cxx @@ -28,9 +28,9 @@ // --- ROOT system --- #include #include -#include -#include -#include +#include +#include +#include #include #include #include @@ -45,8 +45,9 @@ #include "AliTRDQADataMakerSim.h" #include "AliTRDdigitsManager.h" #include "AliTRDgeometry.h" -#include "AliTRDdataArrayS.h" -//#include "AliTRDrawStreamTB.h" +#include "AliTRDarrayADC.h" +#include "AliTRDarraySignal.h" +//#include "AliTRDrawStream.h" #include "AliQAChecker.h" @@ -54,7 +55,8 @@ ClassImp(AliTRDQADataMakerSim) //____________________________________________________________________________ AliTRDQADataMakerSim::AliTRDQADataMakerSim() : - AliQADataMakerSim(AliQA::GetDetName(AliQA::kTRD), "TRD Quality Assurance Data Maker") + AliQADataMakerSim(AliQAv1::GetDetName(AliQAv1::kTRD), "TRD Quality Assurance Data Maker"), + fTmpHits(NULL) { // // Default constructor @@ -62,7 +64,8 @@ ClassImp(AliTRDQADataMakerSim) //____________________________________________________________________________ AliTRDQADataMakerSim::AliTRDQADataMakerSim(const AliTRDQADataMakerSim& qadm) : - AliQADataMakerSim() + AliQADataMakerSim(), + fTmpHits(NULL) { // // Copy constructor @@ -87,16 +90,25 @@ AliTRDQADataMakerSim& AliTRDQADataMakerSim::operator=(const AliTRDQADataMakerSim } //____________________________________________________________________________ -void AliTRDQADataMakerSim::EndOfDetectorCycle(AliQA::TASKINDEX task, TObjArray * list) +AliTRDQADataMakerSim::~AliTRDQADataMakerSim() +{ + if (fTmpHits) { + fTmpHits->Clear() ; + delete fTmpHits ; + } +} + +//____________________________________________________________________________ +void AliTRDQADataMakerSim::EndOfDetectorCycle(AliQAv1::TASKINDEX_t task, TObjArray ** list) { // // Detector specific actions at end of cycle // - - //AliInfo(Form("EndOfCycle", "Fitting RecPoints %d", task)); + ResetEventTrigClasses(); + //AliDebug(AliQAv1::GetQADebugLevel(), Form("EndOfCycle", "Fitting RecPoints %d", task)); // call the checker - AliQAChecker::Instance()->Run(AliQA::kTRD, task, list) ; + AliQAChecker::Instance()->Run(AliQAv1::kTRD, task, list) ; } @@ -107,21 +119,24 @@ void AliTRDQADataMakerSim::InitHits() // // Create Hits histograms in Hits subdir // - + const Bool_t expert = kTRUE ; + const Bool_t image = kTRUE ; + const Int_t kNhist = 4; - TH1D *hist[kNhist]; + TH1F *hist[kNhist]; - hist[0] = new TH1D("qaTRD_hits_det", ";Detector Id of the hit", 540, -0.5, 539.5) ; + hist[0] = new TH1F("qaTRD_hits_det", "TRD hits det;Detector Id of the hit;Counts", 540, -0.5, 539.5) ; - hist[1] = new TH1D("qaTRD_hist_Qdrift", ";Charge from tracks", 100, 0, 100); - hist[2] = new TH1D("qaTRD_hist_Qamp", ";Charge from TRD photon", 100, 0, 100); - hist[3] = new TH1D("qaTRD_hist_Qphoton", ";Charge from TRD photon", 100, 0, 100); + hist[1] = new TH1F("qaTRD_hist_Qdrift", "TRD hits Qdrift;Charge from tracks;Counts", 100, 0, 100); + hist[2] = new TH1F("qaTRD_hist_Qamp", "TRD hits Qamp;Charge from TRD photon;Counts", 100, 0, 100); + hist[3] = new TH1F("qaTRD_hist_Qphoton", "TRD hits Qphoton;Charge from TRD photon;Counts", 100, 0, 100); for(Int_t i=0; iSumw2(); - Add2HitsList(hist[i], i); + Add2HitsList(hist[i], i, !expert, image); } - + // + ClonePerTrigClass(AliQAv1::kHITS); // this should be the last line } //____________________________________________________________________________ @@ -130,19 +145,22 @@ void AliTRDQADataMakerSim::InitDigits() // // Create Digits histograms in Digits subdir // - + const Bool_t expert = kTRUE ; + const Bool_t image = kTRUE ; + const Int_t kNhist = 3; - TH1D *hist[kNhist]; + TH1F *hist[kNhist]; - hist[0] = new TH1D("qaTRD_digits_det", ";Detector Id of the digit", 540, -0.5, 539.5); - hist[1] = new TH1D("qaTRD_digits_time", ";Time bin", 40, -0.5, 39.5); - hist[2] = new TH1D("qaTRD_digits_amp", ";Amplitude", 100, -5.5, 94.5); + hist[0] = new TH1F("qaTRD_digits_det", "TRD digits det;Detector Id of the digit;Counts", 540, -0.5, 539.5); + hist[1] = new TH1F("qaTRD_digits_time", "TRDdigits time;Time bin;Counts", 40, -0.5, 39.5); + hist[2] = new TH1F("qaTRD_digits_amp", "TRD digits amp;Amplitude;Counts", 100, -5.5, 94.5); for(Int_t i=0; iSumw2(); - Add2DigitsList(hist[i], i); + Add2DigitsList(hist[i], i, !expert, image); } - + // + ClonePerTrigClass(AliQAv1::kDIGITS); // this should be the last line } //____________________________________________________________________________ @@ -151,40 +169,42 @@ void AliTRDQADataMakerSim::InitSDigits() // // Create SDigits histograms in SDigits subdir // - + const Bool_t expert = kTRUE ; + const Bool_t image = kTRUE ; + const Int_t kNhist = 3; - TH1D *hist[kNhist]; + TH1F *hist[kNhist]; - hist[0] = new TH1D("qaTRD_sdigits_det", ";Detector Id of the digit", 540, -0.5, 539.5); - hist[1] = new TH1D("qaTRD_sdigits_time", ";Time bin", 40, -0.5, 39.5); - hist[2] = new TH1D("qaTRD_sdigits_amp", ";Amplitude", 100, 0, 1e7); + hist[0] = new TH1F("qaTRD_sdigits_det", "TRD sdigits det;Detector Id of the digit;Counts", 540, -0.5, 539.5); + hist[1] = new TH1F("qaTRD_sdigits_time", "TRD sdigits time;Time bin;Counts", 40, -0.5, 39.5); + hist[2] = new TH1F("qaTRD_sdigits_amp", "TRD sdigits amp;Amplitude;Counts", 100, 0, 1e7); for(Int_t i=0; iSumw2(); - Add2SDigitsList(hist[i], i); + Add2SDigitsList(hist[i], i, !expert, image); } - + // + ClonePerTrigClass(AliQAv1::kSDIGITS); // this should be the last line } //____________________________________________________________________________ -void AliTRDQADataMakerSim::MakeHits(TClonesArray * hits) +void AliTRDQADataMakerSim::MakeHits() { // // Make QA data from Hits // - - TIter next(hits); + + TIter next(fHitsArray); AliTRDhit * hit; while ( (hit = dynamic_cast(next())) ) { - GetHitsData(0)->Fill(hit->GetDetector()); + FillHitsData(0,hit->GetDetector()); Double_t q = TMath::Abs(hit->GetCharge()); - if (hit->FromDrift()) GetHitsData(1)->Fill(q); - if (hit->FromAmplification()) GetHitsData(2)->Fill(q); - if (hit->FromTRphoton()) GetHitsData(3)->Fill(q); + if (hit->FromDrift()) FillHitsData(1,q); + if (hit->FromAmplification()) FillHitsData(2,q); + if (hit->FromTRphoton()) FillHitsData(3,q); } - } //____________________________________________________________________________ @@ -198,46 +218,46 @@ void AliTRDQADataMakerSim::MakeHits(TTree * hitTree) TBranch *branch = hitTree->GetBranch("TRD"); if (!CheckPointer(branch, "TRD hits branch")) return; - + Int_t nhits = (Int_t)(hitTree->GetTotBytes()/sizeof(AliTRDhit)); - TClonesArray *hits = new TClonesArray("AliTRDhit", nhits+1000); - TClonesArray *tmp = new TClonesArray("AliTRDhit", 1000); - branch->SetAddress(&tmp); - - Int_t index = 0; + if (fHitsArray) + fHitsArray->Clear() ; + else + fHitsArray = new TClonesArray("AliTRDhit", nhits+1000); + + //Int_t index = 0; Int_t nEntries = (Int_t)branch->GetEntries(); for(Int_t i = 0; i < nEntries; i++) { branch->GetEntry(i); - Int_t nHits = (Int_t)tmp->GetEntries(); - for(Int_t j=0; jAt(j); - new((*hits)[index++]) AliTRDhit(*hit); - } + MakeHits(); + fHitsArray->Clear() ; } - - tmp->Delete(); - delete tmp; - MakeHits(hits); - + // + IncEvCountCycleHits(); + IncEvCountTotalHits(); + // } //____________________________________________________________________________ -void AliTRDQADataMakerSim::MakeDigits(TClonesArray * digits) +void AliTRDQADataMakerSim::MakeDigits() { // // Makes data from Digits // - TIter next(digits) ; + if (!fDigitsArray) + return ; + + TIter next(fDigitsArray) ; AliTRDdigit * digit ; // Info("Make digits", "From the arrya"); while ( (digit = dynamic_cast(next())) ) { if (digit->GetAmp() < 1) continue; - GetDigitsData(0)->Fill(digit->GetDetector()); - GetDigitsData(1)->Fill(digit->GetTime()); - GetDigitsData(2)->Fill(digit->GetAmp()); + FillDigitsData(0,digit->GetDetector()); + FillDigitsData(1,digit->GetTime()); + FillDigitsData(2,digit->GetAmp()); } } @@ -248,64 +268,69 @@ void AliTRDQADataMakerSim::MakeDigits(TTree * digits) // // Makes data from digits tree // - // Info("Make digits", "From a tree"); AliTRDdigitsManager *digitsManager = new AliTRDdigitsManager(); digitsManager->CreateArrays(); digitsManager->ReadDigits(digits); - - TH1D *histDet = (TH1D*)GetDigitsData(0); - TH1D *histTime = (TH1D*)GetDigitsData(1); - TH1D *histSignal = (TH1D*)GetDigitsData(2); - - for (Int_t i = 0; i < AliTRDgeometry::kNdet; i++) { - - AliTRDdataArrayS *digitsIn = (AliTRDdataArrayS *) digitsManager->GetDigits(i); - - // This is to take care of switched off super modules - if (digitsIn->GetNtime() == 0) continue; - - digitsIn->Expand(); - - //AliTRDSignalIndex* indexes = digitsManager->GetIndexes(i); - //if (indexes->IsAllocated() == kFALSE) digitsManager->BuildIndexes(i); - - Int_t nRows = digitsIn->GetNrow(); - Int_t nCols = digitsIn->GetNcol(); - Int_t nTbins = digitsIn->GetNtime(); - - for(Int_t row = 0; row < nRows; row++) - for(Int_t col = 0; col < nCols; col++) - for(Int_t time = 0; time < nTbins; time++) { - - Float_t signal = digitsIn->GetDataUnchecked(row,col,time); - if (signal < 1) continue; - histDet->Fill(i); - histTime->Fill(time); - histSignal->Fill(signal); - } - - //delete digitsIn; - } - + static TObjArray histDet,histTime,histSignal; + // + GetMatchingDigitsData(0,&histDet); + GetMatchingDigitsData(1,&histTime); + GetMatchingDigitsData(2,&histSignal); + + for (Int_t i = 0; i < AliTRDgeometry::kNdet; i++) + { + AliTRDarrayADC *digitsIn = (AliTRDarrayADC *) digitsManager->GetDigits(i); + + // This is to take care of switched off super modules + if (digitsIn->GetNtime() == 0) continue; + + digitsIn->Expand(); + + //AliTRDSignalIndex* indexes = digitsManager->GetIndexes(i); + //if (indexes->IsAllocated() == kFALSE) digitsManager->BuildIndexes(i); + + Int_t nRows = digitsIn->GetNrow(); + Int_t nCols = digitsIn->GetNcol(); + Int_t nTbins = digitsIn->GetNtime(); + + for(Int_t row = 0; row < nRows; row++) + for(Int_t col = 0; col < nCols; col++) + for(Int_t time = 0; time < nTbins; time++) + { + Float_t signal = digitsIn->GetData(row,col,time); + if (signal < 1) continue; + for (int ih=histDet.GetEntriesFast();ih--;) ((TH1*)histDet.UncheckedAt(ih))->Fill(i); + for (int ih=histTime.GetEntriesFast();ih--;) ((TH1*)histTime.UncheckedAt(ih))->Fill(time); + for (int ih=histSignal.GetEntriesFast();ih--;) ((TH1*)histSignal.UncheckedAt(ih))->Fill(signal); + } + + //delete digitsIn; + } delete digitsManager; - + // + IncEvCountCycleDigits(); + IncEvCountTotalDigits(); + // } //____________________________________________________________________________ -void AliTRDQADataMakerSim::MakeSDigits(TClonesArray * sdigits) +void AliTRDQADataMakerSim::MakeSDigits() { // // Makes data from Digits // - TIter next(sdigits) ; + if (!fSDigitsArray) + return ; + + TIter next(fSDigitsArray) ; AliTRDdigit * digit ; while ( (digit = dynamic_cast(next())) ) { - GetDigitsData(0)->Fill(digit->GetDetector()); - GetDigitsData(1)->Fill(digit->GetTime()); - GetDigitsData(2)->Fill(digit->GetAmp()); + FillDigitsData(0,digit->GetDetector()); + FillDigitsData(1,digit->GetTime()); + FillDigitsData(2,digit->GetAmp()); } } @@ -316,47 +341,57 @@ void AliTRDQADataMakerSim::MakeSDigits(TTree * digits) // // Makes data from SDigits // - + // Check id histograms already created for this Event Specie + if ( ! GetSDigitsData(0) ) + InitSDigits() ; + AliTRDdigitsManager *digitsManager = new AliTRDdigitsManager(); + digitsManager->SetSDigits(kTRUE); digitsManager->CreateArrays(); digitsManager->ReadDigits(digits); - TH1D *histDet = (TH1D*)GetSDigitsData(0); - TH1D *histTime = (TH1D*)GetSDigitsData(1); - TH1D *histSignal = (TH1D*)GetSDigitsData(2); - - for (Int_t i = 0; i < AliTRDgeometry::kNdet; i++) { - - AliTRDdataArrayS *digitsIn = (AliTRDdataArrayS *) digitsManager->GetDigits(i); + static TObjArray histDet,histTime,histSignal; + // + GetMatchingSDigitsData(0,&histDet); + GetMatchingSDigitsData(1,&histTime); + GetMatchingSDigitsData(2,&histSignal); + for (Int_t i = 0; i < AliTRDgeometry::kNdet; i++) + { + AliTRDarraySignal *digitsIn = (AliTRDarraySignal *) digitsManager->GetSDigits(i); + // This is to take care of switched off super modules - if (digitsIn->GetNtime() == 0) continue; - - digitsIn->Expand(); - - //AliTRDSignalIndex* indexes = digitsManager->GetIndexes(i); - //if (indexes->IsAllocated() == kFALSE) digitsManager->BuildIndexes(i); - - Int_t nRows = digitsIn->GetNrow(); - Int_t nCols = digitsIn->GetNcol(); - Int_t nTbins = digitsIn->GetNtime(); - - for(Int_t row = 0; row < nRows; row++) - for(Int_t col = 0; col < nCols; col++) - for(Int_t time = 0; time < nTbins; time++) { - - Float_t signal = digitsIn->GetDataUnchecked(row,col,time); - if (signal < 1) continue; - histDet->Fill(i); - histTime->Fill(time); - histSignal->Fill(signal); - } - - // delete digitsIn; - } - + if (digitsIn->GetNtime() == 0) continue; + + digitsIn->Expand(); + + //AliTRDSignalIndex* indexes = digitsManager->GetIndexes(i); + //if (indexes->IsAllocated() == kFALSE) digitsManager->BuildIndexes(i); + Int_t nRows = digitsIn->GetNrow(); + Int_t nCols = digitsIn->GetNcol(); + Int_t nTbins = digitsIn->GetNtime(); + + for(Int_t row = 0; row < nRows; row++) + { + for(Int_t col = 0; col < nCols; col++) + { + for(Int_t time = 0; time < nTbins; time++) + { + Float_t signal = digitsIn->GetData(row,col,time); + if (signal < 1) continue; + for (int ih=histDet.GetEntriesFast();ih--;) ((TH1*)histDet.UncheckedAt(ih))->Fill(i); + for (int ih=histTime.GetEntriesFast();ih--;) ((TH1*)histTime.UncheckedAt(ih))->Fill(time); + for (int ih=histSignal.GetEntriesFast();ih--;) ((TH1*)histSignal.UncheckedAt(ih))->Fill(signal); + } + } + } + // delete digitsIn; + } delete digitsManager; - + // + IncEvCountCycleSDigits(); + IncEvCountTotalSDigits(); + // } //____________________________________________________________________________