From fd50bb14fe26684d01c912b04f85dfc1aaf08104 Mon Sep 17 00:00:00 2001 From: cblume Date: Sat, 3 Jul 2010 10:54:13 +0000 Subject: [PATCH] Switch to the new raw reader (Julian, Raphaelle) --- TRD/AliTRDCalibChamberStatus.cxx | 346 +++++++++++++++++++++++------ TRD/AliTRDCalibChamberStatus.h | 15 +- TRD/AliTRDCalibPadStatus.cxx | 132 ++++++++++- TRD/AliTRDCalibPadStatus.h | 2 +- TRD/AliTRDCalibraFillHisto.cxx | 143 +++++++++++- TRD/AliTRDCalibraFillHisto.h | 2 +- TRD/Cal/AliTRDCalChamberStatus.cxx | 33 ++- TRD/Cal/AliTRDCalChamberStatus.h | 4 +- TRD/TRDHALFCHAMBERSTATUSda.cxx | 16 +- TRD/TRDPEDESTALda.cxx | 16 +- TRD/TRDVDRIFTda.cxx | 11 +- 11 files changed, 616 insertions(+), 104 deletions(-) diff --git a/TRD/AliTRDCalibChamberStatus.cxx b/TRD/AliTRDCalibChamberStatus.cxx index 299c3800361..e85ef0bf95f 100644 --- a/TRD/AliTRDCalibChamberStatus.cxx +++ b/TRD/AliTRDCalibChamberStatus.cxx @@ -32,6 +32,10 @@ #include #include +#include +#include +#include +#include //AliRoot includes #include "AliRawReader.h" @@ -40,13 +44,17 @@ #include "AliLog.h" #include "AliTRDCalibChamberStatus.h" #include "AliTRDgeometry.h" +#include "AliTRDfeeParam.h" #include "AliTRDdigitsManager.h" #include "AliTRDSignalIndex.h" #include "AliTRDrawFastStream.h" +#include "AliTRDpadPlane.h" #include "./Cal/AliTRDCalChamberStatus.h" #include "./Cal/AliTRDCalDCS.h" #include "./Cal/AliTRDCalDCSFEE.h" +#include "AliTRDrawStream.h" + #ifdef ALI_DATE #include "event.h" #endif @@ -65,6 +73,7 @@ AliTRDCalibChamberStatus::AliTRDCalibChamberStatus() : /*FOLD00*/ fHnSparseEvtDet(0x0), fHnSparseDebug(0x0), fHnSparseMCM(0x0), + fC1(0x0), fDebugLevel(0) { // @@ -84,6 +93,7 @@ AliTRDCalibChamberStatus::AliTRDCalibChamberStatus(const AliTRDCalibChamberStatu fHnSparseEvtDet(ped.fHnSparseEvtDet), fHnSparseDebug(ped.fHnSparseDebug), fHnSparseMCM(ped.fHnSparseMCM), + fC1(ped.fC1), fDebugLevel(ped.fDebugLevel) { // @@ -125,7 +135,10 @@ AliTRDCalibChamberStatus::~AliTRDCalibChamberStatus() /*FOLD00*/ } if(fHnSparseMCM) { delete fHnSparseMCM; - } + } + if(fC1) { + delete fC1; + } } //_____________________________________________________________________ @@ -225,8 +238,8 @@ void AliTRDCalibChamberStatus::Init() thnDimEvtt[1] = 6; thnDimEvtt[2] = 5; thnDimEvtt[3] = 8; - thnDimEvtt[4] = 16; - thnDimEvtt[5] = 16; + thnDimEvtt[4] = 18; + thnDimEvtt[5] = 18; //arrays for lower bounds : Double_t* binEdgesEvtt[6]; for(Int_t ivar = 0; ivar < 6; ivar++) @@ -236,8 +249,8 @@ void AliTRDCalibChamberStatus::Init() for(Int_t i=0; i<=thnDimEvtt[1]; i++) binEdgesEvtt[1][i]= 0.0 + (6.0)/thnDimEvtt[1]*(Double_t)i; for(Int_t i=0; i<=thnDimEvtt[2]; i++) binEdgesEvtt[2][i]= 0.0 + (5.0)/thnDimEvtt[2]*(Double_t)i; for(Int_t i=0; i<=thnDimEvtt[3]; i++) binEdgesEvtt[3][i]= 0.0 + (8.0)/thnDimEvtt[3]*(Double_t)i; - for(Int_t i=0; i<=thnDimEvtt[4]; i++) binEdgesEvtt[4][i]= 0.0 + (16.0)/thnDimEvtt[4]*(Double_t)i; - for(Int_t i=0; i<=thnDimEvtt[5]; i++) binEdgesEvtt[5][i]= 0.0 + (16.0)/thnDimEvtt[5]*(Double_t)i; + for(Int_t i=0; i<=thnDimEvtt[4]; i++) binEdgesEvtt[4][i]= 0.0 + (18.0)/thnDimEvtt[4]*(Double_t)i; + for(Int_t i=0; i<=thnDimEvtt[5]; i++) binEdgesEvtt[5][i]= 0.0 + (18.0)/thnDimEvtt[5]*(Double_t)i; //create the THnSparse fHnSparseMCM = new THnSparseI("MCMerrorDCS","MCMerrorDCS",6,thnDimEvtt); @@ -268,6 +281,77 @@ void AliTRDCalibChamberStatus::ProcessEvent(AliRawReader * rawReader, Int_t neve AliTRDdigitsManager *digitsManager = new AliTRDdigitsManager(kTRUE); digitsManager->CreateArrays(); + Int_t det = 0; + while ((det = rawStream->NextChamber(digitsManager, NULL, NULL)) >= 0) { + + //nextchamber loop + + // do the QA analysis + if (digitsManager->GetIndexes(det)->HasEntry()) {//QA + // printf("there is ADC data on this chamber!\n"); + + AliTRDSignalIndex *indexes = digitsManager->GetIndexes(det); + if (indexes->IsAllocated() == kFALSE) { + // AliError("Indexes do not exist!"); + break; + } + + Int_t iRow = 0; + Int_t iCol = 0; + indexes->ResetCounters(); + + while (indexes->NextRCIndex(iRow, iCol)){ + Int_t iMcm = (Int_t)(iCol/18); // current group of 18 col pads + + Int_t layer = AliTRDgeometry::GetLayer(det); + Int_t sm = AliTRDgeometry::GetSector(det); + Int_t stac = AliTRDgeometry::GetStack(det); + Double_t rphi = 0.5; + if(iMcm > 3) rphi = 1.5; + + Double_t val[4] = {sm,layer,stac,rphi}; + fHnSparseI->Fill(&val[0]); + notEmpty = kTRUE; + + //---------// + // Debug // + if(fDebugLevel > 0) { + Int_t detector = AliTRDgeometry::GetDetector(layer,stac,sm); + Double_t valu[3] = {nevents_physics,detector,rphi}; + fHnSparseEvtDet->Fill(&valu[0]); + } + // Debug // + //---------// + } + + } + digitsManager->ClearArrays(det); + } + + if(notEmpty) fCounterEventNotEmpty++; + + if(digitsManager) delete digitsManager; + if(rawStream) delete rawStream; + +}//_____________________________________________________________________ +void AliTRDCalibChamberStatus::ProcessEvent3(AliRawReader * rawReader, Int_t nevents_physics) +{ + // + // Event Processing loop with AliTRDrawStream + // + // + + Bool_t notEmpty = kFALSE; + + AliTRDdigitsManager *digitsManager = new AliTRDdigitsManager(kTRUE); + digitsManager->CreateArrays(); + + AliTRDrawStream *rawStream = new AliTRDrawStream(rawReader); + rawStream->SetDigitsManager(digitsManager); + // rawStream->SetNoErrorWarning(); + // rawStream->SetSharedPadReadout(kFALSE); + + Int_t det = 0; while ((det = rawStream->NextChamber(digitsManager, NULL, NULL)) >= 0) { @@ -353,15 +437,15 @@ Bool_t AliTRDCalibChamberStatus::TestEventHisto(Int_t nevent) /*FOLD00*/ //_____________________________________________________________________ void AliTRDCalibChamberStatus::AnalyseHisto() /*FOLD00*/ { - // - // Create the AliTRDCalChamberStatus according to the fHnSparseI - // - + // + // Create the AliTRDCalChamberStatus according to the fHnSparseI + // + if(fCalChamberStatus) delete fCalChamberStatus; fCalChamberStatus = new AliTRDCalChamberStatus(); // Check if enough events to say something - if(fCounterEventNotEmpty < 30) { + if(fCounterEventNotEmpty < 200) { // Say all installed for (Int_t ism=0; ism<18; ism++) { for (Int_t ipl=0; ipl<6; ipl++) { @@ -423,10 +507,10 @@ void AliTRDCalibChamberStatus::CheckEORStatus(AliTRDCalDCS *calDCS) /*FOLD00*/ // Correct the AliTRDCalChamberStatus according to the AliTRDCalDCS // Using globale state of the HalfChamberMerger (HCM) // - for(Int_t det = 0; det < 540; det++) { AliTRDCalDCSFEE* calDCSFEEEOR = calDCS->GetCalDCSFEEObj(det); - if(!calDCSFEEEOR) { continue;} + + if(!calDCSFEEEOR) continue; // MCM Global State Machine State Definitions // low_power = 0, @@ -444,43 +528,44 @@ void AliTRDCalibChamberStatus::CheckEORStatus(AliTRDCalDCS *calDCS) /*FOLD00*/ Int_t lay = AliTRDgeometry::GetLayer(det); Int_t stac = AliTRDgeometry::GetStack(det); - Int_t stateA = calDCSFEEEOR->GetMCMGlobalState(4,17); // HCM Side A - Int_t stateB = calDCSFEEEOR->GetMCMGlobalState(5,17); // HCM Side B - Int_t rphi = -1; - - //printf("DCS: stateA %d \t stateB %d \n",stateA,stateB); - if(stateA!=3 && stateA!=9) rphi = 1; - Double_t vals[4] = {sm,lay,stac,rphi}; - if(rphi!=-1) fHnSparseHCM->Fill(&vals[0]); - - if(stateB!=3 && stateB!=9) rphi = 2; - vals[3] = rphi; - if(rphi!=-1) fHnSparseHCM->Fill(&vals[0]); + Int_t stateA = 0; // 0=bad, 1=good state + Int_t stateB = 0; + + // loop over all mcm to define DCS-HCS + for(Int_t ii = 0; ii < 8; ii++) { //ROB loop + for(Int_t i = 0; i < 18; i++) { //MCM loop + + Int_t side = ii%2; // 0=sideA, 1=sideB + Int_t cstate = calDCSFEEEOR->GetMCMGlobalState(ii,i); //current mcm state + + if(cstate==3) { + switch(side) { + case 0: stateA=1; break; + case 1: stateB=1; break; + } + } + } + } //---------// // Debug // if(fDebugLevel > 0) { - if( ((fCalChamberStatus->GetStatus(det) <= 1) && (stateA!=3 && stateA!=9)) || - ((fCalChamberStatus->GetStatus(det) <= 1) && (stateB!=3 && stateB!=9)) || - ((fCalChamberStatus->GetStatus(det) == 2) && (stateA==3 || stateA==9)) || - ((fCalChamberStatus->GetStatus(det) == 2) && (stateB==3 || stateB==9)) || - ((fCalChamberStatus->GetStatus(det) == 3) && (stateA==3 || stateA==9)) || - ((fCalChamberStatus->GetStatus(det) == 3) && (stateB!=3 && stateB!=9)) || - ((fCalChamberStatus->GetStatus(det) == 4) && (stateB==3 || stateB==9)) || - ((fCalChamberStatus->GetStatus(det) == 4) && (stateA!=3 && stateA!=9)) ) + if( ((fCalChamberStatus->GetStatus(det) <= 1) && (stateA==0 || stateB==0)) || + ((fCalChamberStatus->GetStatus(det) == 2) && (stateA==1 || stateB==1)) || + ((fCalChamberStatus->GetStatus(det) == 3) && (stateA==1 || stateB==0)) || + ((fCalChamberStatus->GetStatus(det) == 4) && (stateB==0 || stateB==1)) ) { //printf(" Different half chamber status in DCS and DATA!!\n"); Double_t val[4] = {sm,lay,stac,1}; fHnSparseDebug->Fill(&val[0]); - if(rphi!=-1) { // error in DCS information - // Fill MCM status map - for(Int_t ii = 0; ii < 8; ii++) { //ROB loop - for(Int_t i = 0; i < 16; i++) { //MCM loop - Double_t valss[6] = {sm,lay,stac,ii,i - ,calDCSFEEEOR->GetMCMGlobalState(ii,i)}; - fHnSparseMCM->Fill(&valss[0]); - } + // Fill MCM status map + for(Int_t ii = 0; ii < 8; ii++) { //ROB loop + for(Int_t i = 0; i < 18; i++) { //MCM loop + Double_t valss[6] = {sm,lay,stac,ii,i + ,calDCSFEEEOR->GetMCMGlobalState(ii,i)}; + fHnSparseMCM->Fill(&valss[0]); + } } } @@ -488,42 +573,34 @@ void AliTRDCalibChamberStatus::CheckEORStatus(AliTRDCalDCS *calDCS) /*FOLD00*/ //---------// // Debug // - ////////////////////////////////////////// + //--------------------------------------- // Change the status according to DCS - /////////////////////////////////////////// - - // First put bad status if seen by DCS - ///////////////////////////////////////// - if(stateA!=3 && stateA!=9 && stateB!=3 && stateB!=9) { - // completely masked from DCS - fCalChamberStatus->SetStatus(det,2); - } - if((stateA!=3 && stateA!=9) && (stateB==3 || stateB==9)) { - // Only A side masked from DCS - if(fCalChamberStatus->GetStatus(det) != 3) { - // But not from Data - if(fCalChamberStatus->GetStatus(det) == 4) fCalChamberStatus->SetStatus(det,2); - if(fCalChamberStatus->GetStatus(det) <= 1) fCalChamberStatus->SetStatus(det,3); - } - } - if((stateA==3 || stateA==9) && (stateB!=3 && stateB!=9)) { - // Only B side masked from DCS - if(fCalChamberStatus->GetStatus(det) != 4) { - // But not from Data - if(fCalChamberStatus->GetStatus(det) == 3) fCalChamberStatus->SetStatus(det,2); - if(fCalChamberStatus->GetStatus(det) <= 1) fCalChamberStatus->SetStatus(det,4); + //--------------------------------------- + Int_t StatusData = fCalChamberStatus->GetStatus(det); + switch(StatusData) + { + case 1: + if(stateA==0 && stateB==0) fCalChamberStatus->SetStatus(det,2); // completely masked from DCS + if(stateA==1 && stateB==0) fCalChamberStatus->SetStatus(det,4); // Only B side masked from DCS + if(stateA==0 && stateB==1) fCalChamberStatus->SetStatus(det,3); // Only A side masked from DCS + if(stateA==1 && stateB==1) fCalChamberStatus->SetStatus(det,1); + break; + case 2: // completely masked from DATA + if(stateA==0 && stateB==0) fCalChamberStatus->SetStatus(det,2); // completely masked from DCS + break; + case 3: // Only A side masked from DATA + if(stateA==0 && stateB==0) fCalChamberStatus->SetStatus(det,2); // completely masked from DCS + if(stateA==1 && stateB==0) fCalChamberStatus->SetStatus(det,2); // Only B side masked from DCS + if(stateA==0 && stateB==1) fCalChamberStatus->SetStatus(det,3); // Only A side masked from DCS + if(stateA==1 && stateB==1) fCalChamberStatus->SetStatus(det,3); + break; + case 4: // Only B side masked from DATA + if(stateA==0 && stateB==0) fCalChamberStatus->SetStatus(det,2); // completely masked from DCS + if(stateA==1 && stateB==0) fCalChamberStatus->SetStatus(det,4); // Only B side masked from DCS + if(stateA==0 && stateB==1) fCalChamberStatus->SetStatus(det,2); // Only A side masked from DCS + if(stateA==1 && stateB==1) fCalChamberStatus->SetStatus(det,4); + break; } - } - - // Then release in case of error 3 from DCS - ///////////////////////////////////////////// - if(fCalChamberStatus->GetStatus(det)==2) { - if((stateA==3) && (stateB==3)) fCalChamberStatus->SetStatus(det,1); - if((stateA==3) && (stateB!=3)) fCalChamberStatus->SetStatus(det,4); - if((stateA!=3) && (stateB==3)) fCalChamberStatus->SetStatus(det,3); - } - if((fCalChamberStatus->GetStatus(det)==3) && (stateA==3)) fCalChamberStatus->SetStatus(det,1); - if((fCalChamberStatus->GetStatus(det)==4) && (stateB==3)) fCalChamberStatus->SetStatus(det,1); } @@ -577,4 +654,125 @@ void AliTRDCalibChamberStatus::DumpToFile(const Char_t *filename, const Char_t * if ( backup ) backup->cd(); } +//_____________________________________________________________________________ +TH2D* AliTRDCalibChamberStatus::PlotSparseI(Int_t sm,Int_t side) +{ + // + // Plot number of entries for supermodule sm + // as a function of layer and stack + // + + if(!fHnSparseI) return 0x0; + + fHnSparseI->GetAxis(0)->SetRange(sm+1,sm+1); + fHnSparseI->GetAxis(3)->SetRange(side+1,side+1); + TH2D *h2 = fHnSparseI->Projection(1,2); + + + return h2; + +} +//_____________________________________________________________________ +TH2F *AliTRDCalibChamberStatus::MakeHisto2DSmPlEORStatus(AliTRDCalDCS *calDCS, Int_t sm, Int_t pl) /*FOLD00*/ +{ + // + // Plot globale state of the HalfChamberMerger (HCM) + // + AliTRDfeeParam *paramfee = AliTRDfeeParam::Instance(); + + AliTRDgeometry *trdGeo = new AliTRDgeometry(); + AliTRDpadPlane *padPlane0 = trdGeo->GetPadPlane(pl,0); // layer,stack + Double_t row0 = padPlane0->GetRow0(); + Double_t col0 = padPlane0->GetCol0(); + char name[1000]; + sprintf(name,"%s DCS status sm %d pl %d",GetTitle(),sm,pl); + TH2F * his = new TH2F( name, name, 88,-TMath::Abs(row0),TMath::Abs(row0) + ,148,-TMath::Abs(col0),TMath::Abs(col0)); + + + // Where we begin + Int_t offsetsmpl = 30*sm+pl; + Int_t nstack = 5; + Int_t ncols = 144; + + for (Int_t k = 0; k < nstack; k++){ + Int_t det = offsetsmpl+k*6; + Int_t stac = AliTRDgeometry::GetStack(det); + AliTRDCalDCSFEE* calDCSFEEEOR = calDCS->GetCalDCSFEEObj(det); + if(!calDCSFEEEOR) { continue;} + for (Int_t icol=0; icol 2) binz = 16*(kb-1)+12+krow+1+2*(kb+1); + else binz = 16*kb+krow+1+2*(kb+1); + Int_t biny = kcol+1+2; + // Take the value + Int_t mcm = paramfee->GetMCMfromPad(irow,icol); + Int_t rob = paramfee->GetROBfromPad(irow,icol); + Int_t state = calDCSFEEEOR->GetMCMGlobalState(rob,mcm); + his->SetBinContent(binz,biny,state); + } + } + for(Int_t icol = 1; icol < 147; icol++){ + for(Int_t l = 0; l < 2; l++){ + Int_t binz = 0; + Int_t kb = 5-1-k; + if(kb > 2) binz = 16*(kb-1)+12+1+2*(kb+1)-(l+1); + else binz = 16*kb+1+2*(kb+1)-(l+1); + his->SetBinContent(binz,icol,16.0); + } + } + } + + for(Int_t icol = 1; icol < 147; icol++){ + his->SetBinContent(88,icol,16.0); + his->SetBinContent(87,icol,16.0); + } + for(Int_t irow = 1; irow < 89; irow++){ + his->SetBinContent(irow,1,16.0); + his->SetBinContent(irow,2,16.0); + his->SetBinContent(irow,147,16.0); + his->SetBinContent(irow,148,16.0); + } + + his->SetXTitle("z (cm)"); + his->SetYTitle("y (cm)"); + his->SetMaximum(12); + his->SetMinimum(0.0); + his->SetStats(0); + + return his; + +} +//_____________________________________________________________________________ +TCanvas* AliTRDCalibChamberStatus::PlotHistos2DSmEORStatus(AliTRDCalDCS *calDCS, Int_t sm, const Char_t *name) +{ + // + // Make 2D graph + // + + gStyle->SetPalette(1); + fC1 = new TCanvas(name,name,50,50,600,800); + fC1->Divide(3,2); + fC1->cd(1); + MakeHisto2DSmPlEORStatus(calDCS,sm,0)->Draw("colz"); + fC1->cd(2); + MakeHisto2DSmPlEORStatus(calDCS,sm,1)->Draw("colz"); + fC1->cd(3); + MakeHisto2DSmPlEORStatus(calDCS,sm,2)->Draw("colz"); + fC1->cd(4); + MakeHisto2DSmPlEORStatus(calDCS,sm,3)->Draw("colz"); + fC1->cd(5); + MakeHisto2DSmPlEORStatus(calDCS,sm,4)->Draw("colz"); + fC1->cd(6); + MakeHisto2DSmPlEORStatus(calDCS,sm,5)->Draw("colz"); + + return fC1; + +} diff --git a/TRD/AliTRDCalibChamberStatus.h b/TRD/AliTRDCalibChamberStatus.h index d015dd54c85..25f07aeeb51 100644 --- a/TRD/AliTRDCalibChamberStatus.h +++ b/TRD/AliTRDCalibChamberStatus.h @@ -13,6 +13,8 @@ #ifndef ROOT_THnSparse #include +#include +#include #endif class AliRawReader; @@ -35,6 +37,7 @@ public: AliTRDCalibChamberStatus& operator = (const AliTRDCalibChamberStatus &source); void ProcessEvent(AliRawReader *rawReader, Int_t nevents_physics); + void ProcessEvent3(AliRawReader *rawReader, Int_t nevents_physics); void Init(); void AnalyseHisto(); @@ -43,7 +46,7 @@ public: void Add(AliTRDCalibChamberStatus *calibChamberStatus); Int_t GetNumberEventNotEmpty() const { return fCounterEventNotEmpty; }; - + THnSparseI *GetSparseI() const {return fHnSparseI;}; THnSparseI *GetSparseHCM() const {return fHnSparseHCM;}; // for fDebugLevel>0 @@ -58,6 +61,11 @@ public: Bool_t TestEventHisto(Int_t nevent); + // Plot + TH2D *PlotSparseI(Int_t sm, Int_t side); // Plot fStatus for sm + TH2F *MakeHisto2DSmPlEORStatus(AliTRDCalDCS *calDCS, Int_t sm, Int_t pl); + TCanvas *PlotHistos2DSmEORStatus(AliTRDCalDCS *calDCS,Int_t sm, const Char_t *name); + // Debug void SetDebugLevel(Short_t level) { fDebugLevel = level; } @@ -77,10 +85,11 @@ public: THnSparseI *fHnSparseDebug; // THnSparse for half chambers satuts THnSparseI *fHnSparseMCM; // THnSparse for DCS MCM status + TCanvas *fC1; + Short_t fDebugLevel; // Flag for debugging ClassDef(AliTRDCalibChamberStatus,1) }; -#endif - +#endif \ No newline at end of file diff --git a/TRD/AliTRDCalibPadStatus.cxx b/TRD/AliTRDCalibPadStatus.cxx index 14155711014..9763e197781 100644 --- a/TRD/AliTRDCalibPadStatus.cxx +++ b/TRD/AliTRDCalibPadStatus.cxx @@ -99,6 +99,8 @@ #include "AliTRDarrayADC.h" #include "AliTRDfeeParam.h" +#include "AliTRDrawStream.h" + #ifdef ALI_DATE #include "event.h" #endif @@ -564,6 +566,135 @@ Int_t AliTRDCalibPadStatus::ProcessEvent2(AliRawReader *rawReader) return withInput; } +//_____________________________________________________________________ + +Int_t AliTRDCalibPadStatus::ProcessEvent3(AliRawReader *rawReader) +{ + // + // RawReader = AliTRDrawStream (Jochen Klein) + // + // Event Processing loop - AliTRDRawStreamCosmic + // 0 time bin problem or zero suppression + // 1 no input + // 2 input + // Raw version number: + // [3,31] non zero suppressed + // 2,4 and [32,63] zero suppressed + // + + + + Int_t withInput = 1; + + AliTRDdigitsManager *digitsManager = new AliTRDdigitsManager(kTRUE); + digitsManager->CreateArrays(); + + AliTRDrawStream *rawStream = new AliTRDrawStream(rawReader); + rawStream->SetDigitsManager(digitsManager); + //rawStream->SetNoErrorWarning(); + //rawStream->SetSharedPadReadout(kTRUE); + + AliTRDfeeParam *feeParam = AliTRDfeeParam::Instance(); + + Int_t det = 0; + while ((det = rawStream->NextChamber(digitsManager, NULL, NULL)) >= 0) { //idetector + if (digitsManager->GetIndexes(det)->HasEntry()) {//QA + // printf("there is ADC data on this chamber!\n"); + + AliTRDarrayADC *digits = (AliTRDarrayADC *) digitsManager->GetDigits(det); //mod + if (digits->HasData()) { //array + + AliTRDSignalIndex *indexes = digitsManager->GetIndexes(det); + if (indexes->IsAllocated() == kFALSE) { + AliError("Indexes do not exist!"); + break; + } + Int_t iRow = 0; + Int_t iCol = 0; + indexes->ResetCounters(); + + while (indexes->NextRCIndex(iRow, iCol)) { //column,row + + AliTRDdigitsParam *digitParam = (AliTRDdigitsParam *)digitsManager->GetDigitsParam(); + + Int_t mcm = 0; // MCM from AliTRDfeeParam + Int_t rob = 0; // ROB from AliTRDfeeParam + Int_t extCol = 0; // extended column from AliTRDfeeParam + mcm = feeParam->GetMCMfromPad(iRow,iCol); + rob = feeParam->GetROBfromPad(iRow,iCol); + + Int_t idetector = det; // current detector + Int_t iRowMax = 16; // current rowmax + if(GetStack(det) == 2) iRowMax = 12; + + Int_t adc = 20 - (iCol%18) -1; // current adc + Int_t col = 0; // col!=0 ->Shared Pad + extCol = feeParam->GetExtendedPadColFromADC(rob,mcm,adc); + //printf(" iCol %d iRow %d iRowMax %d rob %d mcm %d adc %d extCol %d\n",iCol,iRow,iRowMax,rob,mcm,adc,extCol); + + // Signal for regular pads + Int_t nbtimebin = digitParam->GetNTimeBins(idetector); // number of time bins read from data + for(Int_t k = 0; k < nbtimebin; k++){ + Short_t signal = 0; + signal = digits->GetData(iRow,iCol,k); + + if(signal>0) { + UpdateHisto2(idetector,iRow,iCol,signal,iRowMax,col,mcm,rob); + } + } + + + + if((adc==3-1 || adc==20-1 || adc==19-1) && (iCol > 1 && iCol <142) ) { //SHARED PADS + + switch(adc) { + case 2: + adc = 20; //shared Pad adc + mcm = feeParam->GetMCMfromSharedPad(iRow,iCol); //shared Pad mcm + col = 1; + break; + case 19: + adc = 1; //shared Pad adc + mcm = feeParam->GetMCMfromSharedPad(iRow,iCol); //shared Pad mcm + col = 2; + break; + case 18: + adc = 0; //shared Pad adc + mcm = feeParam->GetMCMfromSharedPad(iRow,iCol); //shared Pad mcm + col = 3; + break; + } + rob = feeParam->GetROBfromSharedPad(iRow,iCol); //shared Pad rob + + + extCol = feeParam->GetExtendedPadColFromADC(rob,mcm,adc); //extended pad col via the shared pad rob,mcm and adc + + //printf("SHARED PAD --- iCol %d iRow %d rob %d mcm %d adc %d extCol %d col %d\n",iCol,iRow,rob,mcm,adc,extCol,col); + for(Int_t k = 0; k < nbtimebin; k++){ + Short_t signal = 0; + signal = digits->GetDataByAdcCol(iRow,extCol,k); + + if(signal>0) { + UpdateHisto2(idetector,iRow,iCol,signal,iRowMax,col,mcm,rob); + } + } + } //shared pads end + + + withInput = 2; + }//column,row + + }//array + }//QA + digitsManager->ClearArrays(det); + }//idetector + delete digitsManager; + delete rawStream; + return withInput; + +} + + //_____________________________________________________________________ Bool_t AliTRDCalibPadStatus::TestEventHisto(Int_t nevent, Int_t sm, Int_t ch) /*FOLD00*/ { @@ -1074,4 +1205,3 @@ Int_t AliTRDCalibPadStatus::GetSector(Int_t d) const return ((Int_t) (d / 30)); } - diff --git a/TRD/AliTRDCalibPadStatus.h b/TRD/AliTRDCalibPadStatus.h index 748681749af..9e66f20cf74 100644 --- a/TRD/AliTRDCalibPadStatus.h +++ b/TRD/AliTRDCalibPadStatus.h @@ -43,6 +43,7 @@ public: Int_t ProcessEvent(AliRawReader *rawReader, Bool_t nocheck = kFALSE); Int_t ProcessEvent(const eventHeaderStruct *event, Bool_t nocheck = kFALSE); Int_t ProcessEvent2(AliRawReader *rawReader); + Int_t ProcessEvent3(AliRawReader *rawReader); void Destroy(); Int_t UpdateHisto(const Int_t idet, const Int_t iRow, const Int_t iCol, @@ -115,4 +116,3 @@ public: }; #endif - diff --git a/TRD/AliTRDCalibraFillHisto.cxx b/TRD/AliTRDCalibraFillHisto.cxx index be1b40249c7..9ce515cd5b4 100644 --- a/TRD/AliTRDCalibraFillHisto.cxx +++ b/TRD/AliTRDCalibraFillHisto.cxx @@ -76,6 +76,9 @@ #include "AliTRDSignalIndex.h" #include "AliTRDarrayADC.h" +#include "AliTRDrawStream.h" + + #ifdef ALI_DATE #include "event.h" #endif @@ -2705,6 +2708,145 @@ Int_t AliTRDCalibraFillHisto::ProcessEventDAQ2(AliRawReader *rawReader) return withInput; }//main //_____________________________________________________________________ +Int_t AliTRDCalibraFillHisto::ProcessEventDAQ3(AliRawReader *rawReader) + { //main + // + // Event Processing loop - AliTRDrawStream + // + // 0 timebin problem + // 1 no input + // 2 input + // Same algorithm as TestBeam but different reader + // + + // AliTRDrawFastStream *rawStream = AliTRDrawFastStream::GetRawStream(rawReader); + AliTRDrawStream *rawStream = new AliTRDrawStream(rawReader); + rawStream->SetNoErrorWarning(); + rawStream->SetSharedPadReadout(kFALSE); + + AliTRDdigitsManager *digitsManager = new AliTRDdigitsManager(kTRUE); + digitsManager->CreateArrays(); + + Int_t withInput = 1; + + Double_t phvalue[16][144][36]; + for(Int_t k = 0; k < 36; k++){ + for(Int_t j = 0; j < 16; j++){ + for(Int_t c = 0; c < 144; c++){ + phvalue[j][c][k] = 0.0; + } + } + } + + fDetectorPreviousTrack = -1; + fMCMPrevious = -1; + fROBPrevious = -1; + + Int_t nbtimebin = 0; + Int_t baseline = 10; + + + fTimeMax = 0; + + Int_t det = 0; + while ((det = rawStream->NextChamber(digitsManager, NULL, NULL)) >= 0) { //idetector + + if (digitsManager->GetIndexes(det)->HasEntry()) {//QA + // printf("there is ADC data on this chamber!\n"); + + AliTRDarrayADC *digits = (AliTRDarrayADC *) digitsManager->GetDigits(det); //mod + if (digits->HasData()) { //array + + AliTRDSignalIndex *indexes = digitsManager->GetIndexes(det); + if (indexes->IsAllocated() == kFALSE) { + AliError("Indexes do not exist!"); + break; + } + Int_t iRow = 0; + Int_t iCol = 0; + indexes->ResetCounters(); + + while (indexes->NextRCIndex(iRow, iCol)) { //column,row + //printf(" det %d \t row %d \t col %d \t digit\n",det,iRow,iCol); + //while (rawStream->Next()) { + + Int_t idetector = det; // current detector + //Int_t imcm = rawStream->GetMCM(); // current MCM + //Int_t irob = rawStream->GetROB(); // current ROB + + + if((fDetectorPreviousTrack != idetector) && (fDetectorPreviousTrack != -1)) { + // Fill + withInput = TMath::Max(FillDAQ(phvalue),withInput); + + // reset + for(Int_t k = 0; k < 36; k++){ + for(Int_t j = 0; j < 16; j++){ + for(Int_t c = 0; c < 144; c++){ + phvalue[j][c][k] = 0.0; + } + } + } + } + + fDetectorPreviousTrack = idetector; + //fMCMPrevious = imcm; + //fROBPrevious = irob; + + // nbtimebin = rawStream->GetNumberOfTimeBins(); // number of time bins read from data + AliTRDdigitsParam *digitParam = (AliTRDdigitsParam *)digitsManager->GetDigitsParam(); + nbtimebin = digitParam->GetNTimeBins(det); // number of time bins read from data + baseline = digitParam->GetADCbaseline(det); // baseline + + if(nbtimebin == 0) return 0; + if((fTimeMax != 0) && (nbtimebin != fTimeMax)) return 0; + fTimeMax = nbtimebin; + + fNumberClustersf = fTimeMax; + fNumberClusters = (Int_t)(fNumberClustersProcent*fTimeMax); + + + for(Int_t itime = 0; itime < nbtimebin; itime++) { + // phvalue[row][col][itime] = signal[itime]-baseline; + phvalue[iRow][iCol][itime] = (Short_t)(digits->GetData(iRow,iCol,itime) - baseline); + /*if(phvalue[iRow][iCol][itime] >= 20) { + printf("----------> phvalue[%d][%d][%d] %d baseline %d \n", + iRow, + iCol, + itime, + (Short_t)(digits->GetData(iRow,iCol,itime)), + baseline); + }*/ + } + + }//column,row + + // fill the last one + if(fDetectorPreviousTrack != -1){ + + // Fill + withInput = TMath::Max(FillDAQ(phvalue),withInput); + // printf("\n ---> withinput %d\n\n",withInput); + // reset + for(Int_t k = 0; k < 36; k++){ + for(Int_t j = 0; j < 16; j++){ + for(Int_t c = 0; c < 144; c++){ + phvalue[j][c][k] = 0.0; + } + } + } + } + + }//array + }//QA + digitsManager->ClearArrays(det); + }//idetector + delete digitsManager; + + delete rawStream; + return withInput; + }//main +//_____________________________________________________________________ ////////////////////////////////////////////////////////////////////////////// // Routine inside the DAQ process ///////////////////////////////////////////////////////////////////////////// @@ -3415,4 +3557,3 @@ void AliTRDCalibraFillHisto::AnalyseLinearFitter() } } - diff --git a/TRD/AliTRDCalibraFillHisto.h b/TRD/AliTRDCalibraFillHisto.h index e221853a141..196a3f4a818 100644 --- a/TRD/AliTRDCalibraFillHisto.h +++ b/TRD/AliTRDCalibraFillHisto.h @@ -74,6 +74,7 @@ class AliTRDCalibraFillHisto : public TObject { Int_t ProcessEventDAQ(AliRawReader *rawReader, Bool_t nocheck = kFALSE); Int_t ProcessEventDAQ(const eventHeaderStruct *event, Bool_t nocheck = kFALSE); Int_t ProcessEventDAQ2(AliRawReader *rawReader); + Int_t ProcessEventDAQ3(AliRawReader *rawReader); // Is Pad on Bool_t IsPadOn(Int_t detector, Int_t row, Int_t col) const; @@ -325,4 +326,3 @@ AliTRDCalibraVector *GetCalibraVector() const { r }; #endif - diff --git a/TRD/Cal/AliTRDCalChamberStatus.cxx b/TRD/Cal/AliTRDCalChamberStatus.cxx index a79bec1c5ad..5b166417599 100644 --- a/TRD/Cal/AliTRDCalChamberStatus.cxx +++ b/TRD/Cal/AliTRDCalChamberStatus.cxx @@ -52,6 +52,38 @@ AliTRDCalChamberStatus::AliTRDCalChamberStatus(const Text_t *name, const Text_t fStatus[idet] = 0; } +} +//_____________________________________________________________________________ +TH2D* AliTRDCalChamberStatus::Plot(Int_t sm, Int_t rphi) +{ + // + // Plot chamber status for supermodule and halfchamberside + // as a function of layer and stack + // + + TH2D *h2 = new TH2D(Form("sm_%d_rphi_%d",sm,rphi),Form("sm_%d_rphi_%d",sm,rphi),5,0.0,5.0,6,0.0,6.0); + + h2->SetXTitle("stack"); + h2->SetYTitle("layer"); + + Int_t start = sm*30; + Int_t end = (sm+1)*30; + + for(Int_t i=start; i((i-start)/6.); + Int_t status = GetStatus(i); + if(rphi == 0) { + if(status!=4) h2->Fill(stack,layer,status); + } + else if(rphi == 1) { + if(status!=3) h2->Fill(stack,layer,status); + } + + } + + return h2; + } //_____________________________________________________________________________ TH2D* AliTRDCalChamberStatus::Plot(Int_t sm) @@ -79,4 +111,3 @@ TH2D* AliTRDCalChamberStatus::Plot(Int_t sm) return h2; } - diff --git a/TRD/Cal/AliTRDCalChamberStatus.h b/TRD/Cal/AliTRDCalChamberStatus.h index bf0cb488d95..413808e4337 100644 --- a/TRD/Cal/AliTRDCalChamberStatus.h +++ b/TRD/Cal/AliTRDCalChamberStatus.h @@ -32,7 +32,8 @@ class AliTRDCalChamberStatus : public TNamed { Bool_t IsHalfChamberSideAMasked(Int_t det) const { return (GetStatus(det) == kHalfChamberSideAMasked) ? kTRUE : kFALSE; } Bool_t IsHalfChamberSideBMasked(Int_t det) const { return (GetStatus(det) == kHalfChamberSideBMasked) ? kTRUE : kFALSE; } - TH2D *Plot(Int_t sm); // Plot fStatus for sm + TH2D *Plot(Int_t sm, Int_t rphi); // Plot fStatus for sm and halfchamberside + TH2D *Plot(Int_t sm); // Plot fStatus for sm protected: @@ -44,4 +45,3 @@ class AliTRDCalChamberStatus : public TNamed { }; #endif - diff --git a/TRD/TRDHALFCHAMBERSTATUSda.cxx b/TRD/TRDHALFCHAMBERSTATUSda.cxx index 4a635652dab..7526de012fd 100644 --- a/TRD/TRDHALFCHAMBERSTATUSda.cxx +++ b/TRD/TRDHALFCHAMBERSTATUSda.cxx @@ -37,8 +37,8 @@ extern "C" { // #include "AliRawReader.h" #include "AliRawReaderDate.h" -#include "AliTRDrawFastStream.h" -#include "AliTRDrawStreamBase.h" +//#include "AliTRDrawFastStream.h" +//#include "AliTRDrawStreamBase.h" #include "AliLog.h" //#include "AliCDBManager.h" @@ -110,10 +110,11 @@ int main(int argc, char **argv) { // AliTRDCalibPadStatus object AliTRDCalibChamberStatus calipad = AliTRDCalibChamberStatus(); calipad.Init(); + unsigned long32 runNb=0; //run number // setting - AliTRDrawFastStream::DisableSkipData(); + //AliTRDrawFastStream::DisableSkipData(); AliLog::SetGlobalLogLevel(AliLog::kFatal); /* read the file until EOF */ @@ -148,7 +149,7 @@ int main(int argc, char **argv) { AliRawReader *rawReader = new AliRawReaderDate((void*)event); rawReader->Select("TRD"); - calipad.ProcessEvent((AliRawReader *) rawReader,nevents); + calipad.ProcessEvent3((AliRawReader *) rawReader,nevents); nevents++; delete rawReader; @@ -169,15 +170,17 @@ int main(int argc, char **argv) { } } - + Int_t neventused = calipad.GetNumberEventNotEmpty(); + /* report progress */ - printf("%d events processed and %d used\n",nevents_total,nevents); + printf("%d events processed and %d used\n",nevents_total,neventused); /* write file in any case to see what happens in case of problems*/ TFile *fileTRD = new TFile(RESULT_FILE,"recreate"); calipad.AnalyseHisto(); calipad.Write("calibchamberstatus"); fileTRD->Close(); + /* Send to amore */ SendToAmoreDB(&calipad,runNb); @@ -188,7 +191,6 @@ int main(int argc, char **argv) { printf("Failed to export file : %d\n",status); return -1; } - return status; diff --git a/TRD/TRDPEDESTALda.cxx b/TRD/TRDPEDESTALda.cxx index 3849016be42..58dd8332c12 100644 --- a/TRD/TRDPEDESTALda.cxx +++ b/TRD/TRDPEDESTALda.cxx @@ -37,10 +37,11 @@ extern "C" { // #include "AliRawReader.h" #include "AliRawReaderDate.h" -#include "AliTRDrawFastStream.h" -#include "AliTRDrawStreamBase.h" +//#include "AliTRDrawFastStream.h" +//#include "AliTRDrawStreamBase.h" #include "AliTRDgeometry.h" #include "AliCDBManager.h" +#include "AliLog.h" // //AMORE @@ -104,8 +105,8 @@ int main(int argc, char **argv) { unsigned long32 runNb=0; //run number // setting - AliTRDrawFastStream::DisableSkipData(); - + //AliTRDrawFastStream::DisableSkipData(); + AliLog::SetGlobalLogLevel(AliLog::kFatal); /* read the data files */ int n; @@ -150,7 +151,7 @@ int main(int argc, char **argv) { // for debug //rawReader->SelectEquipment(-1,1024,1025); - Int_t result = calipad.ProcessEvent2((AliRawReader *) rawReader); + Int_t result = calipad.ProcessEvent3((AliRawReader *) rawReader); // 0 error, 1 no input, 2 output if(result == 2) nevents++; if(result == 0) passpadstatus = kFALSE; @@ -249,9 +250,9 @@ void SendToAmoreDB(TObject *calipad, unsigned long32 runNb) statusDA+=amoreDA.Send("Pedestals",calipad); statusDA+=amoreDA.Send("Info",&info); if ( statusDA ) - printf("Waring: Failed to write one of the calib objects to the AMORE database\n"); + printf("Warning: Failed to write one of the calib objects to the AMORE database\n"); } else { - printf("Waring: No data found!\n"); + printf("Warning: No data found!\n"); } // reset env var @@ -261,4 +262,3 @@ void SendToAmoreDB(TObject *calipad, unsigned long32 runNb) - diff --git a/TRD/TRDVDRIFTda.cxx b/TRD/TRDVDRIFTda.cxx index 788f05697de..decb24a2467 100644 --- a/TRD/TRDVDRIFTda.cxx +++ b/TRD/TRDVDRIFTda.cxx @@ -42,8 +42,9 @@ extern "C" { // #include "AliRawReader.h" #include "AliRawReaderDate.h" -#include "AliTRDrawFastStream.h" -#include "AliTRDrawStreamBase.h" +//#include "AliTRDrawFastStream.h" +//#include "AliTRDrawStreamBase.h" +#include "AliLog.h" // //AMORE @@ -122,7 +123,8 @@ int main(int argc, char **argv) { Int_t nbvdrift = 0; // number of events with entries for vdrift // setting - AliTRDrawFastStream::DisableSkipData(); + //AliTRDrawFastStream::DisableSkipData(); + AliLog::SetGlobalLogLevel(AliLog::kFatal); /* main loop (infinite) */ for(;;) { @@ -165,7 +167,7 @@ int main(int argc, char **argv) { AliRawReader *rawReader = new AliRawReaderDate((void*)event); rawReader->Select("TRD"); - Int_t result = calibra->ProcessEventDAQ2((AliRawReader *)rawReader); + Int_t result = calibra->ProcessEventDAQ3((AliRawReader *)rawReader); if(!result) passvdrift = kFALSE; else nbvdrift += (Int_t) result/2; @@ -245,4 +247,3 @@ int main(int argc, char **argv) { if (amoreDANameorig) gSystem->Setenv("AMORE_DA_NAME",amoreDANameorig); } */ - -- 2.43.0