CGEM BOSS 6.6.5.f
BESIII Offline Software System
Loading...
Searching...
No Matches
TestInputOutput Class Reference

#include <TestInputOutput.h>

+ Inheritance diagram for TestInputOutput:

Public Member Functions

 TestInputOutput (const std::string &name, ISvcLocator *pSvcLocator)
 
 ~TestInputOutput ()
 
StatusCode initialize ()
 
StatusCode execute ()
 
StatusCode finalize ()
 
 TestInputOutput (const std::string &name, ISvcLocator *pSvcLocator)
 
 ~TestInputOutput ()
 
StatusCode initialize ()
 
StatusCode execute ()
 
StatusCode finalize ()
 
 TestInputOutput (const std::string &name, ISvcLocator *pSvcLocator)
 
 ~TestInputOutput ()
 
StatusCode initialize ()
 
StatusCode execute ()
 
StatusCode finalize ()
 
 TestInputOutput (const std::string &name, ISvcLocator *pSvcLocator)
 
 ~TestInputOutput ()
 
StatusCode initialize ()
 
StatusCode execute ()
 
StatusCode finalize ()
 
 TestInputOutput (const std::string &name, ISvcLocator *pSvcLocator)
 
 ~TestInputOutput ()
 
StatusCode initialize ()
 
StatusCode execute ()
 
StatusCode finalize ()
 
 TestInputOutput (const std::string &name, ISvcLocator *pSvcLocator)
 
 ~TestInputOutput ()
 
StatusCode initialize ()
 
StatusCode execute ()
 
StatusCode finalize ()
 
 TestInputOutput (const std::string &name, ISvcLocator *pSvcLocator)
 
 ~TestInputOutput ()
 
StatusCode initialize ()
 
StatusCode execute ()
 
StatusCode finalize ()
 
 TestInputOutput (const std::string &name, ISvcLocator *pSvcLocator)
 
 ~TestInputOutput ()
 
StatusCode initialize ()
 
StatusCode execute ()
 
StatusCode finalize ()
 
 TestInputOutput (const std::string &name, ISvcLocator *pSvcLocator)
 
 ~TestInputOutput ()
 
StatusCode initialize ()
 
StatusCode execute ()
 
StatusCode finalize ()
 

Detailed Description

Constructor & Destructor Documentation

◆ TestInputOutput() [1/9]

TestInputOutput::TestInputOutput ( const std::string &  name,
ISvcLocator *  pSvcLocator 
)

Definition at line 46 of file bak_ReadCosmicRayData-00-00-04/src/TestInputOutput.cxx.

46 :
47 Algorithm(name,pSvcLocator){
48
49 declareProperty("Dir_file", Dir_file = "Cosmic_data_01.root");
50 declareProperty("TreeDigi", TreeDigi = "t1");
51 declareProperty("CosmicRayDataSetID", CosmicRayDataSetID = "CR201909");
52
53
54}

◆ ~TestInputOutput() [1/9]

TestInputOutput::~TestInputOutput ( )

◆ TestInputOutput() [2/9]

TestInputOutput::TestInputOutput ( const std::string &  name,
ISvcLocator *  pSvcLocator 
)

◆ ~TestInputOutput() [2/9]

TestInputOutput::~TestInputOutput ( )

◆ TestInputOutput() [3/9]

TestInputOutput::TestInputOutput ( const std::string &  name,
ISvcLocator *  pSvcLocator 
)

◆ ~TestInputOutput() [3/9]

TestInputOutput::~TestInputOutput ( )

◆ TestInputOutput() [4/9]

TestInputOutput::TestInputOutput ( const std::string &  name,
ISvcLocator *  pSvcLocator 
)

◆ ~TestInputOutput() [4/9]

TestInputOutput::~TestInputOutput ( )

◆ TestInputOutput() [5/9]

TestInputOutput::TestInputOutput ( const std::string &  name,
ISvcLocator *  pSvcLocator 
)

◆ ~TestInputOutput() [5/9]

TestInputOutput::~TestInputOutput ( )

◆ TestInputOutput() [6/9]

TestInputOutput::TestInputOutput ( const std::string &  name,
ISvcLocator *  pSvcLocator 
)

◆ ~TestInputOutput() [6/9]

TestInputOutput::~TestInputOutput ( )

◆ TestInputOutput() [7/9]

TestInputOutput::TestInputOutput ( const std::string &  name,
ISvcLocator *  pSvcLocator 
)

◆ ~TestInputOutput() [7/9]

TestInputOutput::~TestInputOutput ( )

◆ TestInputOutput() [8/9]

TestInputOutput::TestInputOutput ( const std::string &  name,
ISvcLocator *  pSvcLocator 
)

◆ ~TestInputOutput() [8/9]

