// using timestamp for the clock counts // and timestamperr to store the spill resets (just a temporary solution) #include "PndMvdConvertApv.h" //#include "TsEvent.h" #include "PndMvdSiHit.h" #include "PndMvdApvHit.h" #include "PndSdsDigiStrip.h" #include "TString.h" #include #include #include using namespace std; // ----- Constructor -------------------------------------------- PndMvdConvertApv::PndMvdConvertApv(const TString& CalibFileName, const TString& HitFileName): fCalibPars(), fNofEvents(0), fEvent(-1), fLastEvent(0), fNoCalib(kFALSE), fHitFileName(""), fDataFile(), fhitlist(), fTopModuleID(0), fBottomModuleID(0), fFake(kFALSE), f(NULL), t(NULL), tsEv(NULL), arr(NULL), fGeoH(NULL) { f = new TFile(HitFileName); fGeoH = PndGeoHandling::Instance(); t = (TTree*) f->Get("T"); tsEv = new PndMvdTsEvent(); arr = new TClonesArray("PndMvdSiHit"); cout << "---------------------------------------" << endl; cout << "Number of events: " << t->GetEntries() << endl; cout << "---------------------------------------" << endl; t->SetBranchAddress("events",&tsEv); cout << t->GetEntries() << " events in File" << endl; //LoadCalibration(CalibFileName, fes); LoadCalibration(CalibFileName); fNofEvents=t->GetEntries(); cout<<"** end of PndMvdConvertApv::PndMvdConvertApv(const TString& , const TString&) **"< fes) void PndMvdConvertApv::LoadCalibration(TString CalibFileName) { std::ifstream calibfile(CalibFileName); if(!calibfile) { cout<<"Calibration file not found"<>c; if (calibfile.eof()) break; if (!isdigit(c)) { char str[256]; calibfile.getline(str,256); continue; } calibfile.putback(c); int boxID, channel; double value; calibfile >> boxID >> channel >> value; //for(unsigned int vec=0;vec PndMvdConvertApv::Calc(std::vector hitlist) { std::vector result; for(UInt_t hitnumber=0;hitnumber e !!! }else{ if (fCalibPars[hitlist[hitnumber].GetModuleID()].size()) { if (fCalibPars[hitlist[hitnumber].GetModuleID()][hitlist[hitnumber].GetChannel()]) { q=fCalibPars[hitlist[hitnumber].GetModuleID()][hitlist[hitnumber].GetChannel()]*(hitlist[hitnumber].GetADC())*1000.; // in electrons } } } //TString detPath="Module"; //Int_t modId=-1; //[R.K.02/2017] Unused variable? //if(fFake) //[R.K.02/2017] Unused variable? //{ //[R.K.02/2017] Unused variable? //if(fTopModuleID==hitlist[hitnumber].GetModuleID() || fBottomModuleID==hitlist[hitnumber].GetModuleID()) //modId = 1; //[R.K.02/2017] Unused variable? //if(fBottomModuleID==hitlist[hitnumber].GetModuleID()) hitlist[hitnumber].SetFeID(hitlist[hitnumber].GetFeID()+3); //[R.K.02/2017] Unused variable? //}else{ //[R.K.02/2017] Unused variable? //modId = hitlist[hitnumber].GetModuleID(); //[R.K.02/2017] Unused variable? //} //[R.K.02/2017] Unused variable? /* detPath+=modId; detPath+="Rect"; // std::cout<FindVolumeFast(detPath); TGeoVolume* Vol=0; if(Vol!=0) { // std::cout<GetName()<GetNode(-1)->cd(); detPath="/SiliconTestStation_1/DummysensorAss_0/"; detPath+=Vol->GetName(); detPath+="_0"; gGeoManager->cd(detPath.Data()); } else { // std::cout<<" -E- PndMvdConvertApv::Calc(): "<GetPath()<GetName(); // detPath = Vol->GetName(); // std::cout << "write Digi with "<< detPath.Data()<<" ( "<GetID(detPath)<<" )"< PndMvdConvertApv::ReadNext() { std::vector digiList; //bool work=true; //int triggID=0; int fe=0; //int ts=0; int frame=0; int ch=0; int l=0; int moduleID=0; double q=0.; long int ev=0; UInt_t ClockReset = 0.; ULong64_t ClockCounts = 0.; if (fEvent >= -1 && fEvent <= fNofEvents) { t->GetEvent(fEvent); ClockCounts = tsEv->GetExtClockTimeStamp(ClockReset); // Storing ClockReset in fTriggerID // Storing ClockCounts in fTimestamp arr = tsEv->GetSiHitList(); fhitlist.clear(); for (Int_t kk = 0 ; kk < arr->GetEntries() ; kk++) { PndMvdSiHit *hit = (PndMvdSiHit*) arr->At(kk); ev = tsEv->GetEventId(); //fe = (Int_t) (hit->fChannel)/128; //ch = (Int_t) (hit->fChannel)%128; ch = (Int_t) (hit->fChannel); q = hit->fAdc; l = hit->fNumFrames; moduleID = hit->fBox; //if(fhitlist.size()>20) fhitlist.clear(); // digiList = Calc(fhitlist); fLastEvent=ev; //PndMvdApvHit Hit(ev, moduleID, fe, triggID, ts, frame, ch, q, l); PndMvdApvHit Hit(ev, moduleID, fe, ClockReset, ClockCounts, frame, ch, q, l); //cout << "Ev. " << fEvent << ", trigg: " << triggID << ", sens: " << moduleID << ", ch: " << ch << ", fe: " << (Int_t) (hit->fChannel)/128 << ", channel: " << (Int_t) (hit->fChannel)%128 << endl; fhitlist.push_back(Hit); } //if(fhitlist.size()>20) fhitlist.clear(); digiList = Calc(fhitlist); fEvent++; } if(!(fEvent%10000)) cout<<"[ "<<(fEvent*100)/fNofEvents<<" %] "< PndMvdConvertApv::ReadAll() { std::vector result; while(fEvent!=fNofEvents) { std::vector dummy=ReadNext(); for(unsigned int i=0;i