29 src_(iConfig.getParameter<edm::InputTag>(
"src")),
30 overlapAM_(iConfig.getParameter<edm::InputTag>(
"OverlapAssoMap")),
31 keepTrackStats_(iConfig.getParameter<bool>(
"keepTrackStats")),
32 keepHitPopulation_(iConfig.getParameter<bool>(
"keepHitStats")),
33 statsTreeName_(iConfig.getParameter<
string>(
"TrkStatsFileName")),
34 hitsTreeName_(iConfig.getParameter<
string>(
"HitStatsFileName")),
35 prescale_(iConfig.getParameter<uint32_t>(
"TrkStatsPrescale")),
55 outtree_=
new TTree(
"AlignmentTrackStats",
"Statistics of Tracks used for Alignment");
64 outtree_->Branch(
"P" ,&
P ,
"P[Ntracks]/F");
119 unsigned int trk_cnt=0;
127 for(
int k=0;
k<7;
k++){
135 for(std::vector<reco::Track>::const_iterator ittrk = Tracks->begin(), edtrk = Tracks->end(); ittrk != edtrk; ++ittrk){
136 Eta[trk_cnt]=ittrk->eta();
137 Phi[trk_cnt]=ittrk->phi();
138 Chi2n[trk_cnt]=ittrk->normalizedChi2();
139 P[trk_cnt]=ittrk->p();
140 Pt[trk_cnt]=ittrk->pt();
141 Nhits[trk_cnt][0]=ittrk->numberOfValidHits();
159 DetHitMap::iterator mapiter;
166 hitmap_.insert(pair<uint32_t, uint32_t>(rawId, 1));
174 if(!(hitInPixel||hitInStrip)){
176 edm::LogError(
"AlignmentStats")<<
"Hit not belonging neither to pixels nor to strips! Skipping it. SubDet= "<<subDet;
182 const std::type_info &
type =
typeid(*hit);
189 inval = OverlapMap[stripclust];
193 throw cms::Exception(
"NullPointerError")<<
"ERROR in <AlignmentStats::analyze>: Dynamic cast of Strip RecHit1D failed! TypeId of the RecHit: "<<
className(*hit);
200 inval = OverlapMap[stripclust];
204 throw cms::Exception(
"NullPointerError")<<
"ERROR in <AlignmentStats::analyze>: Dynamic cast of Strip RecHit2D failed! TypeId of the RecHit: "<<
className(*hit);
214 inval = OverlapMap[pixclust];
218 edm::LogError(
"AlignmentStats")<<
"ERROR in <AlignmentStats::analyze>: Dynamic cast of Pixel RecHit failed! TypeId of the RecHit: "<<
className(*hit);
227 DetHitMap::iterator overlapiter;
234 overlapmap_.insert(pair<uint32_t, uint32_t>(rawId, 1));
243 Nhits[trk_cnt][subdethit]=
Nhits[trk_cnt][subdethit]+1;
266 edm::LogInfo(
"AlignmentStats")<<
"Writing out the TrackStatistics in "<<gDirectory->GetPath()<<std::endl;
274 TTree *hitstree=
new TTree(
"AlignmentHitMap",
"Maps of Hits used for Alignment");
276 unsigned int id=0,nhits=0,noverlaps=0;
277 float posX(-99999.0),posY(-77777.0),posZ(-88888.0);
278 float posEta(-6666.0),posPhi(-5555.0),posR(-4444.0);
280 unsigned int layer=0;
281 bool is2D=
false,isStereo=
false;
282 hitstree->Branch(
"DetId", &
id ,
"DetId/i");
283 hitstree->Branch(
"Nhits", &nhits ,
"Nhits/i");
284 hitstree->Branch(
"Noverlaps",&noverlaps,
"Noverlaps/i");
285 hitstree->Branch(
"SubDet", &subdet,
"SubDet/I");
286 hitstree->Branch(
"Layer", &layer,
"Layer/i");
287 hitstree->Branch(
"is2D" , &is2D,
"is2D/B");
288 hitstree->Branch(
"isStereo", &isStereo,
"isStereo/B");
289 hitstree->Branch(
"posX", &posX,
"posX/F");
290 hitstree->Branch(
"posY", &posY,
"posY/F");
291 hitstree->Branch(
"posZ", &posZ,
"posZ/F");
292 hitstree->Branch(
"posR", &posR,
"posR/F");
293 hitstree->Branch(
"posEta", &posEta,
"posEta/F");
294 hitstree->Branch(
"posPhi", &posPhi,
"posPhi/F");
318 const std::vector<Alignable*>& Detunitslist=theAliTracker->
deepComponents();
319 int ndetunits=Detunitslist.size();
320 edm::LogInfo(
"AlignmentStats")<<
"Number of DetUnits in the AlignableTracker: "<< ndetunits<<std::endl;
322 for(
int det_cnt=0;det_cnt< ndetunits;++det_cnt){
341 id=static_cast <uint32_t>( Detunitslist[det_cnt]->id() );
348 hitmap_.insert(pair<uint32_t, uint32_t>(
id, 0));
357 overlapmap_.insert(pair<uint32_t, uint32_t>(
id, 0));
361 posX= Detunitslist[det_cnt]->globalPosition().x();
362 posY= Detunitslist[det_cnt]->globalPosition().y();
363 posZ= Detunitslist[det_cnt]->globalPosition().z();
412 edm::LogError(
"AlignmentStats")<<
"Detector not belonging neither to pixels nor to strips! Skipping it. SubDet= "<<subdet;
ClusterRef cluster() const
EventNumber_t event() const
bool tecIsDoubleSide(const DetId &id) const
bool tobIsDoubleSide(const DetId &id) const
bool tibIsDoubleSide(const DetId &id) const
unsigned int tibLayer(const DetId &id) const
const edm::EventSetup * lastSetup_
bool tobIsStereo(const DetId &id) const
#define DEFINE_FWK_MODULE(type)
unsigned int pxfDisk(const DetId &id) const
Geom::Phi< T > phi() const
unsigned int tidWheel(const DetId &id) const
bool tidIsStereo(const DetId &id) const
uint32_t rawId() const
get the raw id
bool tecIsStereo(const DetId &id) const
ClusterRef cluster() const
int subdetId() const
get the contents of the subdetector field (not cast into any detector's numbering enum) ...
bool getByLabel(InputTag const &tag, Handle< PROD > &result) const
unsigned int pxbLayer(const DetId &id) const
const TrackerGeometry * trackerGeometry_
const Alignables & deepComponents() const
std::string statsTreeName_
virtual void analyze(const edm::Event &iEvent, const edm::EventSetup &iSetup)
ClusterRef cluster() const
bool tibIsStereo(const DetId &id) const
AlignmentStats(const edm::ParameterSet &iConfig)
bool tidIsDoubleSide(const DetId &id) const
T const * product() const
static const int MAXTRKS_
std::string hitsTreeName_
DetId geographicalId() const
unsigned int tecWheel(const DetId &id) const
std::string className(const T &t)
unsigned int tobLayer(const DetId &id) const
TrackingRecHitCollection::base::const_iterator trackingRecHit_iterator
iterator over a vector of reference to TrackingRecHit in the same collection