ViewVC Help
View File | Revision Log | Show Annotations | Root Listing
root/cvsroot/UserCode/L1RpcTriggerAnalysis/plugins/LinkSynchroAnalysis.cc
(Generate patch)

Comparing UserCode/L1RpcTriggerAnalysis/plugins/LinkSynchroAnalysis.cc (file contents):
Revision 1.3 by konec, Sun Jun 6 16:45:43 2010 UTC vs.
Revision 1.5 by konec, Thu Mar 24 21:39:22 2011 UTC

# Line 12 | Line 12
12   #include "CondFormats/RPCObjects/interface/RPCEMap.h"
13   #include "CondFormats/DataRecord/interface/RPCEMapRcd.h"
14  
15 + #include "UserCode/L1RpcTriggerAnalysis/interface/SynchroSelectorTrack.h"
16 + #include "UserCode/L1RpcTriggerAnalysis/interface/SynchroSelectorMuon.h"
17 + #include "UserCode/L1RpcTriggerAnalysis/interface/SynchroSelectorL1Muon.h"
18  
19   #include "DataFormats/MuonDetId/interface/RPCDetId.h"
20   #include "TFile.h"
# Line 26 | Line 29 | struct LessGP { bool operator () (const
29   LinkSynchroAnalysis::LinkSynchroAnalysis(const edm::ParameterSet& cfg)
30      : RPCMonitorLinkSynchro(cfg.getParameter<edm::ParameterSet>("linkMonitorPSet")), theAnaConfig(cfg),theCabling(0), theEventCounter(0) { }
31  
32 < LinkSynchroAnalysis::~LinkSynchroAnalysis(){ delete theCabling;}
32 > LinkSynchroAnalysis::~LinkSynchroAnalysis()
33 > {
34 >  delete theCabling;
35 >  for (std::vector<SynchroSelector* >::iterator ix=theSynchroFilters.begin(); ix != theSynchroFilters.end(); ++ix) delete (*ix);
36 >  theSynchroFilters.clear();
37 > }
38 >
39  
40   void LinkSynchroAnalysis::beginJob()
41   {
42    RPCMonitorLinkSynchro::beginJob();
43    theHistos.SetOwner();
44    theHistos.Add(new TH1F("hBX","hBX",3564,0.,3564));
45 <  theHistos.Add(new TH1F("hDeltaPhi","hDeltaPhi",100, 0., 1.));
46 <  theHistos.Add(new TH1F("hDeltaEta","hDeltaEta",100, 0., 1.));
47 <  theHistos.Add(new TH1F("hDxy","hDxy",100.,0.,1.));
48 <  theHistos.Add(new TH1F("hNumTracks","hNumTracks",50,0.,250.));
49 <  theHistos.Add(new TH1F("hDistB","hDistB",50,0.,200.));
50 <  theHistos.Add(new TH1F("hDistE","hDistE",50,0.,500.));
42 <  theHistos.Add(new TH1F("hPenetrationB","hPenetrationB",10,0.,10.));
43 <  theHistos.Add(new TH1F("hPenetrationE","hPenetrationE",10,0.,10.));
44 <  theHistos.Add(new TH1F("hPullX","hPullX",100,-10.,10.));
45 <  theHistos.Add(new TH1F("hDistX","hDistX",100,-100.,100.));
46 <
47 <  typedef std::vector<edm::ParameterSet> VPSet;
48 <  VPSet selectorConfigs = theAnaConfig.getParameter<VPSet>("ORedSynchroFilters");
49 <  for (VPSet::const_iterator it=selectorConfigs.begin(); it != selectorConfigs.end(); ++it) {
50 <    SynchroSelector f(*it);
51 <    if (it->getParameter<std::string>("collection") == "generalTracks") {
52 <      f.setHistoNum(static_cast<TH1F* >(theHistos.FindObject("hNumTracks")));
53 <      f.setHistoPhi(static_cast<TH1F* >(theHistos.FindObject("hDeltaPhi")));
54 <      f.setHistoEta(static_cast<TH1F* >(theHistos.FindObject("hDeltaEta")));
55 <      f.setHistoDxy(static_cast<TH1F* >(theHistos.FindObject("hDxy")));
56 <      f.setHistoPullX(static_cast<TH1F* >(theHistos.FindObject("hPullX")));
57 <      f.setHistoDistX(static_cast<TH1F* >(theHistos.FindObject("hDistX")));
58 <    }
59 <    if (it->getParameter<std::string>("collection") == "globalMuons") {
60 <    }
61 <    theSynchroFilters.push_back(f);
62 <  }
45 >
46 >  if (theAnaConfig.exists("synchroSelectorMuon"))  theSynchroFilters.push_back( new SynchroSelectorMuon(theAnaConfig.getParameter<edm::ParameterSet>("synchroSelectorMuon"), theHistos) );
47 >  if (theAnaConfig.exists("synchroSelectorTrack")) theSynchroFilters.push_back( new SynchroSelectorTrack(theAnaConfig.getParameter<edm::ParameterSet>("synchroSelectorTrack"), theHistos) );
48 >  if (theAnaConfig.exists("synchroSelectorL1Muon")) theSynchroFilters.push_back( new SynchroSelectorL1Muon(theAnaConfig.getParameter<edm::ParameterSet>("synchroSelectorL1Muon"), theHistos) );
49 >  std::cout << "SIZE OF SELECTORS IS: " << theSynchroFilters.size()<<std::endl;
50 >
51   }
52  
53   void LinkSynchroAnalysis::endJob()
# Line 92 | Line 80 | const RPCRawSynchro::ProdItem& LinkSynch
80      LogTrace("") << "LinkSynchroAnalysis - record has CHANGED!!, read map, VERSION: " << theCabling->version();
81    }
82  
83 <  theSynchroFilters[0].resetPos();
83 >  for (std::vector<SynchroSelector* >::iterator ix=theSynchroFilters.begin(); ix != theSynchroFilters.end(); ++ix) (*ix)->update(ev,es);
84 >
85    for(RPCRawSynchro::ProdItem::const_iterator it = vItem.begin(); it != vItem.end(); ++it) {
86      const LinkBoardElectronicIndex & path = it->first;
87      const  std::vector<FebConnectorSpec> & febs = theCabling->location(path)->febs();
# Line 102 | Line 91 | const RPCRawSynchro::ProdItem& LinkSynch
91      bool takeIt = false;
92      for ( std::map<uint32_t,bool>::const_iterator im = dets.begin(); im != dets.end(); ++im) {
93        RPCDetId rpcDet(im->first);
94 <      for (std::vector<SynchroSelector>::iterator ix=theSynchroFilters.begin(); ix != theSynchroFilters.end(); ++ix) if(ix->takeIt(rpcDet,ev,es) ) takeIt = true;
94 >      for (std::vector<SynchroSelector* >::iterator ix=theSynchroFilters.begin(); ix != theSynchroFilters.end(); ++ix) if((*ix)->takeIt(rpcDet,ev,es) ) takeIt = true;
95      }
96      if (takeIt) selected.push_back(*it);
97      if (takeIt) wasTakeIt = true;
98    }
99  
111 /*
112  std::vector<GlobalPoint> pos = theSynchroFilters[0].positions();
113 std::sort(pos.begin(), pos.end(), LessGP());
114  GlobalPoint last(0.,0.,0.);
115  unsigned int points = 0;
116  bool barrel = false;
117  bool endcap = false;
118  for (std::vector<GlobalPoint>::const_iterator ip= pos.begin(); ip != pos.end(); ++ip) {
119    double dist = 0.;
120    if (fabs(ip->eta()) > 1.24 && fabs(ip->eta()) < 1.6 ) endcap = true;
121    if (fabs(ip->eta()) < 0.93)  barrel= true;
122    if (barrel) dist = ((*ip)-last).perp();
123    if (endcap) dist = fabs(((*ip)-last).z());
124    if (barrel) static_cast<TH1F* >(theHistos.FindObject("hDistB"))->Fill(dist);
125    if (endcap) static_cast<TH1F* >(theHistos.FindObject("hDistE"))->Fill(dist);
126    if (endcap&& dist > 50.) points++;
127    if (barrel&& dist > 30.) points++;
128    last = *ip;
129    std::cout <<"HERE,  barrel: " <<barrel<<" endcap:"<< endcap<<" dist: " << dist <<" points: "<<points<< *ip<<std::endl;
130  }
131  std::cout <<"POINTS: " << points << std::endl;
132  if (barrel && endcap) std::cout << "PROBLEM" << std::endl;
133  if (wasTakeIt && barrel ) static_cast<TH1F* >(theHistos.FindObject("hPenetrationB"))->Fill(points);
134  if (wasTakeIt && endcap) static_cast<TH1F* >(theHistos.FindObject("hPenetrationE"))->Fill(points);
135
136 */
100    if (wasTakeIt) static_cast<TH1*>(theHistos.FindObject("hBX"))->Fill( ev.bunchCrossing());
101    if (wasTakeIt) theEventCounter++;
102    return selected;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines