SND@LHC Software
Loading...
Searching...
No Matches
ecalPrepare Class Reference

#include <ecalPrepare.h>

Inheritance diagram for ecalPrepare:
Collaboration diagram for ecalPrepare:

Public Member Functions

 ecalPrepare ()
 
 ecalPrepare (const char *name, Int_t iVerbose)
 
virtual ~ecalPrepare ()
 
virtual InitStatus Init ()
 
void InitPython (ecalStructure *structure)
 
virtual void Exec (Option_t *option)
 
virtual void Finish ()
 
void SetPedestal (Short_t ped=80)
 
void SetADCMax (Short_t adcmax=16384)
 
void SetADCChannel (Float_t adcchannel=1.0e-3)
 
void SetChannelMap (std::map< Int_t, Float_t > map)
 
void LoadChannelMap (const char *filename)
 
Short_t GetPedestal () const
 
Short_t GetADCMax () const
 
Float_t GetADCChannel () const
 

Private Member Functions

 ecalPrepare (const ecalPrepare &)
 Map: channel number -> ADC channel in GeV.
 
ecalPrepareoperator= (const ecalPrepare &)
 
 ClassDef (ecalPrepare, 1)
 

Private Attributes

Short_t fPedestal
 
Short_t fADCMax
 
Float_t fADCChannel
 
ecalStructurefStr
 
std::map< Int_t, Float_t > fChannelMap
 

Detailed Description

Definition at line 13 of file ecalPrepare.h.

Constructor & Destructor Documentation

◆ ecalPrepare() [1/3]

ecalPrepare::ecalPrepare ( )

Default constructor

— Default constructor ------------------------------------------------—

Definition at line 17 of file ecalPrepare.cxx.

18 : FairTask(),
19 fPedestal(80),
20 fADCMax(16384),
21 fADCChannel(1.0e-3),
22 fStr(NULL), fChannelMap()
23{
24 fChannelMap.clear();
25}
std::map< Int_t, Float_t > fChannelMap
Definition ecalPrepare.h:53
Short_t fPedestal
Definition ecalPrepare.h:44
ecalStructure * fStr
Definition ecalPrepare.h:50
Float_t fADCChannel
Definition ecalPrepare.h:48
Short_t fADCMax
Definition ecalPrepare.h:46

◆ ecalPrepare() [2/3]

ecalPrepare::ecalPrepare ( const char *  name,
Int_t  iVerbose 
)

Standard constructor. Use this

— Standard constructor. Use this -------------------------------------—

Definition at line 28 of file ecalPrepare.cxx.

29 : FairTask(name, iVerbose),
30 fPedestal(80),
31 fADCMax(16384),
32 fADCChannel(1.0e-3),
33 fStr(NULL), fChannelMap()
34{
35 fChannelMap.clear();
36}

◆ ~ecalPrepare()

ecalPrepare::~ecalPrepare ( )
virtual

Destructor

— Destructor ---------------------------------------------------------—

Definition at line 123 of file ecalPrepare.cxx.

124{
125 ;
126}

◆ ecalPrepare() [3/3]

ecalPrepare::ecalPrepare ( const ecalPrepare )
private

Map: channel number -> ADC channel in GeV.

Member Function Documentation

◆ ClassDef()

ecalPrepare::ClassDef ( ecalPrepare  ,
 
)
private

◆ Exec()

void ecalPrepare::Exec ( Option_t *  option)
virtual

Executed task

— Executed task ------------------------------------------------------—

Definition at line 88 of file ecalPrepare.cxx.

89{
90 ecalCell* cell;
91 list<ecalCell*> cells;
92 fStr->GetCells(cells);
93 list<ecalCell*>::const_iterator p=cells.begin();
94 Short_t adc;
95
96 for(;p!=cells.end();++p)
97 {
98 cell=(*p);
99 adc=cell->GetADC();
100 adc-=fPedestal; //if (adc<0) adc=0;
101 if (fChannelMap.empty())
102 cell->SetEnergy(adc*fADCChannel);
103 else
104 if (fChannelMap.find(cell->GetCellNumber())==fChannelMap.end())
105 {
106 Error("Exec", "Channel %d not found in map. Using default value!", cell->GetCellNumber());
107 //TODO: Should we insert Fatal here?
108 cell->SetEnergy(adc*fADCChannel);
109 }
110 else
111 {
112 cell->SetEnergy(adc*fChannelMap[cell->GetCellNumber()]);
113 }
114 }
115}
Int_t GetCellNumber() const
Definition ecalCell.h:40
Short_t GetADC() const
Definition ecalCell.h:38
void SetEnergy(Float_t energy)
Definition ecalCell.h:64
void GetCells(std::list< ecalCell * > &cells) const

