Classes | |
| struct | BeamMonMap::bmon1 |
| struct | BeamMonMap::bmon2 |
Functions | |
| std::map< VldTimeStamp, BeamMonTV > | MakeBeamMonMap (const char *path) |
| BeamMonTV | FindClosestSpill (const std::map< VldTimeStamp, BeamMonTV > &m, VldTimeStamp vts) |
| bool | IsGoodSpill (BeamMonTV b) |
| BeamMonTV | FillBeamMonTV (struct bmon1 bmn) |
| BeamMonTV | FillBeamMonTV (struct bmon2 bmn) |
|
|
|
||||||||||||
|
Definition at line 158 of file BeamMonMap.cxx. References BeamMonTV::closestspill. 00159 {
00160 if(m.size()==0){
00161 BeamMonTV b;
00162 return b;
00163 }
00164
00165 std::map<VldTimeStamp, BeamMonTV>::const_iterator lb = m.lower_bound(vts);
00166 if(lb==m.begin()){ return lb->second; }
00167 std::map<VldTimeStamp, BeamMonTV>::const_iterator prev=lb;
00168 prev--;
00169 if(lb==m.end()){ return prev->second; }
00170
00171 double early = fabs(vts-prev->first);
00172 double late = fabs(lb->first-vts);
00173
00174 // std::cout<<"early "<<early<<" late "<<late<<std::endl;
00175
00176 if(early<late){
00177 BeamMonTV bmtv = prev->second;
00178 bmtv.closestspill=early;
00179 return bmtv;
00180 }
00181 BeamMonTV bmtv2 = lb->second;
00182 bmtv2.closestspill=late;
00183 return bmtv2;
00184 }
|
|
|
Definition at line 186 of file BeamMonMap.cxx. References BeamMonTV::bI, BeamMonTV::closestspill, BeamMonTV::hbw, BeamMonTV::hpos2, BeamMonTV::vbw, and BeamMonTV::vpos2. 00187 {
00188
00189 if(b.bI>0.1&&
00190 b.hbw<2&&b.vbw<2&&
00191 b.hpos2<-1.5&&b.hpos2>-2.0&&
00192 b.vpos2>.2&&b.hpos2<1.8&&b.closestspill<2){
00193 return true;
00194 }
00195 return false;
00196 }
|
|
|
Definition at line 94 of file BeamMonMap.cxx. References BeamMonMap::bmon2::beamIntensity, BeamMonMap::bmon1::beamIntensity, FillBeamMonTV(), BeamMonMap::bmon2::timeStampSec, and BeamMonMap::bmon1::timeStampSec. 00095 {
00096
00097 std::map<VldTimeStamp, BeamMonTV> m;
00098 if(path==NULL){
00099 std::cout<<"Didn't specify a path for beam mon files, wont get em in your tree"<<std::endl;
00100 return m;
00101 }
00102 std::cout<<"opening dir "<<path<<std::endl;
00103
00104 DIR *dfd;
00105 dirent *dp;
00106 if(!(dfd = opendir(path))){
00107 std::cout<<" path "<<path<<" "<<dfd<<std::endl;
00108 return m;
00109 }
00110
00111 std::vector<std::string> names;
00112 while((dp=readdir(dfd))!=NULL){
00113 if(strstr(dp->d_name,"beamsummary_")!=NULL){
00114 names.push_back((std::string)(dp->d_name));
00115 }
00116 }
00117
00118 std::cout<<"Found "<<names.size()<<" names "<<std::endl;
00119 for(unsigned int i=0;i<names.size();i++){
00120 //figure out what version of bmon ntuple we've got
00121 std::string n=names[i].substr(names[i].find_last_of("_")+1,
00122 names[i].find_last_of(".")-names[i].find_last_of("_")-1);
00123 // std::cout<<"n is "<<n<<std::endl;
00124
00125 //open tree file
00126 std::string fname = path+names[i];
00127 TFile f(fname.c_str());
00128 TTree *b = (TTree *)(f.Get("btree"));
00129 if(atoi(n.c_str())<=7){
00130 struct bmon1 bs;
00131 b->SetBranchAddress("Beaminfo",&bs.beamIntensity);
00132 // std::cout<<"In first type"<<std::endl;
00133 //loop over tree
00134 for(int z=0;z<b->GetEntries();z++){
00135 b->GetEntry(z);
00136 BeamMonTV bmtv = FillBeamMonTV(bs);
00137 VldTimeStamp vts(bs.timeStampSec,0);
00138 m[vts]=bmtv;
00139 }
00140 }
00141 else{
00142 // std::cout<<"In second type"<<std::endl;
00143 struct bmon2 bs;
00144 b->SetBranchAddress("Beaminfo",&bs.beamIntensity);
00145 //loop over tree
00146 for(int z=0;z<b->GetEntries();z++){
00147 b->GetEntry(z);
00148 BeamMonTV bmtv = FillBeamMonTV(bs);
00149 VldTimeStamp vts(bs.timeStampSec,0);
00150 m[vts]=bmtv;
00151 }
00152 }
00153 f.Close();
00154 }
00155 return m;
00156 }
|
1.3.9.1