// //
// AliTRDCalibChamberStatus: to determine which half chambers are off //
// Produce a AliTRDCalChamberStatus calibration object //
-// Check with the AliTRDCalDCSFEE info //
+// Check with the AliTRDCalDCSFEEv2 info //
// //
// //
// Authors: //
#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 "./Cal/AliTRDCalDCSv2.h"
+#include "./Cal/AliTRDCalDCSFEEv2.h"
#include "AliTRDrawStream.h"
+#include "AliTRDseedV1.h"
+#include "AliTRDcluster.h"
#ifdef ALI_DATE
#include "event.h"
}
//_____________________________________________________________________
-void AliTRDCalibChamberStatus::ProcessEvent(AliRawReader * rawReader, Int_t nevents_physics)
+void AliTRDCalibChamberStatus::ProcessTrack(const AliTRDtrackV1 * trdTrack)
{
//
- // Event Processing loop
+ // Track Processing to get half chamber status
//
//
- Bool_t notEmpty = kFALSE;
-
- AliTRDrawFastStream *rawStream = new AliTRDrawFastStream(rawReader);
- if (!rawStream) return;
- rawStream->SetNoErrorWarning();
- rawStream->SetSharedPadReadout(kFALSE);
-
- AliTRDdigitsManager *digitsManager = new AliTRDdigitsManager(kTRUE);
- if (!digitsManager) return;
- 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;
+ const AliTRDseedV1 *tracklet = 0x0;
+ AliTRDcluster *cluster;
+ //////////////////////////////////////
+ // Loop tracklets
+ /////////////////////////////////////
+ for(Int_t itr = 0; itr < 6; ++itr){
- //---------//
- // 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 //
- //---------//
+ if(!(tracklet = trdTrack->GetTracklet(itr))) continue;
+ if(!tracklet->IsOK()) continue;
+
+ // Loop on clusters
+ for(int ic=0; ic<AliTRDseedV1::kNtb; ++ic){
+ if((cluster = tracklet->GetClusters(ic))) {
+ //printf("ic %d\n",ic);
+ break;
}
-
}
- digitsManager->ClearArrays(det);
+ if(!cluster) continue;
+
+ Int_t det = cluster->GetDetector();
+ Int_t layer = AliTRDgeometry::GetLayer(det);
+ Int_t sm = AliTRDgeometry::GetSector(det);
+ Int_t stac = AliTRDgeometry::GetStack(det);
+
+ Int_t col = cluster->GetPadCol();
+ Int_t iMcm = (Int_t)(col/18); // current group of 18 col pads
+ Double_t rphi = 0.5;
+ if(iMcm > 3) rphi = 1.5;
+
+ Double_t val[4] = {sm,layer,stac,rphi};
+ if(fHnSparseI->GetBinContent((const Int_t*)val)<2147483646) fHnSparseI->Fill(&val[0]);
}
-
- if(notEmpty) fCounterEventNotEmpty++;
-
- delete digitsManager;
- delete rawStream;
-
-}//_____________________________________________________________________
-void AliTRDCalibChamberStatus::ProcessEvent3(AliRawReader * rawReader, Int_t nevents_physics)
+
+}
+//_____________________________________________________________________
+void AliTRDCalibChamberStatus::ProcessEvent(AliRawReader * rawReader, Int_t nevents_physics)
{
//
// Event Processing loop with AliTRDrawStream
}
//_____________________________________________________________________
-void AliTRDCalibChamberStatus::AnalyseHisto() /*FOLD00*/
+void AliTRDCalibChamberStatus::AnalyseHisto(Int_t limit, Double_t chamberlimit) /*FOLD00*/
{
//
// Create the AliTRDCalChamberStatus according to the fHnSparseI
if(fCalChamberStatus) delete fCalChamberStatus;
fCalChamberStatus = new AliTRDCalChamberStatus();
- // Check if enough events to say something
- if(fCounterEventNotEmpty < 200) {
- // Say all installed
- for (Int_t ism=0; ism<18; ism++) {
- for (Int_t ipl=0; ipl<6; ipl++) {
- for (Int_t istack=0; istack<5; istack++) {
- // layer, stack, sector
- Int_t det = AliTRDgeometry::GetDetector(ipl,istack,ism);
- fCalChamberStatus->SetStatus(det,1);
- }
- }
+ //printf("test0\n");
+
+ // Check if enough events/tracklets per halfchamber to say something
+ Double_t mean=0.0; //number of tracklets per HCS
+ Int_t coord2[4];
+ for(Int_t bin = 0; bin < fHnSparseI->GetNbins(); bin++) {
+ //if(fHnSparseI->GetBinContent(bin,coord2)==0.0) printf(" bin shouldnt be empty!!\n");
+ mean+=fHnSparseI->GetBinContent(bin,coord2);
+ }
+ if(fHnSparseI->GetNbins() > 0.0) mean/=fHnSparseI->GetNbins();
+ //printf(" mean tracklets per halfchamber %.3e \n",mean);
+ if((fCounterEventNotEmpty < limit) && (mean < limit)) {
+ // Say all good
+ for (Int_t idet=0; idet<540; idet++) {
+ fCalChamberStatus->SetStatus(idet,AliTRDCalChamberStatus::kGood);
}
return;
}
- // Mask out all chambers
- for (Int_t ism=0; ism<18; ism++) {
- for (Int_t ipl=0; ipl<6; ipl++) {
- for (Int_t istack=0; istack<5; istack++) {
- // layer, stack, sector
- Int_t det = AliTRDgeometry::GetDetector(ipl,istack,ism);
- fCalChamberStatus->SetStatus(det,2);
- }
- }
+ //printf("test1\n");
+
+ // set all chambers to NoData
+ for (Int_t idet=0; idet<540; idet++) {
+ fCalChamberStatus->SetStatus(idet,AliTRDCalChamberStatus::kNoData);
}
- // Unmask good chambers
+ // set status according to fHnSparseI
Int_t coord[4];
for(Int_t bin = 0; bin < fHnSparseI->GetNbins(); bin++) {
- fHnSparseI->GetBinContent(bin,coord);
- // layer, stack, sector
+ Double_t content = fHnSparseI->GetBinContent(bin,coord);
+
+ // layer, stack, sector
Int_t detector = AliTRDgeometry::GetDetector(coord[1]-1,coord[2]-1,coord[0]-1);
-
+
+ if(content<chamberlimit*mean) {
+ //printf("Number of entries for detector %03d-%s: %.3e -> %.3f \n",detector,(coord[3]-1==0?"A":"B"),content,content/mean);
+ continue;
+ }
//
// Check which halfchamber side corresponds to the bin number (0=A, 1=B)
// Change the status accordingly
//
-
- switch(fCalChamberStatus->GetStatus(detector))
- {
- case 1: break; // no changes
- case 2:
- if(coord[3]-1==0) {
- fCalChamberStatus->SetStatus(detector,4); break; // only SideB is masked
- }
- else {
- fCalChamberStatus->SetStatus(detector,3); break; // only SideA is masked
- }
- case 3: fCalChamberStatus->SetStatus(detector,1); break; // unmask SideA
- case 4: fCalChamberStatus->SetStatus(detector,1); break; // unmask SideB
- }
+ if(coord[3]-1==0) { // HCS-A
+ fCalChamberStatus->SetStatus(detector,AliTRDCalChamberStatus::kGood);
+ fCalChamberStatus->UnsetStatusBit(detector,AliTRDCalChamberStatus::kNoDataHalfChamberSideA); // A has data
+ //fCalChamberStatus->UnsetStatusBit(detector,AliTRDCalChamberStatus::kNoData);
+ }
+ else { //HCS-B
+ fCalChamberStatus->SetStatus(detector,AliTRDCalChamberStatus::kGood);
+ fCalChamberStatus->UnsetStatusBit(detector,AliTRDCalChamberStatus::kNoDataHalfChamberSideB); // B has data
+ //fCalChamberStatus->UnsetStatusBit(detector,AliTRDCalChamberStatus::kNoData);
+ }
}
+ // printf
+ //for (Int_t idet=0; idet<540; idet++) {
+ // if(fCalChamberStatus->IsNoData(idet)) printf("No Data: chamber %d\n",idet);
+ //}
+
}
//_____________________________________________________________________
-void AliTRDCalibChamberStatus::CheckEORStatus(AliTRDCalDCS *calDCS) /*FOLD00*/
+void AliTRDCalibChamberStatus::CheckEORStatus(const AliTRDCalDCSv2 *calDCS) /*FOLD00*/
{
//
- // Correct the AliTRDCalChamberStatus according to the AliTRDCalDCS
+ // Correct the AliTRDCalChamberStatus according to the AliTRDCalDCSv2
// Using globale state of the HalfChamberMerger (HCM)
//
for(Int_t det = 0; det < 540; det++) {
- AliTRDCalDCSFEE* calDCSFEEEOR = calDCS->GetCalDCSFEEObj(det);
+ AliTRDCalDCSFEEv2* calDCSFEEEOR = calDCS->GetCalDCSFEEObj(det);
if(!calDCSFEEEOR) continue;
//---------------------------------------
// Change the status according to DCS
//---------------------------------------
- Int_t StatusData = fCalChamberStatus->GetStatus(det);
- switch(StatusData)
+ Int_t statusData = fCalChamberStatus->GetStatus(det);
+ switch(statusData)
{
case 1:
if(stateA==0 && stateB==0) fCalChamberStatus->SetStatus(det,2); // completely masked from DCS
}
//_____________________________________________________________________________________
-void AliTRDCalibChamberStatus::Add(AliTRDCalibChamberStatus *calibChamberStatus) /*FOLD00*/
+void AliTRDCalibChamberStatus::Add(const AliTRDCalibChamberStatus *calibChamberStatus) /*FOLD00*/
{
//
// Add the THnSparseI of this calibChamberStatus
}
//_____________________________________________________________________
-TH2F *AliTRDCalibChamberStatus::MakeHisto2DSmPlEORStatus(AliTRDCalDCS *calDCS, Int_t sm, Int_t pl) /*FOLD00*/
+TH2F *AliTRDCalibChamberStatus::MakeHisto2DSmPlEORStatus(const AliTRDCalDCSv2 *calDCS, Int_t sm, Int_t pl) /*FOLD00*/
{
//
// Plot globale state of the HalfChamberMerger (HCM)
Double_t col0 = padPlane0->GetCol0();
char name[1000];
- sprintf(name,"%s DCS status sm %d pl %d",GetTitle(),sm,pl);
+ snprintf(name,1000,"%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));
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);
+ AliTRDCalDCSFEEv2* calDCSFEEEOR = calDCS->GetCalDCSFEEObj(det);
if(!calDCSFEEEOR) { continue;}
for (Int_t icol=0; icol<ncols; icol++){
Int_t nrows = 16;
// Take the value
Int_t mcm = paramfee->GetMCMfromPad(irow,icol);
Int_t rob = paramfee->GetROBfromPad(irow,icol);
- Int_t state = calDCSFEEEOR->GetMCMGlobalState(rob,mcm);
+ if(mcm < 0) AliWarning("Problem with mcm number");
+ Int_t state = calDCSFEEEOR->GetMCMGlobalState(rob,TMath::Abs(mcm));
his->SetBinContent(binz,biny,state);
}
}
}
//_____________________________________________________________________________
-TCanvas* AliTRDCalibChamberStatus::PlotHistos2DSmEORStatus(AliTRDCalDCS *calDCS, Int_t sm, const Char_t *name)
+TCanvas* AliTRDCalibChamberStatus::PlotHistos2DSmEORStatus(AliTRDCalDCSv2 *calDCS, Int_t sm, const Char_t *name)
{
//
// Make 2D graph
}
+