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