22 inline void out(std::ofstream &fOut)
const {
23 fOut <<
" " << evt <<
" " << tr <<
" " <<
id <<
" ";
24 fOut <<
" " << (x/10.) <<
" " << (y/10.) <<
" " << (z/10.);
25 fOut <<
" " << (
px) <<
" " << (py) <<
" " << (
pz);
26 fOut <<
" " << ek <<
" " << w <<
" " << g2 <<
std::endl;
32 const std::string dirOutName(
"/lbne/data/users/lebrun/SculptedAbsorber/");
37 bool doLBNE = (tokenDir.find(
"LBNE") != std::string::npos);
38 std::string dirPnfs(
"/pnfs/lbne/scratch/users/lebrun/");
40 const std::string dirScratch(
"/scratch/lbne/lebrun/");
41 const std::string jtitleHA(
"MuonFluxAtSculptedAbsorber_SculptedAbsorberProd1_");
45 std::string header(
" evt tr id x y z px py pz ek w g2 ");
52 const int jCluster = 2623210;
54 std::vector<SCHAmuon> datSl30Tmp;
55 std::vector<SCHAmuon> datSlM2Tmp;
56 std::vector<SCHAmuon> datSl30Cr;
57 std::vector<SCHAmuon> datOneTr;
59 std::ostringstream fOutSlM2StrStr;
60 fOutSlM2StrStr << dirOutName <<
"MuonFluxAtSculptedAbsorber_" << tokenDir <<
"_V2Slm2_" << jCluster <<
".txt";
61 std::string fOutSlM2Str(fOutSlM2StrStr.str());
62 std::ofstream fOutSlM2(fOutSlM2Str.c_str());
67 std::ostringstream fOutSl30StrStr;
68 fOutSl30StrStr << dirOutName <<
"MuonFluxAtSculptedAbsorber_" << tokenDir <<
"_V2Sl30_" << jCluster <<
".txt";
69 std::string fOutSl30Str(fOutSl30StrStr.str());
70 std::ofstream fOutSl30(fOutSl30Str.c_str());
75 const size_t numFiles=200;
78 size_t nSlM2=0;
size_t nSl30=0;
80 for (
size_t kf=0; kf != 3; kf++) {
85 std::ostringstream aFNameStrStr;
86 aFNameStrStr << dirScratch << jtitleHA << jCluster <<
"_" << kf <<
".txt";
87 std::string aFNameStr(aFNameStrStr.str());
88 std::ifstream fIn(aFNameStr.c_str());
90 std::cerr <<
" Can't open file " << aFNameStr <<
std::endl;
95 std::cerr <<
" Got file " << aFNameStr <<
std::endl;
100 while (fIn.good() &&(!fIn.eof())) {
103 fIn.getline(line, 1023);
104 if (k == 1)
continue;
105 std::string linec(line);
106 if (fIn.eof())
break;
107 if (linec.length() < 5)
continue;
109 std::istringstream sIn(linec);
111 if ((a.
slice != -2) && (a.
slice != 30))
continue;
112 sIn >> a.
x; sIn >> a.
y; sIn >> a.
z;
113 sIn >> a.
px; sIn >> a.
py; sIn >> a.
pz;
114 sIn >> a.
ek; sIn >> a.
w ; sIn >> a.
g2;
118 datSlM2Tmp.push_back(a);
122 if ((!doLBNE) || (doLBNE && (a.
z < 236000.))) {
125 datSl30Tmp.push_back(a);
129 if ((prevEvt != a.
evt) || (prevTr != a.
tr)) {
130 size_t nSlPrev = datOneTr.size();
132 if ((datOneTr[nSlPrev-1].
slice == 30) && (datOneTr[0].
slice != -2)) {
133 datSl30Cr.push_back(datOneTr[nSlPrev-1]);
137 datOneTr.push_back(a);
141 datOneTr.push_back(a);
145 std::cerr <<
" One empty file " << aFNameStr <<
std::endl;
158 if (itm2 == datSlM2Tmp.end())
continue;
159 std::cerr <<
" Number of muon in slice 30, all " << datSl30Tmp.size() <<
std::endl;
163 if (it30->g2 == 0) nSl30G2B++;
166 size_t nSl30CrG2G = 0;
167 size_t nSl30CrG2B = 0;
169 if (it30->g2 == 0) nSl30CrG2B++;
173 std::cerr <<
" ... nSl30G2G " << nSl30G2G <<
" nSl30G2B " << nSl30G2B <<
std::endl;
174 std::cerr <<
" ... nSl30CrG2G " << nSl30CrG2G <<
" nSl30CrG2B " << nSl30CrG2B <<
std::endl;
179 std::cerr <<
" Num Sl2 " << nSlM2 <<
" Slice 30 " << nSl30 <<
" Sl30 Cr " << datSl30Cr.size() <<
std::endl;
181 std::ostringstream fOutSl30CrStrStr;
182 fOutSl30CrStrStr << dirOutName <<
"MuonFluxAtSculptedAbsorber_" << tokenDir <<
"_Sl30Cr_" << jCluster <<
".txt";
183 std::string fOutSl30CrStr(fOutSl30CrStrStr.str());
184 std::ofstream fOutSl30Cr(fOutSl30CrStr.c_str());
189 it30Cr->out(fOutSl30Cr);
192 std::cerr <<
" Number of empty or missing files: " << nBadFiles <<
std::endl;
void out(std::ofstream &fOut) const
const GenericPointer< typename T::ValueType > T2 T::AllocatorType & a
int main(int argc, char **argv)
QTextStream & endl(QTextStream &s)