TestInputOutput::~TestInputOutput ( )

◆ TestInputOutput() [9/9]

TestInputOutput::TestInputOutput ( const std::string &  name,
ISvcLocator *  pSvcLocator 
)

◆ ~TestInputOutput() [9/9]

TestInputOutput::~TestInputOutput ( )

Member Function Documentation

◆ execute() [1/9]

StatusCode TestInputOutput::execute ( )

cout<<"testing layer: "<<CgemID::layer(ident) <<" sheet: "<<CgemID::sheet(ident) <<" strip: "<<CgemID::strip(ident) <<" charge: "<<(*iDigiCol)->getCharge_fc() <<" time: "<<(*iDigiCol)->getTime_ns()<<endl;

Definition at line 131 of file bak_ReadCosmicRayData-00-00-04/src/TestInputOutput.cxx.

131 {
132 MsgStream log(msgSvc(), name());
133 cout << "->TestInputOutput::execute" << endl;
134
135
136 bool gotit = GetReferenceFromGRAAL();
137 if(gotit == false)
138 cout<<"Could not accesss Reference Histo!"<<endl;
139
140
141 //interface to event data service
142 ISvcLocator* svcLocator = Gaudi::svcLocator();
143 StatusCode sc=svcLocator->service("EventDataSvc", m_evtSvc);
144 if (sc.isFailure())
145 cout<<"Could not accesss EventDataSvc!"<<endl;
146
147 //retrieve CGEM digits from TDS
148 SmartDataPtr<CgemDigiCol> aDigiCol(m_evtSvc,"/Event/Digi/CgemDigiCol");
149 if(!aDigiCol)
150 cout<<"Could not retrieve CGEM digi collection"<<endl;
151
152 int nhit = aDigiCol->size();
153 int nhit_L1_x = 0;
154 int nhit_L2_x = 0;
155 int nhit_L1_v = 0;
156 int nhit_L2_v = 0;
157 CgemDigiCol::iterator iDigiCol;
158 for(iDigiCol=aDigiCol->begin(); iDigiCol!=aDigiCol->end(); iDigiCol++)
159 {
160 const Identifier ident = (*iDigiCol)->identify();
161
162 /**
163 cout<<"testing layer: "<<CgemID::layer(ident)
164 <<" sheet: "<<CgemID::sheet(ident)
165 <<" strip: "<<CgemID::strip(ident)
166 <<" charge: "<<(*iDigiCol)->getCharge_fc()
167 <<" time: "<<(*iDigiCol)->getTime_ns()<<endl;
168 **/
169 int layerid = CgemID::layer(ident);
170 int stripid = CgemID::strip(ident);
171 bool is_xstrip = CgemID::is_xstrip(ident);
172 double charge = (*iDigiCol)->getCharge_fc();
173 double time = (*iDigiCol)->getTime_ns();
174
175 if(is_xstrip == 1) {
176
177 if(layerid == 0) { // LAYER 1, x strips
178 hcharge_L1_x->Fill(charge);
179 htime_L1_x->Fill(time);
180 hstripid_L1_x->Fill(stripid);
181 nhit_L1_x++;
182 }
183 else if(layerid == 1) { // LAYER 2, x strips
184 hcharge_L2_x->Fill(charge);
185 htime_L2_x->Fill(time);
186 hstripid_L2_x->Fill(stripid);
187 nhit_L1_v++;
188 }
189 }
190 else {
191 if(layerid ==0) { // LAYER 1, v strips
192 hcharge_L1_v->Fill(charge);
193 htime_L1_v->Fill(time);
194 hstripid_L1_v->Fill(stripid);
195 nhit_L2_x++;
196 }
197 else if(layerid == 1) { // LAYER 2, v strips
198 hcharge_L2_v->Fill(charge);
199 htime_L2_v->Fill(time);
200 hstripid_L2_v->Fill(stripid);
201 nhit_L2_v++;
202 }
203 }
204 }
205
206 hnhit_L1_x->Fill(nhit_L1_x);
207 hnhit_L1_v->Fill(nhit_L1_v);
208 hnhit_L2_x->Fill(nhit_L2_x);
209 hnhit_L2_v->Fill(nhit_L2_v);
210
211 cout<<"end of retrieve CGEM digi collection " << nhit <<endl;
212
213 // if(Ind_Entry_D==No_Entries_D-1)
214 // {
215 // log << MSG::INFO << "scheduling a event processing stop...." << endreq;
216 // SmartIF<IEventProcessor> ep(serviceLocator());
217 // if (ep) ep->stopRun();
218 // }
219
220 return StatusCode::SUCCESS;
221}
Double_t time
static int strip(const Identifier &id)
static int layer(const Identifier &id)
static bool is_xstrip(const Identifier &id)

◆ execute() [2/9]

StatusCode TestInputOutput::execute ( )

◆ execute() [3/9]

StatusCode TestInputOutput::execute ( )

◆ execute() [4/9]

StatusCode TestInputOutput::execute ( )

◆ execute() [5/9]

StatusCode TestInputOutput::execute ( )

◆ execute() [6/9]

StatusCode TestInputOutput::execute ( )

◆ execute() [7/9]

StatusCode TestInputOutput::execute ( )

◆ execute() [8/9]

StatusCode TestInputOutput::execute ( )

◆ execute() [9/9]

StatusCode TestInputOutput::execute ( )

◆ finalize() [1/9]

StatusCode TestInputOutput::finalize ( )

Definition at line 223 of file bak_ReadCosmicRayData-00-00-04/src/TestInputOutput.cxx.

223 {
224 MsgStream log(msgSvc(),name());
225 log << MSG::INFO << "TestInputOutput finalize()" << endreq;
226 output->Write();
227
228 CheckIO();
229 return StatusCode::SUCCESS;
230}

◆ finalize() [2/9]

StatusCode TestInputOutput::finalize ( )

◆ finalize() [3/9]

StatusCode TestInputOutput::finalize ( )

◆ finalize() [4/9]

StatusCode TestInputOutput::finalize ( )

◆ finalize() [5/9]

StatusCode TestInputOutput::finalize ( )

◆ finalize() [6/9]

StatusCode TestInputOutput::finalize ( )

◆ finalize() [7/9]

StatusCode TestInputOutput::finalize ( )

◆ finalize() [8/9]

StatusCode TestInputOutput::finalize ( )

◆ finalize() [9/9]

StatusCode TestInputOutput::finalize ( )

◆ initialize() [1/9]

StatusCode TestInputOutput::initialize ( )

Definition at line 58 of file bak_ReadCosmicRayData-00-00-04/src/TestInputOutput.cxx.

