00001 #include <iostream>
00002 #include <fstream>
00003 #include <istream>
00004 #include <sstream>
00005 using namespace std;
00006
00007 #include <TPad.h>
00008 #include <TH2.h>
00009 #include <TF1.h>
00010 #include <TEnv.h>
00011
00012 #include <TPaveStats.h>
00013 #include <TStyle.h>
00014 #include <TROOT.h>
00015 #include <TSystem.h>
00016 #include <TMath.h>
00017
00018 #include <StMessMgr.h>
00019
00020 #include "BemcTwMask.h"
00021
00022
00023 BemcTwMask::BemcTwMask()
00024 : txtH(0)
00025 , nMask(0)
00026 {
00027 }
00028
00029
00030 BemcTwMask::~BemcTwMask()
00031 {
00032 if (txtH) delete txtH; txtH = 0;
00033 }
00034
00035
00036 void BemcTwMask::clear() {
00037 for (int i = 0;i < nPl;i++) {
00038 crG[i].Clear();
00039 crG2[i].Clear();
00040 }
00041 nMask = 0;
00042 memset(crCh, 0, sizeof(crCh));
00043 if (txtH) txtH->Clear();
00044 }
00045
00046
00047 bool useBtowMask(const Char_t *fname, BemcTwMask *m) {
00048 if (!(fname && fname[0] && m)) return false;
00049
00050 LOG_INFO << "BEMCPlots::useTwMask(\"" << fname << "\") ..." << endm;
00051
00052 string line;
00053 Int_t softid, cr, seq, TWmask, HTmask ,TPmask, tp;
00054 Int_t plot, channelinplot, nok=0;
00055 Float_t ped;
00056 Char_t name[1000];
00057
00058 ifstream BemcStatusFile(fname);
00059
00060 if (!BemcStatusFile) {
00061 LOG_ERROR << "BemcTwMask:: useBTowMask Failed due to NO FILE" << endm;
00062 m->clear();
00063 return false;
00064 }
00065
00066 if (BemcStatusFile)
00067 {
00068 if (BemcStatusFile.is_open())
00069 {
00070 while (! BemcStatusFile.eof() )
00071 {
00072 std::getline(BemcStatusFile,line);
00073 size_t comment=line.find("#",0);
00074 size_t trigger=line.find("trigger",0);
00075 if (comment!=string::npos) continue;
00076 if (trigger!=string::npos) continue;
00077 istringstream iss; iss.str(line);
00078 iss>>name>>softid>>cr>>seq>>TWmask>>HTmask>>TPmask>>ped>>tp;
00079 if (softid<1||softid>4800) return 0;
00080
00081 if (TWmask!=1){
00082
00083 channelinplot=softid;
00084
00085 if ((softid>0)&&(softid<=1220)) plot=0;
00086 if ((softid>1220)&&(softid<=2400)) plot=1;
00087 if ((softid>2400)&&(softid<=3540)) plot=2;
00088 if ((softid>3540)&&(softid<=4800)) plot=3;
00089
00090 int jj=m->crG[plot].GetN();
00091 m->crG[plot].SetPoint(jj,channelinplot,-10);
00092 m->crG[plot].SetPoint(jj+1,channelinplot,100000);
00093 m->crG[plot].SetPoint(jj+2,channelinplot,-10);
00094
00095
00096
00097
00098 nok++;
00099 }
00100 }
00101 }
00102 BemcStatusFile.close();
00103 }
00104
00105 m->nMask=nok;
00106
00107 for(int i=0;i<m->nPl;i++){
00108 m->crG[i].SetMarkerStyle(23);
00109 m->crG[i].SetMarkerColor(kRed);
00110
00111
00112 }
00113 return true;
00114 }