21 #include <TClonesArray.h>
34 , fOutputFileName(
"test.dat")
52 Int_t nofDigis = fDigis->GetEntriesFast();
54 for (Int_t ifile = 0; ifile < fNofOutputFiles; ifile++) {
55 fOutputFiles[ifile] <<
"EVENT BEGIN; RUNID = " << fRunId <<
"; MCENTRYNO = " << fMCEntryNo
56 <<
"; PARTNO = " << ifile <<
";" << std::endl;
59 for (Int_t iDigi = 0; iDigi < nofDigis; iDigi++) {
63 Int_t feId = currentDigi->
GetFeID();
64 Int_t col = currentDigi->
GetCol();
65 Int_t row = currentDigi->
GetRow();
66 Double_t charge = currentDigi->
GetCharge();
69 if (fDivideLevel == 1) {
70 fileToSave = detId / 256 - 1;
71 }
else if (fDivideLevel == 2) {
72 fileToSave = (detId / 256 - 1) * 4 + (detId % 256 - 1);
74 fOutputFiles[fileToSave] << detId <<
" " << feId <<
" " << col <<
" " << row <<
" " << charge << std::endl;
77 for (Int_t ifile = 0; ifile < fNofOutputFiles; ifile++) {
78 fOutputFiles[ifile] <<
"EVENT END" << std::endl;
90 LOG(fatal) <<
"No FairRootManager";
91 fDigis =
static_cast<TClonesArray*
>(ioman->
GetObject(
"PixelDigis"));
94 LOG(warn) <<
"PixelDigiWriteToFile::Init() No input PixelDigis array!";
96 LOG(info) <<
"-I- " << fName.Data() <<
"::Init(). Initialization succesfull.";
100 if (fDivideLevel == 0) {
102 fOutputFiles[0].open(fOutputFileName.Data(), std::fstream::out);
104 if (fDivideLevel == 1) {
106 }
else if (fDivideLevel == 2) {
107 fNofOutputFiles = 12;
109 LOG(fatal) <<
"PixelDigiWriteToFile::Init(), fDivideLevel = " << fDivideLevel
110 <<
" unknown, it has to be in the range <0,2>";
114 for (Int_t ifile = 0; ifile < fNofOutputFiles; ifile++) {
115 TString fileName = fOutputFileName;
116 TString uniqFile = Form(
".p%d.", ifile);
117 fileName.Replace(fileName.Last(
'.'), 1, uniqFile.Data());
118 fOutputFiles[ifile].open(fileName.Data(), std::fstream::out);
131 LOG(fatal) <<
"No FairRootManager found.";
140 void PixelDigiWriteToFile::Finish()
142 for (Int_t ifile = 0; ifile < fNofOutputFiles; ifile++) {
143 fOutputFiles[ifile].close();
virtual ~PixelDigiWriteToFile()
static FairRootManager * Instance()
ClassImp(FairEventBuilder)
TObject * GetObject(const char *BrName)
virtual void Exec(Option_t *opt)