58 {
59 MsgStream log(msgSvc(), name());
60 log << MSG::INFO << "TestInputOutput initialize()" << endreq;
61
62 output = new TFile("IOtest_histo.root", "RECREATE");
63
64 // --------------- CgemBoss
65 // x
66 hnhit_L1_x = new TH1F("hnhit_L1_x", "number of hits on layer 1, x srtips", MAXNOFHITS, 0, MAXNOFHITS);
67 hnhit_L2_x = new TH1F("hnhit_L2_x", "number of hits on layer 2, x srtips", MAXNOFHITS, 0, MAXNOFHITS);
68 hcharge_L1_x = new TH1F("hcharge_L1_x", "hcharge on layer 1, x srtips", 50, 0, 50);
69 hcharge_L2_x = new TH1F("hcharge_L2_x", "hcharge on layer 2, x strips", 50, 0, 50);
70 htime_L1_x = new TH1F("htime_L1_x", "htime_L1, x strips", 500, -300, 300);
71 htime_L2_x = new TH1F("htime_L2_x", "htime_L2, x strips", 500, -300, 300);
72 hstripid_L1_x = new TH1F("hstripid_L1_x", "strip IDs of hits on layer 1, x srtips", CgemID::getXSTRIP_MAX(0), 0, CgemID::getXSTRIP_MAX(0));
73 hstripid_L2_x = new TH1F("hstripid_L2_x", "strip IDs of hits on layer 2, x srtips", CgemID::getXSTRIP_MAX(1), 0, CgemID::getXSTRIP_MAX(1));
74
75 // v
76 hnhit_L1_v = new TH1F("hnhit_L1_v", "number of hits on layer 1, v srtips", MAXNOFHITS, 0, MAXNOFHITS);
77 hnhit_L2_v = new TH1F("hnhit_L2_v", "number of hits on layer 2, v srtips", MAXNOFHITS, 0, MAXNOFHITS);
78 hcharge_L1_v = new TH1F("hcharge_L1_v", "hcharge on layer 1, v srtips", 50, 0, 50);
79 hcharge_L2_v = new TH1F("hcharge_L2_v", "hcharge on layer 2, v strips", 50, 0, 50);
80 htime_L1_v = new TH1F("htime_L1_v", "htime_L1, v strips", 500, -300, 300);
81 htime_L2_v = new TH1F("htime_L2_v", "htime_L2, v strips", 500, -300, 300);
82 hstripid_L1_v = new TH1F("hstripid_L1_v", "strip IDs of hits on layer 1, v srtips", CgemID::getVSTRIP_MAX(0), 0, CgemID::getVSTRIP_MAX(0));
83 hstripid_L2_v = new TH1F("hstripid_L2_v", "strip IDs of hits on layer 2, v srtips", CgemID::getVSTRIP_MAX(1), 0, CgemID::getVSTRIP_MAX(1));
84
85 // ----------------- GRAAL
86 // x
87 hnhit_L1_x_GRAAL = new TH1F("hnhit_L1_x_GRAAL", "GRAAL: number of hits on layer 1, x srtips", MAXNOFHITS, 0, MAXNOFHITS);
88 hnhit_L2_x_GRAAL = new TH1F("hnhit_L2_x_GRAAL", "GRAAL: number of hits on layer 2, x srtips", MAXNOFHITS, 0, MAXNOFHITS);
89 hcharge_L1_x_GRAAL = new TH1F("hcharge_L1_x_GRAAL", "GRAAL: hcharge on layer 1, x srtips", 50, 0, 50);
90 hcharge_L2_x_GRAAL = new TH1F("hcharge_L2_x_GRAAL", "GRAAL: hcharge on layer 2, x strips", 50, 0, 50);
91 htime_L1_x_GRAAL = new TH1F("htime_L1_x_GRAAL", "GRAAL: htime_L1, x strips", 500, -300, 300);
92 htime_L2_x_GRAAL = new TH1F("htime_L2_x_GRAAL", "GRAAL: htime_L2, x strips", 500, -300, 300);
93 hstripid_L1_x_GRAAL = new TH1F("hstripid_L1_x_GRAAL", "GRAAL: strip IDs of hits on layer 1, x srtips",
95 hstripid_L2_x_GRAAL = new TH1F("hstripid_L2_x_GRAAL", "GRAAL: strip IDs of hits on layer 2, x srtips",
97
98 // v
99 hnhit_L1_v_GRAAL = new TH1F("hnhit_L1_v_GRAAL", "GRAAL: number of hits on layer 1, v srtips", MAXNOFHITS, 0, MAXNOFHITS);
100 hnhit_L2_v_GRAAL = new TH1F("hnhit_L2_v_GRAAL", "GRAAL: number of hits on layer 2, v srtips", MAXNOFHITS, 0, MAXNOFHITS);
101 hcharge_L1_v_GRAAL = new TH1F("hcharge_L1_v_GRAAL", "GRAAL: hcharge on layer 1, v srtips", 50, 0, 50);
102 hcharge_L2_v_GRAAL = new TH1F("hcharge_L2_v_GRAAL", "GRAAL: hcharge on layer 2, v strips", 50, 0, 50);
103 htime_L1_v_GRAAL = new TH1F("htime_L1_v_GRAAL", "GRAAL: htime_L1, v strips", 500, -300, 300);
104 htime_L2_v_GRAAL = new TH1F("htime_L2_v_GRAAL", "GRAAL: htime_L2, v strips", 500, -300, 300);
105 hstripid_L1_v_GRAAL = new TH1F("hstripid_L1_v_GRAAL", "GRAAL: strip IDs of hits on layer 1, v srtips",
107 hstripid_L2_v_GRAAL = new TH1F("hstripid_L2_v_GRAAL", "GRAAL: strip IDs of hits on layer 2, v srtips",
109
110
111 TString TDir_file(Dir_file);
112 f = new TFile(TDir_file);
113 TString TTreeDigi(TreeDigi);
114 Tdigi = (TTree*)f->Get(TTreeDigi);
115
116 // Get Cgem digi tree
117 Tdigi->SetBranchAddress("nGemHit", &m_nGemHit); // nof GEM hits
118 // information on the IDs
119 Tdigi->SetBranchAddress("GemHit_plane", m_plane); // plane
120 Tdigi->SetBranchAddress("GemHit_view", m_view); // view (axial or stereo strips)
121 Tdigi->SetBranchAddress("GemHit_strip", m_strip); // strip no.
122 // physical information
123 Tdigi->SetBranchAddress("GemHit_q", m_charge); // charge (fC)
124 Tdigi->SetBranchAddress("GemHit_time", m_time); // time (ns)
125
126 Ind_Entry_D = 0;
127
128 return StatusCode::SUCCESS;
129}
static value_type getXSTRIP_MAX(unsigned int f_layer)
static value_type getVSTRIP_MAX(unsigned int f_layer)

◆ initialize() [2/9]

StatusCode TestInputOutput::initialize ( )

◆ initialize() [3/9]

StatusCode TestInputOutput::initialize ( )

◆ initialize() [4/9]

StatusCode TestInputOutput::initialize ( )

◆ initialize() [5/9]

StatusCode TestInputOutput::initialize ( )

◆ initialize() [6/9]

StatusCode TestInputOutput::initialize ( )

◆ initialize() [7/9]

StatusCode TestInputOutput::initialize ( )

◆ initialize() [8/9]

StatusCode TestInputOutput::initialize ( )

◆ initialize() [9/9]

StatusCode TestInputOutput::initialize ( )

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