AliPhysics  e46d415 (e46d415)
BadChannelAna.h
Go to the documentation of this file.
1 #ifndef BADCHANNELANA_H
2 #define BADCHANNELANA_H
3 
26 
28 
29 /* Copyright(c) 1998-2016, ALICE Experiment at CERN, All rights reserved. *
30  * See cxx source for full Copyright notice
31 */
32 
33 
34 #include <Riostream.h>
35 #include <TString.h>
36 #include <TArrayD.h>
37 
38 class TH1;
39 class TH1F;
40 class TH1D;
41 class TH2F;
42 class TFile;
43 class TList;
44 
46 
47 
48 class BadChannelAna : public TObject {
49 
50 public:
51  BadChannelAna() ; // default ctor
52  ~BadChannelAna(); // dtor
53  BadChannelAna(TString period, TString train, TString trigger, Int_t runNumber,Int_t trial, TString workDir, TString listName, Bool_t runByRun=0);
54 
55  void Run(Bool_t mergeOnly=0);
56 
57  //Setters
58  void SetExternalMergedFile(TString inputName) {fExternalFileName = inputName;}
59  void SetExternalBadMap(TString inputName) {fExternalBadMapName = inputName;}
60  void SetQAChecks(Bool_t inputBool) {fTestRoutine = inputBool;}
61  void SetPrintOutput(Bool_t inputBool) {fPrint = inputBool;}
62  void SetTrackCellRecord(Bool_t inputBool) {fTrackCellRecord = inputBool;}
63  void SetStartEndCell(Int_t start, Int_t end) {fStartCell = start; fNoOfCells = end;}
64  void SetLowerBound(Double_t input) {fEndLowerBound = input;}
65  void AddManualMasking(std::vector<Int_t> cellVector) {fManualMask.swap(cellVector) ;}
66  void AddMaskSM(Int_t iSM);
67  void RunMaskSM();
68  void AddPeriodAnalysis(Int_t criteria, Double_t nsigma, Double_t emin, Double_t emax);
69 
70 protected:
71 
72  void Init();
74  void LoadExternalBadMap();
75  void BCAnalysis();
76  void PeriodAnalysis(Int_t criterum=7, Double_t nsigma = 4.0, Double_t emin=0.1, Double_t emax=2.0);
77 
78  TH1F* BuildHitAndEnergyMean(Int_t crit, Double_t emin = 0.1, Double_t emax=2.);
79  TH1F* BuildHitAndEnergyMeanScaled(Int_t crit, Double_t emin = 0.1, Double_t emax=2.);
80  TH1F* BuildTimeMean(Int_t crit, Double_t tmin, Double_t tmax);
81 
82  void FlagAsDead();
83  void FlagAsBad(Int_t crit, TH1F* inhisto, Double_t nsigma = 4., Double_t dnbins = 200);
84  void FlagAsBad_Time(Int_t crit, TH1F* inhisto, Double_t nSig = 3);
85 
87  void SummarizeResults();
88  TH1D *BuildMeanFromGood(Int_t warmIn=0);
89  Bool_t CheckDistribution(TH1* ratio, TH1* reference);
90  Bool_t IsCoveredByTRD(Int_t row, Int_t collumn);
91  void SaveBadCellsToPDF(Int_t version, TString pdfName);
92  void PlotFlaggedCells2D(Int_t flagBegin,Int_t flagEnd=-1);
93  void SaveHistoToFile();
94  void PrintCellInfo(Int_t number);
95 
96  //Settings for analysed period
106 
107  //Genergal paths
114 
115  //
118  std::vector<TArrayD> fAnalysisVector;
119 
120  //Things to be individualized by setters
128 
129  //histogram settings
134 
135  //arrays to store information
137  std::vector<Int_t> fFlag;
139  std::vector<Bool_t> fWarmCell;
140  std::vector<Int_t> fManualMask;
141  std::vector<Int_t> fSMMask;
142 
143  //Calorimeter information for the investigated runs
145 
146  TFile* fRootFile;
150  TH1F* fhCellFlag;
151  TH1F* fhCellWarm;
152 
157 
158 private:
159  BadChannelAna (const BadChannelAna&); // not implemented
160  BadChannelAna &operator=(const BadChannelAna&); // not implemented
161 
164 
165 
167  ClassDef(BadChannelAna, 2);
169 };
170 #endif
TH2F * fCellTime
! possible histogram for the analysis. Cell ID vs. time, read from the input merged file ...
TString fAnalysisOutput
The list with bad channels and histograms are saved in this folder.
TList * fOutputListGood
! list with good channel amplitudes, stored in fRootFile
void FlagAsBad_Time(Int_t crit, TH1F *inhisto, Double_t nSig=3)
TH1F * fProcessedEvents
! Stores the number of events in the run
void Run(Bool_t mergeOnly=0)
TString fQADirect
Dierctory in the QA.root files where the input histograms are stored.
TList * fOutputListBadRatio
! list with bad channel amplitude ratios, stored in fRootFile
double Double_t
Definition: External.C:58
void PlotFlaggedCells2D(Int_t flagBegin, Int_t flagEnd=-1)
Definition: External.C:236
Double_t fnEventsInRange
void SetPrintOutput(Bool_t inputBool)
Definition: BadChannelAna.h:61
void SetTrackCellRecord(Bool_t inputBool)
Definition: BadChannelAna.h:62
BadChannelAna & operator=(const BadChannelAna &)
void SaveBadCellsToPDF(Int_t version, TString pdfName)
TString fPeriod
The name of the analyzed period.
Definition: BadChannelAna.h:98
void SetExternalMergedFile(TString inputName)
Definition: BadChannelAna.h:58
TString fWorkdir
Directory which contains the folders fMergeOutput, fAnalysisInput and fAnalysisOutput. By default it is &#39;./&#39;.
TH1D * BuildMeanFromGood(Int_t warmIn=0)
Bool_t CheckDistribution(TH1 *ratio, TH1 *reference)
Bool_t fTestRoutine
This is a flag, if set true will produce some extra quality check histograms.
std::vector< Int_t > fFlag
! fFlag[CellID] = 0 (ok),1 (dead),2 and higher (bad certain criteria) start at 0 (cellID 0 = histobin...
TH1F * fAvgNHitPerEvVsCellId
! being discussed
TString fRunListFileName
This is the name of the file with the run numbers to be merged, by default it&#39;s &#39;runList.txt&#39;.
TList * fOutputListBad
! list with bad channel amplitudes, stored in fRootFile
Double_t fEndLowerBound
Lower bound.
void AddPeriodAnalysis(Int_t criteria, Double_t nsigma, Double_t emin, Double_t emax)
void FlagAsBad(Int_t crit, TH1F *inhisto, Double_t nsigma=4., Double_t dnbins=200)
void AddManualMasking(std::vector< Int_t > cellVector)
Definition: BadChannelAna.h:65
Int_t fCriterionCounter
! This value will be written in fflag and updates after each PeriodAnalysis, to distinguish the steps...
Bool_t fPrint
If set true more couts with information of the excluded cells will be printed.
int Int_t
Definition: External.C:63
Analyses cell properties and identifies bad cells.
Definition: BadChannelAna.h:48
Int_t fStartCellSM[21]
CellIDs of first cell in the 20SMs plus last cell ID.
Bool_t fRunBRunMap
Produce truely run-by-run maps in a separate folder.
TList * fOutputListGoodRatio
! list with good channel amplitude ratios, stored in fRootFile
Definition: External.C:212
TString fExternalBadMapName
Load an external bad map to test the effect on block or a given run.
TString fTrainNo
Train number of the analyszed data (can deduce pass & trigger from that etc.)
Definition: BadChannelAna.h:99
Int_t fNMaxColsAbs
Maximum No of colums in Calorimeter.
Int_t fNoOfCells
Number of cells in EMCal and DCal.
void PeriodAnalysis(Int_t criterum=7, Double_t nsigma=4.0, Double_t emin=0.1, Double_t emax=2.0)
std::vector< Int_t > fManualMask
! Is a list of cells that should be addidionally masked by hand.
std::vector< Bool_t > fWarmCell
! fWarmCell[CellID] = 0 (really bad), fWarmCell[CellID] = 1 (candidate for warm), ...
Double_t nsigma
void LoadExternalBadMap()
TH1F * fhCellWarm
! histogram that stores whether the cell was marked as warm
TString MergeRuns()
const char * pdfName
Definition: DrawAnaELoss.C:30
std::vector< Int_t > fSMMask
! fSMMask is filled with SM numbers that need to be masked by hand.
TH2F * fCellAmplitude
! main histogram for the analysis. Cell ID vs. amplitude, read from the input merged file ...
void SetQAChecks(Bool_t inputBool)
Definition: BadChannelAna.h:60
void SummarizeResultsByFlag()
TH1F * BuildTimeMean(Int_t crit, Double_t tmin, Double_t tmax)
std::vector< TArrayD > fAnalysisVector
Vector of analysis information. Each place is filled with 4 doubles: version, sigma, lower, and upper energy range.
void SetStartEndCell(Int_t start, Int_t end)
Definition: BadChannelAna.h:63
Int_t fNMaxRows
Maximum No of rows in module (phi direction)
TString fMergedFileName
Filename of the .root file containing the merged runs.
Int_t fCurrentRunNumber
A run number of an analyzed period. This is important for the AliCalorimeterUtils initialization...
Definition: BadChannelAna.h:97
void AddMaskSM(Int_t iSM)
TString fAnalysisOutputRbR
For a compact summary of true run-by-run BC maps.
TString fExternalFileName
If you have already a file that contains many runs merged together you can place it in fMergeOutput a...
TString fRunList
Thats the full path and name of the file which contains a list of all runs to be merged together...
AliCalorimeterUtils * fCaloUtils
! Calorimeter information for the investigated runs
TH1F * BuildHitAndEnergyMean(Int_t crit, Double_t emin=0.1, Double_t emax=2.)
void SetExternalBadMap(TString inputName)
Definition: BadChannelAna.h:59
TH1F * fAvgEngPerHitVsCellId
! being discussed
Bool_t fTrackCellRecord
Track the non-zero elements in the flags throughout the routine.
Int_t fTrial
Number of trial that this specific analyis is. By default &#39;0&#39; so one can try different settings witho...
TH1F * BuildHitAndEnergyMeanScaled(Int_t crit, Double_t emin=0.1, Double_t emax=2.)
Bool_t IsCoveredByTRD(Int_t row, Int_t collumn)
Int_t fStartCell
ID of the first cell you want to check.
Int_t fNMaxCols
Maximum No of colums in module (eta direction)
void PrintCellInfo(Int_t number)
bool Bool_t
Definition: External.C:53
TString fTrigger
Selected trigger for the analysis.
Class with utils specific to calorimeter clusters/cells.
TH1F * fhCellFlag
! histogram that stores by which flag the cell has been excluded
TFile * fRootFile
! root file with all histograms from this analysis
Definition: External.C:196
Int_t fCellStartDCal
ID of the first cell in the DCal.
TString fAnalysisInput
Here the .root files of each run of the period are saved.
Int_t fNMaxRowsAbs
Maximum No of rows in Calorimeter.
void SetLowerBound(Double_t input)
Definition: BadChannelAna.h:64