◆ Finish()

void ecalPrepare::Finish ( )
virtual

Finish task

— Finish task --------------------------------------------------------—

Definition at line 118 of file ecalPrepare.cxx.

119{
120 ;
121}

◆ GetADCChannel()

Float_t ecalPrepare::GetADCChannel ( ) const
inline

Definition at line 41 of file ecalPrepare.h.

41{return fADCChannel;}

◆ GetADCMax()

Short_t ecalPrepare::GetADCMax ( ) const
inline

Definition at line 40 of file ecalPrepare.h.

40{return fADCMax;}

◆ GetPedestal()

Short_t ecalPrepare::GetPedestal ( ) const
inline

Definition at line 39 of file ecalPrepare.h.

39{return fPedestal;}

◆ Init()

InitStatus ecalPrepare::Init ( )
virtual

Initialization of the task

— Initialization of the task -----------------------------------------—

Definition at line 63 of file ecalPrepare.cxx.

64{
65 FairRootManager* manager=FairRootManager::Instance();
66 if (!manager)
67 {
68 Fatal("Init()", "Can't find IOManager.");
69 return kFATAL;
70 }
71
72 fStr=(ecalStructure*)manager->GetObject("EcalStructure");
73 if (!fStr)
74 {
75 Fatal("Init()", "Can't find calorimeter structure in the system.");
76 return kFATAL;
77 }
78
79 return kSUCCESS;
80}

◆ InitPython()

void ecalPrepare::InitPython ( ecalStructure structure)

Definition at line 82 of file ecalPrepare.cxx.

83{
84 fStr=structure;
85}

◆ LoadChannelMap()

void ecalPrepare::LoadChannelMap ( const char *  filename)

— Ugly load of map channel number -> ADC channel from the file -------—

Definition at line 39 of file ecalPrepare.cxx.

40{
41 map<Int_t, Float_t> tmp;
42 TString fname=filename; gSystem->ExpandPathName(fname);
43 ifstream f(filename);
44 Int_t ch;
45 Int_t i=0;
46 Float_t adc;
47
48 tmp.clear();
49 for(;;)
50 {
51 f >> ch; if (f.eof()) break;
52 f >> adc; if (f.eof()) break;
53 tmp[ch]=adc;
54 i++;
55 }
56 if (fVerbose>999)
57 Info("LoadChannelMap", "%d records read", i);
58 f.close();
59 SetChannelMap(tmp);
60}
void SetChannelMap(std::map< Int_t, Float_t > map)
Definition ecalPrepare.h:35
int i
Definition ShipAna.py:86

◆ operator=()

ecalPrepare & ecalPrepare::operator= ( const ecalPrepare )
private

◆ SetADCChannel()

void ecalPrepare::SetADCChannel ( Float_t  adcchannel = 1.0e-3)
inline

Definition at line 32 of file ecalPrepare.h.

32{fADCChannel=adcchannel;}

◆ SetADCMax()

void ecalPrepare::SetADCMax ( Short_t  adcmax = 16384)
inline

Definition at line 31 of file ecalPrepare.h.

31{fADCMax=adcmax;}

◆ SetChannelMap()

void ecalPrepare::SetChannelMap ( std::map< Int_t, Float_t >  map)
inline

Definition at line 35 of file ecalPrepare.h.

35{fChannelMap=map;}

◆ SetPedestal()

void ecalPrepare::SetPedestal ( Short_t  ped = 80)
inline

Definition at line 30 of file ecalPrepare.h.

30{fPedestal=ped;}

Member Data Documentation

◆ fADCChannel

Float_t ecalPrepare::fADCChannel
private

Definition at line 48 of file ecalPrepare.h.

◆ fADCMax

Short_t ecalPrepare::fADCMax
private

Definition at line 46 of file ecalPrepare.h.

◆ fChannelMap

std::map<Int_t, Float_t> ecalPrepare::fChannelMap
private

Definition at line 53 of file ecalPrepare.h.

◆ fPedestal

Short_t ecalPrepare::fPedestal
private

Definition at line 44 of file ecalPrepare.h.

◆ fStr

ecalStructure* ecalPrepare::fStr
private

Definition at line 50 of file ecalPrepare.h.


The documentation for this class was generated from the following files: